@actioncodes/protocol 1.2.2 → 2.0.1
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/LICENSE +1 -1
- package/README.md +318 -33
- package/dist/ActionCodesProtocol.d.ts +37 -0
- package/dist/ActionCodesProtocol.d.ts.map +1 -0
- package/dist/adapters/BaseChainAdapter.d.ts +22 -0
- package/dist/adapters/BaseChainAdapter.d.ts.map +1 -0
- package/dist/adapters/SolanaAdapter.d.ts +44 -0
- package/dist/adapters/SolanaAdapter.d.ts.map +1 -0
- package/dist/constants.d.ts +6 -8
- package/dist/constants.d.ts.map +1 -1
- package/dist/errors.d.ts +63 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +25 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -36
- package/dist/index.js.map +25 -0
- package/dist/strategy/DelegationStrategy.d.ts +45 -0
- package/dist/strategy/DelegationStrategy.d.ts.map +1 -0
- package/dist/strategy/WalletStrategy.d.ts +8 -0
- package/dist/strategy/WalletStrategy.d.ts.map +1 -0
- package/dist/types.d.ts +40 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/canonical.d.ts +5 -0
- package/dist/utils/canonical.d.ts.map +1 -0
- package/dist/utils/crypto.d.ts +13 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/protocolMeta.d.ts +16 -0
- package/dist/utils/protocolMeta.d.ts.map +1 -0
- package/docs/ActionCodesProtocol/README.md +11 -0
- package/docs/ActionCodesProtocol/classes/ActionCodesProtocol.md +147 -0
- package/docs/README.md +10 -50
- package/docs/adapters/BaseChainAdapter/README.md +20 -0
- package/docs/adapters/BaseChainAdapter/classes/BaseChainAdapter.md +56 -0
- package/docs/adapters/BaseChainAdapter/interfaces/BaseContext.md +17 -0
- package/docs/adapters/BaseChainAdapter/interfaces/ChainAdapter.md +33 -0
- package/docs/adapters/BaseChainAdapter/type-aliases/ChainContext.md +23 -0
- package/docs/adapters/NodeCryptoAdapter/README.md +15 -0
- package/docs/adapters/NodeCryptoAdapter/classes/NodeCryptoAdapter.md +254 -0
- package/docs/adapters/NodeCryptoAdapter/type-aliases/NodeCryptoContext.md +27 -0
- package/docs/adapters/SolanaAdapter/README.md +16 -0
- package/docs/adapters/SolanaAdapter/classes/SolanaAdapter.md +190 -0
- package/docs/adapters/SolanaAdapter/type-aliases/SolanaContext.md +27 -0
- package/docs/adapters/SolanaAdapter/type-aliases/SolanaTransaction.md +13 -0
- package/docs/constants/README.md +8 -13
- package/docs/constants/variables/CODE_CHARSET_DIGITS.md +11 -0
- package/docs/constants/variables/CODE_DEFAULT_LENGTH.md +11 -0
- package/docs/constants/variables/CODE_MAX_LENGTH.md +11 -0
- package/docs/constants/variables/CODE_MIN_LENGTH.md +11 -0
- package/docs/constants/variables/PROTOCOL_META_MAX_BYTES.md +11 -0
- package/docs/constants/variables/PROTOCOL_NORMALIZATION.md +11 -0
- package/docs/constants/variables/SUPPORTED_CHAINS.md +3 -3
- package/docs/errors/README.md +22 -0
- package/docs/errors/classes/ExpiredCodeError.md +695 -0
- package/docs/errors/classes/InvalidCodeFormatError.md +691 -0
- package/docs/errors/classes/InvalidPubkeyFormatError.md +691 -0
- package/docs/errors/classes/InvalidSignatureError.md +687 -0
- package/docs/errors/classes/MetaMismatchError.md +695 -0
- package/docs/errors/classes/MissingMetaError.md +681 -0
- package/docs/errors/classes/ProtocolError.md +637 -0
- package/docs/errors/classes/TransactionNotSignedByIntendedOwnerError.md +691 -0
- package/docs/errors/enumerations/ProtocolErrorCode.md +121 -0
- package/docs/index/README.md +83 -41
- package/docs/modules.md +12 -9
- package/docs/strategy/WalletStrategy/README.md +11 -0
- package/docs/strategy/WalletStrategy/classes/WalletStrategy.md +67 -0
- package/docs/types/README.md +14 -0
- package/docs/types/interfaces/ActionCode.md +65 -0
- package/docs/types/interfaces/CanonicalMessageParts.md +33 -0
- package/docs/types/interfaces/CodeGenerationConfig.md +33 -0
- package/docs/types/interfaces/CodeGenerationResult.md +25 -0
- package/docs/utils/canonical/README.md +16 -0
- package/docs/utils/canonical/functions/serializeCanonical.md +21 -0
- package/docs/utils/canonical/variables/CANONICAL_MESSAGE_PREFIX.md +11 -0
- package/docs/utils/canonical/variables/CANONICAL_MESSAGE_VERSION.md +11 -0
- package/docs/utils/crypto/README.md +18 -0
- package/docs/utils/crypto/functions/base32EncodeCrockford.md +21 -0
- package/docs/utils/crypto/functions/codeHash.md +21 -0
- package/docs/utils/crypto/functions/digestToDigits.md +25 -0
- package/docs/utils/crypto/functions/generateRandomSecret.md +15 -0
- package/docs/utils/crypto/functions/hkdfSha256.md +35 -0
- package/docs/utils/crypto/functions/hmacSha256.md +25 -0
- package/docs/utils/crypto/functions/sha256.md +21 -0
- package/docs/utils/crypto/functions/truncateBits.md +25 -0
- package/docs/utils/protocolMeta/README.md +21 -0
- package/docs/utils/protocolMeta/functions/buildProtocolMeta.md +21 -0
- package/docs/utils/protocolMeta/functions/parseProtocolMeta.md +21 -0
- package/docs/utils/protocolMeta/functions/validateProtocolMetaFormat.md +21 -0
- package/docs/utils/protocolMeta/interfaces/ProtocolMetaFields.md +41 -0
- package/docs/utils/protocolMeta/variables/SCHEME.md +11 -0
- package/package.json +42 -47
- package/dist/actioncode.d.ts +0 -120
- package/dist/actioncode.d.ts.map +0 -1
- package/dist/actioncode.js +0 -186
- package/dist/adapters/base.d.ts +0 -93
- package/dist/adapters/base.d.ts.map +0 -1
- package/dist/adapters/base.js +0 -65
- package/dist/adapters/solana/index.d.ts +0 -2
- package/dist/adapters/solana/index.d.ts.map +0 -1
- package/dist/adapters/solana/index.js +0 -30
- package/dist/adapters/solana/solana.d.ts +0 -113
- package/dist/adapters/solana/solana.d.ts.map +0 -1
- package/dist/adapters/solana/solana.js +0 -537
- package/dist/codegen.d.ts +0 -76
- package/dist/codegen.d.ts.map +0 -1
- package/dist/codegen.js +0 -211
- package/dist/constants.js +0 -24
- package/dist/meta.d.ts +0 -54
- package/dist/meta.d.ts.map +0 -1
- package/dist/meta.js +0 -104
- package/dist/protocol.d.ts +0 -179
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js +0 -390
- package/docs/_media/LICENSE +0 -201
- package/docs/_media/README.md +0 -28
- package/docs/actioncode/README.md +0 -21
- package/docs/actioncode/classes/ActionCode.md +0 -430
- package/docs/actioncode/interfaces/ActionCodeFields.md +0 -89
- package/docs/actioncode/interfaces/ActionCodeMetadata.md +0 -25
- package/docs/actioncode/interfaces/ActionCodeTransaction.md +0 -57
- package/docs/actioncode/type-aliases/ActionCodeStatus.md +0 -11
- package/docs/adapters/base/README.md +0 -11
- package/docs/adapters/base/classes/BaseChainAdapter.md +0 -396
- package/docs/adapters/solana/README.md +0 -19
- package/docs/adapters/solana/solana/README.md +0 -15
- package/docs/adapters/solana/solana/classes/SolanaAdapter.md +0 -506
- package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +0 -13
- package/docs/codegen/README.md +0 -11
- package/docs/codegen/classes/CodeGenerator.md +0 -341
- package/docs/constants/type-aliases/SupportedChain.md +0 -11
- package/docs/constants/variables/CODE_LENGTH.md +0 -11
- package/docs/constants/variables/CODE_TTL.md +0 -11
- package/docs/constants/variables/MAX_PREFIX_LENGTH.md +0 -11
- package/docs/constants/variables/MIN_PREFIX_LENGTH.md +0 -11
- package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +0 -11
- package/docs/constants/variables/PROTOCOL_PREFIX.md +0 -11
- package/docs/constants/variables/PROTOCOL_VERSION.md +0 -11
- package/docs/meta/README.md +0 -15
- package/docs/meta/classes/ProtocolMetaParser.md +0 -177
- package/docs/meta/interfaces/ProtocolMetaV1.md +0 -59
- package/docs/protocol/README.md +0 -51
- package/docs/protocol/classes/ActionCodesProtocol.md +0 -676
- package/docs/protocol/interfaces/ProtocolConfig.md +0 -71
@@ -1,341 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [codegen](../README.md) / CodeGenerator
|
6
|
-
|
7
|
-
# Class: CodeGenerator
|
8
|
-
|
9
|
-
Defined in: [codegen.ts:4](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L4)
|
10
|
-
|
11
|
-
## Constructors
|
12
|
-
|
13
|
-
### Constructor
|
14
|
-
|
15
|
-
> **new CodeGenerator**(): `CodeGenerator`
|
16
|
-
|
17
|
-
#### Returns
|
18
|
-
|
19
|
-
`CodeGenerator`
|
20
|
-
|
21
|
-
## Properties
|
22
|
-
|
23
|
-
### CODE\_DIGITS
|
24
|
-
|
25
|
-
> `static` **CODE\_DIGITS**: `number` = `CODE_LENGTH`
|
26
|
-
|
27
|
-
Defined in: [codegen.ts:6](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L6)
|
28
|
-
|
29
|
-
***
|
30
|
-
|
31
|
-
### MAX\_PREFIX\_LENGTH
|
32
|
-
|
33
|
-
> `static` **MAX\_PREFIX\_LENGTH**: `number`
|
34
|
-
|
35
|
-
Defined in: [codegen.ts:8](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L8)
|
36
|
-
|
37
|
-
***
|
38
|
-
|
39
|
-
### MIN\_PREFIX\_LENGTH
|
40
|
-
|
41
|
-
> `static` **MIN\_PREFIX\_LENGTH**: `number`
|
42
|
-
|
43
|
-
Defined in: [codegen.ts:7](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L7)
|
44
|
-
|
45
|
-
***
|
46
|
-
|
47
|
-
### TIME\_WINDOW\_MS
|
48
|
-
|
49
|
-
> `static` **TIME\_WINDOW\_MS**: `number` = `CODE_TTL`
|
50
|
-
|
51
|
-
Defined in: [codegen.ts:5](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L5)
|
52
|
-
|
53
|
-
## Methods
|
54
|
-
|
55
|
-
### deriveCodeHash()
|
56
|
-
|
57
|
-
> `static` **deriveCodeHash**(`pubkey`, `prefix`, `timestamp?`): `string`
|
58
|
-
|
59
|
-
Defined in: [codegen.ts:167](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L167)
|
60
|
-
|
61
|
-
Derive the full SHA-256 hash for storage or encryption key generation
|
62
|
-
|
63
|
-
#### Parameters
|
64
|
-
|
65
|
-
##### pubkey
|
66
|
-
|
67
|
-
`string`
|
68
|
-
|
69
|
-
Solana wallet public key (base58)
|
70
|
-
|
71
|
-
##### prefix
|
72
|
-
|
73
|
-
`string` = `PROTOCOL_CODE_PREFIX`
|
74
|
-
|
75
|
-
Optional namespace prefix (default: PROTOCOL_CODE_PREFIX)
|
76
|
-
|
77
|
-
##### timestamp?
|
78
|
-
|
79
|
-
`number`
|
80
|
-
|
81
|
-
UNIX timestamp in milliseconds (defaults to now)
|
82
|
-
|
83
|
-
#### Returns
|
84
|
-
|
85
|
-
`string`
|
86
|
-
|
87
|
-
Full SHA-256 hash string
|
88
|
-
|
89
|
-
***
|
90
|
-
|
91
|
-
### generateCode()
|
92
|
-
|
93
|
-
> `static` **generateCode**(`pubkey`, `prefix`, `timestamp`): `object`
|
94
|
-
|
95
|
-
Defined in: [codegen.ts:123](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L123)
|
96
|
-
|
97
|
-
Generate a deterministic 8-digit code based on public key, prefix, and timestamp
|
98
|
-
|
99
|
-
#### Parameters
|
100
|
-
|
101
|
-
##### pubkey
|
102
|
-
|
103
|
-
`string`
|
104
|
-
|
105
|
-
Solana wallet public key (base58)
|
106
|
-
|
107
|
-
##### prefix
|
108
|
-
|
109
|
-
`string` = `PROTOCOL_CODE_PREFIX`
|
110
|
-
|
111
|
-
Optional namespace prefix (default: PROTOCOL_CODE_PREFIX)
|
112
|
-
|
113
|
-
##### timestamp
|
114
|
-
|
115
|
-
`number` = `...`
|
116
|
-
|
117
|
-
UNIX timestamp in milliseconds (defaults to now)
|
118
|
-
|
119
|
-
#### Returns
|
120
|
-
|
121
|
-
`object`
|
122
|
-
|
123
|
-
Object containing code, issuedAt, and expiresAt timestamps
|
124
|
-
|
125
|
-
##### code
|
126
|
-
|
127
|
-
> **code**: `string`
|
128
|
-
|
129
|
-
##### expiresAt
|
130
|
-
|
131
|
-
> **expiresAt**: `number`
|
132
|
-
|
133
|
-
##### issuedAt
|
134
|
-
|
135
|
-
> **issuedAt**: `number`
|
136
|
-
|
137
|
-
#### Throws
|
138
|
-
|
139
|
-
Error if generated code is invalid
|
140
|
-
|
141
|
-
***
|
142
|
-
|
143
|
-
### getExpectedCode()
|
144
|
-
|
145
|
-
> `static` **getExpectedCode**(`pubkey`, `timestamp`, `prefix`): `string`
|
146
|
-
|
147
|
-
Defined in: [codegen.ts:186](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L186)
|
148
|
-
|
149
|
-
Get the expected code for a given public key and timestamp
|
150
|
-
|
151
|
-
#### Parameters
|
152
|
-
|
153
|
-
##### pubkey
|
154
|
-
|
155
|
-
`string`
|
156
|
-
|
157
|
-
Solana wallet public key (base58)
|
158
|
-
|
159
|
-
##### timestamp
|
160
|
-
|
161
|
-
`number`
|
162
|
-
|
163
|
-
UNIX timestamp in milliseconds
|
164
|
-
|
165
|
-
##### prefix
|
166
|
-
|
167
|
-
`string` = `PROTOCOL_CODE_PREFIX`
|
168
|
-
|
169
|
-
Optional namespace prefix (default: PROTOCOL_CODE_PREFIX)
|
170
|
-
|
171
|
-
#### Returns
|
172
|
-
|
173
|
-
`string`
|
174
|
-
|
175
|
-
Full code string with prefix + 8 digits
|
176
|
-
|
177
|
-
***
|
178
|
-
|
179
|
-
### isValidTimestamp()
|
180
|
-
|
181
|
-
> `static` **isValidTimestamp**(`timestamp`): `boolean`
|
182
|
-
|
183
|
-
Defined in: [codegen.ts:228](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L228)
|
184
|
-
|
185
|
-
Check if a timestamp falls within a valid time window
|
186
|
-
|
187
|
-
#### Parameters
|
188
|
-
|
189
|
-
##### timestamp
|
190
|
-
|
191
|
-
`number`
|
192
|
-
|
193
|
-
UNIX timestamp in milliseconds
|
194
|
-
|
195
|
-
#### Returns
|
196
|
-
|
197
|
-
`boolean`
|
198
|
-
|
199
|
-
True if timestamp is valid
|
200
|
-
|
201
|
-
***
|
202
|
-
|
203
|
-
### normalizePrefix()
|
204
|
-
|
205
|
-
> `static` **normalizePrefix**(`prefix`): `string`
|
206
|
-
|
207
|
-
Defined in: [codegen.ts:107](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L107)
|
208
|
-
|
209
|
-
Normalize prefix - convert PROTOCOL_CODE_PREFIX to empty string, validate others
|
210
|
-
|
211
|
-
#### Parameters
|
212
|
-
|
213
|
-
##### prefix
|
214
|
-
|
215
|
-
`string`
|
216
|
-
|
217
|
-
The prefix to normalize
|
218
|
-
|
219
|
-
#### Returns
|
220
|
-
|
221
|
-
`string`
|
222
|
-
|
223
|
-
Normalized prefix
|
224
|
-
|
225
|
-
#### Throws
|
226
|
-
|
227
|
-
Error if prefix is invalid
|
228
|
-
|
229
|
-
***
|
230
|
-
|
231
|
-
### validateCode()
|
232
|
-
|
233
|
-
> `static` **validateCode**(`code`, `pubkey`, `timestamp`, `prefix`): `boolean`
|
234
|
-
|
235
|
-
Defined in: [codegen.ts:202](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L202)
|
236
|
-
|
237
|
-
Validate if a code matches the expected code for a given public key and timestamp
|
238
|
-
|
239
|
-
#### Parameters
|
240
|
-
|
241
|
-
##### code
|
242
|
-
|
243
|
-
`string`
|
244
|
-
|
245
|
-
The code to validate (can include prefix)
|
246
|
-
|
247
|
-
##### pubkey
|
248
|
-
|
249
|
-
`string`
|
250
|
-
|
251
|
-
Solana wallet public key (base58)
|
252
|
-
|
253
|
-
##### timestamp
|
254
|
-
|
255
|
-
`number`
|
256
|
-
|
257
|
-
UNIX timestamp in milliseconds
|
258
|
-
|
259
|
-
##### prefix
|
260
|
-
|
261
|
-
`string` = `PROTOCOL_CODE_PREFIX`
|
262
|
-
|
263
|
-
Optional namespace prefix (default: PROTOCOL_CODE_PREFIX)
|
264
|
-
|
265
|
-
#### Returns
|
266
|
-
|
267
|
-
`boolean`
|
268
|
-
|
269
|
-
True if code matches expected code and timestamp is valid
|
270
|
-
|
271
|
-
***
|
272
|
-
|
273
|
-
### validateCodeDigits()
|
274
|
-
|
275
|
-
> `static` **validateCodeDigits**(`code`): `boolean`
|
276
|
-
|
277
|
-
Defined in: [codegen.ts:67](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L67)
|
278
|
-
|
279
|
-
Validate that the numeric part of a code is exactly 8 digits
|
280
|
-
|
281
|
-
#### Parameters
|
282
|
-
|
283
|
-
##### code
|
284
|
-
|
285
|
-
`string`
|
286
|
-
|
287
|
-
The code to validate (can include prefix)
|
288
|
-
|
289
|
-
#### Returns
|
290
|
-
|
291
|
-
`boolean`
|
292
|
-
|
293
|
-
True if numeric part is valid, false otherwise
|
294
|
-
|
295
|
-
***
|
296
|
-
|
297
|
-
### validateCodeFormat()
|
298
|
-
|
299
|
-
> `static` **validateCodeFormat**(`code`): `boolean`
|
300
|
-
|
301
|
-
Defined in: [codegen.ts:26](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L26)
|
302
|
-
|
303
|
-
Validate generated code format (prefix + exactly 8 digits)
|
304
|
-
|
305
|
-
#### Parameters
|
306
|
-
|
307
|
-
##### code
|
308
|
-
|
309
|
-
`string`
|
310
|
-
|
311
|
-
The code to validate
|
312
|
-
|
313
|
-
#### Returns
|
314
|
-
|
315
|
-
`boolean`
|
316
|
-
|
317
|
-
True if code is valid, false otherwise
|
318
|
-
|
319
|
-
***
|
320
|
-
|
321
|
-
### validatePrefix()
|
322
|
-
|
323
|
-
> `static` **validatePrefix**(`prefix`): `boolean`
|
324
|
-
|
325
|
-
Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/codegen.ts#L15)
|
326
|
-
|
327
|
-
Validate prefix format
|
328
|
-
|
329
|
-
#### Parameters
|
330
|
-
|
331
|
-
##### prefix
|
332
|
-
|
333
|
-
`string`
|
334
|
-
|
335
|
-
The prefix to validate
|
336
|
-
|
337
|
-
#### Returns
|
338
|
-
|
339
|
-
`boolean`
|
340
|
-
|
341
|
-
True if prefix is valid, false otherwise
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / SupportedChain
|
6
|
-
|
7
|
-
# Type Alias: SupportedChain
|
8
|
-
|
9
|
-
> **SupportedChain** = *typeof* [`SUPPORTED_CHAINS`](../variables/SUPPORTED_CHAINS.md)\[`number`\]
|
10
|
-
|
11
|
-
Defined in: [constants.ts:9](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L9)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / CODE\_LENGTH
|
6
|
-
|
7
|
-
# Variable: CODE\_LENGTH
|
8
|
-
|
9
|
-
> `const` **CODE\_LENGTH**: `8` = `8`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:3](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L3)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / CODE\_TTL
|
6
|
-
|
7
|
-
# Variable: CODE\_TTL
|
8
|
-
|
9
|
-
> `const` **CODE\_TTL**: `number`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:4](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L4)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / MAX\_PREFIX\_LENGTH
|
6
|
-
|
7
|
-
# Variable: MAX\_PREFIX\_LENGTH
|
8
|
-
|
9
|
-
> `const` **MAX\_PREFIX\_LENGTH**: `12` = `12`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:7](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L7)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / MIN\_PREFIX\_LENGTH
|
6
|
-
|
7
|
-
# Variable: MIN\_PREFIX\_LENGTH
|
8
|
-
|
9
|
-
> `const` **MIN\_PREFIX\_LENGTH**: `3` = `3`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:6](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L6)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_CODE\_PREFIX
|
6
|
-
|
7
|
-
# Variable: PROTOCOL\_CODE\_PREFIX
|
8
|
-
|
9
|
-
> `const` **PROTOCOL\_CODE\_PREFIX**: `"DEFAULT"` = `"DEFAULT"`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:5](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L5)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_PREFIX
|
6
|
-
|
7
|
-
# Variable: PROTOCOL\_PREFIX
|
8
|
-
|
9
|
-
> `const` **PROTOCOL\_PREFIX**: `"actioncodes"` = `"actioncodes"`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:2](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L2)
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [constants](../README.md) / PROTOCOL\_VERSION
|
6
|
-
|
7
|
-
# Variable: PROTOCOL\_VERSION
|
8
|
-
|
9
|
-
> `const` **PROTOCOL\_VERSION**: `"1"` = `"1"`
|
10
|
-
|
11
|
-
Defined in: [constants.ts:1](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/constants.ts#L1)
|
package/docs/meta/README.md
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../modules.md) / meta
|
6
|
-
|
7
|
-
# meta
|
8
|
-
|
9
|
-
## Classes
|
10
|
-
|
11
|
-
- [ProtocolMetaParser](classes/ProtocolMetaParser.md)
|
12
|
-
|
13
|
-
## Interfaces
|
14
|
-
|
15
|
-
- [ProtocolMetaV1](interfaces/ProtocolMetaV1.md)
|
@@ -1,177 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [meta](../README.md) / ProtocolMetaParser
|
6
|
-
|
7
|
-
# Class: ProtocolMetaParser
|
8
|
-
|
9
|
-
Defined in: [meta.ts:19](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L19)
|
10
|
-
|
11
|
-
Protocol meta parser for structured memo/message parsing
|
12
|
-
|
13
|
-
## Constructors
|
14
|
-
|
15
|
-
### Constructor
|
16
|
-
|
17
|
-
> **new ProtocolMetaParser**(): `ProtocolMetaParser`
|
18
|
-
|
19
|
-
#### Returns
|
20
|
-
|
21
|
-
`ProtocolMetaParser`
|
22
|
-
|
23
|
-
## Methods
|
24
|
-
|
25
|
-
### fromInitiator()
|
26
|
-
|
27
|
-
> `static` **fromInitiator**(`initiator`, `iss`, `prefix`, `params?`, `timestamp?`): [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
28
|
-
|
29
|
-
Defined in: [meta.ts:74](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L74)
|
30
|
-
|
31
|
-
Create protocol meta from code and parameters
|
32
|
-
|
33
|
-
#### Parameters
|
34
|
-
|
35
|
-
##### initiator
|
36
|
-
|
37
|
-
`string`
|
38
|
-
|
39
|
-
The initiator public key
|
40
|
-
|
41
|
-
##### iss
|
42
|
-
|
43
|
-
`string`
|
44
|
-
|
45
|
-
The issuer (protocol authority)
|
46
|
-
|
47
|
-
##### prefix
|
48
|
-
|
49
|
-
`string` = `"DEFAULT"`
|
50
|
-
|
51
|
-
The prefix (default: "DEFAULT")
|
52
|
-
|
53
|
-
##### params?
|
54
|
-
|
55
|
-
`string`
|
56
|
-
|
57
|
-
Optional parameters
|
58
|
-
|
59
|
-
##### timestamp?
|
60
|
-
|
61
|
-
`number`
|
62
|
-
|
63
|
-
Optional timestamp
|
64
|
-
|
65
|
-
#### Returns
|
66
|
-
|
67
|
-
[`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
68
|
-
|
69
|
-
ProtocolMeta object
|
70
|
-
|
71
|
-
***
|
72
|
-
|
73
|
-
### parse()
|
74
|
-
|
75
|
-
> `static` **parse**(`metaString`): `null` \| [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
76
|
-
|
77
|
-
Defined in: [meta.ts:27](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L27)
|
78
|
-
|
79
|
-
Parse protocol meta from string
|
80
|
-
|
81
|
-
#### Parameters
|
82
|
-
|
83
|
-
##### metaString
|
84
|
-
|
85
|
-
`string`
|
86
|
-
|
87
|
-
The protocol meta string to parse
|
88
|
-
|
89
|
-
#### Returns
|
90
|
-
|
91
|
-
`null` \| [`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
92
|
-
|
93
|
-
Parsed ProtocolMeta object or null if invalid
|
94
|
-
|
95
|
-
***
|
96
|
-
|
97
|
-
### serialize()
|
98
|
-
|
99
|
-
> `static` **serialize**(`meta`): `string`
|
100
|
-
|
101
|
-
Defined in: [meta.ts:55](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L55)
|
102
|
-
|
103
|
-
Serialize ProtocolMeta to string
|
104
|
-
|
105
|
-
#### Parameters
|
106
|
-
|
107
|
-
##### meta
|
108
|
-
|
109
|
-
[`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
110
|
-
|
111
|
-
The protocol meta to serialize
|
112
|
-
|
113
|
-
#### Returns
|
114
|
-
|
115
|
-
`string`
|
116
|
-
|
117
|
-
Serialized protocol meta string
|
118
|
-
|
119
|
-
***
|
120
|
-
|
121
|
-
### validateCode()
|
122
|
-
|
123
|
-
> `static` **validateCode**(`meta`, `timestamp?`): `boolean`
|
124
|
-
|
125
|
-
Defined in: [meta.ts:99](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L99)
|
126
|
-
|
127
|
-
Validate if a code matches the protocol meta
|
128
|
-
|
129
|
-
#### Parameters
|
130
|
-
|
131
|
-
##### meta
|
132
|
-
|
133
|
-
[`ProtocolMetaV1`](../interfaces/ProtocolMetaV1.md)
|
134
|
-
|
135
|
-
The protocol meta to validate against
|
136
|
-
|
137
|
-
##### timestamp?
|
138
|
-
|
139
|
-
`number`
|
140
|
-
|
141
|
-
Optional timestamp for validation (if not provided, uses current time)
|
142
|
-
|
143
|
-
#### Returns
|
144
|
-
|
145
|
-
`boolean`
|
146
|
-
|
147
|
-
True if the meta is valid
|
148
|
-
|
149
|
-
***
|
150
|
-
|
151
|
-
### validateMetaFromString()
|
152
|
-
|
153
|
-
> `static` **validateMetaFromString**(`metaString`, `timestamp?`): `boolean`
|
154
|
-
|
155
|
-
Defined in: [meta.ts:110](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L110)
|
156
|
-
|
157
|
-
Validate if a code matches the protocol meta by parsing from string
|
158
|
-
|
159
|
-
#### Parameters
|
160
|
-
|
161
|
-
##### metaString
|
162
|
-
|
163
|
-
`string`
|
164
|
-
|
165
|
-
The protocol meta string to validate against
|
166
|
-
|
167
|
-
##### timestamp?
|
168
|
-
|
169
|
-
`number`
|
170
|
-
|
171
|
-
Optional timestamp for validation (if not provided, uses current time)
|
172
|
-
|
173
|
-
#### Returns
|
174
|
-
|
175
|
-
`boolean`
|
176
|
-
|
177
|
-
True if the code matches the meta
|
@@ -1,59 +0,0 @@
|
|
1
|
-
[**@actioncodes/protocol**](../../README.md)
|
2
|
-
|
3
|
-
***
|
4
|
-
|
5
|
-
[@actioncodes/protocol](../../modules.md) / [meta](../README.md) / ProtocolMetaV1
|
6
|
-
|
7
|
-
# Interface: ProtocolMetaV1
|
8
|
-
|
9
|
-
Defined in: [meta.ts:7](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L7)
|
10
|
-
|
11
|
-
Protocol meta structure for code verification
|
12
|
-
|
13
|
-
## Properties
|
14
|
-
|
15
|
-
### id
|
16
|
-
|
17
|
-
> **id**: `string`
|
18
|
-
|
19
|
-
Defined in: [meta.ts:11](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L11)
|
20
|
-
|
21
|
-
***
|
22
|
-
|
23
|
-
### initiator
|
24
|
-
|
25
|
-
> **initiator**: `string`
|
26
|
-
|
27
|
-
Defined in: [meta.ts:10](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L10)
|
28
|
-
|
29
|
-
***
|
30
|
-
|
31
|
-
### iss?
|
32
|
-
|
33
|
-
> `optional` **iss**: `string`
|
34
|
-
|
35
|
-
Defined in: [meta.ts:12](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L12)
|
36
|
-
|
37
|
-
***
|
38
|
-
|
39
|
-
### params?
|
40
|
-
|
41
|
-
> `optional` **params**: `string`
|
42
|
-
|
43
|
-
Defined in: [meta.ts:13](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L13)
|
44
|
-
|
45
|
-
***
|
46
|
-
|
47
|
-
### prefix
|
48
|
-
|
49
|
-
> **prefix**: `string`
|
50
|
-
|
51
|
-
Defined in: [meta.ts:9](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L9)
|
52
|
-
|
53
|
-
***
|
54
|
-
|
55
|
-
### version
|
56
|
-
|
57
|
-
> **version**: `string`
|
58
|
-
|
59
|
-
Defined in: [meta.ts:8](https://github.com/otaprotocol/actioncodes/blob/7fa582d3aecdeca51131d2fc9eec0802298f9a4d/src/meta.ts#L8)
|