ox 0.8.1 → 0.8.2

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 (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/Ed25519/package.json +6 -0
  3. package/X25519/package.json +6 -0
  4. package/_cjs/core/Bls.js +10 -0
  5. package/_cjs/core/Bls.js.map +1 -1
  6. package/_cjs/core/Ed25519.js +53 -0
  7. package/_cjs/core/Ed25519.js.map +1 -0
  8. package/_cjs/core/P256.js +23 -0
  9. package/_cjs/core/P256.js.map +1 -1
  10. package/_cjs/core/Secp256k1.js +20 -0
  11. package/_cjs/core/Secp256k1.js.map +1 -1
  12. package/_cjs/core/WebCryptoP256.js +31 -0
  13. package/_cjs/core/WebCryptoP256.js.map +1 -1
  14. package/_cjs/core/X25519.js +45 -0
  15. package/_cjs/core/X25519.js.map +1 -0
  16. package/_cjs/index.js +4 -2
  17. package/_cjs/index.js.map +1 -1
  18. package/_cjs/version.js +1 -1
  19. package/_esm/core/Bls.js +109 -0
  20. package/_esm/core/Bls.js.map +1 -1
  21. package/_esm/core/Ed25519.js +121 -0
  22. package/_esm/core/Ed25519.js.map +1 -0
  23. package/_esm/core/P256.js +54 -2
  24. package/_esm/core/P256.js.map +1 -1
  25. package/_esm/core/Secp256k1.js +50 -0
  26. package/_esm/core/Secp256k1.js.map +1 -1
  27. package/_esm/core/WebCryptoP256.js +72 -0
  28. package/_esm/core/WebCryptoP256.js.map +1 -1
  29. package/_esm/core/X25519.js +97 -0
  30. package/_esm/core/X25519.js.map +1 -0
  31. package/_esm/index.js +65 -0
  32. package/_esm/index.js.map +1 -1
  33. package/_esm/version.js +1 -1
  34. package/_types/core/Bls.d.ts +124 -0
  35. package/_types/core/Bls.d.ts.map +1 -1
  36. package/_types/core/Ed25519.d.ts +156 -0
  37. package/_types/core/Ed25519.d.ts.map +1 -0
  38. package/_types/core/P256.d.ts +68 -2
  39. package/_types/core/P256.d.ts.map +1 -1
  40. package/_types/core/Secp256k1.d.ts +67 -0
  41. package/_types/core/Secp256k1.d.ts.map +1 -1
  42. package/_types/core/WebCryptoP256.d.ts +76 -1
  43. package/_types/core/WebCryptoP256.d.ts.map +1 -1
  44. package/_types/core/X25519.d.ts +127 -0
  45. package/_types/core/X25519.d.ts.map +1 -0
  46. package/_types/index.d.ts +65 -0
  47. package/_types/index.d.ts.map +1 -1
  48. package/_types/version.d.ts +1 -1
  49. package/core/Bls.ts +150 -0
  50. package/core/Ed25519.ts +237 -0
  51. package/core/P256.ts +114 -2
  52. package/core/Secp256k1.ts +110 -0
  53. package/core/WebCryptoP256.ts +141 -1
  54. package/core/X25519.ts +202 -0
  55. package/index.ts +67 -0
  56. package/package.json +11 -1
  57. package/version.ts +1 -1
@@ -0,0 +1,127 @@
1
+ import * as Bytes from './Bytes.js';
2
+ import type * as Errors from './Errors.js';
3
+ import * as Hex from './Hex.js';
4
+ /** Re-export of noble/curves X25519 utilities. */
5
+ export declare const noble: import("@noble/curves/abstract/montgomery").CurveFn;
6
+ /**
7
+ * Creates a new X25519 key pair consisting of a private key and its corresponding public key.
8
+ *
9
+ * @example
10
+ * ```ts twoslash
11
+ * import { X25519 } from 'ox'
12
+ *
13
+ * const { privateKey, publicKey } = X25519.createKeyPair()
14
+ * ```
15
+ *
16
+ * @param options - The options to generate the key pair.
17
+ * @returns The generated key pair containing both private and public keys.
18
+ */
19
+ export declare function createKeyPair<as extends 'Hex' | 'Bytes' = 'Hex'>(options?: createKeyPair.Options<as>): createKeyPair.ReturnType<as>;
20
+ export declare namespace createKeyPair {
21
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
22
+ /**
23
+ * Format of the returned private and public keys.
24
+ * @default 'Hex'
25
+ */
26
+ as?: as | 'Hex' | 'Bytes' | undefined;
27
+ };
28
+ type ReturnType<as extends 'Hex' | 'Bytes'> = {
29
+ privateKey: (as extends 'Bytes' ? Bytes.Bytes : never) | (as extends 'Hex' ? Hex.Hex : never);
30
+ publicKey: (as extends 'Bytes' ? Bytes.Bytes : never) | (as extends 'Hex' ? Hex.Hex : never);
31
+ };
32
+ type ErrorType = Hex.fromBytes.ErrorType | randomPrivateKey.ErrorType | getPublicKey.ErrorType | Errors.GlobalErrorType;
33
+ }
34
+ /**
35
+ * Computes the X25519 public key from a provided private key.
36
+ *
37
+ * @example
38
+ * ```ts twoslash
39
+ * import { X25519 } from 'ox'
40
+ *
41
+ * const publicKey = X25519.getPublicKey({ privateKey: '0x...' })
42
+ * ```
43
+ *
44
+ * @param options - The options to compute the public key.
45
+ * @returns The computed public key.
46
+ */
47
+ export declare function getPublicKey<as extends 'Hex' | 'Bytes' = 'Hex'>(options: getPublicKey.Options<as>): getPublicKey.ReturnType<as>;
48
+ export declare namespace getPublicKey {
49
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
50
+ /**
51
+ * Format of the returned public key.
52
+ * @default 'Hex'
53
+ */
54
+ as?: as | 'Hex' | 'Bytes' | undefined;
55
+ /**
56
+ * Private key to compute the public key from.
57
+ */
58
+ privateKey: Hex.Hex | Bytes.Bytes;
59
+ };
60
+ type ReturnType<as extends 'Hex' | 'Bytes'> = (as extends 'Bytes' ? Bytes.Bytes : never) | (as extends 'Hex' ? Hex.Hex : never);
61
+ type ErrorType = Bytes.from.ErrorType | Hex.fromBytes.ErrorType | Errors.GlobalErrorType;
62
+ }
63
+ /**
64
+ * Computes a shared secret using X25519 elliptic curve Diffie-Hellman between a private key and a public key.
65
+ *
66
+ * @example
67
+ * ```ts twoslash
68
+ * import { X25519 } from 'ox'
69
+ *
70
+ * const { privateKey: privateKeyA } = X25519.createKeyPair()
71
+ * const { publicKey: publicKeyB } = X25519.createKeyPair()
72
+ *
73
+ * const sharedSecret = X25519.getSharedSecret({
74
+ * privateKey: privateKeyA,
75
+ * publicKey: publicKeyB
76
+ * })
77
+ * ```
78
+ *
79
+ * @param options - The options to compute the shared secret.
80
+ * @returns The computed shared secret.
81
+ */
82
+ export declare function getSharedSecret<as extends 'Hex' | 'Bytes' = 'Hex'>(options: getSharedSecret.Options<as>): getSharedSecret.ReturnType<as>;
83
+ export declare namespace getSharedSecret {
84
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
85
+ /**
86
+ * Format of the returned shared secret.
87
+ * @default 'Hex'
88
+ */
89
+ as?: as | 'Hex' | 'Bytes' | undefined;
90
+ /**
91
+ * Private key to use for the shared secret computation.
92
+ */
93
+ privateKey: Hex.Hex | Bytes.Bytes;
94
+ /**
95
+ * Public key to use for the shared secret computation.
96
+ */
97
+ publicKey: Hex.Hex | Bytes.Bytes;
98
+ };
99
+ type ReturnType<as extends 'Hex' | 'Bytes'> = (as extends 'Bytes' ? Bytes.Bytes : never) | (as extends 'Hex' ? Hex.Hex : never);
100
+ type ErrorType = Bytes.from.ErrorType | Hex.fromBytes.ErrorType | Errors.GlobalErrorType;
101
+ }
102
+ /**
103
+ * Generates a random X25519 private key.
104
+ *
105
+ * @example
106
+ * ```ts twoslash
107
+ * import { X25519 } from 'ox'
108
+ *
109
+ * const privateKey = X25519.randomPrivateKey()
110
+ * ```
111
+ *
112
+ * @param options - The options to generate the private key.
113
+ * @returns The generated private key.
114
+ */
115
+ export declare function randomPrivateKey<as extends 'Hex' | 'Bytes' = 'Hex'>(options?: randomPrivateKey.Options<as>): randomPrivateKey.ReturnType<as>;
116
+ export declare namespace randomPrivateKey {
117
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
118
+ /**
119
+ * Format of the returned private key.
120
+ * @default 'Hex'
121
+ */
122
+ as?: as | 'Hex' | 'Bytes' | undefined;
123
+ };
124
+ type ReturnType<as extends 'Hex' | 'Bytes'> = (as extends 'Bytes' ? Bytes.Bytes : never) | (as extends 'Hex' ? Hex.Hex : never);
125
+ type ErrorType = Hex.fromBytes.ErrorType | Errors.GlobalErrorType;
126
+ }
127
+ //# sourceMappingURL=X25519.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"X25519.d.ts","sourceRoot":"","sources":["../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EG;QACH,SAAS,EAAE,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAA;KACjC,CAAA;IAED,KAAK,UAAU,CAAC,EAAE,SAAS,KAAK,GAAG,OAAO,IACtC,CAAC,EAAE,SAAS,OAAO,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAC1C,CAAC,EAAE,SAAS,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IAExC,KAAK,SAAS,GACV,KAAK,CAAC,IAAI,CAAC,SAAS,GACpB,GAAG,CAAC,SAAS,CAAC,SAAS,GACvB,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,KAAK,GAAG,OAAO,GAAG,KAAK,EACjE,OAAO,GAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAM,GACzC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC,CAKjC;AAED,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACxC,KAAK,OAAO,CAAC,EAAE,SAAS,KAAK,GAAG,OAAO,GAAG,KAAK,IAAI;QACjD;;;WAGG;QACH,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAA;KACtC,CAAA;IAED,KAAK,UAAU,CAAC,EAAE,SAAS,KAAK,GAAG,OAAO,IACtC,CAAC,EAAE,SAAS,OAAO,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAC1C,CAAC,EAAE,SAAS,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IAExC,KAAK,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CAClE"}
package/_types/index.d.ts CHANGED
@@ -1310,6 +1310,37 @@ export * as Caches from './core/Caches.js';
1310
1310
  * @category Addresses
