iso-signatures 0.3.2 → 0.4.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.
Files changed (41) hide show
  1. package/dist/src/asn1.d.ts +6 -6
  2. package/dist/src/asn1.d.ts.map +1 -1
  3. package/dist/src/signers/ecdsa.d.ts +26 -18
  4. package/dist/src/signers/ecdsa.d.ts.map +1 -1
  5. package/dist/src/signers/eddsa.d.ts +21 -18
  6. package/dist/src/signers/eddsa.d.ts.map +1 -1
  7. package/dist/src/signers/eip191.d.ts +549 -0
  8. package/dist/src/signers/eip191.d.ts.map +1 -0
  9. package/dist/src/signers/es256k.d.ts +55 -0
  10. package/dist/src/signers/es256k.d.ts.map +1 -0
  11. package/dist/src/signers/rsa.d.ts +9 -18
  12. package/dist/src/signers/rsa.d.ts.map +1 -1
  13. package/dist/src/spki.d.ts +2 -2
  14. package/dist/src/spki.d.ts.map +1 -1
  15. package/dist/src/types.d.ts +11 -7
  16. package/dist/src/types.d.ts.map +1 -1
  17. package/dist/src/utils.d.ts +1 -12
  18. package/dist/src/utils.d.ts.map +1 -1
  19. package/dist/src/verifiers/ecdsa.d.ts +4 -4
  20. package/dist/src/verifiers/ecdsa.d.ts.map +1 -1
  21. package/dist/src/verifiers/eddsa.d.ts +2 -2
  22. package/dist/src/verifiers/eddsa.d.ts.map +1 -1
  23. package/dist/src/verifiers/eip191.d.ts +15 -0
  24. package/dist/src/verifiers/eip191.d.ts.map +1 -0
  25. package/dist/src/verifiers/resolver.d.ts +4 -4
  26. package/dist/src/verifiers/resolver.d.ts.map +1 -1
  27. package/dist/src/verifiers/rsa.d.ts +1 -1
  28. package/dist/src/verifiers/rsa.d.ts.map +1 -1
  29. package/package.json +16 -24
  30. package/src/signers/ecdsa.js +86 -34
  31. package/src/signers/eddsa.js +33 -22
  32. package/src/signers/eip191.js +95 -0
  33. package/src/signers/es256k.js +121 -0
  34. package/src/signers/rsa.js +10 -20
  35. package/src/types.ts +19 -9
  36. package/src/utils.js +6 -42
  37. package/src/verifiers/ecdsa.js +26 -12
  38. package/src/verifiers/eddsa.js +4 -4
  39. package/src/verifiers/eip191.js +47 -0
  40. package/src/verifiers/resolver.js +7 -5
  41. package/src/verifiers/rsa.js +2 -2
