@actioncodes/protocol 2.0.21 → 2.0.23
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/README.md +239 -146
- package/dist/adapters/SolanaAdapter.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +6 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +6 -6
- package/dist/utils/protocolMeta.d.ts +1 -0
- package/dist/utils/protocolMeta.d.ts.map +1 -1
- package/docs/ActionCodesProtocol/README.md +2 -2
- package/docs/ActionCodesProtocol/classes/ActionCodesProtocol.md +183 -33
- package/docs/README.md +425 -8
- package/docs/adapters/BaseChainAdapter/README.md +3 -4
- package/docs/adapters/BaseChainAdapter/classes/BaseChainAdapter.md +87 -20
- package/docs/adapters/BaseChainAdapter/interfaces/ChainAdapter.md +68 -12
- package/docs/adapters/BaseChainAdapter/type-aliases/SignFn.md +25 -0
- package/docs/adapters/SolanaAdapter/README.md +6 -3
- package/docs/adapters/SolanaAdapter/classes/SolanaAdapter.md +140 -43
- package/docs/adapters/SolanaAdapter/type-aliases/SolanaTransaction.md +3 -3
- package/docs/adapters/SolanaAdapter/variables/ADAPTER_CHAIN_NAME.md +11 -0
- package/docs/constants/README.md +2 -2
- package/docs/constants/variables/CODE_CHARSET_DIGITS.md +2 -2
- package/docs/constants/variables/CODE_DEFAULT_LENGTH.md +2 -2
- package/docs/constants/variables/CODE_MAX_LENGTH.md +2 -2
- package/docs/constants/variables/CODE_MIN_LENGTH.md +2 -2
- package/docs/constants/variables/PROTOCOL_META_MAX_BYTES.md +3 -3
- package/docs/constants/variables/PROTOCOL_NORMALIZATION.md +2 -2
- package/docs/constants/variables/SUPPORTED_CHAINS.md +9 -3
- package/docs/errors/README.md +4 -2
- package/docs/errors/classes/ExpiredCodeError.md +85 -21
- package/docs/errors/classes/InvalidAdapterError.md +751 -0
- package/docs/errors/classes/InvalidCodeFormatError.md +85 -21
- package/docs/errors/classes/InvalidPubkeyFormatError.md +85 -21
- package/docs/errors/classes/InvalidSignatureError.md +85 -21
- package/docs/errors/classes/MetaMismatchError.md +85 -21
- package/docs/errors/classes/MissingMetaError.md +85 -21
- package/docs/errors/classes/ProtocolError.md +75 -21
- package/docs/errors/classes/TransactionNotSignedByIntendedOwnerError.md +85 -21
- package/docs/errors/classes/TransactionNotSignedByIssuerError.md +755 -0
- package/docs/errors/enumerations/ProtocolErrorCode.md +39 -15
- package/docs/index/README.md +170 -14
- package/docs/modules.md +3 -3
- package/docs/strategy/DelegationStrategy/README.md +11 -0
- package/docs/strategy/DelegationStrategy/classes/DelegationStrategy.md +79 -0
- package/docs/strategy/WalletStrategy/README.md +2 -2
- package/docs/strategy/WalletStrategy/classes/WalletStrategy.md +22 -18
- package/docs/types/README.md +11 -3
- package/docs/types/interfaces/ActionCode.md +23 -26
- package/docs/types/interfaces/ActionCodeRevoke.md +93 -0
- package/docs/types/interfaces/CanonicalMessageParts.md +5 -13
- package/docs/types/interfaces/CanonicalRevokeMessageParts.md +33 -0
- package/docs/types/interfaces/CodeGenerationConfig.md +6 -6
- package/docs/types/interfaces/DelegatedActionCode.md +97 -0
- package/docs/types/interfaces/DelegatedActionCodeRevoke.md +105 -0
- package/docs/types/interfaces/DelegationProof.md +49 -0
- package/docs/types/type-aliases/Chain.md +11 -0
- package/docs/utils/canonical/README.md +6 -2
- package/docs/utils/canonical/functions/getCanonicalMessageParts.md +21 -0
- package/docs/utils/canonical/functions/serializeCanonical.md +3 -3
- package/docs/utils/canonical/functions/serializeCanonicalRevoke.md +21 -0
- package/docs/utils/canonical/functions/serializeDelegationProof.md +21 -0
- package/docs/utils/canonical/variables/CANONICAL_MESSAGE_PREFIX.md +3 -3
- package/docs/utils/canonical/variables/CANONICAL_MESSAGE_VERSION.md +3 -3
- package/docs/utils/canonical/variables/CANONICAL_REVOKE_MESSAGE_PREFIX.md +11 -0
- package/docs/utils/crypto/README.md +2 -3
- package/docs/utils/crypto/functions/base32EncodeCrockford.md +2 -2
- package/docs/utils/crypto/functions/codeHash.md +2 -2
- package/docs/utils/crypto/functions/digestToDigits.md +2 -2
- package/docs/utils/crypto/functions/hkdfSha256.md +2 -2
- package/docs/utils/crypto/functions/hmacSha256.md +2 -2
- package/docs/utils/crypto/functions/sha256.md +2 -2
- package/docs/utils/crypto/functions/truncateBits.md +2 -2
- package/docs/utils/protocolMeta/README.md +2 -2
- package/docs/utils/protocolMeta/functions/buildProtocolMeta.md +3 -3
- package/docs/utils/protocolMeta/functions/parseProtocolMeta.md +3 -3
- package/docs/utils/protocolMeta/functions/validateProtocolMetaFormat.md +3 -3
- package/docs/utils/protocolMeta/interfaces/ProtocolMetaFields.md +11 -3
- package/docs/utils/protocolMeta/variables/SCHEME.md +3 -3
- package/package.json +7 -7
- package/docs/adapters/BaseChainAdapter/interfaces/BaseContext.md +0 -17
- package/docs/adapters/BaseChainAdapter/type-aliases/ChainContext.md +0 -23
- package/docs/adapters/NodeCryptoAdapter/README.md +0 -15
- package/docs/adapters/NodeCryptoAdapter/classes/NodeCryptoAdapter.md +0 -254
- package/docs/adapters/NodeCryptoAdapter/type-aliases/NodeCryptoContext.md +0 -27
- package/docs/adapters/SolanaAdapter/type-aliases/SolanaContext.md +0 -27
- package/docs/types/interfaces/CodeGenerationResult.md +0 -25
- package/docs/utils/crypto/functions/generateRandomSecret.md +0 -15
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[**@actioncodes/protocol
|
|
1
|
+
[**@actioncodes/protocol**](../../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@actioncodes/protocol
|
|
5
|
+
[@actioncodes/protocol](../../modules.md) / [errors](../README.md) / ExpiredCodeError
|
|
6
6
|
|
|
7
7
|
# Class: ExpiredCodeError
|
|
8
8
|
|
|
9
|
-
Defined in: src/errors.ts:
|
|
9
|
+
Defined in: src/errors.ts:155
|
|
10
10
|
|
|
11
11
|
## Extends
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Defined in: src/errors.ts:133
|
|
|
18
18
|
|
|
19
19
|
> **new ExpiredCodeError**(`code`, `expiresAt`, `currentTime`): `ExpiredCodeError`
|
|
20
20
|
|
|
21
|
-
Defined in: src/errors.ts:
|
|
21
|
+
Defined in: src/errors.ts:156
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
@@ -62,7 +62,7 @@ The cause of the error.
|
|
|
62
62
|
|
|
63
63
|
> `readonly` **code**: [`ProtocolErrorCode`](../enumerations/ProtocolErrorCode.md)
|
|
64
64
|
|
|
65
|
-
Defined in: src/errors.ts:
|
|
65
|
+
Defined in: src/errors.ts:34
|
|
66
66
|
|
|
67
67
|
#### Inherited from
|
|
68
68
|
|
|
@@ -74,7 +74,7 @@ Defined in: src/errors.ts:29
|
|
|
74
74
|
|
|
75
75
|
> `readonly` `optional` **details**: `Record`\<`string`, `unknown`\>
|
|
76
76
|
|
|
77
|
-
Defined in: src/errors.ts:
|
|
77
|
+
Defined in: src/errors.ts:36
|
|
78
78
|
|
|
79
79
|
#### Inherited from
|
|
80
80
|
|
|
@@ -242,7 +242,7 @@ Create .stack property on a target object
|
|
|
242
242
|
|
|
243
243
|
> `static` **create**(`code`, `message`, `details?`): [`ProtocolError`](ProtocolError.md)
|
|
244
244
|
|
|
245
|
-
Defined in: src/errors.ts:
|
|
245
|
+
Defined in: src/errors.ts:149
|
|
246
246
|
|
|
247
247
|
#### Parameters
|
|
248
248
|
|
|
@@ -272,7 +272,7 @@ Defined in: src/errors.ts:127
|
|
|
272
272
|
|
|
273
273
|
> `static` **cryptoError**(`operation`, `reason`): [`ProtocolError`](ProtocolError.md)
|
|
274
274
|
|
|
275
|
-
Defined in: src/errors.ts:
|
|
275
|
+
Defined in: src/errors.ts:127
|
|
276
276
|
|
|
277
277
|
#### Parameters
|
|
278
278
|
|
|
@@ -298,7 +298,7 @@ Defined in: src/errors.ts:110
|
|
|
298
298
|
|
|
299
299
|
> `static` **expiredCode**(`code`, `expiresAt`, `currentTime`): `ExpiredCodeError`
|
|
300
300
|
|
|
301
|
-
Defined in: src/errors.ts:
|
|
301
|
+
Defined in: src/errors.ts:43
|
|
302
302
|
|
|
303
303
|
#### Parameters
|
|
304
304
|
|
|
@@ -324,11 +324,49 @@ Defined in: src/errors.ts:38
|
|
|
324
324
|
|
|
325
325
|
***
|
|
326
326
|
|
|
327
|
+
### invalidAdapter()
|
|
328
|
+
|
|
329
|
+
> `static` **invalidAdapter**(`adapter`): [`InvalidAdapterError`](InvalidAdapterError.md)
|
|
330
|
+
|
|
331
|
+
Defined in: src/errors.ts:144
|
|
332
|
+
|
|
333
|
+
#### Parameters
|
|
334
|
+
|
|
335
|
+
##### adapter
|
|
336
|
+
|
|
337
|
+
`string`
|
|
338
|
+
|
|
339
|
+
#### Returns
|
|
340
|
+
|
|
341
|
+
[`InvalidAdapterError`](InvalidAdapterError.md)
|
|
342
|
+
|
|
343
|
+
#### Inherited from
|
|
344
|
+
|
|
345
|
+
[`ProtocolError`](ProtocolError.md).[`invalidAdapter`](ProtocolError.md#invalidadapter)
|
|
346
|
+
|
|
347
|
+
***
|
|
348
|
+
|
|
349
|
+
### invalidCode()
|
|
350
|
+
|
|
351
|
+
> `static` **invalidCode**(): [`ProtocolError`](ProtocolError.md)
|
|
352
|
+
|
|
353
|
+
Defined in: src/errors.ts:47
|
|
354
|
+
|
|
355
|
+
#### Returns
|
|
356
|
+
|
|
357
|
+
[`ProtocolError`](ProtocolError.md)
|
|
358
|
+
|
|
359
|
+
#### Inherited from
|
|
360
|
+
|
|
361
|
+
[`ProtocolError`](ProtocolError.md).[`invalidCode`](ProtocolError.md#invalidcode)
|
|
362
|
+
|
|
363
|
+
***
|
|
364
|
+
|
|
327
365
|
### invalidCodeFormat()
|
|
328
366
|
|
|
329
367
|
> `static` **invalidCodeFormat**(`code`, `reason`): [`InvalidCodeFormatError`](InvalidCodeFormatError.md)
|
|
330
368
|
|
|
331
|
-
Defined in: src/errors.ts:
|
|
369
|
+
Defined in: src/errors.ts:55
|
|
332
370
|
|
|
333
371
|
#### Parameters
|
|
334
372
|
|
|
@@ -354,7 +392,7 @@ Defined in: src/errors.ts:42
|
|
|
354
392
|
|
|
355
393
|
> `static` **invalidDigest**(`reason`): [`ProtocolError`](ProtocolError.md)
|
|
356
394
|
|
|
357
|
-
Defined in: src/errors.ts:
|
|
395
|
+
Defined in: src/errors.ts:135
|
|
358
396
|
|
|
359
397
|
#### Parameters
|
|
360
398
|
|
|
@@ -376,7 +414,7 @@ Defined in: src/errors.ts:118
|
|
|
376
414
|
|
|
377
415
|
> `static` **invalidInput**(`field`, `value`, `reason`): [`ProtocolError`](ProtocolError.md)
|
|
378
416
|
|
|
379
|
-
Defined in: src/errors.ts:
|
|
417
|
+
Defined in: src/errors.ts:110
|
|
380
418
|
|
|
381
419
|
#### Parameters
|
|
382
420
|
|
|
@@ -406,7 +444,7 @@ Defined in: src/errors.ts:93
|
|
|
406
444
|
|
|
407
445
|
> `static` **invalidMetaFormat**(`reason`): [`ProtocolError`](ProtocolError.md)
|
|
408
446
|
|
|
409
|
-
Defined in: src/errors.ts:
|
|
447
|
+
Defined in: src/errors.ts:68
|
|
410
448
|
|
|
411
449
|
#### Parameters
|
|
412
450
|
|
|
@@ -428,7 +466,7 @@ Defined in: src/errors.ts:55
|
|
|
428
466
|
|
|
429
467
|
> `static` **invalidPubkeyFormat**(`pubkey`, `reason`): [`InvalidPubkeyFormatError`](InvalidPubkeyFormatError.md)
|
|
430
468
|
|
|
431
|
-
Defined in: src/errors.ts:
|
|
469
|
+
Defined in: src/errors.ts:105
|
|
432
470
|
|
|
433
471
|
#### Parameters
|
|
434
472
|
|
|
@@ -454,7 +492,7 @@ Defined in: src/errors.ts:88
|
|
|
454
492
|
|
|
455
493
|
> `static` **invalidSignature**(`reason`): [`InvalidSignatureError`](InvalidSignatureError.md)
|
|
456
494
|
|
|
457
|
-
Defined in: src/errors.ts:
|
|
495
|
+
Defined in: src/errors.ts:59
|
|
458
496
|
|
|
459
497
|
#### Parameters
|
|
460
498
|
|
|
@@ -476,7 +514,7 @@ Defined in: src/errors.ts:46
|
|
|
476
514
|
|
|
477
515
|
> `static` **invalidTransactionFormat**(`reason`): [`ProtocolError`](ProtocolError.md)
|
|
478
516
|
|
|
479
|
-
Defined in: src/errors.ts:
|
|
517
|
+
Defined in: src/errors.ts:97
|
|
480
518
|
|
|
481
519
|
#### Parameters
|
|
482
520
|
|
|
@@ -550,7 +588,7 @@ True if the value is an instance of Error, false otherwise
|
|
|
550
588
|
|
|
551
589
|
> `static` **metaMismatch**(`expected`, `actual`, `field`): [`MetaMismatchError`](MetaMismatchError.md)
|
|
552
590
|
|
|
553
|
-
Defined in: src/errors.ts:
|
|
591
|
+
Defined in: src/errors.ts:76
|
|
554
592
|
|
|
555
593
|
#### Parameters
|
|
556
594
|
|
|
@@ -580,7 +618,7 @@ Defined in: src/errors.ts:63
|
|
|
580
618
|
|
|
581
619
|
> `static` **metaTooLarge**(`maxBytes`, `actualBytes`): [`ProtocolError`](ProtocolError.md)
|
|
582
620
|
|
|
583
|
-
Defined in: src/errors.ts:
|
|
621
|
+
Defined in: src/errors.ts:80
|
|
584
622
|
|
|
585
623
|
#### Parameters
|
|
586
624
|
|
|
@@ -606,7 +644,7 @@ Defined in: src/errors.ts:67
|
|
|
606
644
|
|
|
607
645
|
> `static` **missingMeta**(): [`MissingMetaError`](MissingMetaError.md)
|
|
608
646
|
|
|
609
|
-
Defined in: src/errors.ts:
|
|
647
|
+
Defined in: src/errors.ts:64
|
|
610
648
|
|
|
611
649
|
#### Returns
|
|
612
650
|
|
|
@@ -622,7 +660,7 @@ Defined in: src/errors.ts:51
|
|
|
622
660
|
|
|
623
661
|
> `static` **missingRequiredField**(`field`): [`ProtocolError`](ProtocolError.md)
|
|
624
662
|
|
|
625
|
-
Defined in: src/errors.ts:
|
|
663
|
+
Defined in: src/errors.ts:118
|
|
626
664
|
|
|
627
665
|
#### Parameters
|
|
628
666
|
|
|
@@ -674,7 +712,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
674
712
|
|
|
675
713
|
> `static` **transactionNotSignedByIntendedOwner**(`intended`, `actualSigners`): [`TransactionNotSignedByIntendedOwnerError`](TransactionNotSignedByIntendedOwnerError.md)
|
|
676
714
|
|
|
677
|
-
Defined in: src/errors.ts:
|
|
715
|
+
Defined in: src/errors.ts:89
|
|
678
716
|
|
|
679
717
|
#### Parameters
|
|
680
718
|
|
|
@@ -693,3 +731,29 @@ Defined in: src/errors.ts:76
|
|
|
693
731
|
#### Inherited from
|
|
694
732
|
|
|
695
733
|
[`ProtocolError`](ProtocolError.md).[`transactionNotSignedByIntendedOwner`](ProtocolError.md#transactionnotsignedbyintendedowner)
|
|
734
|
+
|
|
735
|
+
***
|
|
736
|
+
|
|
737
|
+
### transactionNotSignedByIssuer()
|
|
738
|
+
|
|
739
|
+
> `static` **transactionNotSignedByIssuer**(`issuer`, `actualSigners`): [`TransactionNotSignedByIssuerError`](TransactionNotSignedByIssuerError.md)
|
|
740
|
+
|
|
741
|
+
Defined in: src/errors.ts:93
|
|
742
|
+
|
|
743
|
+
#### Parameters
|
|
744
|
+
|
|
745
|
+
##### issuer
|
|
746
|
+
|
|
747
|
+
`string`
|
|
748
|
+
|
|
749
|
+
##### actualSigners
|
|
750
|
+
|
|
751
|
+
`string`[]
|
|
752
|
+
|
|
753
|
+
#### Returns
|
|
754
|
+
|
|
755
|
+
[`TransactionNotSignedByIssuerError`](TransactionNotSignedByIssuerError.md)
|
|
756
|
+
|
|
757
|
+
#### Inherited from
|
|
758
|
+
|
|
759
|
+
[`ProtocolError`](ProtocolError.md).[`transactionNotSignedByIssuer`](ProtocolError.md#transactionnotsignedbyissuer)
|