1311
1311
  */
1312
1312
  export * as ContractAddress from './core/ContractAddress.js';
1313
+ /**
1314
+ * Utilities for working with Ed25519 signatures and key pairs.
1315
+ *
1316
+ * Ed25519 is a modern elliptic curve signature scheme that provides strong security
1317
+ * guarantees and high performance. It is widely used in various cryptographic applications.
1318
+ *
1319
+ * @example
1320
+ * ### Creating Key Pairs
1321
+ *
1322
+ * ```ts twoslash
1323
+ * import { Ed25519 } from 'ox'
1324
+ *
1325
+ * const { privateKey, publicKey } = Ed25519.createKeyPair()
1326
+ * ```
1327
+ *
1328
+ * @example
1329
+ * ### Signing & Verifying
1330
+ *
1331
+ * ```ts twoslash
1332
+ * import { Ed25519 } from 'ox'
1333
+ *
1334
+ * const { privateKey, publicKey } = Ed25519.createKeyPair()
1335
+ * const payload = '0xdeadbeef'
1336
+ *
1337
+ * const signature = Ed25519.sign({ payload, privateKey })
1338
+ * const isValid = Ed25519.verify({ payload, publicKey, signature })
1339
+ * ```
1340
+ *
1341
+ * @category Crypto
1342
+ */
1343
+ export * as Ed25519 from './core/Ed25519.js';
1313
1344
  /**
1314
1345
  * Utility functions for working with ENS names.
1315
1346
  *
@@ -3448,4 +3479,38 @@ export * as WebCryptoP256 from './core/WebCryptoP256.js';
3448
3479
  * @category Execution Spec
3449
3480
  */
