@ghostspeak/sdk 2.0.6 → 2.0.8
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 +295 -30
- package/dist/GhostSpeakClient-bnXwUPHI.d.ts +1011 -0
- package/dist/StakingModule-DunDShLq.d.ts +2446 -0
- package/dist/{agent-M74TCRON.js → agent-S42FIMR7.js} +4 -4
- package/dist/{agent-M74TCRON.js.map → agent-S42FIMR7.js.map} +1 -1
- package/dist/batch-operations-45CQFEID.js +4 -0
- package/dist/batch-operations-45CQFEID.js.map +1 -0
- package/dist/browser-CI5_6Gzk.d.ts +234 -0
- package/dist/browser.d.ts +6 -576
- package/dist/browser.js +15 -842
- package/dist/browser.js.map +1 -1
- package/dist/chunk-46QWY3MG.js +156 -0
- package/dist/chunk-46QWY3MG.js.map +1 -0
- package/dist/{chunk-F3DZMBUA.js → chunk-5QBSC4T4.js} +327 -493
- package/dist/chunk-5QBSC4T4.js.map +1 -0
- package/dist/chunk-5QZVFUXB.js +4176 -0
- package/dist/chunk-5QZVFUXB.js.map +1 -0
- package/dist/chunk-6XCCMJ6M.js +1865 -0
- package/dist/chunk-6XCCMJ6M.js.map +1 -0
- package/dist/chunk-A7ALCVUI.js +98 -0
- package/dist/chunk-A7ALCVUI.js.map +1 -0
- package/dist/chunk-AWMGX3OX.js +814 -0
- package/dist/chunk-AWMGX3OX.js.map +1 -0
- package/dist/chunk-BF3IQ35I.js +284 -0
- package/dist/chunk-BF3IQ35I.js.map +1 -0
- package/dist/chunk-BQDGRTVP.js +168 -0
- package/dist/chunk-BQDGRTVP.js.map +1 -0
- package/dist/chunk-IQM5RASO.js +8502 -0
- package/dist/chunk-IQM5RASO.js.map +1 -0
- package/dist/chunk-JYXSOXCP.js +3850 -0
- package/dist/chunk-JYXSOXCP.js.map +1 -0
- package/dist/chunk-OXA7MECJ.js +7787 -0
- package/dist/chunk-OXA7MECJ.js.map +1 -0
- package/dist/chunk-QLRWUHN2.js +231 -0
- package/dist/chunk-QLRWUHN2.js.map +1 -0
- package/dist/chunk-SKMJJ3Q6.js +125 -0
- package/dist/chunk-SKMJJ3Q6.js.map +1 -0
- package/dist/chunk-TTB4OS2D.js +69 -0
- package/dist/chunk-TTB4OS2D.js.map +1 -0
- package/dist/chunk-UP2VWCW5.js +33 -0
- package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
- package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
- package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +11 -10
- package/dist/createAgentAuthorization-KGZNXZBT.js +5 -0
- package/dist/createAgentAuthorization-KGZNXZBT.js.map +1 -0
- package/dist/credentials.js +1 -1
- package/dist/crypto.js +2 -2
- package/dist/errors.js +1 -1
- package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
- package/dist/generated-QJREJQ2C.js +9 -0
- package/dist/{generated-VNLHMR6Y.js.map → generated-QJREJQ2C.js.map} +1 -1
- package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
- package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
- package/dist/index.d.ts +1179 -1498
- package/dist/index.js +356 -3578
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/minimal/core-minimal.d.ts +2446 -1245
- package/dist/minimal/core-minimal.js +9 -9
- package/dist/minimal/core-minimal.js.map +1 -1
- package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
- package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
- package/dist/pda-4KP7CURF.js +4 -0
- package/dist/pda-4KP7CURF.js.map +1 -0
- package/dist/pda-Ce7VYg4T.d.ts +25 -0
- package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
- package/dist/revokeAuthorization-2ZRO6GUZ.js +5 -0
- package/dist/revokeAuthorization-2ZRO6GUZ.js.map +1 -0
- package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
- package/dist/types.js +1 -1
- package/dist/updateReputationWithAuth-PCEUOCFV.js +5 -0
- package/dist/updateReputationWithAuth-PCEUOCFV.js.map +1 -0
- package/dist/utils.d.ts +69 -203
- package/dist/utils.js +15 -153
- package/dist/utils.js.map +1 -1
- package/package.json +27 -34
- package/dist/.tsbuildinfo +0 -1
- package/dist/GhostSpeakClient-D_66Uzsf.d.ts +0 -707
- package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
- package/dist/chunk-APCKGD23.js +0 -1328
- package/dist/chunk-APCKGD23.js.map +0 -1
- package/dist/chunk-ASQXX4IT.js +0 -572
- package/dist/chunk-ASQXX4IT.js.map +0 -1
- package/dist/chunk-COGZFWOT.js +0 -19657
- package/dist/chunk-COGZFWOT.js.map +0 -1
- package/dist/chunk-F3DZMBUA.js.map +0 -1
- package/dist/chunk-GMHIUK2R.js +0 -7526
- package/dist/chunk-GMHIUK2R.js.map +0 -1
- package/dist/chunk-IAWBZYPE.js +0 -356
- package/dist/chunk-IAWBZYPE.js.map +0 -1
- package/dist/chunk-NSBPE2FW.js +0 -15
- package/dist/chunk-OWYHJG6H.js +0 -13311
- package/dist/chunk-OWYHJG6H.js.map +0 -1
- package/dist/chunk-RDDPOFR5.js +0 -3
- package/dist/chunk-RDDPOFR5.js.map +0 -1
- package/dist/chunk-RERCHKZP.js +0 -35
- package/dist/chunk-RERCHKZP.js.map +0 -1
- package/dist/chunk-TVVGXYCI.js +0 -2887
- package/dist/chunk-TVVGXYCI.js.map +0 -1
- package/dist/chunk-ZGP5552B.js +0 -377
- package/dist/chunk-ZGP5552B.js.map +0 -1
- package/dist/chunk-ZWOYNHVK.js +0 -196
- package/dist/chunk-ZWOYNHVK.js.map +0 -1
- package/dist/dist/.tsbuildinfo +0 -1
- package/dist/elgamal-VZLWB3XK.js +0 -5
- package/dist/elgamal-VZLWB3XK.js.map +0 -1
- package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
- package/dist/generated-VNLHMR6Y.js +0 -5
- package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
- package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
- package/dist/pda-B_nS8SbD.d.ts +0 -114
- package/dist/pda-S4BFJVGE.js +0 -4
- package/dist/pda-S4BFJVGE.js.map +0 -1
- package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
- package/dist/token-2022-rpc-RALH4RK7.js +0 -593
- package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { REVOKE_AUTHORIZATION_DISCRIMINATOR, getRevokeAuthorizationDiscriminatorBytes, getRevokeAuthorizationInstruction, getRevokeAuthorizationInstructionDataCodec, getRevokeAuthorizationInstructionDataDecoder, getRevokeAuthorizationInstructionDataEncoder, parseRevokeAuthorizationInstruction } from './chunk-A7ALCVUI.js';
|
|
2
|
+
import './chunk-AWMGX3OX.js';
|
|
3
|
+
import './chunk-UP2VWCW5.js';
|
|
4
|
+
//# sourceMappingURL=revokeAuthorization-2ZRO6GUZ.js.map
|
|
5
|
+
//# sourceMappingURL=revokeAuthorization-2ZRO6GUZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"revokeAuthorization-2ZRO6GUZ.js"}
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { Address } from '@solana/addresses';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent Authorization System Types
|
|
5
|
+
*
|
|
6
|
+
* GhostSpeak's trustless authorization mechanism for agents to
|
|
7
|
+
* pre-authorize reputation updates with cryptographic signatures.
|
|
8
|
+
*
|
|
9
|
+
* Built for secure, delegated reputation management across protocols.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Network types supported by GhostSpeak
|
|
14
|
+
*/
|
|
15
|
+
type SolanaNetwork = 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for on-chain authorization storage
|
|
18
|
+
*
|
|
19
|
+
* On-chain storage provides an immutable audit trail for authorizations,
|
|
20
|
+
* but costs ~0.002 SOL in rent. Off-chain storage (default) is free but
|
|
21
|
+
* requires agents to share signed authorizations with facilitators.
|
|
22
|
+
*/
|
|
23
|
+
interface OnChainStorageConfig {
|
|
24
|
+
/** Enable on-chain storage (default: false for cost efficiency) */
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Storage fee in lamports (default: 0.002 SOL = 2000000 lamports for rent)
|
|
28
|
+
* This covers the account rent exemption cost on Solana
|
|
29
|
+
*/
|
|
30
|
+
storageFee?: bigint;
|
|
31
|
+
/**
|
|
32
|
+
* Who pays the storage fee
|
|
33
|
+
* - true: Agent pays (stored authorization benefits agent's transparency)
|
|
34
|
+
* - false: Facilitator pays (facilitator wants on-chain proof)
|
|
35
|
+
* Default: true (agent pays for their own authorization storage)
|
|
36
|
+
*/
|
|
37
|
+
feePayedByAgent?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Automatically store on-chain after creation
|
|
40
|
+
* - true: Store immediately (requires funded wallet)
|
|
41
|
+
* - false: Manual storage via storeAuthorizationOnChain()
|
|
42
|
+
* Default: false (manual control)
|
|
43
|
+
*/
|
|
44
|
+
autoStore?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Custom fee structure for different authorization durations
|
|
47
|
+
* Maps duration in seconds to fee in lamports
|
|
48
|
+
* Example: { 2592000: 1000000n } // 30 days = 0.001 SOL
|
|
49
|
+
*/
|
|
50
|
+
customFees?: Record<number, bigint>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reputation Authorization
|
|
54
|
+
*
|
|
55
|
+
* Allows an agent to pre-authorize a specific source (e.g., PayAI facilitator)
|
|
56
|
+
* to update their reputation a limited number of times before expiration.
|
|
57
|
+
*/
|
|
58
|
+
interface ReputationAuthorization {
|
|
59
|
+
/** Agent's public key (the one granting authorization) */
|
|
60
|
+
agentAddress: Address;
|
|
61
|
+
/** Authorized source address (e.g., PayAI facilitator address) */
|
|
62
|
+
authorizedSource: Address;
|
|
63
|
+
/** Maximum number of reputation updates allowed */
|
|
64
|
+
indexLimit: number;
|
|
65
|
+
/** Unix timestamp when authorization expires */
|
|
66
|
+
expiresAt: number;
|
|
67
|
+
/** Solana network this authorization is valid on */
|
|
68
|
+
network: SolanaNetwork;
|
|
69
|
+
/** Ed25519 signature (64 bytes) proving agent's intent */
|
|
70
|
+
signature: Uint8Array;
|
|
71
|
+
/** Optional nonce to prevent replay attacks */
|
|
72
|
+
nonce?: string;
|
|
73
|
+
/** Optional metadata */
|
|
74
|
+
metadata?: AuthorizationMetadata;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Authorization metadata (optional fields)
|
|
78
|
+
*/
|
|
79
|
+
interface AuthorizationMetadata {
|
|
80
|
+
/** Human-readable description */
|
|
81
|
+
description?: string;
|
|
82
|
+
/** Tags for categorization */
|
|
83
|
+
tags?: string[];
|
|
84
|
+
/** Custom data */
|
|
85
|
+
customData?: Record<string, unknown>;
|
|
86
|
+
/** Creation timestamp */
|
|
87
|
+
createdAt?: number;
|
|
88
|
+
/** Version of authorization format */
|
|
89
|
+
version?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Authorization Proof
|
|
93
|
+
*
|
|
94
|
+
* Result of verifying a reputation authorization
|
|
95
|
+
*/
|
|
96
|
+
interface AuthorizationProof {
|
|
97
|
+
/** The authorization being verified */
|
|
98
|
+
authorization: ReputationAuthorization;
|
|
99
|
+
/** Current index (number of times used) */
|
|
100
|
+
currentIndex: number;
|
|
101
|
+
/** Whether the authorization is valid */
|
|
102
|
+
isValid: boolean;
|
|
103
|
+
/** Reason if invalid */
|
|
104
|
+
invalidReason?: AuthorizationInvalidReason;
|
|
105
|
+
/** Timestamp when verification was performed */
|
|
106
|
+
verifiedAt: number;
|
|
107
|
+
/** Verification metadata */
|
|
108
|
+
verificationDetails?: VerificationDetails;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Reasons why an authorization might be invalid
|
|
112
|
+
*/
|
|
113
|
+
declare enum AuthorizationInvalidReason {
|
|
114
|
+
EXPIRED = "expired",
|
|
115
|
+
INDEX_LIMIT_EXCEEDED = "index_limit_exceeded",
|
|
116
|
+
INVALID_SIGNATURE = "invalid_signature",
|
|
117
|
+
NETWORK_MISMATCH = "network_mismatch",
|
|
118
|
+
REVOKED = "revoked",
|
|
119
|
+
NOT_YET_VALID = "not_yet_valid",
|
|
120
|
+
MALFORMED = "malformed"
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Verification details
|
|
124
|
+
*/
|
|
125
|
+
interface VerificationDetails {
|
|
126
|
+
/** Whether signature was verified */
|
|
127
|
+
signatureVerified: boolean;
|
|
128
|
+
/** Whether expiration was checked */
|
|
129
|
+
expirationChecked: boolean;
|
|
130
|
+
/** Whether index limit was checked */
|
|
131
|
+
indexLimitChecked: boolean;
|
|
132
|
+
/** Whether network matched */
|
|
133
|
+
networkMatched: boolean;
|
|
134
|
+
/** Additional notes */
|
|
135
|
+
notes?: string[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Authorization message to be signed
|
|
139
|
+
*
|
|
140
|
+
* This message is hashed and signed by the agent's private key
|
|
141
|
+
*/
|
|
142
|
+
interface AuthorizationMessage {
|
|
143
|
+
/** Agent granting authorization */
|
|
144
|
+
agentAddress: Address;
|
|
145
|
+
/** Source being authorized */
|
|
146
|
+
authorizedSource: Address;
|
|
147
|
+
/** Maximum updates allowed */
|
|
148
|
+
indexLimit: number;
|
|
149
|
+
/** Expiration timestamp */
|
|
150
|
+
expiresAt: number;
|
|
151
|
+
/** Network */
|
|
152
|
+
network: SolanaNetwork;
|
|
153
|
+
/** Optional nonce */
|
|
154
|
+
nonce?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Authorization creation parameters
|
|
158
|
+
*/
|
|
159
|
+
interface CreateAuthorizationParams {
|
|
160
|
+
/** Authorized source (e.g., PayAI facilitator) */
|
|
161
|
+
authorizedSource: Address;
|
|
162
|
+
/** Maximum number of updates (default: 1000) */
|
|
163
|
+
indexLimit?: number;
|
|
164
|
+
/** Expiration time in seconds from now (default: 30 days) */
|
|
165
|
+
expiresIn?: number;
|
|
166
|
+
/** Specific expiration timestamp (overrides expiresIn) */
|
|
167
|
+
expiresAt?: number;
|
|
168
|
+
/** Network (defaults to current cluster) */
|
|
169
|
+
network?: SolanaNetwork;
|
|
170
|
+
/** Optional nonce for replay protection */
|
|
171
|
+
nonce?: string;
|
|
172
|
+
/** Optional metadata */
|
|
173
|
+
metadata?: AuthorizationMetadata;
|
|
174
|
+
/**
|
|
175
|
+
* Whether to store authorization on-chain (default: false)
|
|
176
|
+
* @deprecated Use onChainStorage.enabled instead
|
|
177
|
+
*/
|
|
178
|
+
storeOnChain?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* On-chain storage configuration
|
|
181
|
+
* If not provided, defaults to off-chain (free) storage
|
|
182
|
+
*/
|
|
183
|
+
onChainStorage?: OnChainStorageConfig;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Authorization verification parameters
|
|
187
|
+
*/
|
|
188
|
+
interface VerifyAuthorizationParams {
|
|
189
|
+
/** Authorization to verify */
|
|
190
|
+
authorization: ReputationAuthorization;
|
|
191
|
+
/** Current index (number of times used) */
|
|
192
|
+
currentIndex: number;
|
|
193
|
+
/** Whether to check on-chain status (default: false) */
|
|
194
|
+
checkOnChain?: boolean;
|
|
195
|
+
/** Expected network (defaults to current cluster) */
|
|
196
|
+
expectedNetwork?: SolanaNetwork;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Authorization update record
|
|
200
|
+
*
|
|
201
|
+
* Tracks when an authorization was used for a reputation update
|
|
202
|
+
*/
|
|
203
|
+
interface AuthorizationUsage {
|
|
204
|
+
/** Authorization ID */
|
|
205
|
+
authorizationId: string;
|
|
206
|
+
/** Agent address */
|
|
207
|
+
agentAddress: Address;
|
|
208
|
+
/** Authorized source */
|
|
209
|
+
authorizedSource: Address;
|
|
210
|
+
/** Index at time of use */
|
|
211
|
+
index: number;
|
|
212
|
+
/** Reputation change applied */
|
|
213
|
+
reputationChange: number;
|
|
214
|
+
/** Timestamp of usage */
|
|
215
|
+
usedAt: number;
|
|
216
|
+
/** Transaction signature (if on-chain) */
|
|
217
|
+
transactionSignature?: string;
|
|
218
|
+
/** Usage metadata */
|
|
219
|
+
metadata?: Record<string, unknown>;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Authorization status
|
|
223
|
+
*/
|
|
224
|
+
declare enum AuthorizationStatus {
|
|
225
|
+
ACTIVE = "active",
|
|
226
|
+
EXPIRED = "expired",
|
|
227
|
+
EXHAUSTED = "exhausted",// Index limit reached
|
|
228
|
+
REVOKED = "revoked",
|
|
229
|
+
PENDING = "pending"
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Authorization with status
|
|
233
|
+
*/
|
|
234
|
+
interface AuthorizationWithStatus extends ReputationAuthorization {
|
|
235
|
+
/** Current status */
|
|
236
|
+
status: AuthorizationStatus;
|
|
237
|
+
/** Current usage count */
|
|
238
|
+
currentIndex: number;
|
|
239
|
+
/** Remaining uses */
|
|
240
|
+
remainingUses: number;
|
|
241
|
+
/** Whether currently valid */
|
|
242
|
+
isValid: boolean;
|
|
243
|
+
/** Last used timestamp */
|
|
244
|
+
lastUsedAt?: number;
|
|
245
|
+
/** Authorization ID (derived from signature or on-chain account) */
|
|
246
|
+
id: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Batch authorization verification result
|
|
250
|
+
*/
|
|
251
|
+
interface BatchAuthorizationVerification {
|
|
252
|
+
/** Total authorizations checked */
|
|
253
|
+
total: number;
|
|
254
|
+
/** Number of valid authorizations */
|
|
255
|
+
valid: number;
|
|
256
|
+
/** Number of invalid authorizations */
|
|
257
|
+
invalid: number;
|
|
258
|
+
/** Individual results */
|
|
259
|
+
results: AuthorizationProof[];
|
|
260
|
+
/** Verification timestamp */
|
|
261
|
+
verifiedAt: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Authorization revocation
|
|
265
|
+
*/
|
|
266
|
+
interface AuthorizationRevocation {
|
|
267
|
+
/** Authorization being revoked */
|
|
268
|
+
authorizationId: string;
|
|
269
|
+
/** Agent revoking (must match authorization.agentAddress) */
|
|
270
|
+
agentAddress: Address;
|
|
271
|
+
/** Reason for revocation */
|
|
272
|
+
reason?: string;
|
|
273
|
+
/** Revocation timestamp */
|
|
274
|
+
revokedAt: number;
|
|
275
|
+
/** Signature proving revocation intent */
|
|
276
|
+
signature: Uint8Array;
|
|
277
|
+
/** Transaction signature (if on-chain) */
|
|
278
|
+
transactionSignature?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Authorization query filter
|
|
282
|
+
*/
|
|
283
|
+
interface AuthorizationFilter {
|
|
284
|
+
/** Filter by agent address */
|
|
285
|
+
agentAddress?: Address;
|
|
286
|
+
/** Filter by authorized source */
|
|
287
|
+
authorizedSource?: Address;
|
|
288
|
+
/** Filter by status */
|
|
289
|
+
status?: AuthorizationStatus | AuthorizationStatus[];
|
|
290
|
+
/** Filter by network */
|
|
291
|
+
network?: SolanaNetwork;
|
|
292
|
+
/** Filter by expiration (before/after timestamp) */
|
|
293
|
+
expiresAfter?: number;
|
|
294
|
+
expiresBefore?: number;
|
|
295
|
+
/** Filter by creation time */
|
|
296
|
+
createdAfter?: number;
|
|
297
|
+
createdBefore?: number;
|
|
298
|
+
/** Pagination */
|
|
299
|
+
limit?: number;
|
|
300
|
+
offset?: number;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Agent Authorization Signature Verification
|
|
305
|
+
*
|
|
306
|
+
* Ed25519 signature creation and verification for GhostSpeak's
|
|
307
|
+
* trustless agent pre-authorization system.
|
|
308
|
+
*
|
|
309
|
+
* Enables verifiable delegation of reputation update authority.
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Keypair interface for Ed25519 signing operations
|
|
314
|
+
* Compatible with both legacy and modern Solana key formats
|
|
315
|
+
*/
|
|
316
|
+
interface SigningKeypair {
|
|
317
|
+
publicKey: {
|
|
318
|
+
toBase58(): string;
|
|
319
|
+
toBytes(): Uint8Array;
|
|
320
|
+
};
|
|
321
|
+
secretKey: Uint8Array;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Create authorization message for signing
|
|
325
|
+
*
|
|
326
|
+
* Message format:
|
|
327
|
+
* - Domain separator (prevents cross-protocol replay)
|
|
328
|
+
* - Agent address (32 bytes)
|
|
329
|
+
* - Authorized source (32 bytes)
|
|
330
|
+
* - Index limit (8 bytes, u64 big-endian)
|
|
331
|
+
* - Expiration timestamp (8 bytes, u64 big-endian)
|
|
332
|
+
* - Network string (variable length)
|
|
333
|
+
* - Nonce (optional, 32 bytes if present)
|
|
334
|
+
*
|
|
335
|
+
* @param message - Authorization message parameters
|
|
336
|
+
* @returns Buffer ready for signing
|
|
337
|
+
*/
|
|
338
|
+
declare function createAuthorizationMessage(message: AuthorizationMessage): Buffer;
|
|
339
|
+
/**
|
|
340
|
+
* Sign authorization message with agent's private key
|
|
341
|
+
*
|
|
342
|
+
* @param message - Authorization message to sign
|
|
343
|
+
* @param agentKeypair - Agent's keypair (must match message.agentAddress)
|
|
344
|
+
* @returns Ed25519 signature (64 bytes)
|
|
345
|
+
*/
|
|
346
|
+
declare function signAuthorizationMessage(message: AuthorizationMessage, agentKeypair: SigningKeypair): Promise<Uint8Array>;
|
|
347
|
+
/**
|
|
348
|
+
* Verify authorization signature
|
|
349
|
+
*
|
|
350
|
+
* @param authorization - Authorization to verify
|
|
351
|
+
* @returns True if signature is valid
|
|
352
|
+
*/
|
|
353
|
+
declare function verifyAuthorizationSignature(authorization: ReputationAuthorization): Promise<boolean>;
|
|
354
|
+
/**
|
|
355
|
+
* Create a complete authorization with signature
|
|
356
|
+
*
|
|
357
|
+
* @param params - Authorization parameters
|
|
358
|
+
* @param agentKeypair - Agent's keypair for signing
|
|
359
|
+
* @returns Complete signed authorization
|
|
360
|
+
*/
|
|
361
|
+
declare function createSignedAuthorization(params: CreateAuthorizationParams, agentKeypair: SigningKeypair): Promise<ReputationAuthorization>;
|
|
362
|
+
/**
|
|
363
|
+
* Generate a random nonce for replay protection
|
|
364
|
+
*
|
|
365
|
+
* @returns 32-byte random nonce as hex string
|
|
366
|
+
*/
|
|
367
|
+
declare function generateNonce(): string;
|
|
368
|
+
/**
|
|
369
|
+
* Serialize authorization to JSON-safe format
|
|
370
|
+
*
|
|
371
|
+
* @param authorization - Authorization to serialize
|
|
372
|
+
* @returns JSON-safe object (signature as base58)
|
|
373
|
+
*/
|
|
374
|
+
declare function serializeAuthorization(authorization: ReputationAuthorization): {
|
|
375
|
+
agentAddress: string;
|
|
376
|
+
authorizedSource: string;
|
|
377
|
+
indexLimit: number;
|
|
378
|
+
expiresAt: number;
|
|
379
|
+
network: SolanaNetwork;
|
|
380
|
+
signature: string;
|
|
381
|
+
nonce?: string;
|
|
382
|
+
metadata?: any;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Deserialize authorization from JSON format
|
|
386
|
+
*
|
|
387
|
+
* @param data - Serialized authorization data
|
|
388
|
+
* @returns ReputationAuthorization with Uint8Array signature
|
|
389
|
+
*/
|
|
390
|
+
declare function deserializeAuthorization(data: {
|
|
391
|
+
agentAddress: string;
|
|
392
|
+
authorizedSource: string;
|
|
393
|
+
indexLimit: number;
|
|
394
|
+
expiresAt: number;
|
|
395
|
+
network: SolanaNetwork;
|
|
396
|
+
signature: string;
|
|
397
|
+
nonce?: string;
|
|
398
|
+
metadata?: any;
|
|
399
|
+
}): ReputationAuthorization;
|
|
400
|
+
/**
|
|
401
|
+
* Get authorization ID (deterministic hash)
|
|
402
|
+
*
|
|
403
|
+
* @param authorization - Authorization to hash
|
|
404
|
+
* @returns Base58-encoded SHA-256 hash
|
|
405
|
+
*/
|
|
406
|
+
declare function getAuthorizationId(authorization: ReputationAuthorization): Promise<string>;
|
|
407
|
+
/**
|
|
408
|
+
* Check if authorization is expired
|
|
409
|
+
*
|
|
410
|
+
* @param authorization - Authorization to check
|
|
411
|
+
* @param currentTime - Current Unix timestamp (defaults to now)
|
|
412
|
+
* @returns True if expired
|
|
413
|
+
*/
|
|
414
|
+
declare function isAuthorizationExpired(authorization: ReputationAuthorization, currentTime?: number): boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Check if authorization has exceeded index limit
|
|
417
|
+
*
|
|
418
|
+
* @param authorization - Authorization to check
|
|
419
|
+
* @param currentIndex - Current usage count
|
|
420
|
+
* @returns True if exhausted
|
|
421
|
+
*/
|
|
422
|
+
declare function isAuthorizationExhausted(authorization: ReputationAuthorization, currentIndex: number): boolean;
|
|
423
|
+
/**
|
|
424
|
+
* Validate authorization network matches expected
|
|
425
|
+
*
|
|
426
|
+
* @param authorization - Authorization to check
|
|
427
|
+
* @param expectedNetwork - Expected network
|
|
428
|
+
* @returns True if networks match
|
|
429
|
+
*/
|
|
430
|
+
declare function validateAuthorizationNetwork(authorization: ReputationAuthorization, expectedNetwork: SolanaNetwork): boolean;
|
|
431
|
+
|
|
432
|
+
type signatureVerification_SigningKeypair = SigningKeypair;
|
|
433
|
+
declare const signatureVerification_createAuthorizationMessage: typeof createAuthorizationMessage;
|
|
434
|
+
declare const signatureVerification_createSignedAuthorization: typeof createSignedAuthorization;
|
|
435
|
+
declare const signatureVerification_deserializeAuthorization: typeof deserializeAuthorization;
|
|
436
|
+
declare const signatureVerification_generateNonce: typeof generateNonce;
|
|
437
|
+
declare const signatureVerification_getAuthorizationId: typeof getAuthorizationId;
|
|
438
|
+
declare const signatureVerification_isAuthorizationExhausted: typeof isAuthorizationExhausted;
|
|
439
|
+
declare const signatureVerification_isAuthorizationExpired: typeof isAuthorizationExpired;
|
|
440
|
+
declare const signatureVerification_serializeAuthorization: typeof serializeAuthorization;
|
|
441
|
+
declare const signatureVerification_signAuthorizationMessage: typeof signAuthorizationMessage;
|
|
442
|
+
declare const signatureVerification_validateAuthorizationNetwork: typeof validateAuthorizationNetwork;
|
|
443
|
+
declare const signatureVerification_verifyAuthorizationSignature: typeof verifyAuthorizationSignature;
|
|
444
|
+
declare namespace signatureVerification {
|
|
445
|
+
export { type signatureVerification_SigningKeypair as SigningKeypair, signatureVerification_createAuthorizationMessage as createAuthorizationMessage, signatureVerification_createSignedAuthorization as createSignedAuthorization, signatureVerification_deserializeAuthorization as deserializeAuthorization, signatureVerification_generateNonce as generateNonce, signatureVerification_getAuthorizationId as getAuthorizationId, signatureVerification_isAuthorizationExhausted as isAuthorizationExhausted, signatureVerification_isAuthorizationExpired as isAuthorizationExpired, signatureVerification_serializeAuthorization as serializeAuthorization, signatureVerification_signAuthorizationMessage as signAuthorizationMessage, signatureVerification_validateAuthorizationNetwork as validateAuthorizationNetwork, signatureVerification_verifyAuthorizationSignature as verifyAuthorizationSignature };
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export { AuthorizationStatus as A, type BatchAuthorizationVerification as B, type CreateAuthorizationParams as C, type OnChainStorageConfig as O, type ReputationAuthorization as R, type SigningKeypair as S, type VerificationDetails as V, signAuthorizationMessage as a, createSignedAuthorization as b, createAuthorizationMessage as c, serializeAuthorization as d, deserializeAuthorization as e, getAuthorizationId as f, generateNonce as g, isAuthorizationExhausted as h, isAuthorizationExpired as i, validateAuthorizationNetwork as j, type AuthorizationWithStatus as k, type AuthorizationFilter as l, type SolanaNetwork as m, type AuthorizationMetadata as n, type AuthorizationProof as o, AuthorizationInvalidReason as p, type AuthorizationMessage as q, type VerifyAuthorizationParams as r, signatureVerification as s, type AuthorizationUsage as t, type AuthorizationRevocation as u, verifyAuthorizationSignature as v };
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AgentType, ChannelType, ErrorCode, EscrowStatus, MessageType, ParticipantType, isError, isSuccess, unwrap } from './chunk-SRS2SKFS.js';
|
|
2
|
-
import './chunk-
|
|
2
|
+
import './chunk-UP2VWCW5.js';
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
|
4
4
|
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { UPDATE_REPUTATION_WITH_AUTH_DISCRIMINATOR, getUpdateReputationWithAuthDiscriminatorBytes, getUpdateReputationWithAuthInstruction, getUpdateReputationWithAuthInstructionAsync, getUpdateReputationWithAuthInstructionDataCodec, getUpdateReputationWithAuthInstructionDataDecoder, getUpdateReputationWithAuthInstructionDataEncoder, parseUpdateReputationWithAuthInstruction } from './chunk-QLRWUHN2.js';
|
|
2
|
+
import './chunk-AWMGX3OX.js';
|
|
3
|
+
import './chunk-UP2VWCW5.js';
|
|
4
|
+
//# sourceMappingURL=updateReputationWithAuth-PCEUOCFV.js.map
|
|
5
|
+
//# sourceMappingURL=updateReputationWithAuth-PCEUOCFV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"updateReputationWithAuth-PCEUOCFV.js"}
|