@x1id/resolve 0.23.0 → 0.44.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.
- package/README.md +97 -0
- package/dist/accounts.d.ts +6 -0
- package/dist/accounts.js +6 -1
- package/dist/agent.d.ts +184 -8
- package/dist/agent.js +351 -3
- package/dist/agentPolicy.d.ts +238 -0
- package/dist/agentPolicy.js +364 -0
- package/dist/attestation.d.ts +25 -0
- package/dist/attestation.js +25 -0
- package/dist/checkout.d.ts +216 -0
- package/dist/checkout.js +327 -0
- package/dist/credentials.d.ts +466 -0
- package/dist/credentials.js +669 -0
- package/dist/gate.d.ts +94 -4
- package/dist/gate.js +206 -7
- package/dist/gateClient.d.ts +12 -0
- package/dist/giftLink.d.ts +272 -0
- package/dist/giftLink.js +452 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +32 -0
- package/dist/loginButton.d.ts +69 -0
- package/dist/loginButton.js +207 -0
- package/dist/logo.d.ts +1 -0
- package/dist/logo.js +8 -0
- package/dist/messaging.d.ts +439 -0
- package/dist/messaging.js +979 -0
- package/dist/nsGate.d.ts +98 -0
- package/dist/nsGate.js +172 -0
- package/dist/oidc.d.ts +272 -0
- package/dist/oidc.js +641 -0
- package/dist/pay.d.ts +513 -0
- package/dist/pay.js +756 -0
- package/dist/payment.d.ts +9 -2
- package/dist/payment.js +9 -2
- package/dist/recovery.d.ts +186 -0
- package/dist/recovery.js +276 -0
- package/dist/recoveryNft.d.ts +183 -0
- package/dist/recoveryNft.js +291 -0
- package/dist/shield.d.ts +373 -0
- package/dist/shield.js +695 -0
- package/dist/subscription.d.ts +439 -0
- package/dist/subscription.js +642 -0
- package/dist/textRecords.d.ts +52 -6
- package/dist/textRecords.js +80 -8
- package/dist/types.d.ts +3 -0
- package/dist/x402Receipt.d.ts +246 -0
- package/dist/x402Receipt.js +374 -0
- package/package.json +18 -1
- package/schema/agent-manifest.json +91 -8
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* X1ID Verify: third-party credentials (docs/specs/x1id-credentials.md,
|
|
3
|
+
* program upgrade 6). Instruction builders, account decoders, PDA finders and
|
|
4
|
+
* the off-chain validity rule for issuer-signed credentials on `@names`.
|
|
5
|
+
*
|
|
6
|
+
* # The model
|
|
7
|
+
*
|
|
8
|
+
* - Anyone registers an **issuer** (`["issuer", authority]`) for a small fee
|
|
9
|
+
* paid to the X1ID treasury. The authority KEY is the issuer's identity; the
|
|
10
|
+
* display name is a label and must never be trusted. An issuer can prove it
|
|
11
|
+
* is `@acme` with {@link buildLinkIssuerHandleIx} (the name's holder
|
|
12
|
+
* co-signs); {@link issuerLinkValid} checks the link is still current.
|
|
13
|
+
* - Issuers define immutable **schemas** (`["cred_schema", issuer, id]`).
|
|
14
|
+
* - A **credential** (`["credential", issuer, handle, id]`) is issued with the
|
|
15
|
+
* name's CURRENT holder co-signing, may expire, and is revoked only by its
|
|
16
|
+
* issuer. Anyone may garbage-collect a dead one (rent goes back to whoever
|
|
17
|
+
* paid it).
|
|
18
|
+
* - A credential counts for the current holder only while it is unexpired,
|
|
19
|
+
* its issuer is not Retired and has not invalidated it, it was issued in
|
|
20
|
+
* the name's current ownership epoch, and its `subject` IS the current
|
|
21
|
+
* holder ({@link credentialValidity}).
|
|
22
|
+
*
|
|
23
|
+
* # Never a blue tick
|
|
24
|
+
*
|
|
25
|
+
* Third-party credentials NEVER satisfy the X1ID blue tick: `isHandleVerified`,
|
|
26
|
+
* `"any-verified"` and `{ kind }` gates read only X1ID `Attestation` accounts.
|
|
27
|
+
* Gate on a credential with an explicit `{ credential: { schema, issuers } }`
|
|
28
|
+
* clause (gate.ts).
|
|
29
|
+
*
|
|
30
|
+
* # Integrators: the issuer set is YOURS
|
|
31
|
+
*
|
|
32
|
+
* **When you call `assert_credential` on-chain (CPI or sibling instruction),
|
|
33
|
+
* the accepted issuer set must be a constant of your program or config,
|
|
34
|
+
* never taken from the end user's input.** Otherwise a user registers an
|
|
35
|
+
* issuer, issues a credential to themselves, and names it.
|
|
36
|
+
*
|
|
37
|
+
* Routed through the program's `fallback` (`extra_ix`): `sha256("global:<name>")
|
|
38
|
+
* [..8]` + raw Borsh, accounts exactly in the order of the program's
|
|
39
|
+
* `Accounts` structs (programs/x1-handles/src/credentials.rs). Hand-rolled,
|
|
40
|
+
* no web3.js.
|
|
41
|
+
*/
|
|
42
|
+
import type { AddressLike, BuiltInstruction } from "./delegate.js";
|
|
43
|
+
import type { RpcFn } from "./accounts.js";
|
|
44
|
+
import type { PdaFinder } from "./namespacePricing.js";
|
|
45
|
+
export declare const ISSUER_SEED = "issuer";
|
|
46
|
+
export declare const CRED_SCHEMA_SEED = "cred_schema";
|
|
47
|
+
export declare const CREDENTIAL_SEED = "credential";
|
|
48
|
+
export declare const CRED_CONFIG_SEED = "cred_config";
|
|
49
|
+
export declare const RECOMMENDED_ISSUERS_SEED = "recommended_issuers";
|
|
50
|
+
/** Allocated sizes (8-byte discriminator + `INIT_SPACE`). */
|
|
51
|
+
export declare const ISSUER_ACCOUNT_LEN: number;
|
|
52
|
+
export declare const CREDENTIAL_SCHEMA_ACCOUNT_LEN: number;
|
|
53
|
+
export declare const CREDENTIAL_ACCOUNT_LEN: number;
|
|
54
|
+
export declare const CRED_CONFIG_ACCOUNT_LEN: number;
|
|
55
|
+
export declare const RECOMMENDED_ISSUERS_ACCOUNT_LEN: number;
|
|
56
|
+
/** Registration fee while the admin never set one: 1 XNT. */
|
|
57
|
+
export declare const DEFAULT_ISSUER_FEE_LAMPORTS = 1000000000n;
|
|
58
|
+
/** Program caps on the admin-set fees: 100 XNT and 0.1 XNT. */
|
|
59
|
+
export declare const ISSUER_FEE_MAX_LAMPORTS = 100000000000n;
|
|
60
|
+
export declare const CREDENTIAL_FEE_MAX_LAMPORTS = 100000000n;
|
|
61
|
+
/** No credential may be valid for more than 10 years (3653 days). */
|
|
62
|
+
export declare const MAX_CREDENTIAL_VALIDITY_SECS: bigint;
|
|
63
|
+
export declare const CRED_URI_MAX_LEN = 200;
|
|
64
|
+
/** `assert_credential` accepts 1..=8 issuers. */
|
|
65
|
+
export declare const MAX_ACCEPTED_ISSUERS = 8;
|
|
66
|
+
export declare const MAX_RECOMMENDED_ISSUERS = 32;
|
|
67
|
+
export declare const ISSUER_STATUS: {
|
|
68
|
+
readonly Active: 0;
|
|
69
|
+
readonly Paused: 1;
|
|
70
|
+
readonly Retired: 2;
|
|
71
|
+
};
|
|
72
|
+
export declare const SCHEMA_STATUS: {
|
|
73
|
+
readonly Active: 0;
|
|
74
|
+
readonly Deprecated: 1;
|
|
75
|
+
};
|
|
76
|
+
/** Compute-unit limits to request (measured in tests/credentials.rs, with
|
|
77
|
+
* headroom; spec §12). */
|
|
78
|
+
export declare const CREDENTIAL_CU_LIMITS: {
|
|
79
|
+
readonly registerIssuer: 60000;
|
|
80
|
+
readonly createSchema: 50000;
|
|
81
|
+
readonly issueCredential: 100000;
|
|
82
|
+
readonly renewCredential: 80000;
|
|
83
|
+
readonly revokeCredential: 50000;
|
|
84
|
+
readonly closeCredential: 50000;
|
|
85
|
+
readonly assertCredential: 80000;
|
|
86
|
+
};
|
|
87
|
+
export declare const REGISTER_ISSUER_DISCRIMINATOR: Uint8Array;
|
|
88
|
+
export declare const UPDATE_ISSUER_DISCRIMINATOR: Uint8Array;
|
|
89
|
+
export declare const LINK_ISSUER_HANDLE_DISCRIMINATOR: Uint8Array;
|
|
90
|
+
export declare const UNLINK_ISSUER_HANDLE_DISCRIMINATOR: Uint8Array;
|
|
91
|
+
export declare const CREATE_SCHEMA_DISCRIMINATOR: Uint8Array;
|
|
92
|
+
export declare const DEPRECATE_SCHEMA_DISCRIMINATOR: Uint8Array;
|
|
93
|
+
export declare const ISSUE_CREDENTIAL_DISCRIMINATOR: Uint8Array;
|
|
94
|
+
export declare const RENEW_CREDENTIAL_DISCRIMINATOR: Uint8Array;
|
|
95
|
+
export declare const REVOKE_CREDENTIAL_DISCRIMINATOR: Uint8Array;
|
|
96
|
+
export declare const CLOSE_CREDENTIAL_DISCRIMINATOR: Uint8Array;
|
|
97
|
+
export declare const ASSERT_CREDENTIAL_DISCRIMINATOR: Uint8Array;
|
|
98
|
+
export declare const SET_CREDENTIAL_CONFIG_DISCRIMINATOR: Uint8Array;
|
|
99
|
+
export declare const SET_RECOMMENDED_ISSUERS_DISCRIMINATOR: Uint8Array;
|
|
100
|
+
/** `sha256("account:<Name>")[..8]`. */
|
|
101
|
+
export declare const ISSUER_ACCOUNT_DISCRIMINATOR: Uint8Array;
|
|
102
|
+
export declare const CREDENTIAL_SCHEMA_ACCOUNT_DISCRIMINATOR: Uint8Array;
|
|
103
|
+
export declare const CREDENTIAL_ACCOUNT_DISCRIMINATOR: Uint8Array;
|
|
104
|
+
export declare const CRED_CONFIG_ACCOUNT_DISCRIMINATOR: Uint8Array;
|
|
105
|
+
export declare const RECOMMENDED_ISSUERS_ACCOUNT_DISCRIMINATOR: Uint8Array;
|
|
106
|
+
/** Byte offsets for `getProgramAccounts` `memcmp` filters. */
|
|
107
|
+
export declare const ISSUER_OFFSETS: {
|
|
108
|
+
readonly authority: 9;
|
|
109
|
+
readonly status: 41;
|
|
110
|
+
readonly invalidateBefore: 42;
|
|
111
|
+
readonly name: 50;
|
|
112
|
+
readonly linkedHandle: 115;
|
|
113
|
+
readonly linkedBy: 147;
|
|
114
|
+
};
|
|
115
|
+
export declare const CREDENTIAL_SCHEMA_OFFSETS: {
|
|
116
|
+
readonly issuer: 9;
|
|
117
|
+
readonly schemaId: 41;
|
|
118
|
+
readonly status: 45;
|
|
119
|
+
};
|
|
120
|
+
export declare const CREDENTIAL_OFFSETS: {
|
|
121
|
+
readonly issuer: 9;
|
|
122
|
+
readonly handle: 41;
|
|
123
|
+
readonly schemaId: 73;
|
|
124
|
+
readonly subject: 77;
|
|
125
|
+
readonly rentPayer: 189;
|
|
126
|
+
};
|
|
127
|
+
/** Program error codes of the credentials block (fixed range 6158-6189;
|
|
128
|
+
* 6181-6189 are reserved placeholders). */
|
|
129
|
+
export declare const CREDENTIAL_ERRORS: {
|
|
130
|
+
readonly IssuerNameInvalid: 6158;
|
|
131
|
+
readonly IssuerNameReserved: 6159;
|
|
132
|
+
readonly IssuerUriTooLong: 6160;
|
|
133
|
+
readonly IssuerNotActive: 6161;
|
|
134
|
+
readonly IssuerRetired: 6162;
|
|
135
|
+
readonly NotIssuerAuthority: 6163;
|
|
136
|
+
readonly InvalidateBeforeInvalid: 6164;
|
|
137
|
+
readonly IssuerStatusInvalid: 6165;
|
|
138
|
+
readonly SchemaNameInvalid: 6166;
|
|
139
|
+
readonly SchemaNotActive: 6167;
|
|
140
|
+
readonly SchemaIssuerMismatch: 6168;
|
|
141
|
+
readonly SchemaValidityInvalid: 6169;
|
|
142
|
+
readonly CredentialExpiryInvalid: 6170;
|
|
143
|
+
readonly CredentialExpiryRequired: 6171;
|
|
144
|
+
readonly CredentialSubjectNotAuthority: 6172;
|
|
145
|
+
readonly CredentialNotRenewable: 6173;
|
|
146
|
+
readonly CredentialStillValid: 6174;
|
|
147
|
+
readonly CredentialIssuerSetInvalid: 6175;
|
|
148
|
+
readonly CredentialGateNotSatisfied: 6176;
|
|
149
|
+
readonly CredentialFeeAboveCap: 6177;
|
|
150
|
+
readonly RecommendedListInvalid: 6178;
|
|
151
|
+
readonly IssuerHandleLinkInvalid: 6179;
|
|
152
|
+
readonly CredConfigMismatch: 6180;
|
|
153
|
+
};
|
|
154
|
+
/** Human message for a credentials error code, or null for another code. */
|
|
155
|
+
export declare function credentialErrorMessage(code: number): string | null;
|
|
156
|
+
/** The display-name rule: 3-32 bytes of `[a-z0-9._-]` (plus single inner
|
|
157
|
+
* spaces for issuers), starting and ending with `[a-z0-9]`. */
|
|
158
|
+
export declare function isValidCredentialName(name: string, allowSpace?: boolean): boolean;
|
|
159
|
+
/** Owner decision Q7: issuer names may not contain `x1id`, also split by
|
|
160
|
+
* separators. */
|
|
161
|
+
export declare function isReservedIssuerName(name: string): boolean;
|
|
162
|
+
/** `["issuer", authority]`. */
|
|
163
|
+
export declare function findIssuerPda(find: PdaFinder, programId: AddressLike, authority: AddressLike): Promise<string>;
|
|
164
|
+
/** `["cred_schema", issuer, schema_id u32 LE]`. */
|
|
165
|
+
export declare function findCredentialSchemaPda(find: PdaFinder, programId: AddressLike, issuer: AddressLike, schemaId: number): Promise<string>;
|
|
166
|
+
/** `["credential", issuer, handle, schema_id u32 LE]`. */
|
|
167
|
+
export declare function findCredentialPda(find: PdaFinder, programId: AddressLike, issuer: AddressLike, handle: AddressLike, schemaId: number): Promise<string>;
|
|
168
|
+
/** `["cred_config"]`. */
|
|
169
|
+
export declare function findCredConfigPda(find: PdaFinder, programId: AddressLike): Promise<string>;
|
|
170
|
+
/** `["recommended_issuers"]`. */
|
|
171
|
+
export declare function findRecommendedIssuersPda(find: PdaFinder, programId: AddressLike): Promise<string>;
|
|
172
|
+
export interface Issuer {
|
|
173
|
+
readonly version: number;
|
|
174
|
+
readonly authority: string;
|
|
175
|
+
readonly status: "active" | "paused" | "retired";
|
|
176
|
+
readonly invalidateBefore: bigint;
|
|
177
|
+
/** Display label only. Never trust it: identity is `authority`. */
|
|
178
|
+
readonly name: string;
|
|
179
|
+
readonly uriHash: Uint8Array;
|
|
180
|
+
/** The linked X1ID `Handle` PDA, or null. Check {@link issuerLinkValid}. */
|
|
181
|
+
readonly linkedHandle: string | null;
|
|
182
|
+
readonly linkedBy: string | null;
|
|
183
|
+
readonly linkedAt: bigint;
|
|
184
|
+
readonly createdAt: bigint;
|
|
185
|
+
readonly feePaid: bigint;
|
|
186
|
+
readonly issuedCount: bigint;
|
|
187
|
+
readonly revokedCount: bigint;
|
|
188
|
+
readonly bump: number;
|
|
189
|
+
readonly uri: string;
|
|
190
|
+
}
|
|
191
|
+
/** Decode a raw `Issuer` (discriminator included); null if it is not one. */
|
|
192
|
+
export declare function decodeIssuer(data: Uint8Array): Issuer | null;
|
|
193
|
+
export interface CredentialSchema {
|
|
194
|
+
readonly version: number;
|
|
195
|
+
readonly issuer: string;
|
|
196
|
+
readonly schemaId: number;
|
|
197
|
+
readonly status: "active" | "deprecated";
|
|
198
|
+
/** 0n = credentials may be no-expiry. */
|
|
199
|
+
readonly maxValiditySecs: bigint;
|
|
200
|
+
readonly name: string;
|
|
201
|
+
readonly contentHash: Uint8Array;
|
|
202
|
+
readonly createdAt: bigint;
|
|
203
|
+
readonly bump: number;
|
|
204
|
+
readonly uri: string;
|
|
205
|
+
}
|
|
206
|
+
export declare function decodeCredentialSchema(data: Uint8Array): CredentialSchema | null;
|
|
207
|
+
export interface Credential {
|
|
208
|
+
readonly version: number;
|
|
209
|
+
/** The `Issuer` PDA. */
|
|
210
|
+
readonly issuer: string;
|
|
211
|
+
/** The `Handle` PDA. */
|
|
212
|
+
readonly handle: string;
|
|
213
|
+
readonly schemaId: number;
|
|
214
|
+
/** The holder it was issued to (co-signed). */
|
|
215
|
+
readonly subject: string;
|
|
216
|
+
readonly evidenceHash: Uint8Array;
|
|
217
|
+
readonly claimHash: Uint8Array;
|
|
218
|
+
readonly issuedAt: bigint;
|
|
219
|
+
/** 0n = no expiry. */
|
|
220
|
+
readonly expiresAt: bigint;
|
|
221
|
+
readonly rentPayer: string;
|
|
222
|
+
readonly bump: number;
|
|
223
|
+
}
|
|
224
|
+
export declare function decodeCredential(data: Uint8Array): Credential | null;
|
|
225
|
+
export interface CredConfig {
|
|
226
|
+
readonly issuerFeeLamports: bigint;
|
|
227
|
+
readonly credentialFeeLamports: bigint;
|
|
228
|
+
readonly updatedAt: bigint;
|
|
229
|
+
}
|
|
230
|
+
export declare function decodeCredConfig(data: Uint8Array): CredConfig | null;
|
|
231
|
+
export interface RecommendedIssuers {
|
|
232
|
+
/** Issuer PDAs, base58. ADVISORY: the program never reads this list. */
|
|
233
|
+
readonly issuers: readonly string[];
|
|
234
|
+
readonly updatedAt: bigint;
|
|
235
|
+
}
|
|
236
|
+
export declare function decodeRecommendedIssuers(data: Uint8Array): RecommendedIssuers | null;
|
|
237
|
+
/** What a reader knows about the handle right now. */
|
|
238
|
+
export interface CredentialHandleContext {
|
|
239
|
+
/** The `Handle` PDA (base58); null/undefined if it no longer exists. */
|
|
240
|
+
readonly handle: string | null;
|
|
241
|
+
readonly registeredAt: bigint;
|
|
242
|
+
/** H5 `holder_epoch` (0n if absent). */
|
|
243
|
+
readonly holderEpoch: bigint;
|
|
244
|
+
/** The CURRENT authority: `Handle.owner` while untokenized, the pNFT
|
|
245
|
+
* holder once tokenized. Null if unknown (the holder check then fails). */
|
|
246
|
+
readonly currentHolder: string | null;
|
|
247
|
+
}
|
|
248
|
+
export type CredentialInvalidReason = "released" | "expired" | "insufficient_headroom" | "issuer_retired" | "invalidated" | "epoch" | "holder_mismatch" | "holder_unknown" | "issuer_not_accepted" | "wrong_handle" | "wrong_schema";
|
|
249
|
+
export interface CredentialValidity {
|
|
250
|
+
readonly valid: boolean;
|
|
251
|
+
readonly reasons: readonly CredentialInvalidReason[];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Whether `cred` counts for the handle's CURRENT holder at `nowSecs` — the
|
|
255
|
+
* same checks `assert_credential` makes. `records_cleared_at` deliberately
|
|
256
|
+
* plays no part (owner decision Q6). Pass `acceptedIssuers` / `schemaId` /
|
|
257
|
+
* `minRemainingSecs` to apply a gate's terms as well.
|
|
258
|
+
*/
|
|
259
|
+
export declare function credentialValidity(cred: Credential, issuer: Pick<Issuer, "status" | "invalidateBefore">, ctx: CredentialHandleContext, nowSecs: bigint | number, terms?: {
|
|
260
|
+
readonly acceptedIssuers?: readonly string[];
|
|
261
|
+
readonly schemaId?: number;
|
|
262
|
+
readonly minRemainingSecs?: bigint | number;
|
|
263
|
+
}): CredentialValidity;
|
|
264
|
+
/**
|
|
265
|
+
* Whether an issuer's `linkedHandle` still proves "this issuer is @name":
|
|
266
|
+
* the link was made in the handle's current ownership epoch and the wallet
|
|
267
|
+
* that co-signed it is still the handle's current authority.
|
|
268
|
+
*/
|
|
269
|
+
export declare function issuerLinkValid(issuer: Pick<Issuer, "linkedHandle" | "linkedBy" | "linkedAt">, ctx: CredentialHandleContext): boolean;
|
|
270
|
+
/** Decode the 52-byte `set_return_data` of a passing `assert_credential`. */
|
|
271
|
+
export declare function decodeAssertCredentialReturn(data: Uint8Array): {
|
|
272
|
+
readonly issuer: string;
|
|
273
|
+
readonly schemaId: number;
|
|
274
|
+
readonly issuedAt: bigint;
|
|
275
|
+
readonly expiresAt: bigint;
|
|
276
|
+
} | null;
|
|
277
|
+
/** Fetch raw data for several accounts in one `getMultipleAccounts` (null
|
|
278
|
+
* for a missing account, or one not owned by `programId`). */
|
|
279
|
+
export declare function fetchProgramAccountsData(rpc: RpcFn, programId: AddressLike, addresses: readonly string[], commitment?: string): Promise<(Uint8Array | null)[]>;
|
|
280
|
+
/** Read the advisory recommended-issuer list (empty if never written). */
|
|
281
|
+
export declare function fetchRecommendedIssuers(rpc: RpcFn, find: PdaFinder, programId: AddressLike): Promise<readonly string[]>;
|
|
282
|
+
/** One credential a handle holds from one issuer for one schema, with its
|
|
283
|
+
* issuer and validity. */
|
|
284
|
+
export interface HandleCredential {
|
|
285
|
+
readonly address: string;
|
|
286
|
+
readonly credential: Credential;
|
|
287
|
+
readonly issuer: Issuer | null;
|
|
288
|
+
readonly validity: CredentialValidity;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Fetch the credentials `handle` holds for `schemaId` from each of `issuers`
|
|
292
|
+
* (PDAs derived, one `getMultipleAccounts`), with each one's validity for
|
|
293
|
+
* `ctx` at `nowSecs`. Missing credentials are omitted.
|
|
294
|
+
*/
|
|
295
|
+
export declare function fetchHandleCredentials(rpc: RpcFn, find: PdaFinder, programId: AddressLike, ctx: CredentialHandleContext & {
|
|
296
|
+
readonly handle: string;
|
|
297
|
+
}, schemaId: number, issuers: readonly string[], nowSecs: bigint | number, minRemainingSecs?: bigint | number): Promise<HandleCredential[]>;
|
|
298
|
+
interface Common {
|
|
299
|
+
readonly programId: AddressLike;
|
|
300
|
+
}
|
|
301
|
+
export interface RegisterIssuerParams extends Common {
|
|
302
|
+
/** Signer, writable: pays the fee + rent. */
|
|
303
|
+
readonly payer: AddressLike;
|
|
304
|
+
/** Signer: the issuer's identity key. */
|
|
305
|
+
readonly authority: AddressLike;
|
|
306
|
+
readonly config: AddressLike;
|
|
307
|
+
/** {@link findCredConfigPda} (initialized or not). */
|
|
308
|
+
readonly credConfig: AddressLike;
|
|
309
|
+
/** `Config.treasury`. */
|
|
310
|
+
readonly treasury: AddressLike;
|
|
311
|
+
/** {@link findIssuerPda}(authority). */
|
|
312
|
+
readonly issuer: AddressLike;
|
|
313
|
+
readonly name: string;
|
|
314
|
+
readonly uri: string;
|
|
315
|
+
readonly uriHash?: Uint8Array;
|
|
316
|
+
}
|
|
317
|
+
/** `register_issuer(name, uri, uri_hash)`. */
|
|
318
|
+
export declare function buildRegisterIssuerIx(p: RegisterIssuerParams): BuiltInstruction;
|
|
319
|
+
export interface UpdateIssuerParams extends Common {
|
|
320
|
+
readonly authority: AddressLike;
|
|
321
|
+
readonly issuer: AddressLike;
|
|
322
|
+
readonly uri?: string;
|
|
323
|
+
readonly uriHash?: Uint8Array;
|
|
324
|
+
/** Active <-> Paused, or Retired (TERMINAL: every credential stops counting). */
|
|
325
|
+
readonly status?: "active" | "paused" | "retired";
|
|
326
|
+
/** Mass revocation cut-off (unix seconds, never lower than stored, <= now). */
|
|
327
|
+
readonly invalidateBefore?: bigint;
|
|
328
|
+
}
|
|
329
|
+
/** `update_issuer(uri?, uri_hash?, status?, invalidate_before?)`. Available
|
|
330
|
+
* during a lockdown (retiring a compromised key always works). */
|
|
331
|
+
export declare function buildUpdateIssuerIx(p: UpdateIssuerParams): BuiltInstruction;
|
|
332
|
+
export interface LinkIssuerHandleParams extends Common {
|
|
333
|
+
readonly authority: AddressLike;
|
|
334
|
+
/** Signer: the handle's current authority (owner, or pNFT holder). */
|
|
335
|
+
readonly handleAuthority: AddressLike;
|
|
336
|
+
readonly issuer: AddressLike;
|
|
337
|
+
readonly handle: AddressLike;
|
|
338
|
+
/** Tokenized name: `handleAuthority`'s ATA for the pNFT mint. */
|
|
339
|
+
readonly holderAta?: AddressLike;
|
|
340
|
+
/** Scoped `name.tld`: the `["namespace", label]` account. */
|
|
341
|
+
readonly namespace?: AddressLike;
|
|
342
|
+
}
|
|
343
|
+
/** `link_issuer_handle()`: the issuer proves it is `@name`. */
|
|
344
|
+
export declare function buildLinkIssuerHandleIx(p: LinkIssuerHandleParams): BuiltInstruction;
|
|
345
|
+
/** `unlink_issuer_handle()`. */
|
|
346
|
+
export declare function buildUnlinkIssuerHandleIx(p: Common & {
|
|
347
|
+
readonly authority: AddressLike;
|
|
348
|
+
readonly issuer: AddressLike;
|
|
349
|
+
}): BuiltInstruction;
|
|
350
|
+
export interface CreateSchemaParams extends Common {
|
|
351
|
+
readonly payer: AddressLike;
|
|
352
|
+
readonly authority: AddressLike;
|
|
353
|
+
readonly config: AddressLike;
|
|
354
|
+
readonly issuer: AddressLike;
|
|
355
|
+
/** {@link findCredentialSchemaPda}(issuer, schemaId). */
|
|
356
|
+
readonly schema: AddressLike;
|
|
357
|
+
readonly schemaId: number;
|
|
358
|
+
readonly name: string;
|
|
359
|
+
readonly uri?: string;
|
|
360
|
+
readonly contentHash?: Uint8Array;
|
|
361
|
+
/** 0n = credentials may be no-expiry; at most 10 years. IMMUTABLE. */
|
|
362
|
+
readonly maxValiditySecs: bigint;
|
|
363
|
+
}
|
|
364
|
+
/** `create_schema(schema_id, name, uri, content_hash, max_validity_secs)`. */
|
|
365
|
+
export declare function buildCreateSchemaIx(p: CreateSchemaParams): BuiltInstruction;
|
|
366
|
+
/** `deprecate_schema(schema_id)`: Active -> Deprecated, one way. */
|
|
367
|
+
export declare function buildDeprecateSchemaIx(p: Common & {
|
|
368
|
+
readonly authority: AddressLike;
|
|
369
|
+
readonly issuer: AddressLike;
|
|
370
|
+
readonly schema: AddressLike;
|
|
371
|
+
readonly schemaId: number;
|
|
372
|
+
}): BuiltInstruction;
|
|
373
|
+
export interface IssueCredentialParams extends Common {
|
|
374
|
+
/** Signer, writable: rent (+ the optional credential fee). Recorded as
|
|
375
|
+
* `rent_payer` on first issue. */
|
|
376
|
+
readonly payer: AddressLike;
|
|
377
|
+
/** Signer: the issuer authority. */
|
|
378
|
+
readonly authority: AddressLike;
|
|
379
|
+
/** Signer: the handle's CURRENT authority (owner decision Q1). */
|
|
380
|
+
readonly subject: AddressLike;
|
|
381
|
+
readonly config: AddressLike;
|
|
382
|
+
readonly credConfig: AddressLike;
|
|
383
|
+
readonly treasury: AddressLike;
|
|
384
|
+
readonly issuer: AddressLike;
|
|
385
|
+
readonly schema: AddressLike;
|
|
386
|
+
readonly handle: AddressLike;
|
|
387
|
+
/** {@link findCredentialPda}(issuer, handle, schemaId). */
|
|
388
|
+
readonly credential: AddressLike;
|
|
389
|
+
readonly schemaId: number;
|
|
390
|
+
readonly evidenceHash: Uint8Array;
|
|
391
|
+
/** sha256(salt ‖ canonical claim); omit for none. */
|
|
392
|
+
readonly claimHash?: Uint8Array;
|
|
393
|
+
/** 0n = no expiry (only when the schema allows it). */
|
|
394
|
+
readonly expiresAt: bigint;
|
|
395
|
+
/** Tokenized name: the subject's ATA for the pNFT mint (FIRST). */
|
|
396
|
+
readonly holderAta?: AddressLike;
|
|
397
|
+
/** Scoped `name.tld`: the namespace (after the ATA). */
|
|
398
|
+
readonly namespace?: AddressLike;
|
|
399
|
+
}
|
|
400
|
+
/** `issue_credential(schema_id, evidence_hash, claim_hash, expires_at)` —
|
|
401
|
+
* a three-signer transaction (payer, issuer authority, holder). */
|
|
402
|
+
export declare function buildIssueCredentialIx(p: IssueCredentialParams): BuiltInstruction;
|
|
403
|
+
export interface RenewCredentialParams extends Common {
|
|
404
|
+
readonly authority: AddressLike;
|
|
405
|
+
readonly config: AddressLike;
|
|
406
|
+
readonly issuer: AddressLike;
|
|
407
|
+
readonly handle: AddressLike;
|
|
408
|
+
readonly credential: AddressLike;
|
|
409
|
+
readonly schema: AddressLike;
|
|
410
|
+
readonly expiresAt: bigint;
|
|
411
|
+
readonly evidenceHash?: Uint8Array;
|
|
412
|
+
/** Tokenized name: the STORED subject's ATA. */
|
|
413
|
+
readonly holderAta?: AddressLike;
|
|
414
|
+
readonly namespace?: AddressLike;
|
|
415
|
+
}
|
|
416
|
+
/** `renew_credential(expires_at, evidence_hash?)` — issuer only; only while
|
|
417
|
+
* the credential still counts for its subject. */
|
|
418
|
+
export declare function buildRenewCredentialIx(p: RenewCredentialParams): BuiltInstruction;
|
|
419
|
+
/** `revoke_credential()` — issuer only; rent to `rentPayer`. */
|
|
420
|
+
export declare function buildRevokeCredentialIx(p: Common & {
|
|
421
|
+
readonly authority: AddressLike;
|
|
422
|
+
readonly issuer: AddressLike;
|
|
423
|
+
readonly credential: AddressLike;
|
|
424
|
+
readonly rentPayer: AddressLike;
|
|
425
|
+
}): BuiltInstruction;
|
|
426
|
+
/** `close_credential()` — anyone (no signer), for a credential that can never
|
|
427
|
+
* count again; rent to `rentPayer`, never to the caller. */
|
|
428
|
+
export declare function buildCloseCredentialIx(p: Common & {
|
|
429
|
+
readonly credential: AddressLike;
|
|
430
|
+
readonly rentPayer: AddressLike;
|
|
431
|
+
readonly issuer: AddressLike;
|
|
432
|
+
readonly handle: AddressLike;
|
|
433
|
+
}): BuiltInstruction;
|
|
434
|
+
export interface AssertCredentialParams extends Common {
|
|
435
|
+
/** Signer: must be the handle's current authority and the credential's subject. */
|
|
436
|
+
readonly caller: AddressLike;
|
|
437
|
+
readonly handle: AddressLike;
|
|
438
|
+
readonly credential: AddressLike;
|
|
439
|
+
readonly issuer: AddressLike;
|
|
440
|
+
readonly schemaId: number;
|
|
441
|
+
/** 1-8 Issuer PDAs. YOUR constant set: never the end user's input. */
|
|
442
|
+
readonly acceptedIssuers: readonly AddressLike[];
|
|
443
|
+
readonly minRemainingSecs?: bigint;
|
|
444
|
+
readonly holderAta?: AddressLike;
|
|
445
|
+
readonly namespace?: AddressLike;
|
|
446
|
+
}
|
|
447
|
+
/** `assert_credential(schema_id, accepted_issuers, min_remaining_secs)` —
|
|
448
|
+
* the side-effect-free gate; compose it before your gated instruction. */
|
|
449
|
+
export declare function buildAssertCredentialIx(p: AssertCredentialParams): BuiltInstruction;
|
|
450
|
+
/** `set_credential_config(issuer_fee, credential_fee)` — `Config.admin`. */
|
|
451
|
+
export declare function buildSetCredentialConfigIx(p: Common & {
|
|
452
|
+
readonly admin: AddressLike;
|
|
453
|
+
readonly config: AddressLike;
|
|
454
|
+
readonly credConfig: AddressLike;
|
|
455
|
+
readonly issuerFeeLamports: bigint;
|
|
456
|
+
readonly credentialFeeLamports: bigint;
|
|
457
|
+
}): BuiltInstruction;
|
|
458
|
+
/** `set_recommended_issuers(issuers)` — `Config.admin`; each listed Issuer
|
|
459
|
+
* account rides along read-only, in list order. */
|
|
460
|
+
export declare function buildSetRecommendedIssuersIx(p: Common & {
|
|
461
|
+
readonly admin: AddressLike;
|
|
462
|
+
readonly config: AddressLike;
|
|
463
|
+
readonly recommended: AddressLike;
|
|
464
|
+
readonly issuers: readonly AddressLike[];
|
|
465
|
+
}): BuiltInstruction;
|
|
466
|
+
export {};
|