3450
3481
  export * as Withdrawal from './core/Withdrawal.js';
3482
+ /**
3483
+ * Utilities for working with X25519 elliptic curve Diffie-Hellman key agreement.
3484
+ *
3485
+ * X25519 is a high-performance elliptic curve that can be used to perform
3486
+ * Diffie-Hellman key agreement to derive shared secrets between parties.
3487
+ * It is designed for use with the elliptic curve Diffie-Hellman (ECDH) key agreement scheme.
3488
+ *
3489
+ * @example
3490
+ * ### Creating Key Pairs
3491
+ *
3492
+ * ```ts twoslash
3493
+ * import { X25519 } from 'ox'
3494
+ *
3495
+ * const { privateKey, publicKey } = X25519.createKeyPair()
3496
+ * ```
3497
+ *
3498
+ * @example
3499
+ * ### Deriving Shared Secrets
3500
+ *
3501
+ * ```ts twoslash
3502
+ * import { X25519 } from 'ox'
3503
+ *
3504
+ * const { privateKey: privateKeyA } = X25519.createKeyPair()
3505
+ * const { publicKey: publicKeyB } = X25519.createKeyPair()
3506
+ *
3507
+ * const sharedSecret = X25519.getSharedSecret({
3508
+ * privateKey: privateKeyA,
3509
+ * publicKey: publicKeyB
3510
+ * })
3511
+ * ```
3512
+ *
3513
+ * @category Crypto
3514
+ */
3515
+ export * as X25519 from './core/X25519.js';
3451
3516
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,YAAY,EAAE,CAAA;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkHG;AACH,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AACH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,OAAO,KAAK,WAAW,MAAM,uBAAuB,C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+1,3 @@
1
1
  /** @internal */
