@mnemom/mnemom 0.17.37 → 0.17.38-next.0
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/dist/commands/agent-run.d.ts +11 -0
- package/dist/commands/agent-run.js +37 -0
- package/dist/commands/agent-share-render.d.ts +5 -5
- package/dist/commands/agent-share-render.js +9 -7
- package/dist/commands/agent-share-test-issuer.d.ts +1 -1
- package/dist/commands/agent-share-test-issuer.js +1 -1
- package/dist/commands/agent.d.ts +8 -1
- package/dist/commands/agent.js +14 -3
- package/dist/commands/scan.d.ts +15 -2
- package/dist/commands/scan.js +48 -3
- package/dist/index.js +1 -1
- package/dist/lib/commit-report.d.ts +7 -13
- package/dist/lib/commit-report.js +12 -5
- package/dist/lib/conduct-receipt.d.ts +8 -3
- package/dist/lib/conduct-receipt.js +29 -7
- package/dist/lib/experimental.d.ts +1 -1
- package/dist/lib/experimental.js +1 -12
- package/dist/lib/runner/executor-client.d.ts +5 -0
- package/dist/lib/runner/executor-client.js +8 -0
- package/dist/lib/runner/job.d.ts +37 -0
- package/dist/lib/runner/job.js +74 -1
- package/dist/lib/runner/phases.d.ts +7 -2
- package/dist/lib/runner/phases.js +7 -2
- package/dist/lib/runner/proxy.d.ts +26 -2
- package/dist/lib/runner/proxy.js +33 -1
- package/dist/lib/runner/record-commit.d.ts +16 -0
- package/dist/lib/runner/record-commit.js +7 -0
- package/dist/lib/scan/spend/anthropic-usage.d.ts +20 -1
- package/dist/lib/scan/spend/anthropic-usage.js +32 -7
- package/dist/lib/scan/spend/anthropic-wif.d.ts +42 -0
- package/dist/lib/scan/spend/anthropic-wif.js +153 -0
- package/package.json +2 -5
- package/node_modules/@mnemom/aip-verifier/LICENSE +0 -190
- package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.cts +0 -478
- package/node_modules/@mnemom/aip-verifier/dist/claim-lint-CVITIRcU.d.ts +0 -478
- package/node_modules/@mnemom/aip-verifier/dist/index.cjs +0 -971
- package/node_modules/@mnemom/aip-verifier/dist/index.cjs.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/index.d.cts +0 -330
- package/node_modules/@mnemom/aip-verifier/dist/index.d.ts +0 -330
- package/node_modules/@mnemom/aip-verifier/dist/index.js +0 -933
- package/node_modules/@mnemom/aip-verifier/dist/index.js.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs +0 -879
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.cjs.map +0 -1
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.cts +0 -96
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.d.ts +0 -96
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.js +0 -875
- package/node_modules/@mnemom/aip-verifier/dist/render-lines.js.map +0 -1
- package/node_modules/@mnemom/aip-verifier/package.json +0 -86
- package/node_modules/@noble/ed25519/LICENSE +0 -21
- package/node_modules/@noble/ed25519/README.md +0 -371
- package/node_modules/@noble/ed25519/index.d.ts +0 -391
- package/node_modules/@noble/ed25519/index.js +0 -933
- package/node_modules/@noble/ed25519/index.ts +0 -1134
- package/node_modules/@noble/ed25519/package.json +0 -54
- package/node_modules/@noble/hashes/LICENSE +0 -21
- package/node_modules/@noble/hashes/README.md +0 -478
- package/node_modules/@noble/hashes/_blake.d.ts +0 -20
- package/node_modules/@noble/hashes/_blake.js +0 -59
- package/node_modules/@noble/hashes/_md.d.ts +0 -95
- package/node_modules/@noble/hashes/_md.js +0 -209
- package/node_modules/@noble/hashes/_u64.d.ts +0 -36
- package/node_modules/@noble/hashes/_u64.js +0 -77
- package/node_modules/@noble/hashes/argon2.d.ts +0 -148
- package/node_modules/@noble/hashes/argon2.js +0 -577
- package/node_modules/@noble/hashes/blake1.d.ts +0 -162
- package/node_modules/@noble/hashes/blake1.js +0 -630
- package/node_modules/@noble/hashes/blake2.d.ts +0 -203
- package/node_modules/@noble/hashes/blake2.js +0 -573
- package/node_modules/@noble/hashes/blake3.d.ts +0 -68
- package/node_modules/@noble/hashes/blake3.js +0 -310
- package/node_modules/@noble/hashes/eskdf.d.ts +0 -91
- package/node_modules/@noble/hashes/eskdf.js +0 -225
- package/node_modules/@noble/hashes/hkdf.d.ts +0 -70
- package/node_modules/@noble/hashes/hkdf.js +0 -152
- package/node_modules/@noble/hashes/hmac.d.ts +0 -50
- package/node_modules/@noble/hashes/hmac.js +0 -93
- package/node_modules/@noble/hashes/index.d.ts +0 -1
- package/node_modules/@noble/hashes/index.js +0 -34
- package/node_modules/@noble/hashes/legacy.d.ts +0 -107
- package/node_modules/@noble/hashes/legacy.js +0 -348
- package/node_modules/@noble/hashes/package.json +0 -91
- package/node_modules/@noble/hashes/pbkdf2.d.ts +0 -66
- package/node_modules/@noble/hashes/pbkdf2.js +0 -176
- package/node_modules/@noble/hashes/scrypt.d.ts +0 -98
- package/node_modules/@noble/hashes/scrypt.js +0 -304
- package/node_modules/@noble/hashes/sha2.d.ts +0 -176
- package/node_modules/@noble/hashes/sha2.js +0 -446
- package/node_modules/@noble/hashes/sha3-addons.d.ts +0 -533
- package/node_modules/@noble/hashes/sha3-addons.js +0 -973
- package/node_modules/@noble/hashes/sha3.d.ts +0 -208
- package/node_modules/@noble/hashes/sha3.js +0 -475
- package/node_modules/@noble/hashes/src/_blake.ts +0 -67
- package/node_modules/@noble/hashes/src/_md.ts +0 -227
- package/node_modules/@noble/hashes/src/_u64.ts +0 -111
- package/node_modules/@noble/hashes/src/argon2.ts +0 -693
- package/node_modules/@noble/hashes/src/blake1.ts +0 -677
- package/node_modules/@noble/hashes/src/blake2.ts +0 -648
- package/node_modules/@noble/hashes/src/blake3.ts +0 -344
- package/node_modules/@noble/hashes/src/eskdf.ts +0 -265
- package/node_modules/@noble/hashes/src/hkdf.ts +0 -161
- package/node_modules/@noble/hashes/src/hmac.ts +0 -130
- package/node_modules/@noble/hashes/src/index.ts +0 -33
- package/node_modules/@noble/hashes/src/legacy.ts +0 -361
- package/node_modules/@noble/hashes/src/pbkdf2.ts +0 -219
- package/node_modules/@noble/hashes/src/scrypt.ts +0 -375
- package/node_modules/@noble/hashes/src/sha2.ts +0 -486
- package/node_modules/@noble/hashes/src/sha3-addons.ts +0 -1157
- package/node_modules/@noble/hashes/src/sha3.ts +0 -525
- package/node_modules/@noble/hashes/src/utils.ts +0 -978
- package/node_modules/@noble/hashes/src/webcrypto.ts +0 -283
- package/node_modules/@noble/hashes/utils.d.ts +0 -560
- package/node_modules/@noble/hashes/utils.js +0 -687
- package/node_modules/@noble/hashes/webcrypto.d.ts +0 -121
- package/node_modules/@noble/hashes/webcrypto.js +0 -228
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
/** Alias to Uint8Array. */
|
|
2
|
-
export type Bytes = Uint8Array;
|
|
3
|
-
/** Edwards elliptic curve options. */
|
|
4
|
-
export type EdwardsOpts = Readonly<{
|
|
5
|
-
/** Prime field modulus. */
|
|
6
|
-
p: bigint;
|
|
7
|
-
/** Group order. */
|
|
8
|
-
n: bigint;
|
|
9
|
-
/** Curve cofactor. */
|
|
10
|
-
h: bigint;
|
|
11
|
-
/** Edwards curve parameter `a`. */
|
|
12
|
-
a: bigint;
|
|
13
|
-
/** Edwards curve parameter `d`. */
|
|
14
|
-
d: bigint;
|
|
15
|
-
/** Generator x coordinate. */
|
|
16
|
-
Gx: bigint;
|
|
17
|
-
/** Generator y coordinate. */
|
|
18
|
-
Gy: bigint;
|
|
19
|
-
}>;
|
|
20
|
-
/** Modular inversion using extended euclidean GCD. Variable-time (non-CT). */
|
|
21
|
-
declare const invert: (number: bigint, modulo: bigint) => bigint;
|
|
22
|
-
/**
|
|
23
|
-
* SHA-512 helper used by the synchronous API.
|
|
24
|
-
* @param msg - Message bytes to hash.
|
|
25
|
-
* @returns 64-byte SHA-512 digest.
|
|
26
|
-
* @example
|
|
27
|
-
* Hash message bytes after wiring the synchronous SHA-512 implementation.
|
|
28
|
-
*
|
|
29
|
-
* ```ts
|
|
30
|
-
* import * as ed from '@noble/ed25519';
|
|
31
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
32
|
-
*
|
|
33
|
-
* ed.hashes.sha512 = sha512;
|
|
34
|
-
* const digest = ed.hash(new Uint8Array([1, 2, 3]));
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
declare const hash: (msg: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
38
|
-
/** Point in 2d xy affine coordinates. */
|
|
39
|
-
export type AffinePoint = {
|
|
40
|
-
/** Affine x coordinate. */
|
|
41
|
-
x: bigint;
|
|
42
|
-
/** Affine y coordinate. */
|
|
43
|
-
y: bigint;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Point in XYZT extended coordinates.
|
|
47
|
-
* @param X - X coordinate.
|
|
48
|
-
* @param Y - Y coordinate.
|
|
49
|
-
* @param Z - Projective Z coordinate.
|
|
50
|
-
* @param T - Cached cross-product term.
|
|
51
|
-
* @example
|
|
52
|
-
* Do point arithmetic with the built-in base point and encode the result as hex.
|
|
53
|
-
*
|
|
54
|
-
* ```ts
|
|
55
|
-
* const hex = Point.BASE.double().toHex();
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
declare class Point {
|
|
59
|
-
static BASE: Point;
|
|
60
|
-
static ZERO: Point;
|
|
61
|
-
readonly X: bigint;
|
|
62
|
-
readonly Y: bigint;
|
|
63
|
-
readonly Z: bigint;
|
|
64
|
-
readonly T: bigint;
|
|
65
|
-
constructor(X: bigint, Y: bigint, Z: bigint, T: bigint);
|
|
66
|
-
static CURVE(): EdwardsOpts;
|
|
67
|
-
static fromAffine(p: AffinePoint): Point;
|
|
68
|
-
/** RFC8032 5.1.3: Uint8Array to Point. */
|
|
69
|
-
static fromBytes(bytes: TArg<Uint8Array>, zip215?: boolean): Point;
|
|
70
|
-
static fromHex(hex: string, zip215?: boolean): Point;
|
|
71
|
-
get x(): bigint;
|
|
72
|
-
get y(): bigint;
|
|
73
|
-
/** Checks if the point is valid and on-curve. */
|
|
74
|
-
assertValidity(): this;
|
|
75
|
-
/** Equality check: compare points P&Q. */
|
|
76
|
-
equals(other: Point): boolean;
|
|
77
|
-
is0(): boolean;
|
|
78
|
-
/** Flip point over y coordinate. */
|
|
79
|
-
negate(): Point;
|
|
80
|
-
/** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */
|
|
81
|
-
double(): Point;
|
|
82
|
-
/** Point addition. Complete formula. Cost: `9M + 1*a + 1*d + 7add`. */
|
|
83
|
-
add(other: Point): Point;
|
|
84
|
-
subtract(other: Point): Point;
|
|
85
|
-
/**
|
|
86
|
-
* Point-by-scalar multiplication. Safe mode requires `1 <= n < CURVE.n`.
|
|
87
|
-
* Unsafe mode additionally permits `n = 0` and returns the identity point for that case.
|
|
88
|
-
* Uses {@link wNAF} for base point.
|
|
89
|
-
* Uses fake point to mitigate side-channel leakage.
|
|
90
|
-
* @param n - scalar by which point is multiplied
|
|
91
|
-
* @param safe - safe mode guards against timing attacks; unsafe mode is faster
|
|
92
|
-
*/
|
|
93
|
-
multiply(n: bigint, safe?: boolean): Point;
|
|
94
|
-
multiplyUnsafe(scalar: bigint): Point;
|
|
95
|
-
/** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */
|
|
96
|
-
toAffine(): AffinePoint;
|
|
97
|
-
toBytes(): TRet<Uint8Array>;
|
|
98
|
-
toHex(): string;
|
|
99
|
-
clearCofactor(): Point;
|
|
100
|
-
isSmallOrder(): boolean;
|
|
101
|
-
isTorsionFree(): boolean;
|
|
102
|
-
}
|
|
103
|
-
type ExtK = {
|
|
104
|
-
head: Uint8Array;
|
|
105
|
-
prefix: Uint8Array;
|
|
106
|
-
scalar: bigint;
|
|
107
|
-
point: Point;
|
|
108
|
-
pointBytes: Uint8Array;
|
|
109
|
-
};
|
|
110
|
-
declare const getExtendedPublicKeyAsync: (secretKey: TArg<Uint8Array>) => Promise<TRet<ExtK>>;
|
|
111
|
-
declare const getExtendedPublicKey: (secretKey: TArg<Uint8Array>) => TRet<ExtK>;
|
|
112
|
-
/**
|
|
113
|
-
* Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed. Async.
|
|
114
|
-
* @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key.
|
|
115
|
-
* @returns 32-byte public key.
|
|
116
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
117
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
118
|
-
* @example
|
|
119
|
-
* Derive the public key bytes for a newly generated signer secret.
|
|
120
|
-
*
|
|
121
|
-
* ```ts
|
|
122
|
-
* import * as ed from '@noble/ed25519';
|
|
123
|
-
*
|
|
124
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
125
|
-
* const publicKey = await ed.getPublicKeyAsync(secretKey);
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
declare const getPublicKeyAsync: (secretKey: TArg<Uint8Array>) => Promise<TRet<Uint8Array>>;
|
|
129
|
-
/**
|
|
130
|
-
* Creates a 32-byte Ed25519 public key from the RFC 8032 32-byte secret-key seed.
|
|
131
|
-
* To use, set `hashes.sha512` first.
|
|
132
|
-
* @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key.
|
|
133
|
-
* @returns 32-byte public key.
|
|
134
|
-
* @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error}
|
|
135
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
136
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
137
|
-
* @example
|
|
138
|
-
* Derive the public key entirely through the synchronous API.
|
|
139
|
-
*
|
|
140
|
-
* ```ts
|
|
141
|
-
* import * as ed from '@noble/ed25519';
|
|
142
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
143
|
-
*
|
|
144
|
-
* ed.hashes.sha512 = sha512;
|
|
145
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
146
|
-
* const publicKey = ed.getPublicKey(secretKey);
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
declare const getPublicKey: (secretKey: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
150
|
-
/**
|
|
151
|
-
* Signs message using secret key. Async.
|
|
152
|
-
* Follows RFC8032 5.1.6.
|
|
153
|
-
* @param message - Message bytes to sign.
|
|
154
|
-
* @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key.
|
|
155
|
-
* @returns 64-byte Ed25519 signature.
|
|
156
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
157
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
158
|
-
* @example
|
|
159
|
-
* Sign an arbitrary message with a fresh Ed25519 secret key.
|
|
160
|
-
*
|
|
161
|
-
* ```ts
|
|
162
|
-
* import * as ed from '@noble/ed25519';
|
|
163
|
-
*
|
|
164
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
165
|
-
* const message = new Uint8Array([1, 2, 3]);
|
|
166
|
-
* const signature = await ed.signAsync(message, secretKey);
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
declare const signAsync: (message: TArg<Uint8Array>, secretKey: TArg<Uint8Array>) => Promise<TRet<Uint8Array>>;
|
|
170
|
-
/**
|
|
171
|
-
* Signs message using secret key. To use, set `hashes.sha512` first.
|
|
172
|
-
* Follows RFC8032 5.1.6.
|
|
173
|
-
* @param message - Message bytes to sign.
|
|
174
|
-
* @param secretKey - 32-byte RFC 8032 secret-key seed, not a 64-byte expanded secret key.
|
|
175
|
-
* @returns 64-byte Ed25519 signature.
|
|
176
|
-
* @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error}
|
|
177
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
178
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
179
|
-
* @example
|
|
180
|
-
* Use the sync API when you've wired a SHA-512 implementation yourself.
|
|
181
|
-
*
|
|
182
|
-
* ```ts
|
|
183
|
-
* import * as ed from '@noble/ed25519';
|
|
184
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
185
|
-
*
|
|
186
|
-
* ed.hashes.sha512 = sha512;
|
|
187
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
188
|
-
* const signature = ed.sign(new Uint8Array([1, 2, 3]), secretKey);
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
declare const sign: (message: TArg<Uint8Array>, secretKey: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
192
|
-
/**
|
|
193
|
-
* Verification options. zip215: true (default) follows ZIP215 spec. false would follow RFC8032.
|
|
194
|
-
*
|
|
195
|
-
* Any message with pubkey from `ED25519_TORSION_SUBGROUP` would be valid in sigs under ZIP215.
|
|
196
|
-
*/
|
|
197
|
-
export type EdDSAVerifyOpts = {
|
|
198
|
-
/** Whether to use ZIP215 verification semantics instead of the library's stricter branch. */
|
|
199
|
-
zip215?: boolean;
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Verifies a signature on message and public key. Async.
|
|
203
|
-
* The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass
|
|
204
|
-
* `{ zip215: false }` for the library's stricter branch.
|
|
205
|
-
* @param signature - 64-byte signature.
|
|
206
|
-
* @param message - Signed message bytes.
|
|
207
|
-
* @param publicKey - 32-byte public key.
|
|
208
|
-
* @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}.
|
|
209
|
-
* @returns `true` when the signature is valid.
|
|
210
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
211
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
212
|
-
* @example
|
|
213
|
-
* Verify the signature against the same message and derived public key.
|
|
214
|
-
*
|
|
215
|
-
* ```ts
|
|
216
|
-
* import * as ed from '@noble/ed25519';
|
|
217
|
-
*
|
|
218
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
219
|
-
* const message = new Uint8Array([1, 2, 3]);
|
|
220
|
-
* const publicKey = await ed.getPublicKeyAsync(secretKey);
|
|
221
|
-
* const signature = await ed.signAsync(message, secretKey);
|
|
222
|
-
* const isValid = await ed.verifyAsync(signature, message, publicKey);
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
declare const verifyAsync: (signature: TArg<Uint8Array>, message: TArg<Uint8Array>, publicKey: TArg<Uint8Array>, opts?: TArg<EdDSAVerifyOpts>) => Promise<boolean>;
|
|
226
|
-
/**
|
|
227
|
-
* Verifies a signature on message and public key using the synchronous hash path.
|
|
228
|
-
* The implementation is based on RFC8032 5.1.7, but default opts use ZIP-215 semantics; pass
|
|
229
|
-
* `{ zip215: false }` for the library's stricter branch.
|
|
230
|
-
* @param signature - 64-byte signature.
|
|
231
|
-
* @param message - Signed message bytes.
|
|
232
|
-
* @param publicKey - 32-byte public key.
|
|
233
|
-
* @param opts - Verification options. Defaults to ZIP-215 semantics. See {@link EdDSAVerifyOpts}.
|
|
234
|
-
* @returns `true` when the signature is valid.
|
|
235
|
-
* @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error}
|
|
236
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
237
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
238
|
-
* @example
|
|
239
|
-
* Verify a signature entirely through the synchronous API.
|
|
240
|
-
*
|
|
241
|
-
* ```ts
|
|
242
|
-
* import * as ed from '@noble/ed25519';
|
|
243
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
244
|
-
*
|
|
245
|
-
* ed.hashes.sha512 = sha512;
|
|
246
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
247
|
-
* const message = new Uint8Array([1, 2, 3]);
|
|
248
|
-
* const publicKey = ed.getPublicKey(secretKey);
|
|
249
|
-
* const signature = ed.sign(message, secretKey);
|
|
250
|
-
* const isValid = ed.verify(signature, message, publicKey);
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
declare const verify: (signature: TArg<Uint8Array>, message: TArg<Uint8Array>, publicKey: TArg<Uint8Array>, opts?: TArg<EdDSAVerifyOpts>) => boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Math, hex, byte helpers. Not in `utils` because utils share API with noble-curves.
|
|
256
|
-
* Exposes the same low-level field-default `mod` reducer and non-CT `invert` helper used
|
|
257
|
-
* internally.
|
|
258
|
-
* @example
|
|
259
|
-
* Convert bytes to a hex string with the low-level helper namespace.
|
|
260
|
-
*
|
|
261
|
-
* ```ts
|
|
262
|
-
* const hex = etc.bytesToHex(new Uint8Array([1, 2, 3]));
|
|
263
|
-
* ```
|
|
264
|
-
*/
|
|
265
|
-
declare const etc: {
|
|
266
|
-
bytesToHex: (bytes: TArg<Uint8Array>) => string;
|
|
267
|
-
hexToBytes: (hex: string) => TRet<Uint8Array>;
|
|
268
|
-
concatBytes: (...arrs: TArg<Uint8Array[]>) => TRet<Uint8Array>;
|
|
269
|
-
mod: (a: bigint, md?: bigint) => bigint;
|
|
270
|
-
invert: typeof invert;
|
|
271
|
-
randomBytes: (len?: number) => TRet<Uint8Array>;
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Hash implementations used by the synchronous API plus the default async WebCrypto provider.
|
|
275
|
-
* Both slots are configurable API surface; wrapper helpers revalidate that providers still return
|
|
276
|
-
* 64-byte SHA-512 digests.
|
|
277
|
-
* @example
|
|
278
|
-
* Provide a SHA-512 implementation before calling synchronous helpers.
|
|
279
|
-
*
|
|
280
|
-
* ```ts
|
|
281
|
-
* import * as ed from '@noble/ed25519';
|
|
282
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
283
|
-
*
|
|
284
|
-
* ed.hashes.sha512 = sha512;
|
|
285
|
-
* const { publicKey } = ed.keygen();
|
|
286
|
-
* ```
|
|
287
|
-
*/
|
|
288
|
-
declare const hashes: {
|
|
289
|
-
sha512Async: (message: TArg<Uint8Array>) => Promise<TRet<Uint8Array>>;
|
|
290
|
-
sha512: undefined | ((message: TArg<Uint8Array>) => TRet<Uint8Array>);
|
|
291
|
-
};
|
|
292
|
-
declare const randomSecretKey: (seed?: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
293
|
-
type KeysSecPub = {
|
|
294
|
-
secretKey: Uint8Array;
|
|
295
|
-
publicKey: Uint8Array;
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Generates a secret/public keypair.
|
|
299
|
-
* @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`.
|
|
300
|
-
* @returns Keypair with `secretKey` and `publicKey`.
|
|
301
|
-
* @throws If synchronous SHA-512 has not been configured in `hashes`. {@link Error}
|
|
302
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
303
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
304
|
-
* @example
|
|
305
|
-
* Generate a new keypair through the synchronous API after wiring SHA-512.
|
|
306
|
-
*
|
|
307
|
-
* ```ts
|
|
308
|
-
* import * as ed from '@noble/ed25519';
|
|
309
|
-
* import { sha512 } from '@noble/hashes/sha2.js';
|
|
310
|
-
*
|
|
311
|
-
* ed.hashes.sha512 = sha512;
|
|
312
|
-
* const { secretKey, publicKey } = ed.keygen();
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
declare const keygen: (seed?: TArg<Uint8Array>) => TRet<KeysSecPub>;
|
|
316
|
-
/**
|
|
317
|
-
* Generates a secret/public keypair asynchronously.
|
|
318
|
-
* @param seed - Optional 32-byte Ed25519 secret-key seed, returned verbatim as `secretKey`.
|
|
319
|
-
* @returns Keypair with `secretKey` and `publicKey`.
|
|
320
|
-
* @throws On wrong argument types. {@link TypeError}
|
|
321
|
-
* @throws On wrong argument ranges or values. {@link RangeError}
|
|
322
|
-
* @example
|
|
323
|
-
* Generate a new keypair through the asynchronous WebCrypto-backed path.
|
|
324
|
-
*
|
|
325
|
-
* ```ts
|
|
326
|
-
* import * as ed from '@noble/ed25519';
|
|
327
|
-
*
|
|
328
|
-
* const { secretKey, publicKey } = await ed.keygenAsync();
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
declare const keygenAsync: (seed?: TArg<Uint8Array>) => Promise<TRet<KeysSecPub>>;
|
|
332
|
-
/**
|
|
333
|
-
* Ed25519-specific key utilities.
|
|
334
|
-
* `utils.getExtendedPublicKey*` expose secret-derived internals (`head`, `prefix`, `scalar`, and
|
|
335
|
-
* point objects), not just public-key bytes.
|
|
336
|
-
* @example
|
|
337
|
-
* Generate a new Ed25519 secret key and derive the matching public key.
|
|
338
|
-
*
|
|
339
|
-
* ```ts
|
|
340
|
-
* import * as ed from '@noble/ed25519';
|
|
341
|
-
*
|
|
342
|
-
* const secretKey = ed.utils.randomSecretKey();
|
|
343
|
-
* const publicKey = await ed.getPublicKeyAsync(secretKey);
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
declare const utils: {
|
|
347
|
-
getExtendedPublicKeyAsync: typeof getExtendedPublicKeyAsync;
|
|
348
|
-
getExtendedPublicKey: typeof getExtendedPublicKey;
|
|
349
|
-
randomSecretKey: typeof randomSecretKey;
|
|
350
|
-
};
|
|
351
|
-
export { etc, getPublicKey, getPublicKeyAsync, hash, hashes, keygen, keygenAsync, Point, sign, signAsync, utils, verify, verifyAsync, };
|
|
352
|
-
/**
|
|
353
|
-
* Bytes API type helpers for old + new TypeScript.
|
|
354
|
-
*
|
|
355
|
-
* TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array<ArrayBuffer>`.
|
|
356
|
-
* We can't use specific return type, because TS 5.6 will error.
|
|
357
|
-
* We can't use generic return type, because most TS 5.9 software will expect specific type.
|
|
358
|
-
*
|
|
359
|
-
* Maps typed-array input leaves to broad forms.
|
|
360
|
-
* These are compatibility adapters, not ownership guarantees.
|
|
361
|
-
*
|
|
362
|
-
* - `TArg` keeps byte inputs broad.
|
|
363
|
-
* - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility.
|
|
364
|
-
*/
|
|
365
|
-
export type TypedArg<T> = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never;
|
|
366
|
-
/** Maps typed-array output leaves to narrow TS-compatible forms. */
|
|
367
|
-
export type TypedRet<T> = T extends BigInt64Array ? ReturnType<typeof BigInt64Array.of> : T extends BigUint64Array ? ReturnType<typeof BigUint64Array.of> : T extends Float32Array ? ReturnType<typeof Float32Array.of> : T extends Float64Array ? ReturnType<typeof Float64Array.of> : T extends Int16Array ? ReturnType<typeof Int16Array.of> : T extends Int32Array ? ReturnType<typeof Int32Array.of> : T extends Int8Array ? ReturnType<typeof Int8Array.of> : T extends Uint16Array ? ReturnType<typeof Uint16Array.of> : T extends Uint32Array ? ReturnType<typeof Uint32Array.of> : T extends Uint8ClampedArray ? ReturnType<typeof Uint8ClampedArray.of> : T extends Uint8Array ? ReturnType<typeof Uint8Array.of> : never;
|
|
368
|
-
/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */
|
|
369
|
-
export type TArg<T> = T | ([TypedArg<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
370
|
-
[K in keyof A]: TRet<A[K]>;
|
|
371
|
-
}) => TArg<R>) & {
|
|
372
|
-
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg<T[K]>;
|
|
373
|
-
} : T extends [infer A, ...infer R] ? [TArg<A>, ...{
|
|
374
|
-
[K in keyof R]: TArg<R[K]>;
|
|
375
|
-
}] : T extends readonly [infer A, ...infer R] ? readonly [TArg<A>, ...{
|
|
376
|
-
[K in keyof R]: TArg<R[K]>;
|
|
377
|
-
}] : T extends (infer A)[] ? TArg<A>[] : T extends readonly (infer A)[] ? readonly TArg<A>[] : T extends Promise<infer A> ? Promise<TArg<A>> : T extends object ? {
|
|
378
|
-
[K in keyof T]: TArg<T[K]>;
|
|
379
|
-
} : T : TypedArg<T>);
|
|
380
|
-
/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */
|
|
381
|
-
export type TRet<T> = T extends unknown ? T & ([TypedRet<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
382
|
-
[K in keyof A]: TArg<A[K]>;
|
|
383
|
-
}) => TRet<R>) & {
|
|
384
|
-
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet<T[K]>;
|
|
385
|
-
} : T extends [infer A, ...infer R] ? [TRet<A>, ...{
|
|
386
|
-
[K in keyof R]: TRet<R[K]>;
|
|
387
|
-
}] : T extends readonly [infer A, ...infer R] ? readonly [TRet<A>, ...{
|
|
388
|
-
[K in keyof R]: TRet<R[K]>;
|
|
389
|
-
}] : T extends (infer A)[] ? TRet<A>[] : T extends readonly (infer A)[] ? readonly TRet<A>[] : T extends Promise<infer A> ? Promise<TRet<A>> : T extends object ? {
|
|
390
|
-
[K in keyof T]: TRet<T[K]>;
|
|
391
|
-
} : T : TypedRet<T>) : never;
|