@@ -0,0 +1,549 @@
1
+ /**
2
+ * @typedef {import('../types.js').ISigner<string>} ISigner
3
+ * @typedef {import('ox').Provider.Provider} Provider
4
+ */
5
+ /**
6
+ * EIP191 signer
7
+ *
8
+ * @implements {ISigner}
9
+ */
10
+ export class EIP191Signer extends DID implements ISigner {
11
+ /**
12
+ * Generate a new signer
13
+ *
14
+ * @param {object} options
15
+ * @param {Provider} options.provider - https://oxlib.sh/guides/eip-1193#eip-1193-providers
16
+ * @param {`0x${string}`} [options.address] - default: first account from provider
17
+ * @param {number | `0x${string}`} [options.chainId] - default: 1
18
+ * @param {string} [options.namespace] - default: eip155
19
+ *
20
+ * @example
21
+ * ```ts twoslash
22
+ * import { Provider } from 'ox'
23
+ * const provider = Provider.from(window.ethereum)
24
+ * const signer = await EIP191Signer.generate({
25
+ * provider,
26
+ * })
27
+ * ```
28
+ */
29
+ static from(options: {
30
+ provider: Provider;
31
+ address?: `0x${string}` | undefined;
32
+ chainId?: number | `0x${string}` | undefined;
33
+ namespace?: string | undefined;
34
+ }): Promise<EIP191Signer>;
35
+ /**
36
+ * Create a DIDPkh from an address
37
+ *
38
+ * @param {Provider} provider - https://oxlib.sh/guides/eip-1193#eip-1193-providers
39
+ * @param {`0x${string}`} address
40
+ * @param {number | `0x${string}`} [chainId]
41
+ * @param {string} [namespace]
42
+ */
43
+ constructor(provider: Provider, address: `0x${string}`, chainId?: number | `0x${string}`, namespace?: string);
44
+ /** @type {import('../types.js').SignatureType} */
45
+ signatureType: import("../types.js").SignatureType;
46
+ provider: {
47
+ request: Provider.RequestFn<{
48
+ Request: {
49
+ method: "eth_accounts";
50
+ params?: undefined;
51
+ };
52
+ ReturnType: readonly import("ox/Address").Address[];
53
+ } | {
54
+ Request: {
55
+ method: "eth_blobBaseFee";
56
+ params?: undefined;
57
+ };
58
+ ReturnType: import("ox/Hex").Hex;
59
+ } | {
60
+ Request: {
61
+ method: "eth_blockNumber";
62
+ params?: undefined;
63
+ };
64
+ ReturnType: import("ox/Hex").Hex;
65
+ } | {
66
+ Request: {
67
+ method: "eth_call";
68
+ params: [transaction: import("ox/TransactionRequest").Rpc] | [transaction: import("ox/TransactionRequest").Rpc, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier] | [transaction: import("ox/TransactionRequest").Rpc, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier, stateOverrides: import("ox/StateOverrides").Rpc];
69
+ };
70
+ ReturnType: import("ox/Hex").Hex;
71
+ } | {
72
+ Request: {
73
+ method: "eth_chainId";
74
+ params?: undefined;
75
+ };
76
+ ReturnType: import("ox/Hex").Hex;
77
+ } | {
78
+ Request: {
79
+ method: "eth_coinbase";
80
+ params?: undefined;
81
+ };
82
+ ReturnType: import("ox/Address").Address;
83
+ } | {
84
+ Request: {
85
+ method: "eth_estimateGas";
86
+ params: [transaction: import("ox/TransactionRequest").Rpc] | [transaction: import("ox/TransactionRequest").Rpc, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier] | [transaction: import("ox/TransactionRequest").Rpc, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier, stateOverrides: import("ox/StateOverrides").Rpc];
87
+ };
88
+ ReturnType: import("ox/Hex").Hex;
89
+ } | {
90
+ Request: {
91
+ method: "eth_feeHistory";
92
+ params: [blockCount: import("ox/Hex").Hex, newestBlock: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag, rewardPercentiles: number[] | undefined];
93
+ };
94
+ ReturnType: import("ox/Fee").FeeHistoryRpc;
95
+ } | {
96
+ Request: {
97
+ method: "eth_gasPrice";
98
+ params?: undefined;
99
+ };
100
+ ReturnType: import("ox/Hex").Hex;
101
+ } | {
102
+ Request: {
103
+ method: "eth_getBalance";
104
+ params: [address: import("ox/Address").Address, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
105
+ };
106
+ ReturnType: import("ox/Hex").Hex;
107
+ } | {
108
+ Request: {
109
+ method: "eth_getBlockByHash";
110
+ params: [hash: import("ox/Hex").Hex, includeTransactionObjects: boolean];
111
+ };
112
+ ReturnType: import("ox/Block").Rpc | null;
113
+ } | {
114
+ Request: {
115
+ method: "eth_getBlockByNumber";
116
+ params: [block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag, includeTransactionObjects: boolean];
117
+ };
118
+ ReturnType: import("ox/Block").Rpc | null;
119
+ } | {
120
+ Request: {
121
+ method: "eth_getBlockTransactionCountByHash";
122
+ params: [hash: import("ox/Hex").Hex];
123
+ };
124
+ ReturnType: import("ox/Hex").Hex;
125
+ } | {
126
+ Request: {
127
+ method: "eth_getBlockTransactionCountByNumber";
128
+ params: [block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag];
129
+ };
130
+ ReturnType: import("ox/Hex").Hex;
131
+ } | {
132
+ Request: {
133
+ method: "eth_getCode";
134
+ params: [address: import("ox/Address").Address, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
135
+ };
136
+ ReturnType: import("ox/Hex").Hex;
137
+ } | {
138
+ Request: {
139
+ method: "eth_getFilterChanges";
140
+ params: [filterId: import("ox/Hex").Hex];
141
+ };
142
+ ReturnType: readonly import("ox/Log").Rpc[] | readonly import("ox/Hex").Hex[];
143
+ } | {
144
+ Request: {
145
+ method: "eth_getFilterLogs";
146
+ params: [filterId: import("ox/Hex").Hex];
147
+ };
148
+ ReturnType: readonly import("ox/Log").Rpc[];
149
+ } | {
150
+ Request: {
151
+ method: "eth_getLogs";
152
+ params: [filter: import("ox/Filter").Rpc];
153
+ };
154
+ ReturnType: readonly import("ox/Log").Rpc[];
155
+ } | {
156
+ Request: {
157
+ method: "eth_getProof";
158
+ params: [address: import("ox/Address").Address, storageKeys: import("ox/Hex").Hex[], block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
159
+ };
160
+ ReturnType: import("ox/AccountProof").Rpc;
161
+ } | {
162
+ Request: {
163
+ method: "eth_getStorageAt";
164
+ params: [address: import("ox/Address").Address, index: import("ox/Hex").Hex, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
165
+ };
166
+ ReturnType: import("ox/Hex").Hex;
167
+ } | {
168
+ Request: {
169
+ method: "eth_getTransactionByBlockHashAndIndex";
170
+ params: [hash: import("ox/Hex").Hex, index: import("ox/Hex").Hex];
171
+ };
172
+ ReturnType: import("ox/Transaction").Rpc | null;
173
+ } | {
174
+ Request: {
175
+ method: "eth_getTransactionByBlockNumberAndIndex";
176
+ params: [block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag, index: import("ox/Hex").Hex];
177
+ };
178
+ ReturnType: import("ox/Transaction").Rpc | null;
179
+ } | {
180
+ Request: {
181
+ method: "eth_getTransactionByHash";
182
+ params: [hash: import("ox/Hex").Hex];
183
+ };
184
+ ReturnType: import("ox/Transaction").Rpc | null;
185
+ } | {
186
+ Request: {
187
+ method: "eth_getTransactionCount";
188
+ params: [address: import("ox/Address").Address, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
189
+ };
190
+ ReturnType: import("ox/Hex").Hex;
191
+ } | {
192
+ Request: {
193
+ method: "eth_getTransactionReceipt";
194
+ params: [hash: import("ox/Hex").Hex];
195
+ };
196
+ ReturnType: import("ox/TransactionReceipt").Rpc | null;
197
+ } | {
198
+ Request: {
199
+ method: "eth_getUncleCountByBlockHash";
200
+ params: [hash: import("ox/Hex").Hex];
201
+ };
202
+ ReturnType: import("ox/Hex").Hex;
203
+ } | {
204
+ Request: {
205
+ method: "eth_getUncleCountByBlockNumber";
206
+ params: [block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag];
207
+ };
208
+ ReturnType: import("ox/Hex").Hex;
209
+ } | {
210
+ Request: {
211
+ method: "eth_maxPriorityFeePerGas";
212
+ params?: undefined;
213
+ };
214
+ ReturnType: import("ox/Hex").Hex;
215
+ } | {
216
+ Request: {
217
+ method: "eth_newBlockFilter";
218
+ params?: undefined;
219
+ };
220
+ ReturnType: import("ox/Hex").Hex;
221
+ } | {
222
+ Request: {
223
+ method: "eth_newFilter";
224
+ params: [filter: import("ox/Filter").Rpc];
225
+ };
226
+ ReturnType: import("ox/Hex").Hex;
227
+ } | {
228
+ Request: {
229
+ method: "eth_newPendingTransactionFilter";
230
+ params?: undefined;
231
+ };
232
+ ReturnType: import("ox/Hex").Hex;
233
+ } | {
234
+ Request: {
235
+ method: "eth_protocolVersion";
236
+ params?: undefined;
237
+ };
238
+ ReturnType: string;
239
+ } | {
240
+ Request: {
241
+ method: "eth_requestAccounts";
242
+ params?: undefined;
243
+ };
244
+ ReturnType: readonly import("ox/Address").Address[];
245
+ } | {
246
+ Request: {
247
+ method: "eth_sendRawTransaction";
248
+ params: [serializedTransaction: import("ox/Hex").Hex];
249
+ };
250
+ ReturnType: import("ox/Hex").Hex;
251
+ } | {
252
+ Request: {
253
+ method: "eth_sendTransaction";
254
+ params: [transaction: import("ox/TransactionRequest").Rpc];
255
+ };
256
+ ReturnType: import("ox/Hex").Hex;
257
+ } | {
258
+ Request: {
259
+ method: "eth_simulateV1";
260
+ params: [{
261
+ blockStateCalls: readonly {
262
+ blockOverrides?: import("ox/BlockOverrides").Rpc | undefined;
263
+ calls?: readonly import("ox/TransactionRequest").Rpc[] | undefined;
264
+ stateOverrides?: import("ox/StateOverrides").Rpc | undefined;
265
+ }[];
266
+ returnFullTransactions?: boolean | undefined;
267
+ traceTransfers?: boolean | undefined;
268
+ validation?: boolean | undefined;
269
+ }, block: import("ox/Block").Number<import("ox/Hex").Hex> | import("ox/Block").Tag | import("ox/Block").Hash | import("ox/Block").Identifier];
270
+ };
271
+ ReturnType: readonly (import("ox/Block").Rpc & {
272
+ calls?: readonly {
273
+ error?: {
274
+ data?: import("ox/Hex").Hex | undefined;
275
+ code: number;
276
+ message: string;
277
+ } | undefined;
278
+ logs?: readonly import("ox/Log").Rpc[] | undefined;
279
+ gasUsed: import("ox/Hex").Hex;
280
+ returnData: import("ox/Hex").Hex;
281
+ status: import("ox/Hex").Hex;
282
+ }[] | undefined;
283
+ })[];
284
+ } | {
285
+ Request: {
286
+ method: "eth_signTransaction";
287
+ params: [request: import("ox/TransactionRequest").Rpc];
288
+ };
289
+ ReturnType: import("ox/Hex").Hex;
290
+ } | {
291
+ Request: {
292
+ method: "eth_signTypedData_v4";
293
+ params: [address: import("ox/Address").Address, message: string];
294
+ };
295
+ ReturnType: import("ox/Hex").Hex;
296
+ } | {
297
+ Request: {
298
+ method: "eth_uninstallFilter";
299
+ params: [filterId: import("ox/Hex").Hex];
300
+ };
301
+ ReturnType: boolean;
302
+ } | {
303
+ Request: {
304
+ method: "eth_requestAccounts";
305
+ params?: undefined;
306
+ };
307
+ ReturnType: readonly import("ox/Address").Address[];
308
+ } | {
309
+ Request: {
310
+ method: "eth_sendRawTransaction";
311
+ params: [serializedTransaction: import("ox/Hex").Hex];
312
+ };
313
+ ReturnType: import("ox/Hex").Hex;
314
+ } | {
315
+ Request: {
316
+ method: "eth_sendTransaction";
317
+ params: [transaction: import("ox/TransactionRequest").Rpc];
318
+ };
319
+ ReturnType: import("ox/Hex").Hex;
320
+ } | {
321
+ Request: {
322
+ method: "eth_signTransaction";
323
+ params: [request: import("ox/TransactionRequest").Rpc];
324
+ };
325
+ ReturnType: import("ox/Hex").Hex;
326
+ } | {
327
+ Request: {
328
+ method: "eth_signTypedData_v4";
329
+ params: [address: import("ox/Address").Address, message: string];
330
+ };
331
+ ReturnType: import("ox/Hex").Hex;
332
+ } | {
333
+ Request: {
334
+ method: "personal_sign";
335
+ params: [data: import("ox/Hex").Hex, address: import("ox/Address").Address];
336
+ };
337
+ ReturnType: import("ox/Hex").Hex;
338
+ } | {
339
+ Request: {
340
+ method: "wallet_addEthereumChain";
341
+ params: [chain: {
342
+ chainId: string;
343
+ chainName: string;
344
+ nativeCurrency?: {
345
+ name: string;
346
+ symbol: string;
347
+ decimals: number;
348
+ } | undefined | undefined;
349
+ rpcUrls: readonly string[];
350
+ blockExplorerUrls?: readonly string[] | undefined;
351
+ iconUrls?: readonly string[] | undefined;
352
+ }];
353
+ };
354
+ ReturnType: null;
355
+ } | {
356
+ Request: {
357
+ method: "wallet_getCallsStatus";
358
+ params?: [string];
359
+ };
360
+ ReturnType: {
361
+ atomic: boolean;
362
+ capabilities?: {
363
+ [capability: string]: any;
364
+ } | undefined;
365
+ chainId: import("ox/Hex").Hex;
366
+ id: string;
367
+ receipts?: readonly {
368
+ logs: {
369
+ address: import("ox/Hex").Hex;
370
+ data: import("ox/Hex").Hex;
371
+ topics: readonly import("ox/Hex").Hex[];
372
+ }[];
373
+ status: import("ox/Hex").Hex;
374
+ blockHash: import("ox/Hex").Hex;
375
+ blockNumber: import("ox/Hex").Hex;
376
+ gasUsed: import("ox/Hex").Hex;
377
+ transactionHash: import("ox/Hex").Hex;
378
+ }[] | undefined;
379
+ status: number;
380
+ version: string;
381
+ };
382
+ } | {
383
+ Request: {
384
+ method: "wallet_getCapabilities";
385
+ params?: readonly [] | readonly [import("ox/Address").Address | undefined] | readonly [import("ox/Address").Address | undefined, readonly import("ox/Hex").Hex[] | undefined] | undefined;
386
+ };
387
+ ReturnType: {
388
+ [x: `0x${string}`]: {
389
+ [capability: string]: any;
390
+ };
391
+ };
392
+ } | {
393
+ Request: {
394
+ method: "wallet_getPermissions";
395
+ params?: undefined;
396
+ };
397
+ ReturnType: readonly {
398
+ caveats: readonly {
399
+ type: string;
400
+ value: any;
401
+ }[];
402
+ date: number;
403
+ id: string;
404
+ invoker: `http://${string}` | `https://${string}`;
405
+ parentCapability: "eth_accounts" | string;
406
+ }[];
407
+ } | {
408
+ Request: {
409
+ method: "wallet_grantPermissions";
410
+ params?: [{
411
+ signer?: {
412
+ type: string;
413
+ data?: unknown | undefined;
414
+ } | undefined;
415
+ permissions: readonly {
416
+ data: unknown;
417
+ policies: readonly {
418
+ data: unknown;
419
+ type: string;
420
+ }[];
421
+ required?: boolean | undefined;
422
+ type: string;
423
+ }[];
424
+ expiry: number;
425
+ }];
426
+ };
427
+ ReturnType: {
428
+ expiry: number;
429
+ factory?: `0x${string}` | undefined | undefined;
430
+ factoryData?: string | undefined | undefined;
431
+ grantedPermissions: readonly {
432
+ data: unknown;
433
+ policies: readonly {
434
+ data: unknown;
435
+ type: string;
436
+ }[];
437
+ required?: boolean | undefined;
438
+ type: string;
439
+ }[];
440
+ permissionsContext: string;
441
+ signerData?: {
442
+ userOpBuilder?: `0x${string}` | undefined;
443
+ submitToAddress?: `0x${string}` | undefined;
444
+ } | undefined | undefined;
445
+ };
446
+ } | {
447
+ Request: {
448
+ method: "wallet_requestPermissions";
449
+ params: [permissions: {
450
+ eth_accounts: Record<string, any>;
451
+ }];
452
+ };
453
+ ReturnType: readonly {
454
+ caveats: readonly {
455
+ type: string;
456
+ value: any;
457
+ }[];
458
+ date: number;
459
+ id: string;
460
+ invoker: `http://${string}` | `https://${string}`;
461
+ parentCapability: "eth_accounts" | string;
462
+ }[];
463
+ } | {
464
+ Request: {
465
+ method: "wallet_revokePermissions";
466
+ params: [permissions: {
467
+ eth_accounts: Record<string, any>;
468
+ }];
469
+ };
470
+ ReturnType: null;
471
+ } | {
472
+ Request: {
473
+ method: "wallet_sendCalls";
474
+ params: [{
475
+ atomicRequired: boolean;
476
+ calls: readonly {
477
+ capabilities?: {
478
+ [capability: string]: any;
479
+ } | undefined;
480
+ to?: import("ox/Address").Address | undefined;
481
+ data?: import("ox/Hex").Hex | undefined;
482
+ value?: import("ox/Hex").Hex | undefined;
483
+ }[];
484
+ capabilities?: {
485
+ [capability: string]: any;
486
+ } | undefined;
487
+ chainId?: import("ox/Hex").Hex | undefined;
488
+ id?: string | undefined;
489
+ from?: import("ox/Address").Address | undefined;
490
+ version: string;
491
+ }];
492
+ };
493
+ ReturnType: {
494
+ capabilities?: {
495
+ [capability: string]: any;
496
+ } | undefined;
497
+ id: string;
498
+ };
499
+ } | {
500
+ Request: {
501
+ method: "wallet_showCallsStatus";
502
+ params: [string];
503
+ };
504
+ ReturnType: undefined;
505
+ } | {
506
+ Request: {
507
+ method: "wallet_switchEthereumChain";
508
+ params: [chain: {
509
+ chainId: string;
510
+ }];
511
+ };
512
+ ReturnType: null;
513
+ } | {
514
+ Request: {
515
+ method: "wallet_watchAsset";
516
+ params: [{
517
+ type: "ERC20";
518
+ options: {
519
+ address: string;
520
+ symbol: string;
521
+ decimals: number;
522
+ image?: string | undefined;
523
+ };
524
+ }];
525
+ };
526
+ ReturnType: boolean;
527
+ }>;
528
+ on: Provider.EventListenerFn;
529
+ removeListener: Provider.EventListenerFn;
530
+ };
531
+ address: `0x${string}`;
532
+ chainId: number | `0x${string}`;
533
+ namespace: string;
534
+ /**
535
+ * Sign a message
536
+ *
537
+ * @param {Uint8Array} message
538
+ */
539
+ sign(message: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
540
+ /**
541
+ * Export the signer as a encoded string
542
+ */
543
+ export(): string;
544
+ }
545
+ export type ISigner = import("../types.js").ISigner<string>;
546
+ export type Provider = import("ox").Provider.Provider;
547
+ import { DID } from 'iso-did';
548
+ import { Provider } from 'ox';
549
+ //# sourceMappingURL=eip191.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip191.d.ts","sourceRoot":"","sources":["../../../src/signers/eip191.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;GAIG;AACH,iDAFgB,OAAO;IAuBrB;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAdG;QAA0B,QAAQ,EAA1B,QAAQ;QACgB,OAAO;QACE,OAAO;QACvB,SAAS;KAElC,yBAwBF;IAlDD;;;;;;;OAOG;IACH,sBALW,QAAQ,WACR,KAAK,MAAM,EAAE,YACb,MAAM,GAAG,KAAK,MAAM,EAAE,cACtB,MAAM,EAShB;IAlBD,kDAAkD;IAClD,eADW,OAAO,aAAa,EAAE,aAAa,CACjC;IAaX;;;;sBAW4D,CAAC;;;;;;sBAQzD,CAAC;;;;;;sBAS2B,CAAC;;;;;;;;;;;;sBAqCwQ,CAAC;;;;;;sBAAmP,CAAC;;;;;;;;;;;;;;;;;;sBAA6jE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAqxP,CAAC;;;;;;sBAAkT,CAAC;;;;;;;;;;;;sBAAovB,CAAC;;;;;;sBAAuQ,CAAC;;;;;;sBAAwW,CAAC;;;;;;;;;;;;;;;;;;;;sCAA+4B,CAAC;6BAA2D,CAAC;sCAAmF,CAAC;;0CAA6F,CAAC;kCAAqD,CAAC;8BAAiD,CAAC;;;;qBAAkM,CAAC;yBAA8B,CAAC;4BAAwB,CAAC;;;;wBAAiI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;sBApExjb,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAoE+gC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA0Q,CAAC;;;;;;;;;;sBAA+Z,CAAC;;;;;;;;;;;;;;;sBAAmQ,CAAC;;;4BAAguI,CAAC;;;;;;;;gCAA4M,CAAC;;;;;;;;;;;;;;;;4BAA2f,CAAC;;;;;iCAA8H,CAAC;mCAAoD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAA+R,CAAC;;;0BAAgD,CAAC;4BAA+C,CAAC;6BAAwC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAA68B,CAAC;;;;;;;;MAjEn7Q;IACxB,uBAAsB;IACtB,gCAAsB;IACtB,kBAA0B;IAsC5B;;;;OAIG;IACH,cAFW,UAAU,wCAQpB;IAED;;OAEG;IACH,iBAEC;CAKF;sBAxFY,OAAO,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC;uBACrC,OAAO,IAAI,EAAE,QAAQ,CAAC,QAAQ;oBANvB,SAAS;yBAEJ,IAAI"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * ES256K signer (secp256k1 and SHA-256)
3
+ *
4
+ * @implements {ISigner}
5
+ */
6
+ export class ES256KSigner extends DID implements ISigner {
7
+ /**
8
+ * Multibase code for secp256k1 private key
9
+ * @see https://github.com/multiformats/multicodec/blob/3bc7f4c20afe28e10d9d539e2a565578de6dd71c/table.csv#L182
10
+ * @type {number}
11
+ */
12
+ static code: number;
13
+ /**
14
+ * Generate a new signer
15
+ *
16
+ * @param {Uint8Array} [bytes]
17
+ */
18
+ static generate(bytes?: Uint8Array): ES256KSigner;
19
+ /**
20
+ * Import a signer from a JWK
21
+ *
22
+ * @param {import('iso-did/types').ECJWKPrivate} jwk
23
+ * @param {import('iso-did/types').VerifiableDID} [did] - Optional DID to verify the JWK
24
+ */
25
+ static importJwk(jwk: import("iso-did/types").ECJWKPrivate, did?: import("iso-did/types").VerifiableDID): ES256KSigner;
26
+ /**
27
+ * Import a signer from a encoded string
28
+ *
29
+ * @param {string} encoded
30
+ * @param {import('iso-did/types').VerifiableDID} [did]
31
+ */
32
+ static import(encoded: string, did?: import("iso-did/types").VerifiableDID): ES256KSigner;
33
+ /**
34
+ *
35
+ * @param {import('iso-did/types').VerifiableDID} did
36
+ * @param {Uint8Array} privateKey
37
+ */
38
+ constructor(did: import("iso-did/types").VerifiableDID, privateKey: Uint8Array);
39
+ /** @type {import('../types.js').SignatureType} */
40
+ signatureType: import("../types.js").SignatureType;
41
+ /**
42
+ * Sign a message
43
+ *
44
+ * @param {Uint8Array} message
45
+ */
46
+ sign(message: Uint8Array): Promise<import("@noble/secp256k1").Bytes>;
47
+ /**
48
+ * Export the signer as a encoded string
49
+ */
50
+ export(): string;
51
+ #private;
52
+ }
53
+ export type ISigner = import("../types.js").ISigner<string>;
54
+ import { DID } from 'iso-did';
55
+ //# sourceMappingURL=es256k.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es256k.d.ts","sourceRoot":"","sources":["../../../src/signers/es256k.js"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,iDAFgB,OAAO;IAGrB;;;;OAIG;IACH,aAFU,MAAM,CAEI;IAoBpB;;;;OAIG;IACH,wBAFW,UAAU,gBAUpB;IAED;;;;;OAKG;IACH,sBAHW,OAAO,eAAe,EAAE,YAAY,QACpC,OAAO,eAAe,EAAE,aAAa,gBAU/C;IAED;;;;;OAKG;IACH,uBAHW,MAAM,QACN,OAAO,eAAe,EAAE,aAAa,gBAU/C;IAzDD;;;;OAIG;IACH,iBAHW,OAAO,eAAe,EAAE,aAAa,cACrC,UAAU,EAOpB;IAhBD,kDAAkD;IAClD,eADW,OAAO,aAAa,EAAE,aAAa,CACjC;IAgEb;;;;OAIG;IACH,cAFW,UAAU,6CAMpB;IAED;;OAEG;IACH,iBAEC;;CAKF;sBA/GY,OAAO,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC;oBAL9B,SAAS"}
@@ -3,11 +3,7 @@
3
3
  *
4
4
  * @implements {ISigner}
5
5
  */
6
- export class RSASigner implements ISigner {
7
- /** @type {Extract<import('iso-did/types').SignatureAlgorithm, "RS256">} */
8
- static alg: Extract<import('iso-did/types').SignatureAlgorithm, "RS256">;
9
- /** @type {Extract<import('iso-did/types').KeyType, "RSA">} */
10
- static type: Extract<import('iso-did/types').KeyType, "RSA">;
6
+ export class RSASigner extends DID implements ISigner {
11
7
  static code: number;
12
8
  /**
13
9
  * Generate a new signer
@@ -19,38 +15,33 @@ export class RSASigner implements ISigner {
19
15
  * @param {import('iso-did/types').RSAJWKPrivate} jwk
20
16
  * @param {import('iso-did/types').VerifiableDID} [did]
21
17
  */
22
- static importJwk(jwk: import('iso-did/types').RSAJWKPrivate, did?: import("iso-did/types").VerifiableDID | undefined): Promise<RSASigner>;
18
+ static importJwk(jwk: import("iso-did/types").RSAJWKPrivate, did?: import("iso-did/types").VerifiableDID): Promise<RSASigner>;
23
19
  /**
24
20
  * Import a signer from a keypair
25
21
  *
26
22
  * @param {CryptoKeyPair} keypair
27
23
  * @param {import('iso-did/types').VerifiableDID} [did]
28
24
  */
29
- static import(keypair: CryptoKeyPair, did?: import("iso-did/types").VerifiableDID | undefined): Promise<RSASigner>;
25
+ static import(keypair: CryptoKeyPair, did?: import("iso-did/types").VerifiableDID): Promise<RSASigner>;
30
26
  /**
31
27
  * @param {import('iso-did/types').VerifiableDID} did
32
28
  * @param {CryptoKeyPair} keypair
33
29
  */
34
- constructor(did: import('iso-did/types').VerifiableDID, keypair: CryptoKeyPair);
35
- did: `did:${string}:${string}`;
36
- url: import("iso-did/types").DIDURLObject;
37
- type: "P-256" | "P-384" | "P-521" | "Ed25519" | "secp256k1" | "RSA";
38
- publicKey: Uint8Array;
39
- alg: "EdDSA" | "ES256" | "ES384" | "ES512" | "ES256K" | "RS256";
40
- document: import("iso-did/types").DIDDocument;
41
- didKey: `did:${string}:${string}`;
30
+ constructor(did: import("iso-did/types").VerifiableDID, keypair: CryptoKeyPair);
31
+ /** @type {import('../types.js').SignatureType} */
32
+ signatureType: import("../types.js").SignatureType;
42
33
  /**
43
34
  * Sign a message
44
35
  *
45
36
  * @param {Uint8Array} message
46
37
  */
47
- sign(message: Uint8Array): Promise<Uint8Array>;
38
+ sign(message: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
48
39
  /**
49
40
  * Export the signer as a crypto key pair
50
41
  */
51
42
  export(): CryptoKeyPair;
52
- toString(): string;
53
43
  #private;
54
44
  }
55
- export type ISigner = import('../types.js').ISigner<CryptoKeyPair>;
45
+ export type ISigner = import("../types.js").ISigner<CryptoKeyPair>;
46
+ import { DID } from 'iso-did';
56
47
  //# sourceMappingURL=rsa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rsa.d.ts","sourceRoot":"","sources":["../../../src/signers/rsa.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH;IACE,2EAA2E;IAC3E,YADW,QAAQ,OAAO,eAAe,EAAE,kBAAkB,EAAE,OAAO,CAAC,CACnD;IAEpB,8DAA8D;IAC9D,aADW,QAAQ,OAAO,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC,CACvC;IAGnB,oBAAoB;IAqBpB;;OAEG;IACH,sCAqBC;IAED;;;;;OAKG;IACH,sBAHW,OAAO,eAAe,EAAE,aAAa,+EAgC/C;IAED;;;;;OAKG;IACH,uBAHW,aAAa,+EAevB;IAjGD;;;OAGG;IACH,iBAHW,OAAO,eAAe,EAAE,aAAa,WACrC,aAAa,EAYvB;IARC,+BAAkB;IAClB,0CAAkB;IAClB,oEAAoB;IACpB,sBAA8B;IAC9B,gEAAkB;IAClB,8CAA4B;IAE5B,kCAAwB;IAsF1B;;;;OAIG;IACH,cAFW,UAAU,uBAUpB;IAED;;OAEG;IACH,wBAEC;IAED,mBAEC;;CACF;sBA9JY,OAAO,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC"}
1
+ {"version":3,"file":"rsa.d.ts","sourceRoot":"","sources":["../../../src/signers/rsa.js"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,8CAFgB,OAAO;IAIrB,oBAAoB;IAmBpB;;OAEG;IACH,sCAqBC;IAED;;;;;OAKG;IACH,sBAHW,OAAO,eAAe,EAAE,aAAa,QACrC,OAAO,eAAe,EAAE,aAAa,sBA+B/C;IAED;;;;;OAKG;IACH,uBAHW,aAAa,QACb,OAAO,eAAe,EAAE,aAAa,sBAc/C;IA5FD;;;OAGG;IACH,iBAHW,OAAO,eAAe,EAAE,aAAa,WACrC,aAAa,EAOvB;IAZD,kDAAkD;IAClD,eADW,OAAO,aAAa,EAAE,aAAa,CACjC;IAgGb;;;;OAIG;IACH,cAFW,UAAU,wCAUpB;IAED;;OAEG;IACH,wBAEC;;CAKF;sBAnJY,OAAO,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC;oBANrC,SAAS"}