@twin.org/crypto 0.0.3-next.3 → 0.0.3-next.31
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/dist/es/hashes/argon2id.js +38 -0
- package/dist/es/hashes/argon2id.js.map +1 -0
- package/dist/es/helpers/integrityHelper.js +67 -0
- package/dist/es/helpers/integrityHelper.js.map +1 -0
- package/dist/es/index.js +3 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/integrityAlgorithm.js +21 -0
- package/dist/es/models/integrityAlgorithm.js.map +1 -0
- package/dist/es/passwords/passwordGenerator.js +70 -12
- package/dist/es/passwords/passwordGenerator.js.map +1 -1
- package/dist/es/passwords/passwordValidator.js +68 -4
- package/dist/es/passwords/passwordValidator.js.map +1 -1
- package/dist/types/hashes/argon2id.d.ts +28 -0
- package/dist/types/helpers/integrityHelper.d.ts +26 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/models/integrityAlgorithm.d.ts +21 -0
- package/dist/types/passwords/passwordGenerator.d.ts +13 -2
- package/dist/types/passwords/passwordValidator.d.ts +34 -2
- package/docs/changelog.md +571 -1
- package/docs/examples.md +130 -1
- package/docs/reference/classes/Argon2id.md +83 -0
- 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 +85 -0
- package/docs/reference/classes/PasswordGenerator.md +41 -5
- package/docs/reference/classes/PasswordValidator.md +116 -3
- 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/index.md +4 -0
- package/docs/reference/type-aliases/IntegrityAlgorithm.md +5 -0
- package/docs/reference/variables/IntegrityAlgorithm.md +25 -0
- package/docs/reference/variables/KeyType.md +2 -2
- package/package.json +6 -7
|
@@ -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
|
|
|
@@ -6,7 +6,7 @@ Class to help with HmacSha256 scheme.
|
|
|
6
6
|
|
|
7
7
|
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new HmacSha256**(`key`, `bits
|
|
9
|
+
> **new HmacSha256**(`key`, `bits?`): `HmacSha256`
|
|
10
10
|
|
|
11
11
|
Create a new instance of HmacSha256.
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Create a new instance of HmacSha256.
|
|
|
18
18
|
|
|
19
19
|
The key for the hmac.
|
|
20
20
|
|
|
21
|
-
##### bits
|
|
21
|
+
##### bits?
|
|
22
22
|
|
|
23
23
|
`number` = `HmacSha256.SIZE_256`
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ The number of bits.
|
|
|
30
30
|
|
|
31
31
|
## Properties
|
|
32
32
|
|
|
33
|
-
### SIZE\_256
|
|
33
|
+
### SIZE\_256 {#size_256}
|
|
34
34
|
|
|
35
35
|
> `readonly` `static` **SIZE\_256**: `number` = `256`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Sha256 256.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### SIZE\_224
|
|
41
|
+
### SIZE\_224 {#size_224}
|
|
42
42
|
|
|
43
43
|
> `readonly` `static` **SIZE\_224**: `number` = `224`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Sha256 224.
|
|
|
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
|
-
### sum224()
|
|
57
|
+
### sum224() {#sum224}
|
|
58
58
|
|
|
59
59
|
> `static` **sum224**(`key`, `block`): `Uint8Array`
|
|
60
60
|
|
|
@@ -82,7 +82,7 @@ The sum 224 of the block.
|
|
|
82
82
|
|
|
83
83
|
***
|
|
84
84
|
|
|
85
|
-
### sum256()
|
|
85
|
+
### sum256() {#sum256}
|
|
86
86
|
|
|
87
87
|
> `static` **sum256**(`key`, `block`): `Uint8Array`
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ The sum 256 of the block.
|
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
113
|
-
### update()
|
|
113
|
+
### update() {#update}
|
|
114
114
|
|
|
115
115
|
> **update**(`block`): `HmacSha256`
|
|
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
|
|
|
@@ -6,7 +6,7 @@ Class to help with HmacSha512 scheme.
|
|
|
6
6
|
|
|
7
7
|
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new HmacSha512**(`key`, `bits
|
|
9
|
+
> **new HmacSha512**(`key`, `bits?`): `HmacSha512`
|
|
10
10
|
|
|
11
11
|
Create a new instance of HmacSha512.
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Create a new instance of HmacSha512.
|
|
|
18
18
|
|
|
19
19
|
The key for the hmac.
|
|
20
20
|
|
|
21
|
-
##### bits
|
|
21
|
+
##### bits?
|
|
22
22
|
|
|
23
23
|
`number` = `HmacSha512.SIZE_512`
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ The number of bits.
|
|
|
30
30
|
|
|
31
31
|
## Properties
|
|
32
32
|
|
|
33
|
-
### SIZE\_224
|
|
33
|
+
### SIZE\_224 {#size_224}
|
|
34
34
|
|
|
35
35
|
> `static` **SIZE\_224**: `number` = `224`
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Sha512 224.
|
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
41
|
-
### SIZE\_256
|
|
41
|
+
### SIZE\_256 {#size_256}
|
|
42
42
|
|
|
43
43
|
> `static` **SIZE\_256**: `number` = `256`
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Sha512 256.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### SIZE\_384
|
|
49
|
+
### SIZE\_384 {#size_384}
|
|
50
50
|
|
|
51
51
|
> `static` **SIZE\_384**: `number` = `384`
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Sha512 384.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### SIZE\_512
|
|
57
|
+
### SIZE\_512 {#size_512}
|
|
58
58
|
|
|
59
59
|
> `static` **SIZE\_512**: `number` = `512`
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ Sha512 512.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### CLASS\_NAME
|
|
65
|
+
### CLASS\_NAME {#class_name}
|
|
66
66
|
|
|
67
67
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ Runtime name for the class.
|
|
|
70
70
|
|
|
71
71
|
## Methods
|
|
72
72
|
|
|
73
|
-
### sum512()
|
|
73
|
+
### sum512() {#sum512}
|
|
74
74
|
|
|
75
75
|
> `static` **sum512**(`key`, `block`): `Uint8Array`
|
|
76
76
|
|
|
@@ -98,7 +98,7 @@ The sum 512 of the block.
|
|
|
98
98
|
|
|
99
99
|
***
|
|
100
100
|
|
|
101
|
-
### sum384()
|
|
101
|
+
### sum384() {#sum384}
|
|
102
102
|
|
|
103
103
|
> `static` **sum384**(`key`, `block`): `Uint8Array`
|
|
104
104
|
|
|
@@ -126,7 +126,7 @@ The sum 384 of the block.
|
|
|
126
126
|
|
|
127
127
|
***
|
|
128
128
|
|
|
129
|
-
### sum256()
|
|
129
|
+
### sum256() {#sum256}
|
|
130
130
|
|
|
131
131
|
> `static` **sum256**(`key`, `block`): `Uint8Array`
|
|
132
132
|
|
|
@@ -154,7 +154,7 @@ The sum 256 of the block.
|
|
|
154
154
|
|
|
155
155
|
***
|
|
156
156
|
|
|
157
|
-
### sum224()
|
|
157
|
+
### sum224() {#sum224}
|
|
158
158
|
|
|
159
159
|
> `static` **sum224**(`key`, `block`): `Uint8Array`
|
|
160
160
|
|
|
@@ -182,7 +182,7 @@ The sum 224 of the block.
|
|
|
182
182
|
|
|
183
183
|
***
|
|
184
184
|
|
|
185
|
-
### update()
|
|
185
|
+
### update() {#update}
|
|
186
186
|
|
|
187
187
|
> **update**(`block`): `HmacSha512`
|
|
188
188
|
|
|
@@ -204,7 +204,7 @@ The instance for chaining.
|
|
|
204
204
|
|
|
205
205
|
***
|
|
206
206
|
|
|
207
|
-
### digest()
|
|
207
|
+
### digest() {#digest}
|
|
208
208
|
|
|
209
209
|
> **digest**(): `Uint8Array`
|
|
210
210
|
|
|
@@ -15,7 +15,7 @@ Implementation of https://datatracker.ietf.org/doc/html/rfc4226 .
|
|
|
15
15
|
|
|
16
16
|
## Properties
|
|
17
17
|
|
|
18
|
-
### CLASS\_NAME
|
|
18
|
+
### CLASS\_NAME {#class_name}
|
|
19
19
|
|
|
20
20
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ Runtime name for the class.
|
|
|
23
23
|
|
|
24
24
|
## Methods
|
|
25
25
|
|
|
26
|
-
### generate()
|
|
26
|
+
### generate() {#generate}
|
|
27
27
|
|
|
28
28
|
> `static` **generate**(`key`, `counter`): `string`
|
|
29
29
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Class: IntegrityHelper
|
|
2
|
+
|
|
3
|
+
Helper class for creating integrity signatures.
|
|
4
|
+
|
|
5
|
+
## See
|
|
6
|
+
|
|
7
|
+
https://www.w3.org/TR/SRI/
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new IntegrityHelper**(): `IntegrityHelper`
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
`IntegrityHelper`
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
### CLASS\_NAME {#class_name}
|
|
22
|
+
|
|
23
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
24
|
+
|
|
25
|
+
Runtime name for the class.
|
|
26
|
+
|
|
27
|
+
## Methods
|
|
28
|
+
|
|
29
|
+
### generate() {#generate}
|
|
30
|
+
|
|
31
|
+
> `static` **generate**(`type`, `content`): `string`
|
|
32
|
+
|
|
33
|
+
Generate an integrity signature for the given content using the specified hash algorithm.
|
|
34
|
+
|
|
35
|
+
#### Parameters
|
|
36
|
+
|
|
37
|
+
##### type
|
|
38
|
+
|
|
39
|
+
[`IntegrityAlgorithm`](../type-aliases/IntegrityAlgorithm.md)
|
|
40
|
+
|
|
41
|
+
The hash algorithm to use, either "sha256", "sha384" or "sha512".
|
|
42
|
+
|
|
43
|
+
##### content
|
|
44
|
+
|
|
45
|
+
`Uint8Array`
|
|
46
|
+
|
|
47
|
+
The content to hash as a Uint8Array.
|
|
48
|
+
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
`string`
|
|
52
|
+
|
|
53
|
+
The integrity signature in the format "type-base64hash".
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### verify() {#verify}
|
|
58
|
+
|
|
59
|
+
> `static` **verify**(`integrity`, `content`): `boolean`
|
|
60
|
+
|
|
61
|
+
Verify an integrity signature for the given content.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### integrity
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
|
+
|
|
69
|
+
The integrity signature in the format "type-base64hash".
|
|
70
|
+
|
|
71
|
+
##### content
|
|
72
|
+
|
|
73
|
+
`Uint8Array`
|
|
74
|
+
|
|
75
|
+
The content to hash as a Uint8Array.
|
|
76
|
+
|
|
77
|
+
#### Returns
|
|
78
|
+
|
|
79
|
+
`boolean`
|
|
80
|
+
|
|
81
|
+
True if the integrity signature matches the content.
|
|
82
|
+
|
|
83
|
+
#### Throws
|
|
84
|
+
|
|
85
|
+
If the integrity signature is invalid.
|
|
@@ -12,24 +12,60 @@ Generate random passwords.
|
|
|
12
12
|
|
|
13
13
|
`PasswordGenerator`
|
|
14
14
|
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
|
-
### generate()
|
|
25
|
+
### generate() {#generate}
|
|
18
26
|
|
|
19
|
-
> `static` **generate**(`length
|
|
27
|
+
> `static` **generate**(`length?`): `string`
|
|
20
28
|
|
|
21
29
|
Generate a password of given length.
|
|
22
30
|
|
|
23
31
|
#### Parameters
|
|
24
32
|
|
|
25
|
-
##### length
|
|
33
|
+
##### length?
|
|
26
34
|
|
|
27
|
-
`number`
|
|
35
|
+
`number` = `PasswordGenerator._DEFAULT_MIN_PASSWORD_LENGTH`
|
|
28
36
|
|
|
29
|
-
The length of the password to generate.
|
|
37
|
+
The length of the password to generate, default to 15.
|
|
30
38
|
|
|
31
39
|
#### Returns
|
|
32
40
|
|
|
33
41
|
`string`
|
|
34
42
|
|
|
35
43
|
The random password.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### hashPassword() {#hashpassword}
|
|
48
|
+
|
|
49
|
+
> `static` **hashPassword**(`passwordBytes`, `saltBytes`): `Promise`\<`string`\>
|
|
50
|
+
|
|
51
|
+
Hash the password for the user.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### passwordBytes
|
|
56
|
+
|
|
57
|
+
`Uint8Array`
|
|
58
|
+
|
|
59
|
+
The password bytes.
|
|
60
|
+
|
|
61
|
+
##### saltBytes
|
|
62
|
+
|
|
63
|
+
`Uint8Array`
|
|
64
|
+
|
|
65
|
+
The salt bytes.
|
|
66
|
+
|
|
67
|
+
#### Returns
|
|
68
|
+
|
|
69
|
+
`Promise`\<`string`\>
|
|
70
|
+
|
|
71
|
+
The hashed password.
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# Class: PasswordValidator
|
|
2
2
|
|
|
3
3
|
Test password strength.
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
## See
|
|
6
|
+
|
|
7
|
+
https://www.owasp.org/index.php/Authentication_Cheat_Sheet#Implement_Proper_Password_Strength_Controls .
|
|
5
8
|
|
|
6
9
|
## Constructors
|
|
7
10
|
|
|
@@ -13,9 +16,17 @@ Ref https://www.owasp.org/index.php/Authentication_Cheat_Sheet#Implement_Proper_
|
|
|
13
16
|
|
|
14
17
|
`PasswordValidator`
|
|
15
18
|
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
### CLASS\_NAME {#class_name}
|
|
22
|
+
|
|
23
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
24
|
+
|
|
25
|
+
Runtime name for the class.
|
|
26
|
+
|
|
16
27
|
## Methods
|
|
17
28
|
|
|
18
|
-
### validate()
|
|
29
|
+
### validate() {#validate}
|
|
19
30
|
|
|
20
31
|
> `static` **validate**(`property`, `password`, `failures`, `options?`): `void`
|
|
21
32
|
|
|
@@ -49,7 +60,49 @@ Options to configure the testing.
|
|
|
49
60
|
|
|
50
61
|
`number`
|
|
51
62
|
|
|
52
|
-
The minimum length of the password, defaults to 8.
|
|
63
|
+
The minimum length of the password, defaults to 15, can be 8 if MFA is enabled.
|
|
64
|
+
|
|
65
|
+
###### maxLength?
|
|
66
|
+
|
|
67
|
+
`number`
|
|
68
|
+
|
|
69
|
+
The minimum length of the password, defaults to 128.
|
|
70
|
+
|
|
71
|
+
###### minPhraseLength?
|
|
72
|
+
|
|
73
|
+
`number`
|
|
74
|
+
|
|
75
|
+
The minimum length of the password for it to be considered a pass phrase.
|
|
76
|
+
|
|
77
|
+
#### Returns
|
|
78
|
+
|
|
79
|
+
`void`
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### validatePassword() {#validatepassword}
|
|
84
|
+
|
|
85
|
+
> `static` **validatePassword**(`password`, `options?`): `void`
|
|
86
|
+
|
|
87
|
+
Validate the password against security policy.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### password
|
|
92
|
+
|
|
93
|
+
`string`
|
|
94
|
+
|
|
95
|
+
The password to validate.
|
|
96
|
+
|
|
97
|
+
##### options?
|
|
98
|
+
|
|
99
|
+
Options to configure the testing.
|
|
100
|
+
|
|
101
|
+
###### minLength?
|
|
102
|
+
|
|
103
|
+
`number`
|
|
104
|
+
|
|
105
|
+
The minimum length of the password, defaults to 15.
|
|
53
106
|
|
|
54
107
|
###### maxLength?
|
|
55
108
|
|
|
@@ -66,3 +119,63 @@ The minimum length of the password for it to be considered a pass phrase.
|
|
|
66
119
|
#### Returns
|
|
67
120
|
|
|
68
121
|
`void`
|
|
122
|
+
|
|
123
|
+
#### Throws
|
|
124
|
+
|
|
125
|
+
Error if the password does not meet the requirements.
|
|
126
|
+
|
|
127
|
+
***
|
|
128
|
+
|
|
129
|
+
### comparePasswordBytes() {#comparepasswordbytes}
|
|
130
|
+
|
|
131
|
+
> `static` **comparePasswordBytes**(`hashedPasswordBytes`, `storedPasswordBytes`): `boolean`
|
|
132
|
+
|
|
133
|
+
Compare two password byte arrays in constant time to prevent timing attacks.
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
##### hashedPasswordBytes
|
|
138
|
+
|
|
139
|
+
`Uint8Array`
|
|
140
|
+
|
|
141
|
+
The computed password bytes to compare.
|
|
142
|
+
|
|
143
|
+
##### storedPasswordBytes
|
|
144
|
+
|
|
145
|
+
`Uint8Array`
|
|
146
|
+
|
|
147
|
+
The stored password bytes to compare against.
|
|
148
|
+
|
|
149
|
+
#### Returns
|
|
150
|
+
|
|
151
|
+
`boolean`
|
|
152
|
+
|
|
153
|
+
True if the bytes match, false otherwise.
|
|
154
|
+
|
|
155
|
+
***
|
|
156
|
+
|
|
157
|
+
### comparePasswordHashes() {#comparepasswordhashes}
|
|
158
|
+
|
|
159
|
+
> `static` **comparePasswordHashes**(`hashedPassword`, `storedPassword`): `boolean`
|
|
160
|
+
|
|
161
|
+
Compare two hashed passwords in constant time to prevent timing attacks.
|
|
162
|
+
|
|
163
|
+
#### Parameters
|
|
164
|
+
|
|
165
|
+
##### hashedPassword
|
|
166
|
+
|
|
167
|
+
`string`
|
|
168
|
+
|
|
169
|
+
The computed hash to compare.
|
|
170
|
+
|
|
171
|
+
##### storedPassword
|
|
172
|
+
|
|
173
|
+
`string`
|
|
174
|
+
|
|
175
|
+
The stored hash to compare against.
|
|
176
|
+
|
|
177
|
+
#### Returns
|
|
178
|
+
|
|
179
|
+
`boolean`
|
|
180
|
+
|
|
181
|
+
True if the hashes match, false otherwise.
|
|
@@ -14,7 +14,7 @@ Implementation of the password based key derivation function 2.
|
|
|
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
|
-
### sha256()
|
|
25
|
+
### sha256() {#sha256}
|
|
26
26
|
|
|
27
27
|
> `static` **sha256**(`password`, `salt`, `iterations`, `keyLength`): `Uint8Array`
|
|
28
28
|
|
|
@@ -62,7 +62,7 @@ The derived key.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### sha512()
|
|
65
|
+
### sha512() {#sha512}
|
|
66
66
|
|
|
67
67
|
> `static` **sha512**(`password`, `salt`, `iterations`, `keyLength`): `Uint8Array`
|
|
68
68
|
|
|
@@ -14,7 +14,7 @@ Helper class for working with PEM (Privacy-Enhanced Mail) formatted data.
|
|
|
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
|
-
### stripPemMarkers()
|
|
25
|
+
### stripPemMarkers() {#strippemmarkers}
|
|
26
26
|
|
|
27
27
|
> `static` **stripPemMarkers**(`pemContent`): `string`
|
|
28
28
|
|
|
@@ -44,9 +44,9 @@ The stripped PEM content in bas64 format.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### formatPem()
|
|
47
|
+
### formatPem() {#formatpem}
|
|
48
48
|
|
|
49
|
-
> `static` **formatPem**(`marker`, `base64Content`, `lineLength
|
|
49
|
+
> `static` **formatPem**(`marker`, `base64Content`, `lineLength?`): `string`
|
|
50
50
|
|
|
51
51
|
Format the PEM content to have a specific line length.
|
|
52
52
|
|
|
@@ -64,7 +64,7 @@ The marker for the PEM content, e.g. RSA PRIVATE KEY
|
|
|
64
64
|
|
|
65
65
|
The base64 content to format.
|
|
66
66
|
|
|
67
|
-
##### lineLength
|
|
67
|
+
##### lineLength?
|
|
68
68
|
|
|
69
69
|
`number` = `64`
|
|
70
70
|
|
|
@@ -14,7 +14,7 @@ Implementation of secp256k1.
|
|
|
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` = `33`
|
|
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
|
|
|
@@ -16,7 +16,7 @@ Create a new instance of Sha1.
|
|
|
16
16
|
|
|
17
17
|
## Properties
|
|
18
18
|
|
|
19
|
-
### CLASS\_NAME
|
|
19
|
+
### CLASS\_NAME {#class_name}
|
|
20
20
|
|
|
21
21
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ Runtime name for the class.
|
|
|
24
24
|
|
|
25
25
|
## Methods
|
|
26
26
|
|
|
27
|
-
### sum()
|
|
27
|
+
### sum() {#sum}
|
|
28
28
|
|
|
29
29
|
> `static` **sum**(`block`): `Uint8Array`
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ The sum of the block.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### update()
|
|
49
|
+
### update() {#update}
|
|
50
50
|
|
|
51
51
|
> **update**(`block`): `Sha1`
|
|
52
52
|
|
|
@@ -68,7 +68,7 @@ The instance for chaining.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### digest()
|
|
71
|
+
### digest() {#digest}
|
|
72
72
|
|
|
73
73
|
> **digest**(): `Uint8Array`
|
|
74
74
|
|