@twin.org/crypto 0.0.1-next.9 → 0.0.2-next.3

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.
Files changed (38) hide show
  1. package/dist/cjs/index.cjs +304 -1
  2. package/dist/esm/index.mjs +304 -3
  3. package/dist/types/address/bip44.d.ts +15 -0
  4. package/dist/types/ciphers/rsa.d.ts +63 -0
  5. package/dist/types/curves/ed25519.d.ts +12 -0
  6. package/dist/types/helpers/pemHelper.d.ts +19 -0
  7. package/dist/types/index.d.ts +2 -0
  8. package/docs/changelog.md +400 -1
  9. package/docs/reference/classes/Bech32.md +15 -7
  10. package/docs/reference/classes/Bip32Path.md +17 -9
  11. package/docs/reference/classes/Bip39.md +28 -12
  12. package/docs/reference/classes/Bip44.md +121 -21
  13. package/docs/reference/classes/Blake2b.md +35 -17
  14. package/docs/reference/classes/Blake3.md +28 -14
  15. package/docs/reference/classes/ChaCha20Poly1305.md +18 -8
  16. package/docs/reference/classes/Ed25519.md +65 -9
  17. package/docs/reference/classes/HmacSha1.md +17 -9
  18. package/docs/reference/classes/HmacSha256.md +26 -12
  19. package/docs/reference/classes/HmacSha512.md +38 -16
  20. package/docs/reference/classes/Hotp.md +9 -5
  21. package/docs/reference/classes/PasswordGenerator.md +6 -4
  22. package/docs/reference/classes/PasswordValidator.md +23 -11
  23. package/docs/reference/classes/Pbkdf2.md +27 -11
  24. package/docs/reference/classes/PemHelper.md +69 -0
  25. package/docs/reference/classes/RSA.md +213 -0
  26. package/docs/reference/classes/Secp256k1.md +21 -9
  27. package/docs/reference/classes/Sha1.md +11 -7
  28. package/docs/reference/classes/Sha256.md +17 -9
  29. package/docs/reference/classes/Sha3.md +23 -11
  30. package/docs/reference/classes/Sha512.md +23 -11
  31. package/docs/reference/classes/Slip0010.md +27 -11
  32. package/docs/reference/classes/Totp.md +42 -16
  33. package/docs/reference/classes/X25519.md +9 -5
  34. package/docs/reference/classes/Zip215.md +12 -6
  35. package/docs/reference/index.md +2 -0
  36. package/docs/reference/type-aliases/KeyType.md +1 -1
  37. package/locales/en.json +4 -0
  38. package/package.json +13 -13
@@ -5,13 +5,13 @@ Implementation of https://datatracker.ietf.org/doc/html/rfc4226 .
5
5
 
6
6
  ## Constructors
7
7
 
8
- ### new Totp()
8
+ ### Constructor
9
9
 
10
- > **new Totp**(): [`Totp`](Totp.md)
10
+ > **new Totp**(): `Totp`
11
11
 
12
12
  #### Returns
13
13
 
14
- [`Totp`](Totp.md)
14
+ `Totp`
15
15
 
16
16
  ## Methods
17
17
 
@@ -23,15 +23,21 @@ Generate a time based One Time Password.
23
23
 
24
24
  #### Parameters
25
25
 
26
- **key**: `Uint8Array`
26
+ ##### key
27
+
28
+ `Uint8Array`
27
29
 
28
30
  Key for the one time password.
29
31
 
30
- **interval**: `number` = `30`
32
+ ##### interval
33
+
34
+ `number` = `30`
31
35
 
32
36
  The time step of the counter.
33
37
 
34
- **timestamp**: `number` = `...`
38
+ ##### timestamp
39
+
40
+ `number` = `...`
35
41
 
36
42
  The timestamp.
37
43
 
@@ -51,24 +57,34 @@ Check a One Time Password based on a timer.
51
57
 
52
58
  #### Parameters
