@actioncodes/protocol 1.0.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 (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +55 -0
  3. package/dist/actioncode.d.ts +114 -0
  4. package/dist/actioncode.d.ts.map +1 -0
  5. package/dist/actioncode.js +159 -0
  6. package/dist/adapters/base.d.ts +52 -0
  7. package/dist/adapters/base.d.ts.map +1 -0
  8. package/dist/adapters/base.js +41 -0
  9. package/dist/adapters/solana/index.d.ts +2 -0
  10. package/dist/adapters/solana/index.d.ts.map +1 -0
  11. package/dist/adapters/solana/index.js +17 -0
  12. package/dist/adapters/solana/solana.d.ts +84 -0
  13. package/dist/adapters/solana/solana.d.ts.map +1 -0
  14. package/dist/adapters/solana/solana.js +223 -0
  15. package/dist/codegen.d.ts +73 -0
  16. package/dist/codegen.d.ts.map +1 -0
  17. package/dist/codegen.js +118 -0
  18. package/dist/constants.d.ts +10 -0
  19. package/dist/constants.d.ts.map +1 -0
  20. package/dist/constants.js +11 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +23 -0
  24. package/dist/meta.d.ts +54 -0
  25. package/dist/meta.d.ts.map +1 -0
  26. package/dist/meta.js +91 -0
  27. package/dist/protocol.d.ts +167 -0
  28. package/dist/protocol.d.ts.map +1 -0
  29. package/dist/protocol.js +280 -0
  30. package/docs/README.md +59 -0
  31. package/docs/_media/LICENSE +201 -0
  32. package/docs/_media/README.md +28 -0
  33. package/docs/actioncode/README.md +21 -0
  34. package/docs/actioncode/classes/ActionCode.md +412 -0
  35. package/docs/actioncode/interfaces/ActionCodeFields.md +95 -0
  36. package/docs/actioncode/interfaces/ActionCodeMetadata.md +25 -0
  37. package/docs/actioncode/interfaces/ActionCodeTransaction.md +39 -0
  38. package/docs/actioncode/type-aliases/ActionCodeStatus.md +11 -0
  39. package/docs/adapters/base/README.md +11 -0
  40. package/docs/adapters/base/classes/BaseChainAdapter.md +222 -0
  41. package/docs/adapters/solana/README.md +19 -0
  42. package/docs/adapters/solana/solana/README.md +15 -0
  43. package/docs/adapters/solana/solana/classes/SolanaAdapter.md +306 -0
  44. package/docs/adapters/solana/solana/type-aliases/SolanaTransaction.md +13 -0
  45. package/docs/codegen/README.md +11 -0
  46. package/docs/codegen/classes/CodeGenerator.md +337 -0
  47. package/docs/constants/README.md +22 -0
  48. package/docs/constants/type-aliases/SupportedChain.md +11 -0
  49. package/docs/constants/variables/CODE_LENGTH.md +11 -0
  50. package/docs/constants/variables/CODE_TTL.md +11 -0
  51. package/docs/constants/variables/MAX_PREFIX_LENGTH.md +11 -0
  52. package/docs/constants/variables/MIN_PREFIX_LENGTH.md +11 -0
  53. package/docs/constants/variables/PROTOCOL_CODE_PREFIX.md +11 -0
  54. package/docs/constants/variables/PROTOCOL_PREFIX.md +11 -0
  55. package/docs/constants/variables/PROTOCOL_VERSION.md +11 -0
  56. package/docs/constants/variables/SUPPORTED_CHAINS.md +11 -0
  57. package/docs/index/README.md +139 -0
  58. package/docs/meta/README.md +15 -0
  59. package/docs/meta/classes/ProtocolMetaParser.md +177 -0
  60. package/docs/meta/interfaces/ProtocolMetaV1.md +59 -0
  61. package/docs/modules.md +17 -0
  62. package/docs/protocol/README.md +51 -0
  63. package/docs/protocol/classes/ActionCodesProtocol.md +616 -0
  64. package/docs/protocol/interfaces/ProtocolConfig.md +71 -0
  65. package/package.json +90 -0
@@ -0,0 +1,306 @@
1
+ [**@actioncodes/protocol**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../../../modules.md) / [adapters/solana/solana](../README.md) / SolanaAdapter
6
+
7
+ # Class: SolanaAdapter
8
+
9
+ Defined in: [adapters/solana/solana.ts:20](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L20)
10
+
11
+ Simple Solana adapter for protocol meta operations
12
+ Supports both legacy and versioned transactions
13
+
14
+ ## Extends
15
+
16
+ - [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md)\<[`SolanaTransaction`](../type-aliases/SolanaTransaction.md)\>
17
+
18
+ ## Constructors
19
+
20
+ ### Constructor
21
+
22
+ > **new SolanaAdapter**(): `SolanaAdapter`
23
+
24
+ #### Returns
25
+
26
+ `SolanaAdapter`
27
+
28
+ #### Inherited from
29
+
30
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`constructor`](../../../base/classes/BaseChainAdapter.md#constructor)
31
+
32
+ ## Properties
33
+
34
+ ### chain
35
+
36
+ > `readonly` **chain**: `"solana"` = `'solana'`
37
+
38
+ Defined in: [adapters/solana/solana.ts:23](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L23)
39
+
40
+ #### Overrides
41
+
42
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`chain`](../../../base/classes/BaseChainAdapter.md#chain)
43
+
44
+ ## Methods
45
+
46
+ ### decode()
47
+
48
+ > **decode**(`tx`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
49
+
50
+ Defined in: [adapters/solana/solana.ts:40](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L40)
51
+
52
+ Decode protocol meta from Solana transaction (legacy or versioned)
53
+
54
+ #### Parameters
55
+
56
+ ##### tx
57
+
58
+ [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
59
+
60
+ The Solana transaction
61
+
62
+ #### Returns
63
+
64
+ `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
65
+
66
+ Decoded ProtocolMetaV1 or null if not found
67
+
68
+ #### Overrides
69
+
70
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`decode`](../../../base/classes/BaseChainAdapter.md#decode)
71
+
72
+ ***
73
+
74
+ ### decodeFromBase64()
75
+
76
+ > **decodeFromBase64**(`base64String`): `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
77
+
78
+ Defined in: [adapters/solana/solana.ts:201](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L201)
79
+
80
+ Decode protocol meta from base64 string (for backward compatibility)
81
+
82
+ #### Parameters
83
+
84
+ ##### base64String
85
+
86
+ `string`
87
+
88
+ Base64 encoded transaction
89
+
90
+ #### Returns
91
+
92
+ `null` \| [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
93
+
94
+ Decoded ProtocolMetaV1 or null
95
+
96
+ ***
97
+
98
+ ### detectTampering()
99
+
100
+ > **detectTampering**(`tx`, `authorities`, `expectedPrefix`): `boolean`
101
+
102
+ Defined in: [adapters/base.ts:48](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/base.ts#L48)
103
+
104
+ Detect tampered transactions by cross-checking metadata
105
+
106
+ #### Parameters
107
+
108
+ ##### tx
109
+
110
+ [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
111
+
112
+ Chain-specific transaction
113
+
114
+ ##### authorities
115
+
116
+ `string`[]
117
+
118
+ Array of valid protocol authority identifiers
119
+
120
+ ##### expectedPrefix
121
+
122
+ `string` = `'DEFAULT'`
123
+
124
+ Expected protocol prefix
125
+
126
+ #### Returns
127
+
128
+ `boolean`
129
+
130
+ True if transaction is valid and not tampered
131
+
132
+ #### Inherited from
133
+
134
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`detectTampering`](../../../base/classes/BaseChainAdapter.md#detecttampering)
135
+
136
+ ***
137
+
138
+ ### encode()
139
+
140
+ > **encode**(`meta`): `TransactionInstruction`
141
+
142
+ Defined in: [adapters/solana/solana.ts:30](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L30)
143
+
144
+ Encode protocol meta as a Solana memo instruction
145
+
146
+ #### Parameters
147
+
148
+ ##### meta
149
+
150
+ [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
151
+
152
+ The protocol meta to encode
153
+
154
+ #### Returns
155
+
156
+ `TransactionInstruction`
157
+
158
+ TransactionInstruction for the memo
159
+
160
+ #### Overrides
161
+
162
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`encode`](../../../base/classes/BaseChainAdapter.md#encode)
163
+
164
+ ***
165
+
166
+ ### hasIssuerSignature()
167
+
168
+ > **hasIssuerSignature**(`tx`, `issuer`): `boolean`
169
+
170
+ Defined in: [adapters/solana/solana.ts:68](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L68)
171
+
172
+ Check if the issuer has signed the transaction
173
+
174
+ #### Parameters
175
+
176
+ ##### tx
177
+
178
+ [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
179
+
180
+ The Solana transaction
181
+
182
+ ##### issuer
183
+
184
+ `string`
185
+
186
+ Issuer public key to check
187
+
188
+ #### Returns
189
+
190
+ `boolean`
191
+
192
+ True if issuer has signed
193
+
194
+ #### Overrides
195
+
196
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`hasIssuerSignature`](../../../base/classes/BaseChainAdapter.md#hasissuersignature)
197
+
198
+ ***
199
+
200
+ ### validate()
201
+
202
+ > **validate**(`tx`, `authorities`, `expectedPrefix`): `boolean`
203
+
204
+ Defined in: [adapters/solana/solana.ts:58](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L58)
205
+
206
+ Validate transaction with protocol meta and authority list
207
+
208
+ #### Parameters
209
+
210
+ ##### tx
211
+
212
+ [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
213
+
214
+ The Solana transaction
215
+
216
+ ##### authorities
217
+
218
+ `string`[]
219
+
220
+ Array of valid protocol authority public keys (base58)
221
+
222
+ ##### expectedPrefix
223
+
224
+ `string` = `'DEFAULT'`
225
+
226
+ Expected protocol prefix (default: 'DEFAULT')
227
+
228
+ #### Returns
229
+
230
+ `boolean`
231
+
232
+ True if transaction is valid
233
+
234
+ #### Overrides
235
+
236
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`validate`](../../../base/classes/BaseChainAdapter.md#validate)
237
+
238
+ ***
239
+
240
+ ### validateFromBase64()
241
+
242
+ > **validateFromBase64**(`base64String`, `authorities`, `expectedPrefix`): `boolean`
243
+
244
+ Defined in: [adapters/solana/solana.ts:224](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L224)
245
+
246
+ Validate base64 transaction (for backward compatibility)
247
+
248
+ #### Parameters
249
+
250
+ ##### base64String
251
+
252
+ `string`
253
+
254
+ Base64 encoded transaction
255
+
256
+ ##### authorities
257
+
258
+ `string`[]
259
+
260
+ Array of valid protocol authority public keys (base58)
261
+
262
+ ##### expectedPrefix
263
+
264
+ `string` = `'DEFAULT'`
265
+
266
+ Expected protocol prefix (default: 'DEFAULT')
267
+
268
+ #### Returns
269
+
270
+ `boolean`
271
+
272
+ True if transaction is valid
273
+
274
+ ***
275
+
276
+ ### validateTransactionIntegrity()
277
+
278
+ > `protected` **validateTransactionIntegrity**(`tx`, `meta`): `boolean`
279
+
280
+ Defined in: [adapters/solana/solana.ts:175](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L175)
281
+
282
+ Validate Solana transaction integrity with additional checks
283
+
284
+ #### Parameters
285
+
286
+ ##### tx
287
+
288
+ [`SolanaTransaction`](../type-aliases/SolanaTransaction.md)
289
+
290
+ The Solana transaction
291
+
292
+ ##### meta
293
+
294
+ [`ProtocolMetaV1`](../../../../meta/interfaces/ProtocolMetaV1.md)
295
+
296
+ Decoded protocol meta
297
+
298
+ #### Returns
299
+
300
+ `boolean`
301
+
302
+ True if transaction integrity is valid
303
+
304
+ #### Overrides
305
+
306
+ [`BaseChainAdapter`](../../../base/classes/BaseChainAdapter.md).[`validateTransactionIntegrity`](../../../base/classes/BaseChainAdapter.md#validatetransactionintegrity)
@@ -0,0 +1,13 @@
1
+ [**@actioncodes/protocol**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../../../../modules.md) / [adapters/solana/solana](../README.md) / SolanaTransaction
6
+
7
+ # Type Alias: SolanaTransaction
8
+
9
+ > **SolanaTransaction** = `Transaction` \| `VersionedTransaction`
10
+
11
+ Defined in: [adapters/solana/solana.ts:14](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/adapters/solana/solana.ts#L14)
12
+
13
+ Solana transaction type union
@@ -0,0 +1,11 @@
1
+ [**@actioncodes/protocol**](../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../modules.md) / codegen
6
+
7
+ # codegen
8
+
9
+ ## Classes
10
+
11
+ - [CodeGenerator](classes/CodeGenerator.md)
@@ -0,0 +1,337 @@
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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L5)
52
+
53
+ ## Methods
54
+
55
+ ### deriveCodeHash()
56
+
57
+ > `static` **deriveCodeHash**(`pubkey`, `prefix`, `timestamp?`): `string`
58
+
59
+ Defined in: [codegen.ts:74](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L74)
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` = `"DEFAULT"`
74
+
75
+ Optional namespace prefix (default: "DEFAULT")
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`, `signature`, `prefix`, `timestamp`): `object`
94
+
95
+ Defined in: [codegen.ts:43](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L43)
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
+ ##### signature
108
+
109
+ `string`
110
+
111
+ User's signature string
112
+
113
+ ##### prefix
114
+
115
+ `string` = `"DEFAULT"`
116
+
117
+ Optional namespace prefix (default: "DEFAULT")
118
+
119
+ ##### timestamp
120
+
121
+ `number` = `...`
122
+
123
+ UNIX timestamp in milliseconds (defaults to now)
124
+
125
+ #### Returns
126
+
127
+ `object`
128
+
129
+ Object containing code, issuedAt, and expiresAt timestamps
130
+
131
+ ##### code
132
+
133
+ > **code**: `string`
134
+
135
+ ##### expiresAt
136
+
137
+ > **expiresAt**: `number`
138
+
139
+ ##### issuedAt
140
+
141
+ > **issuedAt**: `number`
142
+
143
+ ***
144
+
145
+ ### generateCodeSignatureMessage()
146
+
147
+ > `static` **generateCodeSignatureMessage**(`code`, `timestamp`): `string`
148
+
149
+ Defined in: [codegen.ts:92](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L92)
150
+
151
+ Generate the message that should be signed for code verification
152
+
153
+ #### Parameters
154
+
155
+ ##### code
156
+
157
+ `string`
158
+
159
+ The generated 8-digit code
160
+
161
+ ##### timestamp
162
+
163
+ `number`
164
+
165
+ UNIX timestamp in milliseconds
166
+
167
+ #### Returns
168
+
169
+ `string`
170
+
171
+ Message string in format "actioncodes:<code>:<timestamp>"
172
+
173
+ ***
174
+
175
+ ### getExpectedCode()
176
+
177
+ > `static` **getExpectedCode**(`pubkey`, `timestamp`, `signature`, `prefix`): `string`
178
+
179
+ Defined in: [codegen.ts:104](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L104)
180
+
181
+ Get the expected code for a given public key and timestamp
182
+
183
+ #### Parameters
184
+
185
+ ##### pubkey
186
+
187
+ `string`
188
+
189
+ Solana wallet public key (base58)
190
+
191
+ ##### timestamp
192
+
193
+ `number`
194
+
195
+ UNIX timestamp in milliseconds
196
+
197
+ ##### signature
198
+
199
+ `string`
200
+
201
+ User's signature string
202
+
203
+ ##### prefix
204
+
205
+ `string` = `"DEFAULT"`
206
+
207
+ Optional namespace prefix (default: "DEFAULT")
208
+
209
+ #### Returns
210
+
211
+ `string`
212
+
213
+ 8-digit numeric string
214
+
215
+ ***
216
+
217
+ ### isValidTimestamp()
218
+
219
+ > `static` **isValidTimestamp**(`timestamp`): `boolean`
220
+
221
+ Defined in: [codegen.ts:140](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L140)
222
+
223
+ Check if a timestamp falls within a valid time window
224
+
225
+ #### Parameters
226
+
227
+ ##### timestamp
228
+
229
+ `number`
230
+
231
+ UNIX timestamp in milliseconds
232
+
233
+ #### Returns
234
+
235
+ `boolean`
236
+
237
+ True if timestamp is valid
238
+
239
+ ***
240
+
241
+ ### normalizePrefix()
242
+
243
+ > `static` **normalizePrefix**(`prefix`): `string`
244
+
245
+ Defined in: [codegen.ts:27](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L27)
246
+
247
+ Normalize prefix - convert "DEFAULT" to empty string, validate others
248
+
249
+ #### Parameters
250
+
251
+ ##### prefix
252
+
253
+ `string`
254
+
255
+ The prefix to normalize
256
+
257
+ #### Returns
258
+
259
+ `string`
260
+
261
+ Normalized prefix
262
+
263
+ #### Throws
264
+
265
+ Error if prefix is invalid
266
+
267
+ ***
268
+
269
+ ### validateCode()
270
+
271
+ > `static` **validateCode**(`code`, `pubkey`, `timestamp`, `signature`, `prefix`): `boolean`
272
+
273
+ Defined in: [codegen.ts:122](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L122)
274
+
275
+ Validate if a code matches the expected code for a given public key and timestamp
276
+
277
+ #### Parameters
278
+
279
+ ##### code
280
+
281
+ `string`
282
+
283
+ The code to validate
284
+
285
+ ##### pubkey
286
+
287
+ `string`
288
+
289
+ Solana wallet public key (base58)
290
+
291
+ ##### timestamp
292
+
293
+ `number`
294
+
295
+ UNIX timestamp in milliseconds
296
+
297
+ ##### signature
298
+
299
+ `string`
300
+
301
+ User's signature string
302
+
303
+ ##### prefix
304
+
305
+ `string` = `"DEFAULT"`
306
+
307
+ Optional namespace prefix (default: "DEFAULT")
308
+
309
+ #### Returns
310
+
311
+ `boolean`
312
+
313
+ True if code matches expected code and timestamp is valid
314
+
315
+ ***
316
+
317
+ ### validatePrefix()
318
+
319
+ > `static` **validatePrefix**(`prefix`): `boolean`
320
+
321
+ Defined in: [codegen.ts:15](https://github.com/otaprotocol/actioncodes/blob/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/codegen.ts#L15)
322
+
323
+ Validate prefix format
324
+
325
+ #### Parameters
326
+
327
+ ##### prefix
328
+
329
+ `string`
330
+
331
+ The prefix to validate
332
+
333
+ #### Returns
334
+
335
+ `boolean`
336
+
337
+ True if prefix is valid, false otherwise
@@ -0,0 +1,22 @@
1
+ [**@actioncodes/protocol**](../README.md)
2
+
3
+ ***
4
+
5
+ [@actioncodes/protocol](../modules.md) / constants
6
+
7
+ # constants
8
+
9
+ ## Type Aliases
10
+
11
+ - [SupportedChain](type-aliases/SupportedChain.md)
12
+
13
+ ## Variables
14
+
15
+ - [CODE\_LENGTH](variables/CODE_LENGTH.md)
16
+ - [CODE\_TTL](variables/CODE_TTL.md)
17
+ - [MAX\_PREFIX\_LENGTH](variables/MAX_PREFIX_LENGTH.md)
18
+ - [MIN\_PREFIX\_LENGTH](variables/MIN_PREFIX_LENGTH.md)
19
+ - [PROTOCOL\_CODE\_PREFIX](variables/PROTOCOL_CODE_PREFIX.md)
20
+ - [PROTOCOL\_PREFIX](variables/PROTOCOL_PREFIX.md)
21
+ - [PROTOCOL\_VERSION](variables/PROTOCOL_VERSION.md)
22
+ - [SUPPORTED\_CHAINS](variables/SUPPORTED_CHAINS.md)
@@ -0,0 +1,11 @@
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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L9)
@@ -0,0 +1,11 @@
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/b4bc06f6d42b5f06660c6f068ac123b4cd9daff7/src/constants.ts#L3)