@twin.org/crypto 0.0.2-next.20 → 0.0.2-next.22

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 (47) hide show
  1. package/dist/cjs/index.cjs +124 -143
  2. package/dist/esm/index.mjs +124 -143
  3. package/dist/types/address/bech32.d.ts +4 -0
  4. package/dist/types/address/bip44.d.ts +4 -0
  5. package/dist/types/ciphers/chaCha20Poly1305.d.ts +4 -0
  6. package/dist/types/curves/ed25519.d.ts +4 -0
  7. package/dist/types/curves/secp256k1.d.ts +4 -0
  8. package/dist/types/curves/x25519.d.ts +4 -0
  9. package/dist/types/curves/zip215.d.ts +4 -0
  10. package/dist/types/hashes/blake2b.d.ts +4 -0
  11. package/dist/types/hashes/blake3.d.ts +4 -0
  12. package/dist/types/hashes/hmacSha1.d.ts +4 -0
  13. package/dist/types/hashes/hmacSha256.d.ts +4 -0
  14. package/dist/types/hashes/hmacSha512.d.ts +4 -0
  15. package/dist/types/hashes/pbkdf2.d.ts +4 -0
  16. package/dist/types/hashes/sha1.d.ts +4 -0
  17. package/dist/types/hashes/sha256.d.ts +4 -0
  18. package/dist/types/hashes/sha3.d.ts +4 -0
  19. package/dist/types/hashes/sha512.d.ts +4 -0
  20. package/dist/types/helpers/pemHelper.d.ts +4 -0
  21. package/dist/types/keys/bip39.d.ts +4 -0
  22. package/dist/types/keys/slip0010.d.ts +4 -0
  23. package/dist/types/otp/hotp.d.ts +4 -0
  24. package/docs/changelog.md +38 -0
  25. package/docs/reference/classes/Bech32.md +8 -0
  26. package/docs/reference/classes/Bip39.md +8 -0
  27. package/docs/reference/classes/Bip44.md +8 -0
  28. package/docs/reference/classes/Blake2b.md +8 -0
  29. package/docs/reference/classes/Blake3.md +8 -0
  30. package/docs/reference/classes/ChaCha20Poly1305.md +8 -0
  31. package/docs/reference/classes/Ed25519.md +8 -0
  32. package/docs/reference/classes/HmacSha1.md +8 -0
  33. package/docs/reference/classes/HmacSha256.md +8 -0
  34. package/docs/reference/classes/HmacSha512.md +8 -0
  35. package/docs/reference/classes/Hotp.md +8 -0
  36. package/docs/reference/classes/Pbkdf2.md +8 -0
  37. package/docs/reference/classes/PemHelper.md +8 -0
  38. package/docs/reference/classes/Secp256k1.md +8 -0
  39. package/docs/reference/classes/Sha1.md +8 -0
  40. package/docs/reference/classes/Sha256.md +8 -0
  41. package/docs/reference/classes/Sha3.md +8 -0
  42. package/docs/reference/classes/Sha512.md +8 -0
  43. package/docs/reference/classes/Slip0010.md +8 -0
  44. package/docs/reference/classes/X25519.md +8 -0
  45. package/docs/reference/classes/Zip215.md +8 -0
  46. package/locales/en.json +9 -28
  47. package/package.json +10 -6
@@ -2,6 +2,10 @@
2
2
  * Bech32 encoding and decoding.
3
3
  */
4
4
  export declare class Bech32 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Encode the buffer.
7
11
  * @param humanReadablePart The header.
@@ -4,6 +4,10 @@ import { KeyType } from "../models/keyType";
4
4
  * Implementation of Bip44 for address generation.
5
5
  */
