@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) / [ActionCodesProtocol](../README.md) / ActionCodesProtocol
|
|
6
6
|
|
|
7
7
|
# Class: ActionCodesProtocol
|
|
8
8
|
|
|
9
|
-
Defined in: src/ActionCodesProtocol.ts:
|
|
9
|
+
Defined in: src/ActionCodesProtocol.ts:22
|
|
10
10
|
|
|
11
11
|
## Constructors
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Defined in: src/ActionCodesProtocol.ts:7
|
|
|
14
14
|
|
|
15
15
|
> **new ActionCodesProtocol**(`config`): `ActionCodesProtocol`
|
|
16
16
|
|
|
17
|
-
Defined in: src/ActionCodesProtocol.ts:
|
|
17
|
+
Defined in: src/ActionCodesProtocol.ts:27
|
|
18
18
|
|
|
19
19
|
#### Parameters
|
|
20
20
|
|
|
@@ -34,7 +34,7 @@ Defined in: src/ActionCodesProtocol.ts:10
|
|
|
34
34
|
|
|
35
35
|
> **get** **adapter**(): `object`
|
|
36
36
|
|
|
37
|
-
Defined in: src/ActionCodesProtocol.ts:
|
|
37
|
+
Defined in: src/ActionCodesProtocol.ts:51
|
|
38
38
|
|
|
39
39
|
Typed access to specific adapters
|
|
40
40
|
|
|
@@ -46,43 +46,103 @@ Typed access to specific adapters
|
|
|
46
46
|
|
|
47
47
|
> **solana**: [`SolanaAdapter`](../../adapters/SolanaAdapter/classes/SolanaAdapter.md)
|
|
48
48
|
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### delegationStrategy
|
|
52
|
+
|
|
53
|
+
#### Get Signature
|
|
54
|
+
|
|
55
|
+
> **get** **delegationStrategy**(): [`DelegationStrategy`](../../strategy/DelegationStrategy/classes/DelegationStrategy.md)
|
|
56
|
+
|
|
57
|
+
Defined in: src/ActionCodesProtocol.ts:62
|
|
58
|
+
|
|
59
|
+
##### Returns
|
|
60
|
+
|
|
61
|
+
[`DelegationStrategy`](../../strategy/DelegationStrategy/classes/DelegationStrategy.md)
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### walletStrategy
|
|
66
|
+
|
|
67
|
+
#### Get Signature
|
|
68
|
+
|
|
69
|
+
> **get** **walletStrategy**(): [`WalletStrategy`](../../strategy/WalletStrategy/classes/WalletStrategy.md)
|
|
70
|
+
|
|
71
|
+
Defined in: src/ActionCodesProtocol.ts:58
|
|
72
|
+
|
|
73
|
+
Access to strategies
|
|
74
|
+
|
|
75
|
+
##### Returns
|
|
76
|
+
|
|
77
|
+
[`WalletStrategy`](../../strategy/WalletStrategy/classes/WalletStrategy.md)
|
|
78
|
+
|
|
49
79
|
## Methods
|
|
50
80
|
|
|
51
|
-
###
|
|
81
|
+
### generate()
|
|
52
82
|
|
|
53
|
-
|
|
83
|
+
#### Call Signature
|
|
54
84
|
|
|
55
|
-
|
|
85
|
+
> **generate**(`strategy`, `pubkey`, `chain`, `signFn`): `Promise`\<[`ActionCode`](../../types/interfaces/ActionCode.md)\>
|
|
56
86
|
|
|
57
|
-
|
|
87
|
+
Defined in: src/ActionCodesProtocol.ts:67
|
|
58
88
|
|
|
59
|
-
#####
|
|
89
|
+
##### Parameters
|
|
60
90
|
|
|
61
|
-
|
|
91
|
+
###### strategy
|
|
62
92
|
|
|
63
|
-
|
|
93
|
+
`"wallet"`
|
|
94
|
+
|
|
95
|
+
###### pubkey
|
|
64
96
|
|
|
65
97
|
`string`
|
|
66
98
|
|
|
67
|
-
|
|
99
|
+
###### chain
|
|
68
100
|
|
|
69
|
-
`
|
|
101
|
+
`"solana"`
|
|
70
102
|
|
|
71
|
-
|
|
103
|
+
###### signFn
|
|
72
104
|
|
|
73
|
-
|
|
105
|
+
[`SignFn`](../../adapters/BaseChainAdapter/type-aliases/SignFn.md)
|
|
74
106
|
|
|
75
|
-
#####
|
|
107
|
+
##### Returns
|
|
108
|
+
|
|
109
|
+
`Promise`\<[`ActionCode`](../../types/interfaces/ActionCode.md)\>
|
|
110
|
+
|
|
111
|
+
#### Call Signature
|
|
112
|
+
|
|
113
|
+
> **generate**(`strategy`, `delegationProof`, `chain`, `signFn`): `Promise`\<[`DelegatedActionCode`](../../types/interfaces/DelegatedActionCode.md)\>
|
|
114
|
+
|
|
115
|
+
Defined in: src/ActionCodesProtocol.ts:73
|
|
116
|
+
|
|
117
|
+
##### Parameters
|
|
118
|
+
|
|
119
|
+
###### strategy
|
|
120
|
+
|
|
121
|
+
`"delegation"`
|
|
122
|
+
|
|
123
|
+
###### delegationProof
|
|
124
|
+
|
|
125
|
+
[`DelegationProof`](../../types/interfaces/DelegationProof.md)
|
|
126
|
+
|
|
127
|
+
###### chain
|
|
128
|
+
|
|
129
|
+
`"solana"`
|
|
130
|
+
|
|
131
|
+
###### signFn
|
|
76
132
|
|
|
77
|
-
|
|
133
|
+
[`SignFn`](../../adapters/BaseChainAdapter/type-aliases/SignFn.md)
|
|
134
|
+
|
|
135
|
+
##### Returns
|
|
136
|
+
|
|
137
|
+
`Promise`\<[`DelegatedActionCode`](../../types/interfaces/DelegatedActionCode.md)\>
|
|
78
138
|
|
|
79
139
|
***
|
|
80
140
|
|
|
81
141
|
### getAdapter()
|
|
82
142
|
|
|
83
|
-
> **getAdapter**(`chain`): `undefined` \| [`ChainAdapter`](../../adapters/BaseChainAdapter/interfaces/ChainAdapter.md)
|
|
143
|
+
> **getAdapter**(`chain`): `undefined` \| [`ChainAdapter`](../../adapters/BaseChainAdapter/interfaces/ChainAdapter.md)
|
|
84
144
|
|
|
85
|
-
Defined in: src/ActionCodesProtocol.ts:
|
|
145
|
+
Defined in: src/ActionCodesProtocol.ts:46
|
|
86
146
|
|
|
87
147
|
Get a registered adapter
|
|
88
148
|
|
|
@@ -94,7 +154,19 @@ Get a registered adapter
|
|
|
94
154
|
|
|
95
155
|
#### Returns
|
|
96
156
|
|
|
97
|
-
`undefined` \| [`ChainAdapter`](../../adapters/BaseChainAdapter/interfaces/ChainAdapter.md)
|
|
157
|
+
`undefined` \| [`ChainAdapter`](../../adapters/BaseChainAdapter/interfaces/ChainAdapter.md)
|
|
158
|
+
|
|
159
|
+
***
|
|
160
|
+
|
|
161
|
+
### getConfig()
|
|
162
|
+
|
|
163
|
+
> **getConfig**(): [`CodeGenerationConfig`](../../types/interfaces/CodeGenerationConfig.md)
|
|
164
|
+
|
|
165
|
+
Defined in: src/ActionCodesProtocol.ts:36
|
|
166
|
+
|
|
167
|
+
#### Returns
|
|
168
|
+
|
|
169
|
+
[`CodeGenerationConfig`](../../types/interfaces/CodeGenerationConfig.md)
|
|
98
170
|
|
|
99
171
|
***
|
|
100
172
|
|
|
@@ -102,7 +174,7 @@ Get a registered adapter
|
|
|
102
174
|
|
|
103
175
|
> **registerAdapter**(`chain`, `adapter`): `void`
|
|
104
176
|
|
|
105
|
-
Defined in: src/ActionCodesProtocol.ts:
|
|
177
|
+
Defined in: src/ActionCodesProtocol.ts:41
|
|
106
178
|
|
|
107
179
|
Register a chain adapter
|
|
108
180
|
|
|
@@ -122,26 +194,104 @@ Register a chain adapter
|
|
|
122
194
|
|
|
123
195
|
***
|
|
124
196
|
|
|
125
|
-
###
|
|
197
|
+
### revoke()
|
|
126
198
|
|
|
127
|
-
|
|
199
|
+
#### Call Signature
|
|
128
200
|
|
|
129
|
-
|
|
201
|
+
> **revoke**(`strategy`, `actionCode`, `chain`, `signFn`): `Promise`\<[`ActionCodeRevoke`](../../types/interfaces/ActionCodeRevoke.md)\>
|
|
130
202
|
|
|
131
|
-
|
|
203
|
+
Defined in: src/ActionCodesProtocol.ts:124
|
|
204
|
+
|
|
205
|
+
##### Parameters
|
|
206
|
+
|
|
207
|
+
###### strategy
|
|
208
|
+
|
|
209
|
+
`"wallet"`
|
|
132
210
|
|
|
133
|
-
|
|
211
|
+
###### actionCode
|
|
134
212
|
|
|
135
213
|
[`ActionCode`](../../types/interfaces/ActionCode.md)
|
|
136
214
|
|
|
137
|
-
|
|
215
|
+
###### chain
|
|
138
216
|
|
|
139
|
-
`
|
|
217
|
+
`"solana"`
|
|
140
218
|
|
|
141
|
-
|
|
219
|
+
###### signFn
|
|
142
220
|
|
|
143
|
-
|
|
221
|
+
[`SignFn`](../../adapters/BaseChainAdapter/type-aliases/SignFn.md)
|
|
144
222
|
|
|
145
|
-
|
|
223
|
+
##### Returns
|
|
224
|
+
|
|
225
|
+
`Promise`\<[`ActionCodeRevoke`](../../types/interfaces/ActionCodeRevoke.md)\>
|
|
226
|
+
|
|
227
|
+
#### Call Signature
|
|
228
|
+
|
|
229
|
+
> **revoke**(`strategy`, `actionCode`, `chain`, `signFn`): `Promise`\<[`DelegatedActionCodeRevoke`](../../types/interfaces/DelegatedActionCodeRevoke.md)\>
|
|
230
|
+
|
|
231
|
+
Defined in: src/ActionCodesProtocol.ts:130
|
|
232
|
+
|
|
233
|
+
##### Parameters
|
|
234
|
+
|
|
235
|
+
###### strategy
|
|
236
|
+
|
|
237
|
+
`"delegation"`
|
|
238
|
+
|
|
239
|
+
###### actionCode
|
|
240
|
+
|
|
241
|
+
[`DelegatedActionCode`](../../types/interfaces/DelegatedActionCode.md)
|
|
242
|
+
|
|
243
|
+
###### chain
|
|
244
|
+
|
|
245
|
+
`"solana"`
|
|
246
|
+
|
|
247
|
+
###### signFn
|
|
248
|
+
|
|
249
|
+
[`SignFn`](../../adapters/BaseChainAdapter/type-aliases/SignFn.md)
|
|
250
|
+
|
|
251
|
+
##### Returns
|
|
252
|
+
|
|
253
|
+
`Promise`\<[`DelegatedActionCodeRevoke`](../../types/interfaces/DelegatedActionCodeRevoke.md)\>
|
|
254
|
+
|
|
255
|
+
***
|
|
146
256
|
|
|
147
|
-
|
|
257
|
+
### validate()
|
|
258
|
+
|
|
259
|
+
#### Call Signature
|
|
260
|
+
|
|
261
|
+
> **validate**(`strategy`, `actionCode`): `void`
|
|
262
|
+
|
|
263
|
+
Defined in: src/ActionCodesProtocol.ts:193
|
|
264
|
+
|
|
265
|
+
##### Parameters
|
|
266
|
+
|
|
267
|
+
###### strategy
|
|
268
|
+
|
|
269
|
+
`"wallet"`
|
|
270
|
+
|
|
271
|
+
###### actionCode
|
|
272
|
+
|
|
273
|
+
[`ActionCode`](../../types/interfaces/ActionCode.md)
|
|
274
|
+
|
|
275
|
+
##### Returns
|
|
276
|
+
|
|
277
|
+
`void`
|
|
278
|
+
|
|
279
|
+
#### Call Signature
|
|
280
|
+
|
|
281
|
+
> **validate**(`strategy`, `actionCode`): `void`
|
|
282
|
+
|
|
283
|
+
Defined in: src/ActionCodesProtocol.ts:194
|
|
284
|
+
|
|
285
|
+
##### Parameters
|
|
286
|
+
|
|
287
|
+
###### strategy
|
|
288
|
+
|
|
289
|
+
`"delegation"`
|
|
290
|
+
|
|
291
|
+
###### actionCode
|
|
292
|
+
|
|
293
|
+
[`DelegatedActionCode`](../../types/interfaces/DelegatedActionCode.md)
|
|
294
|
+
|
|
295
|
+
##### Returns
|
|
296
|
+
|
|
297
|
+
`void`
|