You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,12 +14,12 @@ AES-GCM is extremely fast on modern CPUs, which have dedicated hardware accelera
14
14
Using `bun`:
15
15
16
16
```shell
17
-
bun add singlecrypt
17
+
bun add singlecrypt-text
18
18
```
19
19
20
20
## Methods
21
21
22
-
#### `createSymmetricCryptoKey`
22
+
#### `createSymmetricKeyWithText`
23
23
24
24
Creates a symmetric `CryptoKey` object to be used in the following methods. This method also converts your value key to a SHA-256 hash. It takes two parameters:
25
25
@@ -30,24 +30,24 @@ Returns a `Promise<CryptoKey>` containing a SHA-256 hash used to encrypt and dec
30
30
31
31
A `TypeError` may be thrown if there are problems with the string key.
32
32
33
-
### `encryptSymmetrically`
33
+
### `encryptSymmetricallyText`
34
34
35
35
Encrypts a value with a symmetric `CryptoKey` previously generated. It takes three parameters:
36
36
37
37
1. A string value to be encrypted.
38
-
2. The symmetric key generated with `createSymmetricCryptoKey`.
38
+
2. The symmetric key generated with `createSymmetricKeyWithText`.
39
39
3. A `TextEncoder` instance, if you want to reuse it (optional).
40
40
41
41
Returns a `Promise<string>` containing the encrypted value.
42
42
43
43
A `DOMException` may be thrown if the key is invalid or if the operation failed (e.g., AES-GCM plaintext longer than 2^39−256 bytes).
44
44
45
-
### `decryptSymmetrically`
45
+
### `decryptSymmetricallyText`
46
46
47
47
Decrypts a value with a symmetric `CryptoKey` previously generated. It takes three parameters:
48
48
49
49
1. A string value to be decrypted.
50
-
2. The symmetric key generated with `createSymmetricCryptoKey`.
50
+
2. The symmetric key generated with `createSymmetricKeyWithText`.
51
51
3. A `TextDecoder` instance, if you want to reuse it (optional).
52
52
53
53
Returns a `Promise<string>` containing the decrypted value.
@@ -66,26 +66,26 @@ Let's say you have a user ID in a server and you want the server to encrypt and
0 commit comments