mol_crypto_lib 0.1.1514 → 0.1.1516
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
@@ -9,19 +9,19 @@ Simple API for effective cross platform cryptography with minimal extra size.
|
|
9
9
|
const Alice = await $mol_crypto_key_private.generate() // 96 B
|
10
10
|
const Bella = await $mol_crypto_key_private.generate() // 96 B
|
11
11
|
|
12
|
-
const secret = await $
|
13
|
-
Alice
|
14
|
-
Bella.public()
|
12
|
+
const secret = await $mol_crypto_sacred_shared( // 16 B
|
13
|
+
Alice, // 96 B
|
14
|
+
Bella.public(), // 64 B
|
15
15
|
)
|
16
16
|
|
17
17
|
const data = new Uint8Array([ 1, 2, 3 ]) // 3 B
|
18
|
-
const salt = $mol_crypto_salt() //
|
18
|
+
const salt = $mol_crypto_salt() // 16 B
|
19
19
|
|
20
|
-
const closed = await secret.encrypt( data, salt ) //
|
20
|
+
const closed = await secret.encrypt( data, salt ) // 16x B
|
21
21
|
const digest = $mol_crypto_hash( closed ) // 20 B
|
22
22
|
const sign = await Alice.sign( digest ) // 64 B
|
23
23
|
|
24
|
-
const verified = await Alice.public().verify( digest, sign )
|
24
|
+
const verified = await Alice.public().verify( digest, sign ) // true
|
25
25
|
const opened = await secret.decrypt( closed, salt ) // 3 B
|
26
26
|
```
|
27
27
|
|
@@ -29,7 +29,7 @@ const opened = await secret.decrypt( closed, salt ) // 3 B
|
|
29
29
|
|
30
30
|
```typescript
|
31
31
|
// Returns authenticated secret key using WebAuthn
|
32
|
-
const Alice = await
|
32
|
+
const Alice = await $.$mol_crypto_sacred_id() // 16 B
|
33
33
|
```
|
34
34
|
|
35
35
|
# Usage from NPM
|
@@ -41,5 +41,5 @@ npm install mol_crypto_lib
|
|
41
41
|
[](https://bundlephobia.com/package/mol_crypto_lib)
|
42
42
|
|
43
43
|
```javascript
|
44
|
-
|
44
|
+
export { $mol_crypto_salt, default as $ } from "mol_crypto_lib"
|
45
45
|
```
|