@twin.org/crypto 0.0.1-next.1
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/LICENSE +201 -0
- package/README.md +31 -0
- package/dist/cjs/index.cjs +1572 -0
- package/dist/esm/index.mjs +1528 -0
- package/dist/types/address/bech32.d.ts +28 -0
- package/dist/types/address/bip44.d.ts +53 -0
- package/dist/types/ciphers/chaCha20Poly1305.d.ts +24 -0
- package/dist/types/curves/ed25519.d.ts +37 -0
- package/dist/types/curves/secp256k1.d.ts +37 -0
- package/dist/types/curves/x25519.d.ts +18 -0
- package/dist/types/curves/zip215.d.ts +15 -0
- package/dist/types/hashes/blake2b.d.ts +55 -0
- package/dist/types/hashes/hmacSha1.d.ts +28 -0
- package/dist/types/hashes/hmacSha256.d.ts +44 -0
- package/dist/types/hashes/hmacSha512.d.ts +66 -0
- package/dist/types/hashes/pbkdf2.d.ts +23 -0
- package/dist/types/hashes/sha1.d.ts +26 -0
- package/dist/types/hashes/sha256.d.ts +41 -0
- package/dist/types/hashes/sha512.d.ts +61 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/keys/bip32Path.d.ts +40 -0
- package/dist/types/keys/bip39.d.ts +36 -0
- package/dist/types/keys/slip0010.d.ts +38 -0
- package/dist/types/models/keyType.d.ts +17 -0
- package/dist/types/otp/hotp.d.ts +14 -0
- package/dist/types/otp/totp.d.ts +46 -0
- package/dist/types/passwords/passwordGenerator.d.ts +11 -0
- package/dist/types/passwords/passwordValidator.d.ts +22 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/Bech32.md +89 -0
- package/docs/reference/classes/Bip32Path.md +117 -0
- package/docs/reference/classes/Bip39.md +121 -0
- package/docs/reference/classes/Bip44.md +173 -0
- package/docs/reference/classes/Blake2b.md +155 -0
- package/docs/reference/classes/ChaCha20Poly1305.md +69 -0
- package/docs/reference/classes/Ed25519.md +113 -0
- package/docs/reference/classes/HmacSha1.md +79 -0
- package/docs/reference/classes/HmacSha256.md +123 -0
- package/docs/reference/classes/HmacSha512.md +187 -0
- package/docs/reference/classes/Hotp.md +39 -0
- package/docs/reference/classes/PasswordGenerator.md +33 -0
- package/docs/reference/classes/PasswordValidator.md +56 -0
- package/docs/reference/classes/Pbkdf2.md +77 -0
- package/docs/reference/classes/Secp256k1.md +113 -0
- package/docs/reference/classes/Sha1.md +69 -0
- package/docs/reference/classes/Sha256.md +111 -0
- package/docs/reference/classes/Sha512.md +167 -0
- package/docs/reference/classes/Slip0010.md +114 -0
- package/docs/reference/classes/Totp.md +148 -0
- package/docs/reference/classes/X25519.md +57 -0
- package/docs/reference/classes/Zip215.md +43 -0
- package/docs/reference/index.md +34 -0
- package/docs/reference/type-aliases/KeyType.md +5 -0
- package/docs/reference/variables/KeyType.md +19 -0
- package/locales/en.json +71 -0
- package/package.json +71 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Class: Slip0010
|
|
2
|
+
|
|
3
|
+
Class to help with slip0010 key derivation
|
|
4
|
+
https://github.com/satoshilabs/slips/blob/master/slip-0010.md.
|
|
5
|
+
|
|
6
|
+
## Constructors
|
|
7
|
+
|
|
8
|
+
### new Slip0010()
|
|
9
|
+
|
|
10
|
+
> **new Slip0010**(): [`Slip0010`](Slip0010.md)
|
|
11
|
+
|
|
12
|
+
#### Returns
|
|
13
|
+
|
|
14
|
+
[`Slip0010`](Slip0010.md)
|
|
15
|
+
|
|
16
|
+
## Methods
|
|
17
|
+
|
|
18
|
+
### getMasterKeyFromSeed()
|
|
19
|
+
|
|
20
|
+
> `static` **getMasterKeyFromSeed**(`seed`, `keyType`): `object`
|
|
21
|
+
|
|
22
|
+
Get the master key from the seed.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
• **seed**: `Uint8Array`
|
|
27
|
+
|
|
28
|
+
The seed to generate the master key from.
|
|
29
|
+
|
|
30
|
+
• **keyType**: [`KeyType`](../type-aliases/KeyType.md) = `KeyType.Ed25519`
|
|
31
|
+
|
|
32
|
+
The key type.
|
|
33
|
+
|
|
34
|
+
#### Returns
|
|
35
|
+
|
|
36
|
+
`object`
|
|
37
|
+
|
|
38
|
+
The key and chain code.
|
|
39
|
+
|
|
40
|
+
##### privateKey
|
|
41
|
+
|
|
42
|
+
> **privateKey**: `Uint8Array`
|
|
43
|
+
|
|
44
|
+
##### chainCode
|
|
45
|
+
|
|
46
|
+
> **chainCode**: `Uint8Array`
|
|
47
|
+
|
|
48
|
+
#### Throws
|
|
49
|
+
|
|
50
|
+
If the seed is invalid.
|
|
51
|
+
|
|
52
|
+
***
|
|
53
|
+
|
|
54
|
+
### derivePath()
|
|
55
|
+
|
|
56
|
+
> `static` **derivePath**(`seed`, `path`, `keyType`): `object`
|
|
57
|
+
|
|
58
|
+
Derive a key from the path.
|
|
59
|
+
|
|
60
|
+
#### Parameters
|
|
61
|
+
|
|
62
|
+
• **seed**: `Uint8Array`
|
|
63
|
+
|
|
64
|
+
The seed.
|
|
65
|
+
|
|
66
|
+
• **path**: [`Bip32Path`](Bip32Path.md)
|
|
67
|
+
|
|
68
|
+
The path.
|
|
69
|
+
|
|
70
|
+
• **keyType**: [`KeyType`](../type-aliases/KeyType.md) = `KeyType.Ed25519`
|
|
71
|
+
|
|
72
|
+
The key type.
|
|
73
|
+
|
|
74
|
+
#### Returns
|
|
75
|
+
|
|
76
|
+
`object`
|
|
77
|
+
|
|
78
|
+
The key and chain code.
|
|
79
|
+
|
|
80
|
+
##### privateKey
|
|
81
|
+
|
|
82
|
+
> **privateKey**: `Uint8Array`
|
|
83
|
+
|
|
84
|
+
##### chainCode
|
|
85
|
+
|
|
86
|
+
> **chainCode**: `Uint8Array`
|
|
87
|
+
|
|
88
|
+
***
|
|
89
|
+
|
|
90
|
+
### getPublicKey()
|
|
91
|
+
|
|
92
|
+
> `static` **getPublicKey**(`privateKey`, `keyType`, `withZeroByte`): `Uint8Array`
|
|
93
|
+
|
|
94
|
+
Get the public key from the private key.
|
|
95
|
+
|
|
96
|
+
#### Parameters
|
|
97
|
+
|
|
98
|
+
• **privateKey**: `Uint8Array`
|
|
99
|
+
|
|
100
|
+
The private key.
|
|
101
|
+
|
|
102
|
+
• **keyType**: [`KeyType`](../type-aliases/KeyType.md) = `KeyType.Ed25519`
|
|
103
|
+
|
|
104
|
+
The key type.
|
|
105
|
+
|
|
106
|
+
• **withZeroByte**: `boolean` = `true`
|
|
107
|
+
|
|
108
|
+
Include a zero bute prefix.
|
|
109
|
+
|
|
110
|
+
#### Returns
|
|
111
|
+
|
|
112
|
+
`Uint8Array`
|
|
113
|
+
|
|
114
|
+
The public key.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Class: Totp
|
|
2
|
+
|
|
3
|
+
Perform TOTP.
|
|
4
|
+
Implementation of https://datatracker.ietf.org/doc/html/rfc4226 .
|
|
5
|
+
|
|
6
|
+
## Constructors
|
|
7
|
+
|
|
8
|
+
### new Totp()
|
|
9
|
+
|
|
10
|
+
> **new Totp**(): [`Totp`](Totp.md)
|
|
11
|
+
|
|
12
|
+
#### Returns
|
|
13
|
+
|
|
14
|
+
[`Totp`](Totp.md)
|
|
15
|
+
|
|
16
|
+
## Methods
|
|
17
|
+
|
|
18
|
+
### generate()
|
|
19
|
+
|
|
20
|
+
> `static` **generate**(`key`, `interval`, `timestamp`): `string`
|
|
21
|
+
|
|
22
|
+
Generate a time based One Time Password.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
• **key**: `Uint8Array`
|
|
27
|
+
|
|
28
|
+
Key for the one time password.
|
|
29
|
+
|
|
30
|
+
• **interval**: `number` = `30`
|
|
31
|
+
|
|
32
|
+
The time step of the counter.
|
|
33
|
+
|
|
34
|
+
• **timestamp**: `number` = `...`
|
|
35
|
+
|
|
36
|
+
The timestamp.
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`string`
|
|
41
|
+
|
|
42
|
+
The one time password.
|
|
43
|
+
|
|
44
|
+
***
|
|
45
|
+
|
|
46
|
+
### verify()
|
|
47
|
+
|
|
48
|
+
> `static` **verify**(`token`, `key`, `window`, `interval`, `timestamp`): `undefined` \| `number`
|
|
49
|
+
|
|
50
|
+
Check a One Time Password based on a timer.
|
|
51
|
+
|
|
52
|
+
#### Parameters
|
|
53
|
+
|
|
54
|
+
• **token**: `string`
|
|
55
|
+
|
|
56
|
+
Passcode to validate.
|
|
57
|
+
|
|
58
|
+
• **key**: `Uint8Array`
|
|
59
|
+
|
|
60
|
+
Key for the one time password. This should be unique and secret for
|
|
61
|
+
every user as it is the seed used to calculate the HMAC.
|
|
62
|
+
|
|
63
|
+
• **window**: `number` = `2`
|
|
64
|
+
|
|
65
|
+
The allowable margin for the counter.
|
|
66
|
+
|
|
67
|
+
• **interval**: `number` = `30`
|
|
68
|
+
|
|
69
|
+
The time step of the counter.
|
|
70
|
+
|
|
71
|
+
• **timestamp**: `number` = `...`
|
|
72
|
+
|
|
73
|
+
The timestamp now.
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`undefined` \| `number`
|
|
78
|
+
|
|
79
|
+
Undefined if failure, delta on success
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### generateSecret()
|
|
84
|
+
|
|
85
|
+
> `static` **generateSecret**(`length`): `string`
|
|
86
|
+
|
|
87
|
+
Generate a secret.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
• **length**: `number`
|
|
92
|
+
|
|
93
|
+
The length of the secret to generate.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`string`
|
|
98
|
+
|
|
99
|
+
The secret encoded as base32.
|
|
100
|
+
|
|
101
|
+
***
|
|
102
|
+
|
|
103
|
+
### secretToBytes()
|
|
104
|
+
|
|
105
|
+
> `static` **secretToBytes**(`secretBase32`): `Uint8Array`
|
|
106
|
+
|
|
107
|
+
Convert the secret back to bytes.
|
|
108
|
+
|
|
109
|
+
#### Parameters
|
|
110
|
+
|
|
111
|
+
• **secretBase32**: `string`
|
|
112
|
+
|
|
113
|
+
The secret encoded as base32.
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`Uint8Array`
|
|
118
|
+
|
|
119
|
+
The bytes of the secret.
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### generateAuthUrl()
|
|
124
|
+
|
|
125
|
+
> `static` **generateAuthUrl**(`issuer`, `label`, `secretBase32`): `string`
|
|
126
|
+
|
|
127
|
+
Generate a url for use with authenticator apps.
|
|
128
|
+
See https://github.com/google/google-authenticator/wiki/Key-Uri-Format .
|
|
129
|
+
|
|
130
|
+
#### Parameters
|
|
131
|
+
|
|
132
|
+
• **issuer**: `string`
|
|
133
|
+
|
|
134
|
+
The issuer of the totp.
|
|
135
|
+
|
|
136
|
+
• **label**: `string`
|
|
137
|
+
|
|
138
|
+
The label that will show in auth apps.
|
|
139
|
+
|
|
140
|
+
• **secretBase32**: `string`
|
|
141
|
+
|
|
142
|
+
The secret as base 32.
|
|
143
|
+
|
|
144
|
+
#### Returns
|
|
145
|
+
|
|
146
|
+
`string`
|
|
147
|
+
|
|
148
|
+
The url.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Class: X25519
|
|
2
|
+
|
|
3
|
+
Implementation of X25519.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new X25519()
|
|
8
|
+
|
|
9
|
+
> **new X25519**(): [`X25519`](X25519.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`X25519`](X25519.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### convertPrivateKeyToX25519()
|
|
18
|
+
|
|
19
|
+
> `static` **convertPrivateKeyToX25519**(`ed25519PrivateKey`): `Uint8Array`
|
|
20
|
+
|
|
21
|
+
Convert Ed25519 private key to X25519 private key.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **ed25519PrivateKey**: `Uint8Array`
|
|
26
|
+
|
|
27
|
+
The ed25519 private key to convert.
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
`Uint8Array`
|
|
32
|
+
|
|
33
|
+
The x25519 private key.
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### convertPublicKeyToX25519()
|
|
38
|
+
|
|
39
|
+
> `static` **convertPublicKeyToX25519**(`ed25519PublicKey`): `Uint8Array`
|
|
40
|
+
|
|
41
|
+
Convert Ed25519 public key to X25519 public key.
|
|
42
|
+
|
|
43
|
+
#### Parameters
|
|
44
|
+
|
|
45
|
+
• **ed25519PublicKey**: `Uint8Array`
|
|
46
|
+
|
|
47
|
+
The ed25519 public key to convert.
|
|
48
|
+
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
`Uint8Array`
|
|
52
|
+
|
|
53
|
+
The x25519 public key.
|
|
54
|
+
|
|
55
|
+
#### Throws
|
|
56
|
+
|
|
57
|
+
GeneralError On invalid public key.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Class: Zip215
|
|
2
|
+
|
|
3
|
+
Implementation of Zip215.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new Zip215()
|
|
8
|
+
|
|
9
|
+
> **new Zip215**(): [`Zip215`](Zip215.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`Zip215`](Zip215.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### verify()
|
|
18
|
+
|
|
19
|
+
> `static` **verify**(`publicKey`, `block`, `sig`): `boolean`
|
|
20
|
+
|
|
21
|
+
Verify reports whether sig is a valid signature of block by
|
|
22
|
+
publicKey, using precisely-specified validation criteria (ZIP 215) suitable
|
|
23
|
+
for use in consensus-critical contexts.
|
|
24
|
+
|
|
25
|
+
#### Parameters
|
|
26
|
+
|
|
27
|
+
• **publicKey**: `Uint8Array`
|
|
28
|
+
|
|
29
|
+
The public key for the block.
|
|
30
|
+
|
|
31
|
+
• **block**: `Uint8Array`
|
|
32
|
+
|
|
33
|
+
The block content to validate.
|
|
34
|
+
|
|
35
|
+
• **sig**: `Uint8Array`
|
|
36
|
+
|
|
37
|
+
The signature to verify.
|
|
38
|
+
|
|
39
|
+
#### Returns
|
|
40
|
+
|
|
41
|
+
`boolean`
|
|
42
|
+
|
|
43
|
+
True if the signature is valid.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @twin.org/crypto
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [Bech32](classes/Bech32.md)
|
|
6
|
+
- [Bip44](classes/Bip44.md)
|
|
7
|
+
- [ChaCha20Poly1305](classes/ChaCha20Poly1305.md)
|
|
8
|
+
- [Ed25519](classes/Ed25519.md)
|
|
9
|
+
- [Secp256k1](classes/Secp256k1.md)
|
|
10
|
+
- [X25519](classes/X25519.md)
|
|
11
|
+
- [Zip215](classes/Zip215.md)
|
|
12
|
+
- [Blake2b](classes/Blake2b.md)
|
|
13
|
+
- [HmacSha1](classes/HmacSha1.md)
|
|
14
|
+
- [HmacSha256](classes/HmacSha256.md)
|
|
15
|
+
- [HmacSha512](classes/HmacSha512.md)
|
|
16
|
+
- [Pbkdf2](classes/Pbkdf2.md)
|
|
17
|
+
- [Sha1](classes/Sha1.md)
|
|
18
|
+
- [Sha256](classes/Sha256.md)
|
|
19
|
+
- [Sha512](classes/Sha512.md)
|
|
20
|
+
- [Bip32Path](classes/Bip32Path.md)
|
|
21
|
+
- [Bip39](classes/Bip39.md)
|
|
22
|
+
- [Slip0010](classes/Slip0010.md)
|
|
23
|
+
- [Hotp](classes/Hotp.md)
|
|
24
|
+
- [Totp](classes/Totp.md)
|
|
25
|
+
- [PasswordGenerator](classes/PasswordGenerator.md)
|
|
26
|
+
- [PasswordValidator](classes/PasswordValidator.md)
|
|
27
|
+
|
|
28
|
+
## Type Aliases
|
|
29
|
+
|
|
30
|
+
- [KeyType](type-aliases/KeyType.md)
|
|
31
|
+
|
|
32
|
+
## Variables
|
|
33
|
+
|
|
34
|
+
- [KeyType](variables/KeyType.md)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: KeyType
|
|
2
|
+
|
|
3
|
+
> `const` **KeyType**: `object`
|
|
4
|
+
|
|
5
|
+
The names of the key types.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### Ed25519
|
|
10
|
+
|
|
11
|
+
> `readonly` **Ed25519**: `0` = `0`
|
|
12
|
+
|
|
13
|
+
Ed25519.
|
|
14
|
+
|
|
15
|
+
### Secp256k1
|
|
16
|
+
|
|
17
|
+
> `readonly` **Secp256k1**: `1` = `1`
|
|
18
|
+
|
|
19
|
+
Secp256k1.
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"error": {
|
|
3
|
+
"guard": {
|
|
4
|
+
"length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
|
|
5
|
+
"lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
|
|
6
|
+
"length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
|
|
7
|
+
"greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
|
|
8
|
+
},
|
|
9
|
+
"bip39": {
|
|
10
|
+
"missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
|
|
11
|
+
"checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
|
|
12
|
+
},
|
|
13
|
+
"ed25519": {
|
|
14
|
+
"privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
|
|
15
|
+
"publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
|
|
16
|
+
},
|
|
17
|
+
"secp256k1": {
|
|
18
|
+
"privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
|
|
19
|
+
"publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
|
|
20
|
+
},
|
|
21
|
+
"x25519": {
|
|
22
|
+
"invalidPublicKey": "Invalid Ed25519 Public Key"
|
|
23
|
+
},
|
|
24
|
+
"blake2b": {
|
|
25
|
+
"outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
|
|
26
|
+
"keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
|
|
27
|
+
},
|
|
28
|
+
"sha512": {
|
|
29
|
+
"bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
|
|
30
|
+
},
|
|
31
|
+
"sha256": {
|
|
32
|
+
"bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
|
|
33
|
+
},
|
|
34
|
+
"hmacSha256": {
|
|
35
|
+
"bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
|
|
36
|
+
},
|
|
37
|
+
"hmacSha512": {
|
|
38
|
+
"bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
|
|
39
|
+
},
|
|
40
|
+
"base32": {
|
|
41
|
+
"invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
|
|
42
|
+
},
|
|
43
|
+
"base64": {
|
|
44
|
+
"length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
|
|
45
|
+
},
|
|
46
|
+
"bech32": {
|
|
47
|
+
"decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
|
|
48
|
+
"invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
|
|
49
|
+
"separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
|
|
50
|
+
"lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
|
|
51
|
+
"dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
|
|
52
|
+
},
|
|
53
|
+
"pbkdf2": {
|
|
54
|
+
"keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
|
|
55
|
+
},
|
|
56
|
+
"chaCha20Poly1305": {
|
|
57
|
+
"noAadWithData": "You can not set the aad when there is already data",
|
|
58
|
+
"noAuthTag": "Can not finalise when the auth tag is not set",
|
|
59
|
+
"authenticationFailed": "The data could not be authenticated",
|
|
60
|
+
"authTagDecrypting": "Can not get the auth tag when decrypting",
|
|
61
|
+
"authTagEncrypting": "Can not set the auth tag when encrypting",
|
|
62
|
+
"noAuthTagSet": "The auth tag has not been set"
|
|
63
|
+
},
|
|
64
|
+
"bip44": {
|
|
65
|
+
"unsupportedKeyType": "The key type \"{keyType}\" is not supported"
|
|
66
|
+
},
|
|
67
|
+
"slip0010": {
|
|
68
|
+
"invalidSeed": "The seed is invalid \"{seed}\""
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/crypto",
|
|
3
|
+
"version": "0.0.1-next.1",
|
|
4
|
+
"description": "Contains helper methods and classes which implement cryptographic functions",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/framework.git",
|
|
8
|
+
"directory": "packages/crypto"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "rimraf dist coverage docs/reference",
|
|
18
|
+
"build": "tspc",
|
|
19
|
+
"test": "vitest --run --config ./vitest.config.ts --no-cache",
|
|
20
|
+
"coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
|
|
21
|
+
"bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
|
|
22
|
+
"bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
|
|
23
|
+
"bundle": "npm run bundle:esm && npm run bundle:cjs",
|
|
24
|
+
"docs:clean": "rimraf docs/reference",
|
|
25
|
+
"docs:generate": "typedoc",
|
|
26
|
+
"docs": "npm run docs:clean && npm run docs:generate",
|
|
27
|
+
"dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@twin.org/core": "0.0.1-next.1",
|
|
31
|
+
"@twin.org/nameof": "next",
|
|
32
|
+
"@noble/ciphers": "1.0.0",
|
|
33
|
+
"@noble/curves": "1.6.0",
|
|
34
|
+
"@noble/hashes": "1.5.0",
|
|
35
|
+
"@scure/base": "1.1.9",
|
|
36
|
+
"@scure/bip32": "1.5.0",
|
|
37
|
+
"@scure/bip39": "1.4.0",
|
|
38
|
+
"micro-key-producer": "0.7.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@twin.org/nameof-transformer": "next",
|
|
42
|
+
"@vitest/coverage-v8": "2.1.1",
|
|
43
|
+
"copyfiles": "2.4.1",
|
|
44
|
+
"rimraf": "6.0.1",
|
|
45
|
+
"rollup": "4.21.3",
|
|
46
|
+
"rollup-plugin-typescript2": "0.36.0",
|
|
47
|
+
"ts-patch": "3.2.1",
|
|
48
|
+
"typedoc": "0.26.7",
|
|
49
|
+
"typedoc-plugin-markdown": "4.2.7",
|
|
50
|
+
"typescript": "5.6.2",
|
|
51
|
+
"vitest": "2.1.1"
|
|
52
|
+
},
|
|
53
|
+
"main": "./dist/cjs/index.cjs",
|
|
54
|
+
"module": "./dist/esm/index.mjs",
|
|
55
|
+
"types": "./dist/types/index.d.ts",
|
|
56
|
+
"exports": {
|
|
57
|
+
".": {
|
|
58
|
+
"require": "./dist/cjs/index.cjs",
|
|
59
|
+
"import": "./dist/esm/index.mjs",
|
|
60
|
+
"types": "./dist/types/index.d.ts"
|
|
61
|
+
},
|
|
62
|
+
"./locales": "./locales"
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"dist/cjs",
|
|
66
|
+
"dist/esm",
|
|
67
|
+
"dist/types",
|
|
68
|
+
"locales",
|
|
69
|
+
"docs"
|
|
70
|
+
]
|
|
71
|
+
}
|