2
- export declare const version = "0.8.1";
2
+ export declare const version = "0.8.2";
3
3
  //# sourceMappingURL=version.d.ts.map
package/core/Bls.ts CHANGED
@@ -70,6 +70,156 @@ export declare namespace aggregate {
70
70
  type ErrorType = Errors.GlobalErrorType
71
71
  }
72
72
 
73
+ /**
74
+ * Creates a new BLS12-381 key pair consisting of a private key and its corresponding public key.
75
+ *
76
+ * - G1 Point (Default):
77
+ * - short (48 bytes)
78
+ * - computes longer G2 Signatures (96 bytes)
79
+ * - G2 Point:
80
+ * - long (96 bytes)
81
+ * - computes short G1 Signatures (48 bytes)
82
+ *
83
+ * @example
84
+ * ### Short G1 Public Keys (Default)
85
+ *
86
+ * ```ts twoslash
87
+ * import { Bls } from 'ox'
88
+ *
89
+ * const { publicKey } = Bls.createKeyPair()
90
+ * // ^?
91
+ *
92
+ *
93
+ *
94
+ *
95
+ *
96
+ *
97
+ *
98
+ * ```
99
+ *
100
+ * @example
101
+ * ### Long G2 Public Keys
102
+ *
103
+ * A G2 Public Key can be derived as a G2 point (96 bytes) using `size: 'long-key:short-sig'`.
104
+ *
105
+ * This will allow you to compute G1 Signatures (48 bytes) with {@link ox#Bls.(sign:function)}.
106
+ *
107
+ * ```ts twoslash
108
+ * import { Bls } from 'ox'
109
+ *
110
+ * const { publicKey } = Bls.createKeyPair({
111
+ * size: 'long-key:short-sig',
112
+ * })
113
+ *
114
+ * publicKey
115
+ * // ^?
116
+ *
117
+ *
118
+ *
119
+ *
120
+ *
121
+ *
122
+ *
123
+ *
124
+ *
125
+ *
126
+ *
127
+ *
128
+ *
129
+ *
130
+ *
131
+ *
132
+ * ```
133
+ *
134
+ * ### Serializing
135
+ *
136
+ * Public Keys can be serialized to hex or bytes using {@link ox#BlsPoint.(toHex:function)} or {@link ox#BlsPoint.(toBytes:function)}:
137
+ *
138
+ * ```ts twoslash
139
+ * import { Bls, BlsPoint } from 'ox'
140
+ *
141
+ * const { publicKey } = Bls.createKeyPair()
142
+ *
143
+ * const publicKeyHex = BlsPoint.toHex(publicKey)
144
+ * // ^?
145
+ *
146
+ *
147
+ * const publicKeyBytes = BlsPoint.toBytes(publicKey)
148
+ * // ^?
149
+ *
150
+ * ```
151
+ *
152
+ * They can also be deserialized from hex or bytes using {@link ox#BlsPoint.(fromHex:function)} or {@link ox#BlsPoint.(fromBytes:function)}:
153
+ *
154
+ * ```ts twoslash
155
+ * import { Bls, BlsPoint } from 'ox'
156
+ *
157
+ * const publicKeyHex = '0x...'
158
+ *
159
+ * const publicKey = BlsPoint.fromHex(publicKeyHex, 'G1')
160
+ * // ^?
161
+ *
162
+ *
163
+ *
164
+ *
165
+ *
166
+ *
167
+ *
168
+ * ```
169
+ *
170
+ * @param options - The options to generate the key pair.
171
+ * @returns The generated key pair containing both private and public keys.
172
+ */
173
+ export function createKeyPair<
174
+ as extends 'Hex' | 'Bytes' = 'Hex',
175
+ size extends Size = 'short-key:long-sig',
176
+ >(
177
+ options: createKeyPair.Options<as, size> = {},
178
+ ): createKeyPair.ReturnType<as, size> {
179
+ const { as = 'Hex', size = 'short-key:long-sig' } = options
180
+ const privateKey = randomPrivateKey({ as })
181
+ const publicKey = getPublicKey({ privateKey, size })
182
+
183
+ return {
184
+ privateKey: privateKey as never,
185
+ publicKey: publicKey as never,
186
+ }
187
+ }
188
+
189
+ export declare namespace createKeyPair {
190
+ type Options<
191
+ as extends 'Hex' | 'Bytes' = 'Hex',
192
+ size extends Size = 'short-key:long-sig',
193
+ > = {
194
+ /**
195
+ * Format of the returned private key.
196
+ * @default 'Hex'
197
+ */
198
+ as?: as | 'Hex' | 'Bytes' | undefined
199
+ /**
200
+ * Size of the public key to compute.
201
+ *
202
+ * - `'short-key:long-sig'`: 48 bytes; computes long signatures (96 bytes)
203
+ * - `'long-key:short-sig'`: 96 bytes; computes short signatures (48 bytes)
204
+ *
205
+ * @default 'short-key:long-sig'
206
+ */
207
+ size?: size | Size | undefined
208
+ }
209
+
210
+ type ReturnType<as extends 'Hex' | 'Bytes', size extends Size> = {
211
+ privateKey:
212
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
213
+ | (as extends 'Hex' ? Hex.Hex : never)
214
+ publicKey: size extends 'short-key:long-sig' ? BlsPoint.G1 : BlsPoint.G2
215
+ }
216
+
217
+ type ErrorType =
218
+ | Hex.fromBytes.ErrorType
219
+ | getPublicKey.ErrorType
220
+ | Errors.GlobalErrorType
221
+ }
222
+
73
223
  /**
74
224
  * Computes the BLS12-381 public key from a provided private key.
75
225
  *
@@ -0,0 +1,237 @@
1
+ import { ed25519 } from '@noble/curves/ed25519'
2
+ import * as Bytes from './Bytes.js'
3
+ import type * as Errors from './Errors.js'
4
+ import * as Hex from './Hex.js'
5
+
6
+ /** Re-export of noble/curves Ed25519 utilities. */
7
+ export const noble = ed25519
8
+
9
+ /**
10
+ * Creates a new Ed25519 key pair consisting of a private key and its corresponding public key.
11
+ *
12
+ * @example
13
+ * ```ts twoslash
14
+ * import { Ed25519 } from 'ox'
15
+ *
16
+ * const { privateKey, publicKey } = Ed25519.createKeyPair()
17
+ * ```
18
+ *
19
+ * @param options - The options to generate the key pair.
20
+ * @returns The generated key pair containing both private and public keys.
21
+ */
22
+ export function createKeyPair<as extends 'Hex' | 'Bytes' = 'Hex'>(
23
+ options: createKeyPair.Options<as> = {},
24
+ ): createKeyPair.ReturnType<as> {
25
+ const { as = 'Hex' } = options
26
+ const privateKey = randomPrivateKey({ as })
27
+ const publicKey = getPublicKey({ privateKey, as })
28
+
29
+ return {
30
+ privateKey: privateKey as never,
31
+ publicKey: publicKey as never,
32
+ }
33
+ }
34
+
35
+ export declare namespace createKeyPair {
36
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
37
+ /**
38
+ * Format of the returned private and public keys.
39
+ * @default 'Hex'
40
+ */
41
+ as?: as | 'Hex' | 'Bytes' | undefined
42
+ }
43
+
44
+ type ReturnType<as extends 'Hex' | 'Bytes'> = {
45
+ privateKey:
46
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
47
+ | (as extends 'Hex' ? Hex.Hex : never)
48
+ publicKey:
49
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
50
+ | (as extends 'Hex' ? Hex.Hex : never)
51
+ }
52
+
53
+ type ErrorType =
54
+ | Hex.fromBytes.ErrorType
55
+ | randomPrivateKey.ErrorType
56
+ | getPublicKey.ErrorType
57
+ | Errors.GlobalErrorType
58
+ }
59
+
60
+ /**
61
+ * Computes the Ed25519 public key from a provided private key.
62
+ *
63
+ * @example
64
+ * ```ts twoslash
65
+ * import { Ed25519 } from 'ox'
66
+ *
67
+ * const publicKey = Ed25519.getPublicKey({ privateKey: '0x...' })
68
+ * ```
69
+ *
70
+ * @param options - The options to compute the public key.
71
+ * @returns The computed public key.
72
+ */
73
+ export function getPublicKey<as extends 'Hex' | 'Bytes' = 'Hex'>(
74
+ options: getPublicKey.Options<as>,
75
+ ): getPublicKey.ReturnType<as> {
76
+ const { as = 'Hex', privateKey } = options
77
+ const privateKeyBytes = Bytes.from(privateKey)
78
+ const publicKeyBytes = ed25519.getPublicKey(privateKeyBytes)
79
+ if (as === 'Hex') return Hex.fromBytes(publicKeyBytes) as never
80
+ return publicKeyBytes as never
81
+ }
82
+
83
+ export declare namespace getPublicKey {
84
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
85
+ /**
86
+ * Format of the returned public key.
87
+ * @default 'Hex'
88
+ */
89
+ as?: as | 'Hex' | 'Bytes' | undefined
90
+ /**
91
+ * Private key to compute the public key from.
92
+ */
93
+ privateKey: Hex.Hex | Bytes.Bytes
94
+ }
95
+
96
+ type ReturnType<as extends 'Hex' | 'Bytes'> =
97
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
98
+ | (as extends 'Hex' ? Hex.Hex : never)
99
+
100
+ type ErrorType =
101
+ | Bytes.from.ErrorType
102
+ | Hex.fromBytes.ErrorType
103
+ | Errors.GlobalErrorType
104
+ }
105
+
106
+ /**
107
+ * Generates a random Ed25519 private key.
108
+ *
109
+ * @example
110
+ * ```ts twoslash
111
+ * import { Ed25519 } from 'ox'
112
+ *
113
+ * const privateKey = Ed25519.randomPrivateKey()
114
+ * ```
115
+ *
116
+ * @param options - The options to generate the private key.
117
+ * @returns The generated private key.
118
+ */
119
+ export function randomPrivateKey<as extends 'Hex' | 'Bytes' = 'Hex'>(
120
+ options: randomPrivateKey.Options<as> = {},
121
+ ): randomPrivateKey.ReturnType<as> {
122
+ const { as = 'Hex' } = options
123
+ const bytes = ed25519.utils.randomPrivateKey()
124
+ if (as === 'Hex') return Hex.fromBytes(bytes) as never
125
+ return bytes as never
126
+ }
127
+
128
+ export declare namespace randomPrivateKey {
129
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
130
+ /**
131
+ * Format of the returned private key.
132
+ * @default 'Hex'
133
+ */
134
+ as?: as | 'Hex' | 'Bytes' | undefined
135
+ }
136
+
137
+ type ReturnType<as extends 'Hex' | 'Bytes'> =
138
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
139
+ | (as extends 'Hex' ? Hex.Hex : never)
140
+
141
+ type ErrorType = Hex.fromBytes.ErrorType | Errors.GlobalErrorType
142
+ }
143
+
144
+ /**
145
+ * Signs the payload with the provided private key and returns an Ed25519 signature.
146
+ *
147
+ * @example
148
+ * ```ts twoslash
149
+ * import { Ed25519 } from 'ox'
150
+ *
151
+ * const signature = Ed25519.sign({ // [!code focus]
152
+ * payload: '0xdeadbeef', // [!code focus]
153
+ * privateKey: '0x...' // [!code focus]
154
+ * }) // [!code focus]
155
+ * ```
156
+ *
157
+ * @param options - The signing options.
158
+ * @returns The Ed25519 signature.
159
+ */
160
+ export function sign<as extends 'Hex' | 'Bytes' = 'Hex'>(
161
+ options: sign.Options<as>,
162
+ ): sign.ReturnType<as> {
163
+ const { as = 'Hex', payload, privateKey } = options
164
+ const payloadBytes = Bytes.from(payload)
165
+ const privateKeyBytes = Bytes.from(privateKey)
166
+ const signatureBytes = ed25519.sign(payloadBytes, privateKeyBytes)
167
+ if (as === 'Hex') return Hex.fromBytes(signatureBytes) as never
168
+ return signatureBytes as never
169
+ }
170
+
171
+ export declare namespace sign {
172
+ type Options<as extends 'Hex' | 'Bytes' = 'Hex'> = {
173
+ /**
174
+ * Format of the returned signature.
175
+ * @default 'Hex'
176
+ */
177
+ as?: as | 'Hex' | 'Bytes' | undefined
178
+ /**
179
+ * Payload to sign.
180
+ */
181
+ payload: Hex.Hex | Bytes.Bytes
182
+ /**
183
+ * Ed25519 private key.
184
+ */
185
+ privateKey: Hex.Hex | Bytes.Bytes
186
+ }
187
+
188
+ type ReturnType<as extends 'Hex' | 'Bytes'> =
189
+ | (as extends 'Bytes' ? Bytes.Bytes : never)
190
+ | (as extends 'Hex' ? Hex.Hex : never)
191
+
192
+ type ErrorType =
193
+ | Bytes.from.ErrorType
194
+ | Hex.fromBytes.ErrorType
195
+ | Errors.GlobalErrorType
196
+ }
197
+
198
+ /**
199
+ * Verifies a payload was signed by the provided public key.
200
+ *
201
+ * @example
202
+ * ```ts twoslash
203
+ * import { Ed25519 } from 'ox'
204
+ *
205
+ * const { privateKey, publicKey } = Ed25519.createKeyPair()
206
+ * const signature = Ed25519.sign({ payload: '0xdeadbeef', privateKey })
207
+ *
208
+ * const verified = Ed25519.verify({ // [!code focus]
209
+ * publicKey, // [!code focus]
210
+ * payload: '0xdeadbeef', // [!code focus]
211
+ * signature, // [!code focus]
212
+ * }) // [!code focus]
213
+ * ```
214
+ *
215
+ * @param options - The verification options.
216
+ * @returns Whether the payload was signed by the provided public key.
217
+ */
218
+ export function verify(options: verify.Options): boolean {
219
+ const { payload, publicKey, signature } = options
220
+ const payloadBytes = Bytes.from(payload)
221
+ const publicKeyBytes = Bytes.from(publicKey)
222
+ const signatureBytes = Bytes.from(signature)
223
+ return ed25519.verify(signatureBytes, payloadBytes, publicKeyBytes)
224
+ }
225
+
226
+ export declare namespace verify {
227
+ type Options = {
228
+ /** Payload that was signed. */
229
+ payload: Hex.Hex | Bytes.Bytes
230
+ /** Public key that signed the payload. */
231
+ publicKey: Hex.Hex | Bytes.Bytes
232
+ /** Signature of the payload. */
233
+ signature: Hex.Hex | Bytes.Bytes
234
+ }
235
+
236
+ type ErrorType = Bytes.from.ErrorType | Errors.GlobalErrorType
237
+ }