53
59
 
54
- **token**: `string`
60
+ ##### token
61
+
62
+ `string`
55
63
 
56
64
  Passcode to validate.
57
65
 
58
- **key**: `Uint8Array`
66
+ ##### key
67
+
68
+ `Uint8Array`
59
69
 
60
70
  Key for the one time password. This should be unique and secret for
61
71
  every user as it is the seed used to calculate the HMAC.
62
72
 
63
- **window**: `number` = `2`
73
+ ##### window
74
+
75
+ `number` = `2`
64
76
 
65
77
  The allowable margin for the counter.
66
78
 
67
- **interval**: `number` = `30`
79
+ ##### interval
80
+
81
+ `number` = `30`
68
82
 
69
83
  The time step of the counter.
70
84
 
71
- **timestamp**: `number` = `...`
85
+ ##### timestamp
86
+
87
+ `number` = `...`
72
88
 
73
89
  The timestamp now.
74
90
 
@@ -88,7 +104,9 @@ Generate a secret.
88
104
 
89
105
  #### Parameters
90
106
 
91
- **length**: `number`
107
+ ##### length
108
+
109
+ `number`
92
110
 
93
111
  The length of the secret to generate.
94
112
 
@@ -108,7 +126,9 @@ Convert the secret back to bytes.
108
126
 
109
127
  #### Parameters
110
128
 
111
- **secretBase32**: `string`
129
+ ##### secretBase32
130
+
131
+ `string`
112
132
 
113
133
  The secret encoded as base32.
114
134
 
@@ -129,15 +149,21 @@ See https://github.com/google/google-authenticator/wiki/Key-Uri-Format .
129
149
 
130
150
  #### Parameters
131
151
 
132
- **issuer**: `string`
152
+ ##### issuer
153
+
154
+ `string`
133
155
 
134
156
  The issuer of the totp.
135
157
 
136
- **label**: `string`
158
+ ##### label
159
+
160
+ `string`
137
161
 
138
162
  The label that will show in auth apps.
139
163
 
140
- **secretBase32**: `string`
164
+ ##### secretBase32
165
+
166
+ `string`
141
167
 
142
168
  The secret as base 32.
143
169
 
@@ -4,13 +4,13 @@ Implementation of X25519.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new X25519()
7
+ ### Constructor
8
8
 
9
- > **new X25519**(): [`X25519`](X25519.md)
9
+ > **new X25519**(): `X25519`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`X25519`](X25519.md)
13
+ `X25519`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,7 +22,9 @@ Convert Ed25519 private key to X25519 private key.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **ed25519PrivateKey**: `Uint8Array`
25
+ ##### ed25519PrivateKey
26
+
27
+ `Uint8Array`
26
28
 
27
29
  The ed25519 private key to convert.
28
30
 
@@ -42,7 +44,9 @@ Convert Ed25519 public key to X25519 public key.
42
44
 
43
45
  #### Parameters
44
46
 
45
- **ed25519PublicKey**: `Uint8Array`
47
+ ##### ed25519PublicKey
48
+
49
+ `Uint8Array`
46
50
 
47
51
  The ed25519 public key to convert.
48
52
 
@@ -4,13 +4,13 @@ Implementation of Zip215.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new Zip215()
7
+ ### Constructor
8
8
 
9
- > **new Zip215**(): [`Zip215`](Zip215.md)
9
+ > **new Zip215**(): `Zip215`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`Zip215`](Zip215.md)
13
+ `Zip215`
14
14
 
15
15
  ## Methods
16
16
 
@@ -24,15 +24,21 @@ for use in consensus-critical contexts.
24
24
 
25
25
  #### Parameters
26
26
 
27
- **publicKey**: `Uint8Array`
27
+ ##### publicKey
28
+
29
+ `Uint8Array`
28
30
 
29
31
  The public key for the block.
30
32
 