6
6
  export declare class Bip44 {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static readonly CLASS_NAME: string;
7
11
  /**
8
12
  * Generate a bip44 key pair from the seed and parts.
9
13
  * @param seed The account seed.
@@ -2,6 +2,10 @@
2
2
  * Implementation of the ChaCha20Poly1305 cipher.
3
3
  */
4
4
  export declare class ChaCha20Poly1305 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Create a new instance of ChaCha20Poly1305.
7
11
  * @param key The key.
@@ -10,6 +10,10 @@ export declare class Ed25519 {
10
10
  * Public Key Size is the size, in bytes, of public keys as used in this package.
11
11
  */
12
12
  static PUBLIC_KEY_SIZE: number;
13
+ /**
14
+ * Runtime name for the class.
15
+ */
16
+ static readonly CLASS_NAME: string;
13
17
  /**
14
18
  * Public returns the PublicKey corresponding to private.
15
19
  * @param privateKey The private key to get the corresponding public key.
@@ -10,6 +10,10 @@ export declare class Secp256k1 {
10
10
  * Public Key Size is the size, in bytes, of public keys as used in this package.
11
11
  */
12
12
  static PUBLIC_KEY_SIZE: number;
13
+ /**
14
+ * Runtime name for the class.
15
+ */
16
+ static readonly CLASS_NAME: string;
13
17
  /**
14
18
  * Public returns the PublicKey corresponding to private.
15
19
  * @param privateKey The private key to get the corresponding public key.
@@ -2,6 +2,10 @@
2
2
  * Implementation of X25519.
3
3
  */
4
4
  export declare class X25519 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Convert Ed25519 private key to X25519 private key.
7
11
  * @param ed25519PrivateKey The ed25519 private key to convert.
@@ -2,6 +2,10 @@
2
2
  * Implementation of Zip215.
3
3
  */
4
4
  export declare class Zip215 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Verify reports whether sig is a valid signature of block by
7
11
  * publicKey, using precisely-specified validation criteria (ZIP 215) suitable
@@ -14,6 +14,10 @@ export declare class Blake2b {
14
14
  * Blake2b 512.
15
15
  */
16
16
  static SIZE_512: number;
17
+ /**
18
+ * Runtime name for the class.
19
+ */
20
+ static readonly CLASS_NAME: string;
17
21
  /**
18
22
  * Create a new instance of Blake2b.
19
23
  * @param outputLength The output length.
@@ -10,6 +10,10 @@ export declare class Blake3 {
10
10
  * Blake3 512.
11
11
  */
12
12
  static SIZE_512: number;
13
+ /**
14
+ * Runtime name for the class.
15
+ */
16
+ static readonly CLASS_NAME: string;
13
17
  /**
14
18
  * Create a new instance of Blake3.
15
19
  * @param outputLength The output length.
@@ -2,6 +2,10 @@
2
2
  * Class to help with HmacSha1 scheme.
3
3
  */
4
4
  export declare class HmacSha1 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Create a new instance of HmacSha1.
7
11
  * @param key The key for the hmac.
@@ -10,6 +10,10 @@ export declare class HmacSha256 {
10
10
  * Sha256 224.
11
11
  */
12
12
  static readonly SIZE_224: number;
13
+ /**
14
+ * Runtime name for the class.
15
+ */
16
+ static readonly CLASS_NAME: string;
13
17
  /**
14
18
  * Create a new instance of HmacSha256.
15
19
  * @param key The key for the hmac.
@@ -18,6 +18,10 @@ export declare class HmacSha512 {
18
18
  * Sha512 512.
19
19
  */
20
20
  static SIZE_512: number;
21
+ /**
22
+ * Runtime name for the class.
23
+ */
24
+ static readonly CLASS_NAME: string;
21
25
  /**
22
26
  * Create a new instance of HmacSha512.
23
27
  * @param key The key for the hmac.
@@ -2,6 +2,10 @@
2
2
  * Implementation of the password based key derivation function 2.
3
3
  */
4
4
  export declare class Pbkdf2 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Derive a key from the parameters using Sha256.
7
11
  * @param password The password to derive the key from.
@@ -2,6 +2,10 @@
2
2
  * Perform a SHA-1 hash on the block.
3
3
  */
4
4
  export declare class Sha1 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Create a new instance of Sha1.
7
11
  */
@@ -10,6 +10,10 @@ export declare class Sha256 {
10
10
  * Sha256 224.
11
11
  */
12
12
  static readonly SIZE_224: number;
13
+ /**
14
+ * Runtime name for the class.
15
+ */
16
+ static readonly CLASS_NAME: string;
13
17
  /**
14
18
  * Create a new instance of Sha256.
15
19
  * @param bits The number of bits.
@@ -18,6 +18,10 @@ export declare class Sha3 {
18
18
  * Sha3 512.
19
19
  */
20
20
  static readonly SIZE_512: number;
21
+ /**
22
+ * Runtime name for the class.
23
+ */
24
+ static readonly CLASS_NAME: string;
21
25
  /**
22
26
  * Create a new instance of Sha3.
23
27
  * @param bits The number of bits.
@@ -18,6 +18,10 @@ export declare class Sha512 {
18
18
  * Sha512 512.
19
19
  */
20
20
  static SIZE_512: number;
21
+ /**
22
+ * Runtime name for the class.
23
+ */
24
+ static readonly CLASS_NAME: string;
21
25
  /**
22
26
  * Create a new instance of Sha512.
23
27
  * @param bits The number of bits.
@@ -2,6 +2,10 @@
2
2
  * Helper class for working with PEM (Privacy-Enhanced Mail) formatted data.
3
3
  */
4
4
  export declare class PemHelper {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Strip the PEM content of its headers, footers, and newlines.
7
11
  * @param pemContent The PEM content to strip.
@@ -2,6 +2,10 @@
2
2
  * Implementation of Bip39 for mnemonic generation.
3
3
  */
4
4
  export declare class Bip39 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Generate a random mnemonic.
7
11
  * @param strength The strength of the mnemonic to generate, defaults to 256.
@@ -5,6 +5,10 @@ import { KeyType } from "../models/keyType";
5
5
  * https://github.com/satoshilabs/slips/blob/master/slip-0010.md.
6
6
  */
7
7
  export declare class Slip0010 {
8
+ /**
9
+ * Runtime name for the class.
10
+ */
11
+ static readonly CLASS_NAME: string;
8
12
  /**
9
13
  * Get the master key from the seed.
10
14
  * @param seed The seed to generate the master key from.
@@ -3,6 +3,10 @@
3
3
  * Implementation of https://datatracker.ietf.org/doc/html/rfc4226 .
4
4
  */
5
5
  export declare class Hotp {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Generate a counter based One Time Password.
8
12
  * @param key Key for the one time password.
package/docs/changelog.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @twin.org/crypto - Changelog
2
2
 
3
+ ## [0.0.2-next.22](https://github.com/twinfoundation/framework/compare/crypto-v0.0.2-next.21...crypto-v0.0.2-next.22) (2025-10-10)
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.2-next.21 to 0.0.2-next.22
16
+ * @twin.org/nameof bumped from 0.0.2-next.21 to 0.0.2-next.22
17
+ * devDependencies
18
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.21 to 0.0.2-next.22
19
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.21 to 0.0.2-next.22
20
+ * @twin.org/validate-locales bumped from 0.0.2-next.21 to 0.0.2-next.22
21
+
22
+ ## [0.0.2-next.21](https://github.com/twinfoundation/framework/compare/crypto-v0.0.2-next.20...crypto-v0.0.2-next.21) (2025-10-09)
23
+
24
+
25
+ ### Features
26
+
27
+ * locales validation ([#197](https://github.com/twinfoundation/framework/issues/197)) ([55fdadb](https://github.com/twinfoundation/framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
28
+
29
+
30
+ ### Dependencies
31
+
32
+ * The following workspace dependencies were updated
33
+ * dependencies
34
+ * @twin.org/core bumped from 0.0.2-next.20 to 0.0.2-next.21
35
+ * @twin.org/nameof bumped from 0.0.2-next.20 to 0.0.2-next.21
36
+ * devDependencies
37
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.20 to 0.0.2-next.21
38
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.20 to 0.0.2-next.21
39
+ * @twin.org/validate-locales bumped from 0.0.2-next.20 to 0.0.2-next.21
40
+
3
41
  ## [0.0.2-next.20](https://github.com/twinfoundation/framework/compare/crypto-v0.0.2-next.19...crypto-v0.0.2-next.20) (2025-10-02)
4
42
 
5
43
 
@@ -12,6 +12,14 @@ Bech32 encoding and decoding.
12
12
 
13
13
  `Bech32`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### encode()
@@ -12,6 +12,14 @@ Implementation of Bip39 for mnemonic generation.
12
12
 
13
13
  `Bip39`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### randomMnemonic()
@@ -12,6 +12,14 @@ Implementation of Bip44 for address generation.
12
12
 
13
13
  `Bip44`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### keyPair()
@@ -52,6 +52,14 @@ Blake2b 256.
52
52
 
53
53
  Blake2b 512.
54
54
 
55
+ ***
56
+
57
+ ### CLASS\_NAME
58
+
59
+ > `readonly` `static` **CLASS\_NAME**: `string`
60
+
61
+ Runtime name for the class.
62
+
55
63
  ## Methods
56
64
 
57
65
  ### sum160()
@@ -44,6 +44,14 @@ Blake3 256.
44
44
 
45
45
  Blake3 512.
46
46
 
47
+ ***
48
+
49
+ ### CLASS\_NAME
50
+
51
+ > `readonly` `static` **CLASS\_NAME**: `string`
52
+
53
+ Runtime name for the class.
54
+
47
55
  ## Methods
48
56
 
49
57
  ### sum256()
@@ -34,6 +34,14 @@ The additional authenticated data.
34
34
 
35
35
  `ChaCha20Poly1305`
36
36
 
37
+ ## Properties
38
+
39
+ ### CLASS\_NAME
40
+
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
+
43
+ Runtime name for the class.
44
+
37
45
  ## Methods
38
46
 
39
47
  ### encrypt()
@@ -28,6 +28,14 @@ Private Key Size is the size, in bytes, of private keys as used in this package.
28
28
 
29
29
  Public Key Size is the size, in bytes, of public keys as used in this package.
30
30
 
31
+ ***
32
+
33
+ ### CLASS\_NAME
34
+
35
+ > `readonly` `static` **CLASS\_NAME**: `string`
36
+
37
+ Runtime name for the class.
38
+
31
39
  ## Methods
32
40
 
33
41
  ### publicKeyFromPrivateKey()
@@ -22,6 +22,14 @@ The key for the hmac.
22
22
 
23
23
  `HmacSha1`
24
24
 
25
+ ## Properties
26
+
27
+ ### CLASS\_NAME
28
+
29
+ > `readonly` `static` **CLASS\_NAME**: `string`
30
+
31
+ Runtime name for the class.
32
+
25
33
  ## Methods
26
34
 
27
35
  ### sum()
@@ -44,6 +44,14 @@ Sha256 256.
44
44
 
45
45
  Sha256 224.
46
46
 
47
+ ***
48
+
49
+ ### CLASS\_NAME
50
+
51
+ > `readonly` `static` **CLASS\_NAME**: `string`
52
+
53
+ Runtime name for the class.
54
+
47
55
  ## Methods
48
56
 
49
57
  ### sum224()
@@ -60,6 +60,14 @@ Sha512 384.
60
60
 
61
61
  Sha512 512.
62
62
 
63
+ ***
64
+
65
+ ### CLASS\_NAME
66
+
67
+ > `readonly` `static` **CLASS\_NAME**: `string`
68
+
69
+ Runtime name for the class.
70
+
63
71
  ## Methods
64
72
 
65
73
  ### sum512()
@@ -13,6 +13,14 @@ Implementation of https://datatracker.ietf.org/doc/html/rfc4226 .
13
13
 
14
14
  `Hotp`
15
15
 
16
+ ## Properties
17
+
18
+ ### CLASS\_NAME
19
+
20
+ > `readonly` `static` **CLASS\_NAME**: `string`
21
+
22
+ Runtime name for the class.
23
+
16
24
  ## Methods
17
25
 
18
26
  ### generate()
@@ -12,6 +12,14 @@ Implementation of the password based key derivation function 2.
12
12
 
13
13
  `Pbkdf2`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### sha256()
@@ -12,6 +12,14 @@ Helper class for working with PEM (Privacy-Enhanced Mail) formatted data.
12
12
 
13
13
  `PemHelper`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### stripPemMarkers()
@@ -28,6 +28,14 @@ Private Key Size is the size, in bytes, of private keys as used in this package.
28
28
 
29
29
  Public Key Size is the size, in bytes, of public keys as used in this package.
30
30
 
31
+ ***
32
+
33
+ ### CLASS\_NAME
34
+
35
+ > `readonly` `static` **CLASS\_NAME**: `string`
36
+
37
+ Runtime name for the class.
38
+
31
39
  ## Methods
32
40
 
33
41
  ### publicKeyFromPrivateKey()
@@ -14,6 +14,14 @@ Create a new instance of Sha1.
14
14
 
15
15
  `Sha1`
16
16
 
17
+ ## Properties
18
+
19
+ ### CLASS\_NAME
20
+
21
+ > `readonly` `static` **CLASS\_NAME**: `string`
22
+
23
+ Runtime name for the class.
24
+
17
25
  ## Methods
18
26
 
19
27
  ### sum()
@@ -38,6 +38,14 @@ Sha256 256.
38
38
 
39
39
  Sha256 224.
40
40
 
41
+ ***
42
+
43
+ ### CLASS\_NAME
44
+
45
+ > `readonly` `static` **CLASS\_NAME**: `string`
46
+
47
+ Runtime name for the class.
48
+
41
49
  ## Methods
42
50
 
43
51
  ### sum256()
@@ -54,6 +54,14 @@ Sha3 384.
54
54
 
55
55
  Sha3 512.
56
56
 
57
+ ***
58
+
59
+ ### CLASS\_NAME
60
+
61
+ > `readonly` `static` **CLASS\_NAME**: `string`
62
+
63
+ Runtime name for the class.
64
+
57
65
  ## Methods
58
66
 
59
67
  ### sum256()
@@ -54,6 +54,14 @@ Sha512 384.
54
54
 
55
55
  Sha512 512.
56
56
 
57
+ ***
58
+
59
+ ### CLASS\_NAME
60
+
61
+ > `readonly` `static` **CLASS\_NAME**: `string`
62
+
63
+ Runtime name for the class.
64
+
57
65
  ## Methods
58
66
 
59
67
  ### sum512()
@@ -13,6 +13,14 @@ https://github.com/satoshilabs/slips/blob/master/slip-0010.md.
13
13
 
14
14
  `Slip0010`
15
15
 
16
+ ## Properties
17
+
18
+ ### CLASS\_NAME
19
+
20
+ > `readonly` `static` **CLASS\_NAME**: `string`
21
+
22
+ Runtime name for the class.
23
+
16
24
  ## Methods
17
25
 
18
26
  ### getMasterKeyFromSeed()
@@ -12,6 +12,14 @@ Implementation of X25519.
12
12
 
13
13
  `X25519`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### convertPrivateKeyToX25519()
@@ -12,6 +12,14 @@ Implementation of Zip215.
12
12
 
13
13
  `Zip215`
14
14
 
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
15
23
  ## Methods
16
24
 
17
25
  ### verify()