@twin.org/crypto 0.0.3-next.22 → 0.0.3-next.23
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 +1 -11
- package/docs/changelog.md +20 -1
- package/docs/examples.md +130 -1
- package/docs/reference/classes/Bech32.md +4 -4
- package/docs/reference/classes/Bip32Path.md +6 -6
- package/docs/reference/classes/Bip39.md +16 -16
- package/docs/reference/classes/Bip44.md +6 -6
- package/docs/reference/classes/Blake2b.md +9 -9
- package/docs/reference/classes/Blake3.md +7 -7
- package/docs/reference/classes/ChaCha20Poly1305.md +3 -3
- package/docs/reference/classes/Ed25519.md +8 -8
- package/docs/reference/classes/HmacSha1.md +4 -4
- package/docs/reference/classes/HmacSha256.md +9 -9
- package/docs/reference/classes/HmacSha512.md +13 -13
- package/docs/reference/classes/Hotp.md +2 -2
- package/docs/reference/classes/IntegrityHelper.md +3 -3
- package/docs/reference/classes/PasswordGenerator.md +5 -5
- package/docs/reference/classes/PasswordValidator.md +5 -5
- package/docs/reference/classes/Pbkdf2.md +3 -3
- package/docs/reference/classes/PemHelper.md +5 -5
- package/docs/reference/classes/Secp256k1.md +6 -6
- package/docs/reference/classes/Sha1.md +4 -4
- package/docs/reference/classes/Sha256.md +9 -9
- package/docs/reference/classes/Sha3.md +13 -13
- package/docs/reference/classes/Sha512.md +13 -13
- package/docs/reference/classes/Slip0010.md +11 -11
- package/docs/reference/classes/Totp.md +12 -12
- package/docs/reference/classes/X25519.md +3 -3
- package/docs/reference/classes/Zip215.md +2 -2
- package/docs/reference/variables/IntegrityAlgorithm.md +3 -3
- package/docs/reference/variables/KeyType.md +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
# TWIN Framework Crypto
|
|
2
2
|
|
|
3
|
-
This package
|
|
4
|
-
|
|
5
|
-
- Blake2B
|
|
6
|
-
- Sha256
|
|
7
|
-
- HmacSha1
|
|
8
|
-
- Ed25519
|
|
9
|
-
- Bip32
|
|
10
|
-
- Slip100
|
|
11
|
-
- Pbkdf2
|
|
12
|
-
|
|
13
|
-
- Totp
|
|
3
|
+
This package is part of the framework workspace and provides helper methods and classes which implement cryptographic functions to support consistent development workflows across the ecosystem.
|
|
14
4
|
|
|
15
5
|
## Installation
|
|
16
6
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.23](https://github.com/twinfoundation/framework/compare/crypto-v0.0.3-next.22...crypto-v0.0.3-next.23) (2026-03-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **crypto:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/core bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
16
|
+
* @twin.org/nameof bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
17
|
+
* devDependencies
|
|
18
|
+
* @twin.org/nameof-transformer bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
19
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
20
|
+
* @twin.org/validate-locales bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
2
21
|
|
|
3
22
|
## [0.0.3-next.22](https://github.com/twinfoundation/framework/compare/crypto-v0.0.3-next.21...crypto-v0.0.3-next.22) (2026-02-26)
|
|
4
23
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,130 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Crypto Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets as practical building blocks for hashes, signatures, key derivation, passwords and one-time passwords.
|
|
4
|
+
|
|
5
|
+
## Sha3, Sha512, HmacSha512
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { HmacSha512, Sha3, Sha512 } from '@twin.org/crypto';
|
|
9
|
+
|
|
10
|
+
const message = new TextEncoder().encode('hello twin');
|
|
11
|
+
const key = new TextEncoder().encode('super-secret');
|
|
12
|
+
|
|
13
|
+
Sha3.sum256(message);
|
|
14
|
+
Sha512.sum512(message);
|
|
15
|
+
HmacSha512.sum512(key, message);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Blake2b, Blake3, Sha256, HmacSha256, Sha1, HmacSha1
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Blake2b, Blake3, HmacSha1, HmacSha256, Sha1, Sha256 } from '@twin.org/crypto';
|
|
22
|
+
|
|
23
|
+
const bytes = new TextEncoder().encode('digest me');
|
|
24
|
+
const hmacKey = new TextEncoder().encode('key-01');
|
|
25
|
+
|
|
26
|
+
Blake2b.sum256(bytes);
|
|
27
|
+
Blake3.sum256(bytes);
|
|
28
|
+
Sha256.sum256(bytes);
|
|
29
|
+
Sha1.sum(bytes);
|
|
30
|
+
HmacSha256.sum256(hmacKey, bytes);
|
|
31
|
+
HmacSha1.sum(hmacKey, bytes);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Ed25519, Secp256k1, X25519, Zip215
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Ed25519, Secp256k1, X25519, Zip215 } from '@twin.org/crypto';
|
|
38
|
+
|
|
39
|
+
const privateKey = new Uint8Array(32).fill(7);
|
|
40
|
+
const payload = new TextEncoder().encode('payload');
|
|
41
|
+
|
|
42
|
+
const edPublic = Ed25519.publicKeyFromPrivateKey(privateKey);
|
|
43
|
+
const edSignature = Ed25519.sign(privateKey, payload);
|
|
44
|
+
Ed25519.verify(edPublic, payload, edSignature); // true
|
|
45
|
+
|
|
46
|
+
const secpPublic = Secp256k1.publicKeyFromPrivateKey(privateKey);
|
|
47
|
+
const secpSignature = Secp256k1.sign(privateKey, payload);
|
|
48
|
+
Secp256k1.verify(secpPublic, payload, secpSignature); // true
|
|
49
|
+
|
|
50
|
+
X25519.convertPublicKeyToX25519(edPublic);
|
|
51
|
+
Zip215.verify(edPublic, payload, edSignature); // true
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Bip39, Bip32Path, Slip0010, Bip44, Bech32
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { Bech32, Bip32Path, Bip39, Bip44, Slip0010 } from '@twin.org/crypto';
|
|
58
|
+
|
|
59
|
+
const entropy = new Uint8Array(32).fill(1);
|
|
60
|
+
const mnemonic = Bip39.entropyToMnemonic(entropy);
|
|
61
|
+
const seed = Bip39.mnemonicToSeed(mnemonic, 'passphrase');
|
|
62
|
+
|
|
63
|
+
const path = Bip32Path.fromPath("m/44'/4218'/0'/0'/0'");
|
|
64
|
+
path.numberSegments(); // 5
|
|
65
|
+
|
|
66
|
+
const master = Slip0010.getMasterKeyFromSeed(seed);
|
|
67
|
+
const derived = Slip0010.derivePath(master.privateKey, master.chainCode, path.toString());
|
|
68
|
+
|
|
69
|
+
Bip44.address(derived.privateKey); // '0x...'
|
|
70
|
+
Bech32.encode('twin', new Uint8Array([1, 2, 3, 4]));
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## ChaCha20Poly1305, Pbkdf2, IntegrityHelper, PemHelper
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { ChaCha20Poly1305, IntegrityHelper, Pbkdf2, PemHelper } from '@twin.org/crypto';
|
|
77
|
+
|
|
78
|
+
const password = new TextEncoder().encode('passw0rd!');
|
|
79
|
+
const salt = new Uint8Array(16).fill(2);
|
|
80
|
+
const key = Pbkdf2.sha512(password, salt, 4096, 32);
|
|
81
|
+
|
|
82
|
+
const nonce = new Uint8Array(12).fill(3);
|
|
83
|
+
const plaintext = new TextEncoder().encode('encrypted-content');
|
|
84
|
+
const cipher = ChaCha20Poly1305.encrypt(key, nonce, plaintext, new Uint8Array(0));
|
|
85
|
+
ChaCha20Poly1305.decrypt(key, nonce, cipher, new Uint8Array(0));
|
|
86
|
+
|
|
87
|
+
const checksum = IntegrityHelper.generate('sha256', plaintext);
|
|
88
|
+
IntegrityHelper.verify('sha256', plaintext, checksum); // true
|
|
89
|
+
|
|
90
|
+
PemHelper.formatPem('PUBLIC KEY', new Uint8Array([10, 11, 12]));
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Hotp and Totp
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { Hotp, Totp } from '@twin.org/crypto';
|
|
97
|
+
|
|
98
|
+
const secret = Totp.generateSecret();
|
|
99
|
+
|
|
100
|
+
Hotp.generate(secret, 42, 6); // '123456'
|
|
101
|
+
const token = Totp.generate(secret, {
|
|
102
|
+
periodSeconds: 30,
|
|
103
|
+
digits: 6,
|
|
104
|
+
timestamp: Date.now()
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
Totp.verify(secret, token, {
|
|
108
|
+
periodSeconds: 30,
|
|
109
|
+
digits: 6,
|
|
110
|
+
timestamp: Date.now()
|
|
111
|
+
}); // true
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## PasswordGenerator and PasswordValidator
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { PasswordGenerator, PasswordValidator } from '@twin.org/crypto';
|
|
118
|
+
|
|
119
|
+
const generated = PasswordGenerator.generate({
|
|
120
|
+
length: 20,
|
|
121
|
+
includeLowercase: true,
|
|
122
|
+
includeUppercase: true,
|
|
123
|
+
includeNumbers: true,
|
|
124
|
+
includeSymbols: true
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const hashed = await PasswordGenerator.hashPassword(generated);
|
|
128
|
+
PasswordValidator.validate(generated);
|
|
129
|
+
await PasswordValidator.comparePasswordHashes(generated, hashed); // true
|
|
130
|
+
```
|
|
@@ -14,7 +14,7 @@ Bech32 encoding and decoding.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### encode()
|
|
25
|
+
### encode() {#encode}
|
|
26
26
|
|
|
27
27
|
> `static` **encode**(`humanReadablePart`, `data`): `string`
|
|
28
28
|
|
|
@@ -50,7 +50,7 @@ The encoded data.
|
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
53
|
-
### decode()
|
|
53
|
+
### decode() {#decode}
|
|
54
54
|
|
|
55
55
|
> `static` **decode**(`bech`): `object`
|
|
56
56
|
|
|
@@ -84,7 +84,7 @@ An error if the decoding fails.
|
|
|
84
84
|
|
|
85
85
|
***
|
|
86
86
|
|
|
87
|
-
### isBech32()
|
|
87
|
+
### isBech32() {#isbech32}
|
|
88
88
|
|
|
89
89
|
> `static` **isBech32**(`bech`): `bech is string`
|
|
90
90
|
|
|
@@ -24,7 +24,7 @@ Initial path to create.
|
|
|
24
24
|
|
|
25
25
|
## Methods
|
|
26
26
|
|
|
27
|
-
### fromPath()
|
|
27
|
+
### fromPath() {#frompath}
|
|
28
28
|
|
|
29
29
|
> `static` **fromPath**(`bip32Path`): `Bip32Path`
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ A new instance of Bip32Path.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### toString()
|
|
49
|
+
### toString() {#tostring}
|
|
50
50
|
|
|
51
51
|
> **toString**(): `string`
|
|
52
52
|
|
|
@@ -60,7 +60,7 @@ The path as a string.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### push()
|
|
63
|
+
### push() {#push}
|
|
64
64
|
|
|
65
65
|
> **push**(`index`): `void`
|
|
66
66
|
|
|
@@ -80,7 +80,7 @@ The index to add to the path.
|
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
83
|
-
### pushHardened()
|
|
83
|
+
### pushHardened() {#pushhardened}
|
|
84
84
|
|
|
85
85
|
> **pushHardened**(`index`): `void`
|
|
86
86
|
|
|
@@ -100,7 +100,7 @@ The index to add to the path.
|
|
|
100
100
|
|
|
101
101
|
***
|
|
102
102
|
|
|
103
|
-
### pop()
|
|
103
|
+
### pop() {#pop}
|
|
104
104
|
|
|
105
105
|
> **pop**(): `void`
|
|
106
106
|
|
|
@@ -112,7 +112,7 @@ Pop an index from the path.
|
|
|
112
112
|
|
|
113
113
|
***
|
|
114
114
|
|
|
115
|
-
### numberSegments()
|
|
115
|
+
### numberSegments() {#numbersegments}
|
|
116
116
|
|
|
117
117
|
> **numberSegments**(): `number`[]
|
|
118
118
|
|
|
@@ -14,7 +14,7 @@ Implementation of Bip39 for mnemonic generation.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,21 +22,21 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### randomMnemonic()
|
|
25
|
+
### randomMnemonic() {#randommnemonic}
|
|
26
26
|
|
|
27
|
-
> `static` **randomMnemonic**(`strength
|
|
27
|
+
> `static` **randomMnemonic**(`strength?`, `words?`): `string`
|
|
28
28
|
|
|
29
29
|
Generate a random mnemonic.
|
|
30
30
|
|
|
31
31
|
#### Parameters
|
|
32
32
|
|
|
33
|
-
##### strength
|
|
33
|
+
##### strength?
|
|
34
34
|
|
|
35
35
|
`number` = `256`
|
|
36
36
|
|
|
37
37
|
The strength of the mnemonic to generate, defaults to 256.
|
|
38
38
|
|
|
39
|
-
##### words
|
|
39
|
+
##### words?
|
|
40
40
|
|
|
41
41
|
`string`[] = `wordlist`
|
|
42
42
|
|
|
@@ -54,9 +54,9 @@ Error if the length is not a multiple of 32.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### entropyToMnemonic()
|
|
57
|
+
### entropyToMnemonic() {#entropytomnemonic}
|
|
58
58
|
|
|
59
|
-
> `static` **entropyToMnemonic**(`entropy`, `words
|
|
59
|
+
> `static` **entropyToMnemonic**(`entropy`, `words?`): `string`
|
|
60
60
|
|
|
61
61
|
Generate a mnemonic from the entropy.
|
|
62
62
|
|
|
@@ -68,7 +68,7 @@ Generate a mnemonic from the entropy.
|
|
|
68
68
|
|
|
69
69
|
The entropy to generate.
|
|
70
70
|
|
|
71
|
-
##### words
|
|
71
|
+
##### words?
|
|
72
72
|
|
|
73
73
|
`string`[] = `wordlist`
|
|
74
74
|
|
|
@@ -86,7 +86,7 @@ Error if the length of the entropy is not a multiple of 4, or is less than 16 or
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
### mnemonicToSeed()
|
|
89
|
+
### mnemonicToSeed() {#mnemonictoseed}
|
|
90
90
|
|
|
91
91
|
> `static` **mnemonicToSeed**(`mnemonic`, `password?`): `Uint8Array`
|
|
92
92
|
|
|
@@ -114,9 +114,9 @@ The seed.
|
|
|
114
114
|
|
|
115
115
|
***
|
|
116
116
|
|
|
117
|
-
### mnemonicToEntropy()
|
|
117
|
+
### mnemonicToEntropy() {#mnemonictoentropy}
|
|
118
118
|
|
|
119
|
-
> `static` **mnemonicToEntropy**(`mnemonic`, `words
|
|
119
|
+
> `static` **mnemonicToEntropy**(`mnemonic`, `words?`): `Uint8Array`
|
|
120
120
|
|
|
121
121
|
Convert the mnemonic back to entropy.
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ Convert the mnemonic back to entropy.
|
|
|
128
128
|
|
|
129
129
|
The mnemonic to convert.
|
|
130
130
|
|
|
131
|
-
##### words
|
|
131
|
+
##### words?
|
|
132
132
|
|
|
133
133
|
`string`[] = `wordlist`
|
|
134
134
|
|
|
@@ -146,9 +146,9 @@ Error if the number of words is not a multiple of 3.
|
|
|
146
146
|
|
|
147
147
|
***
|
|
148
148
|
|
|
149
|
-
### validateMnemonic()
|
|
149
|
+
### validateMnemonic() {#validatemnemonic}
|
|
150
150
|
|
|
151
|
-
> `static` **validateMnemonic**(`mnemonic`, `wordCount
|
|
151
|
+
> `static` **validateMnemonic**(`mnemonic`, `wordCount?`, `words?`): `boolean`
|
|
152
152
|
|
|
153
153
|
Validate the mnemonic.
|
|
154
154
|
|
|
@@ -160,13 +160,13 @@ Validate the mnemonic.
|
|
|
160
160
|
|
|
161
161
|
The mnemonic to validate.
|
|
162
162
|
|
|
163
|
-
##### wordCount
|
|
163
|
+
##### wordCount?
|
|
164
164
|
|
|
165
165
|
`number` = `24`
|
|
166
166
|
|
|
167
167
|
The expected number of words in the mnemonic, defaults to 24.
|
|
168
168
|
|
|
169
|
-
##### words
|
|
169
|
+
##### words?
|
|
170
170
|
|
|
171
171
|
`string`[] = `wordlist`
|
|
172
172
|
|
|
@@ -14,7 +14,7 @@ Implementation of Bip44 for address generation.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### keyPair()
|
|
25
|
+
### keyPair() {#keypair}
|
|
26
26
|
|
|
27
27
|
> `static` **keyPair**(`seed`, `keyType`, `coinType`, `accountIndex`, `isInternal`, `addressIndex`): `object`
|
|
28
28
|
|
|
@@ -86,7 +86,7 @@ Error if the address type is not supported.
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
### path()
|
|
89
|
+
### path() {#path}
|
|
90
90
|
|
|
91
91
|
> `static` **path**(`coinType`, `accountIndex`, `isInternal`, `addressIndex`): [`Bip32Path`](Bip32Path.md)
|
|
92
92
|
|
|
@@ -126,7 +126,7 @@ The generated path.
|
|
|
126
126
|
|
|
127
127
|
***
|
|
128
128
|
|
|
129
|
-
### basePath()
|
|
129
|
+
### basePath() {#basepath}
|
|
130
130
|
|
|
131
131
|
> `static` **basePath**(`coinType`): `string`
|
|
132
132
|
|
|
@@ -148,7 +148,7 @@ The bip44 address base path.
|
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### address()
|
|
151
|
+
### address() {#address}
|
|
152
152
|
|
|
153
153
|
> `static` **address**(`seed`, `keyType`, `coinType`, `accountIndex`, `isInternal`, `addressIndex`): `object`
|
|
154
154
|
|
|
@@ -212,7 +212,7 @@ The generated path and the associated keypair.
|
|
|
212
212
|
|
|
213
213
|
***
|
|
214
214
|
|
|
215
|
-
### addressBech32()
|
|
215
|
+
### addressBech32() {#addressbech32}
|
|
216
216
|
|
|
217
217
|
> `static` **addressBech32**(`seed`, `keyType`, `hrp`, `coinType`, `accountIndex`, `isInternal`, `addressIndex`): `object`
|
|
218
218
|
|
|
@@ -30,7 +30,7 @@ Optional key for the hash.
|
|
|
30
30
|
|
|
31
31
|
## Properties
|
|
32
32
|
|
|
33
|
-
### SIZE\_160
|
|
33
|
+
### SIZE\_160 {#size_160}
|
|
34
34
|
|
|
35
35
|
> `static` **SIZE\_160**: `number` = `20`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Blake2b 160.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### SIZE\_256
|
|
41
|
+
### SIZE\_256 {#size_256}
|
|
42
42
|
|
|
43
43
|
> `static` **SIZE\_256**: `number` = `32`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Blake2b 256.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### SIZE\_512
|
|
49
|
+
### SIZE\_512 {#size_512}
|
|
50
50
|
|
|
51
51
|
> `static` **SIZE\_512**: `number` = `64`
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Blake2b 512.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### CLASS\_NAME
|
|
57
|
+
### CLASS\_NAME {#class_name}
|
|
58
58
|
|
|
59
59
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ Runtime name for the class.
|
|
|
62
62
|
|
|
63
63
|
## Methods
|
|
64
64
|
|
|
65
|
-
### sum160()
|
|
65
|
+
### sum160() {#sum160}
|
|
66
66
|
|
|
67
67
|
> `static` **sum160**(`block`, `key?`): `Uint8Array`
|
|
68
68
|
|
|
@@ -90,7 +90,7 @@ The sum 160 of the block.
|
|
|
90
90
|
|
|
91
91
|
***
|
|
92
92
|
|
|
93
|
-
### sum256()
|
|
93
|
+
### sum256() {#sum256}
|
|
94
94
|
|
|
95
95
|
> `static` **sum256**(`block`, `key?`): `Uint8Array`
|
|
96
96
|
|
|
@@ -118,7 +118,7 @@ The sum 256 of the block.
|
|
|
118
118
|
|
|
119
119
|
***
|
|
120
120
|
|
|
121
|
-
### sum512()
|
|
121
|
+
### sum512() {#sum512}
|
|
122
122
|
|
|
123
123
|
> `static` **sum512**(`block`, `key?`): `Uint8Array`
|
|
124
124
|
|
|
@@ -146,7 +146,7 @@ The sum 512 of the block.
|
|
|
146
146
|
|
|
147
147
|
***
|
|
148
148
|
|
|
149
|
-
### update()
|
|
149
|
+
### update() {#update}
|
|
150
150
|
|
|
151
151
|
> **update**(`block`): `Blake2b`
|
|
152
152
|
|
|
@@ -168,7 +168,7 @@ The instance for chaining.
|
|
|
168
168
|
|
|
169
169
|
***
|
|
170
170
|
|
|
171
|
-
### digest()
|
|
171
|
+
### digest() {#digest}
|
|
172
172
|
|
|
173
173
|
> **digest**(): `Uint8Array`
|
|
174
174
|
|
|
@@ -30,7 +30,7 @@ Optional key for the hash.
|
|
|
30
30
|
|
|
31
31
|
## Properties
|
|
32
32
|
|
|
33
|
-
### SIZE\_256
|
|
33
|
+
### SIZE\_256 {#size_256}
|
|
34
34
|
|
|
35
35
|
> `static` **SIZE\_256**: `number` = `32`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Blake3 256.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### SIZE\_512
|
|
41
|
+
### SIZE\_512 {#size_512}
|
|
42
42
|
|
|
43
43
|
> `static` **SIZE\_512**: `number` = `64`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Blake3 512.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### CLASS\_NAME
|
|
49
|
+
### CLASS\_NAME {#class_name}
|
|
50
50
|
|
|
51
51
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Runtime name for the class.
|
|
|
54
54
|
|
|
55
55
|
## Methods
|
|
56
56
|
|
|
57
|
-
### sum256()
|
|
57
|
+
### sum256() {#sum256}
|
|
58
58
|
|
|
59
59
|
> `static` **sum256**(`block`, `key?`): `Uint8Array`
|
|
60
60
|
|
|
@@ -82,7 +82,7 @@ The sum 256 of the block.
|
|
|
82
82
|
|
|
83
83
|
***
|
|
84
84
|
|
|
85
|
-
### sum512()
|
|
85
|
+
### sum512() {#sum512}
|
|
86
86
|
|
|
87
87
|
> `static` **sum512**(`block`, `key?`): `Uint8Array`
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ The sum 512 of the block.
|
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
113
|
-
### update()
|
|
113
|
+
### update() {#update}
|
|
114
114
|
|
|
115
115
|
> **update**(`block`): `Blake3`
|
|
116
116
|
|
|
@@ -132,7 +132,7 @@ The instance for chaining.
|
|
|
132
132
|
|
|
133
133
|
***
|
|
134
134
|
|
|
135
|
-
### digest()
|
|
135
|
+
### digest() {#digest}
|
|
136
136
|
|
|
137
137
|
> **digest**(): `Uint8Array`
|
|
138
138
|
|
|
@@ -36,7 +36,7 @@ The additional authenticated data.
|
|
|
36
36
|
|
|
37
37
|
## Properties
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### encrypt()
|
|
47
|
+
### encrypt() {#encrypt}
|
|
48
48
|
|
|
49
49
|
> **encrypt**(`block`): `Uint8Array`
|
|
50
50
|
|
|
@@ -66,7 +66,7 @@ The block encrypted.
|
|
|
66
66
|
|
|
67
67
|
***
|
|
68
68
|
|
|
69
|
-
### decrypt()
|
|
69
|
+
### decrypt() {#decrypt}
|
|
70
70
|
|
|
71
71
|
> **decrypt**(`block`): `Uint8Array`
|
|
72
72
|
|
|
@@ -14,7 +14,7 @@ Implementation of Ed25519.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### PRIVATE\_KEY\_SIZE
|
|
17
|
+
### PRIVATE\_KEY\_SIZE {#private_key_size}
|
|
18
18
|
|
|
19
19
|
> `static` **PRIVATE\_KEY\_SIZE**: `number` = `32`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Private Key Size is the size, in bytes, of private keys as used in this package.
|
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
25
|
-
### PUBLIC\_KEY\_SIZE
|
|
25
|
+
### PUBLIC\_KEY\_SIZE {#public_key_size}
|
|
26
26
|
|
|
27
27
|
> `static` **PUBLIC\_KEY\_SIZE**: `number` = `32`
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ Public Key Size is the size, in bytes, of public keys as used in this package.
|
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
33
|
-
### CLASS\_NAME
|
|
33
|
+
### CLASS\_NAME {#class_name}
|
|
34
34
|
|
|
35
35
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Runtime name for the class.
|
|
|
38
38
|
|
|
39
39
|
## Methods
|
|
40
40
|
|
|
41
|
-
### publicKeyFromPrivateKey()
|
|
41
|
+
### publicKeyFromPrivateKey() {#publickeyfromprivatekey}
|
|
42
42
|
|
|
43
43
|
> `static` **publicKeyFromPrivateKey**(`privateKey`): `Uint8Array`
|
|
44
44
|
|
|
@@ -64,7 +64,7 @@ Error if the private key is not the correct length.
|
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
67
|
-
### sign()
|
|
67
|
+
### sign() {#sign}
|
|
68
68
|
|
|
69
69
|
> `static` **sign**(`privateKey`, `block`): `Uint8Array`
|
|
70
70
|
|
|
@@ -96,7 +96,7 @@ Error if the private key is not the correct length.
|
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
99
|
-
### verify()
|
|
99
|
+
### verify() {#verify}
|
|
100
100
|
|
|
101
101
|
> `static` **verify**(`publicKey`, `block`, `signature`): `boolean`
|
|
102
102
|
|
|
@@ -134,7 +134,7 @@ Error if the public key is not the correct length.
|
|
|
134
134
|
|
|
135
135
|
***
|
|
136
136
|
|
|
137
|
-
### privateKeyToPkcs8()
|
|
137
|
+
### privateKeyToPkcs8() {#privatekeytopkcs8}
|
|
138
138
|
|
|
139
139
|
> `static` **privateKeyToPkcs8**(`privateKey`): `Promise`\<`CryptoKey`\>
|
|
140
140
|
|
|
@@ -156,7 +156,7 @@ The private key in PKCS8 format.
|
|
|
156
156
|
|
|
157
157
|
***
|
|
158
158
|
|
|
159
|
-
### pkcs8ToPrivateKey()
|
|
159
|
+
### pkcs8ToPrivateKey() {#pkcs8toprivatekey}
|
|
160
160
|
|
|
161
161
|
> `static` **pkcs8ToPrivateKey**(`cryptoKey`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
162
162
|
|
|
@@ -24,7 +24,7 @@ The key for the hmac.
|
|
|
24
24
|
|
|
25
25
|
## Properties
|
|
26
26
|
|
|
27
|
-
### CLASS\_NAME
|
|
27
|
+
### CLASS\_NAME {#class_name}
|
|
28
28
|
|
|
29
29
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ Runtime name for the class.
|
|
|
32
32
|
|
|
33
33
|
## Methods
|
|
34
34
|
|
|
35
|
-
### sum()
|
|
35
|
+
### sum() {#sum}
|
|
36
36
|
|
|
37
37
|
> `static` **sum**(`key`, `block`): `Uint8Array`
|
|
38
38
|
|
|
@@ -60,7 +60,7 @@ The sum of the block.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### update()
|
|
63
|
+
### update() {#update}
|
|
64
64
|
|
|
65
65
|
> **update**(`block`): `HmacSha1`
|
|
66
66
|
|
|
@@ -82,7 +82,7 @@ The instance for chaining.
|
|
|
82
82
|
|
|
83
83
|
***
|
|
84
84
|
|
|
85
|
-
### digest()
|
|
85
|
+
### digest() {#digest}
|
|
86
86
|
|
|
87
87
|
> **digest**(): `Uint8Array`
|
|
88
88
|
|