31
- **block**: `Uint8Array`
33
+ ##### block
34
+
35
+ `Uint8Array`
32
36
 
33
37
  The block content to validate.
34
38
 
35
- **sig**: `Uint8Array`
39
+ ##### sig
40
+
41
+ `Uint8Array`
36
42
 
37
43
  The signature to verify.
38
44
 
@@ -5,6 +5,7 @@
5
5
  - [Bech32](classes/Bech32.md)
6
6
  - [Bip44](classes/Bip44.md)
7
7
  - [ChaCha20Poly1305](classes/ChaCha20Poly1305.md)
8
+ - [RSA](classes/RSA.md)
8
9
  - [Ed25519](classes/Ed25519.md)
9
10
  - [Secp256k1](classes/Secp256k1.md)
10
11
  - [X25519](classes/X25519.md)
@@ -19,6 +20,7 @@
19
20
  - [Sha256](classes/Sha256.md)
20
21
  - [Sha3](classes/Sha3.md)
21
22
  - [Sha512](classes/Sha512.md)
23
+ - [PemHelper](classes/PemHelper.md)
22
24
  - [Bip32Path](classes/Bip32Path.md)
23
25
  - [Bip39](classes/Bip39.md)
24
26
  - [Slip0010](classes/Slip0010.md)
@@ -1,5 +1,5 @@
1
1
  # Type Alias: KeyType
2
2
 
3
- > **KeyType**: *typeof* [`KeyType`](../variables/KeyType.md)\[keyof *typeof* [`KeyType`](../variables/KeyType.md)\]
3
+ > **KeyType** = *typeof* [`KeyType`](../variables/KeyType.md)\[keyof *typeof* [`KeyType`](../variables/KeyType.md)\]
4
4
 
5
5
  Key types.
package/locales/en.json CHANGED
@@ -63,6 +63,10 @@
63
63
  },
64
64
  "slip0010": {
65
65
  "invalidSeed": "The seed is invalid \"{seed}\""
66
+ },
67
+ "rsa": {
68
+ "noPrivateKey": "Private key is required for decryption",
69
+ "invalidKeySize": "Invalid RSA key size"
66
70
  }
67
71
  }
68
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/crypto",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2-next.3",
4
4
  "description": "Contains helper methods and classes which implement cryptographic functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,26 +14,26 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@noble/ciphers": "1.0.0",
18
- "@noble/curves": "1.6.0",
19
- "@noble/hashes": "1.5.0",
20
- "@scure/base": "1.1.9",
21
- "@scure/bip32": "1.5.0",
22
- "@scure/bip39": "1.4.0",
23
- "@twin.org/core": "0.0.1-next.9",
24
- "@twin.org/nameof": "next",
25
- "micro-key-producer": "0.7.0"
17
+ "@noble/ciphers": "1.3.0",
18
+ "@noble/curves": "1.9.2",
19
+ "@noble/hashes": "1.8.0",
20
+ "@scure/base": "1.2.6",
21
+ "@scure/bip32": "1.7.0",
22
+ "@scure/bip39": "1.6.0",
23
+ "@twin.org/core": "0.0.2-next.3",
24
+ "@twin.org/nameof": "0.0.2-next.3",
25
+ "micro-key-producer": "0.7.6"
26
26
  },
27
27
  "main": "./dist/cjs/index.cjs",
28
28
  "module": "./dist/esm/index.mjs",
29
29
  "types": "./dist/types/index.d.ts",
30
30
  "exports": {
31
31
  ".": {
32
+ "types": "./dist/types/index.d.ts",
32
33
  "require": "./dist/cjs/index.cjs",
33
- "import": "./dist/esm/index.mjs",
34
- "types": "./dist/types/index.d.ts"
34
+ "import": "./dist/esm/index.mjs"
35
35
  },
36
- "./locales": "./locales"
36
+ "./locales/*.json": "./locales/*.json"
37
37
  },
38
38
  "files": [
39
39
  "dist/cjs",