Skip to content

Commit dd9bd8d

Browse files
committed
docs: fix
1 parent a3bfdc1 commit dd9bd8d

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ const messageCryptoKey = await createSymmetricKeyFromText(
9797

9898
export async function encryptMessage(text: string) {
9999
return await encryptTextSymmetrically(
100-
text,
101-
messageCryptoKey
100+
messageCryptoKey,
101+
text
102102
);
103103
}
104104

105105
export async function decryptMessage(ciphertext: string) {
106106
return await decryptTextSymmetrically(
107-
ciphertext,
108-
messageCryptoKey
107+
messageCryptoKey,
108+
ciphertext
109109
);
110110
}
111111
```
@@ -132,17 +132,17 @@ const messageCryptoKey = await createSymmetricKeyFromText(
132132

133133
export async function encryptMessage(text: string) {
134134
return await encryptTextSymmetrically(
135-
text,
136135
messageCryptoKey,
136+
text,
137137
true,
138138
textEncoder
139139
);
140140
}
141141

142142
export async function decryptMessage(ciphertext: string) {
143143
return await decryptTextSymmetrically(
144-
ciphertext,
145144
messageCryptoKey,
145+
ciphertext,
146146
textDecoder
147147
);
148148
}
@@ -190,17 +190,23 @@ new SingleCryptText(
190190

191191
#### Instance methods
192192

193-
- `async encrypt(text: string, urlSafe?: boolean, additionalData?: BufferSource): Promise<string>`
193+
```ts
194+
async encrypt(text: string, urlSafe?: boolean, additionalData?: BufferSource): Promise<string>
195+
```
194196

195-
Encrypt a string using the instance's key. Optionally specify `urlSafe` (`true` by default) to use `base64url` encoding.
197+
Encrypt a string using the instance's key. Optionally specify `urlSafe` (`true` by default) to use `base64url` encoding.
196198

197-
- `async decrypt(ciphertext: string, additionalData?: BufferSource): Promise<string>`
199+
```ts
200+
async decrypt(ciphertext: string, additionalData?: BufferSource): Promise<string>
201+
```
198202

199-
Decrypt a string previously encrypted by this or any compatible instance.
203+
Decrypt a string previously encrypted by this or any compatible instance.
200204

201-
- `async getKey(): Promise<CryptoKey>`
205+
```ts
206+
async getKey(): Promise<CryptoKey>
207+
```
202208

203-
Returns the underlying `CryptoKey` instance.
209+
Returns the underlying `CryptoKey` instance.
204210

205211
#### Example
206212

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "singlecrypt-text",
3-
"version": "4.1.1",
3+
"version": "4.1.2",
44
"author": "Stefan Samson <ss42701@outlook.com> (https://ssbit01.github.io/)",
55
"repository": "github:SSbit01/singlecrypt-text",
66
"main": "index.js",

0 commit comments

Comments
 (0)