@oma3/omatrust 0.1.0-alpha.2 → 0.1.0-alpha.3
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/dist/eip712-C4a-JGko.d.cts +344 -0
- package/dist/eip712-C4a-JGko.d.ts +344 -0
- package/dist/index-BDeQNCi_.d.ts +96 -0
- package/dist/index-DP6IIpIh.d.cts +96 -0
- package/dist/index.cjs +63 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +63 -32
- package/dist/index.js.map +1 -1
- package/dist/reputation/index.browser.cjs +1490 -0
- package/dist/reputation/index.browser.cjs.map +1 -0
- package/dist/reputation/index.browser.d.cts +10 -0
- package/dist/reputation/index.browser.d.ts +10 -0
- package/dist/reputation/index.browser.js +1435 -0
- package/dist/reputation/index.browser.js.map +1 -0
- package/dist/reputation/index.cjs +63 -32
- package/dist/reputation/index.cjs.map +1 -1
- package/dist/reputation/index.d.cts +2 -1
- package/dist/reputation/index.d.ts +2 -1
- package/dist/reputation/index.js +63 -33
- package/dist/reputation/index.js.map +1 -1
- package/package.json +5 -1
- package/dist/index-ChbJxwOA.d.cts +0 -415
- package/dist/index-ChbJxwOA.d.ts +0 -415
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
type Hex = `0x${string}`;
|
|
2
|
+
type Did = string;
|
|
3
|
+
type ProofType = "pop-jws" | "pop-eip712" | "x402-receipt" | "evidence-pointer" | "tx-encoded-value" | "tx-interaction" | "x402-offer";
|
|
4
|
+
type ProofPurpose = "shared-control" | "commercial-tx";
|
|
5
|
+
type SchemaField = {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
};
|
|
10
|
+
type AttestationQueryResult = {
|
|
11
|
+
uid: Hex;
|
|
12
|
+
schema: Hex;
|
|
13
|
+
attester: Hex;
|
|
14
|
+
recipient: Hex;
|
|
15
|
+
revocable: boolean;
|
|
16
|
+
revocationTime: bigint;
|
|
17
|
+
expirationTime: bigint;
|
|
18
|
+
time: bigint;
|
|
19
|
+
refUID: Hex;
|
|
20
|
+
data: Record<string, unknown>;
|
|
21
|
+
raw?: Hex;
|
|
22
|
+
};
|
|
23
|
+
type ProofWrapper = {
|
|
24
|
+
proofType: ProofType;
|
|
25
|
+
proofObject: unknown;
|
|
26
|
+
proofPurpose?: ProofPurpose;
|
|
27
|
+
version?: number;
|
|
28
|
+
issuedAt?: number;
|
|
29
|
+
expiresAt?: number;
|
|
30
|
+
};
|
|
31
|
+
type TxEncodedValueProof = ProofWrapper & {
|
|
32
|
+
proofType: "tx-encoded-value";
|
|
33
|
+
proofPurpose: ProofPurpose;
|
|
34
|
+
proofObject: {
|
|
35
|
+
chainId: string;
|
|
36
|
+
txHash: Hex;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type TxInteractionProof = ProofWrapper & {
|
|
40
|
+
proofType: "tx-interaction";
|
|
41
|
+
proofPurpose: "commercial-tx";
|
|
42
|
+
proofObject: {
|
|
43
|
+
chainId: string;
|
|
44
|
+
txHash: Hex;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type PopEip712Proof = ProofWrapper & {
|
|
48
|
+
proofType: "pop-eip712";
|
|
49
|
+
proofObject: {
|
|
50
|
+
domain: {
|
|
51
|
+
name: string;
|
|
52
|
+
version: string;
|
|
53
|
+
chainId: number;
|
|
54
|
+
verifyingContract?: Hex;
|
|
55
|
+
};
|
|
56
|
+
message: {
|
|
57
|
+
signer: string;
|
|
58
|
+
authorizedEntity: string;
|
|
59
|
+
signingPurpose: string;
|
|
60
|
+
creationTimestamp: number;
|
|
61
|
+
expirationTimestamp: number;
|
|
62
|
+
randomValue: Hex;
|
|
63
|
+
statement: string;
|
|
64
|
+
};
|
|
65
|
+
signature: Hex;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type PopJwsProof = ProofWrapper & {
|
|
69
|
+
proofType: "pop-jws";
|
|
70
|
+
proofObject: string;
|
|
71
|
+
};
|
|
72
|
+
type X402ReceiptProof = ProofWrapper & {
|
|
73
|
+
proofType: "x402-receipt";
|
|
74
|
+
proofPurpose: "commercial-tx";
|
|
75
|
+
proofObject: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
type X402OfferProof = ProofWrapper & {
|
|
78
|
+
proofType: "x402-offer";
|
|
79
|
+
proofPurpose: "commercial-tx";
|
|
80
|
+
proofObject: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
type EvidencePointerProof = ProofWrapper & {
|
|
83
|
+
proofType: "evidence-pointer";
|
|
84
|
+
proofPurpose: "shared-control";
|
|
85
|
+
proofObject: {
|
|
86
|
+
url: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
type ChainConstants = {
|
|
90
|
+
base: bigint;
|
|
91
|
+
range: bigint;
|
|
92
|
+
decimals: number;
|
|
93
|
+
nativeSymbol: string;
|
|
94
|
+
};
|
|
95
|
+
type SubmitAttestationParams = {
|
|
96
|
+
signer: unknown;
|
|
97
|
+
chainId: number;
|
|
98
|
+
easContractAddress: Hex;
|
|
99
|
+
schemaUid: Hex;
|
|
100
|
+
schema: SchemaField[] | string;
|
|
101
|
+
data: Record<string, unknown>;
|
|
102
|
+
revocable?: boolean;
|
|
103
|
+
expirationTime?: bigint | number;
|
|
104
|
+
refUid?: Hex;
|
|
105
|
+
value?: bigint | number;
|
|
106
|
+
};
|
|
107
|
+
type SubmitAttestationResult = {
|
|
108
|
+
uid: Hex;
|
|
109
|
+
txHash: Hex;
|
|
110
|
+
receipt?: unknown;
|
|
111
|
+
};
|
|
112
|
+
type PrepareDelegatedAttestationParams = {
|
|
113
|
+
chainId: number;
|
|
114
|
+
easContractAddress: Hex;
|
|
115
|
+
schemaUid: Hex;
|
|
116
|
+
schema: SchemaField[] | string;
|
|
117
|
+
data: Record<string, unknown>;
|
|
118
|
+
attester: Hex;
|
|
119
|
+
nonce: bigint | number;
|
|
120
|
+
revocable?: boolean;
|
|
121
|
+
expirationTime?: bigint | number;
|
|
122
|
+
refUid?: Hex;
|
|
123
|
+
value?: bigint | number;
|
|
124
|
+
deadline?: bigint | number;
|
|
125
|
+
};
|
|
126
|
+
type PrepareDelegatedAttestationResult = {
|
|
127
|
+
delegatedRequest: Record<string, unknown>;
|
|
128
|
+
typedData: {
|
|
129
|
+
domain: Record<string, unknown>;
|
|
130
|
+
types: Record<string, unknown>;
|
|
131
|
+
message: Record<string, unknown>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
type BuildDelegatedTypedDataFromEncodedParams = {
|
|
135
|
+
chainId: number;
|
|
136
|
+
easContractAddress: Hex;
|
|
137
|
+
schemaUid: Hex;
|
|
138
|
+
encodedData: Hex;
|
|
139
|
+
recipient: Hex;
|
|
140
|
+
attester: Hex;
|
|
141
|
+
nonce: bigint | number;
|
|
142
|
+
revocable?: boolean;
|
|
143
|
+
expirationTime?: bigint | number;
|
|
144
|
+
refUid?: Hex;
|
|
145
|
+
value?: bigint | number;
|
|
146
|
+
deadline?: bigint | number;
|
|
147
|
+
};
|
|
148
|
+
type SubmitDelegatedAttestationParams = {
|
|
149
|
+
relayUrl: string;
|
|
150
|
+
prepared: PrepareDelegatedAttestationResult;
|
|
151
|
+
signature: Hex | string;
|
|
152
|
+
attester?: Hex;
|
|
153
|
+
};
|
|
154
|
+
type SubmitDelegatedAttestationResult = {
|
|
155
|
+
uid: Hex;
|
|
156
|
+
txHash?: Hex;
|
|
157
|
+
status: "submitted" | "confirmed";
|
|
158
|
+
};
|
|
159
|
+
type GetAttestationParams = {
|
|
160
|
+
uid: Hex;
|
|
161
|
+
provider: unknown;
|
|
162
|
+
easContractAddress: Hex;
|
|
163
|
+
schema?: SchemaField[] | string;
|
|
164
|
+
};
|
|
165
|
+
type ListAttestationsParams = {
|
|
166
|
+
did: Did;
|
|
167
|
+
provider: unknown;
|
|
168
|
+
easContractAddress: Hex;
|
|
169
|
+
schemas?: Hex[];
|
|
170
|
+
limit?: number;
|
|
171
|
+
fromBlock?: number;
|
|
172
|
+
toBlock?: number;
|
|
173
|
+
};
|
|
174
|
+
type VerifyAttestationParams = {
|
|
175
|
+
attestation: AttestationQueryResult;
|
|
176
|
+
provider?: unknown;
|
|
177
|
+
checks?: ProofType[];
|
|
178
|
+
context?: Record<string, unknown>;
|
|
179
|
+
};
|
|
180
|
+
type VerifyAttestationResult = {
|
|
181
|
+
valid: boolean;
|
|
182
|
+
checks: Record<string, boolean>;
|
|
183
|
+
reasons: string[];
|
|
184
|
+
};
|
|
185
|
+
type CallControllerWitnessParams = {
|
|
186
|
+
gatewayUrl: string;
|
|
187
|
+
attestationUid: Hex;
|
|
188
|
+
chainId: number;
|
|
189
|
+
easContract: Hex;
|
|
190
|
+
schemaUid: Hex;
|
|
191
|
+
subject: Did;
|
|
192
|
+
controller: Did;
|
|
193
|
+
timeoutMs?: number;
|
|
194
|
+
};
|
|
195
|
+
type CallControllerWitnessResult = {
|
|
196
|
+
ok: boolean;
|
|
197
|
+
method: "dns-txt" | "did-json";
|
|
198
|
+
details?: unknown;
|
|
199
|
+
};
|
|
200
|
+
type VerifyProofParams = {
|
|
201
|
+
proof: ProofWrapper;
|
|
202
|
+
provider?: unknown;
|
|
203
|
+
expectedSubject?: Did;
|
|
204
|
+
expectedController?: Did;
|
|
205
|
+
};
|
|
206
|
+
type VerifyProofResult = {
|
|
207
|
+
valid: boolean;
|
|
208
|
+
proofType: ProofType;
|
|
209
|
+
reason?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare function submitAttestation(params: SubmitAttestationParams): Promise<SubmitAttestationResult>;
|
|
213
|
+
|
|
214
|
+
declare function buildDelegatedAttestationTypedData(params: PrepareDelegatedAttestationParams): {
|
|
215
|
+
domain: Record<string, unknown>;
|
|
216
|
+
types: Record<string, unknown>;
|
|
217
|
+
message: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
declare function buildDelegatedTypedDataFromEncoded(params: BuildDelegatedTypedDataFromEncodedParams): {
|
|
220
|
+
domain: Record<string, unknown>;
|
|
221
|
+
types: Record<string, unknown>;
|
|
222
|
+
message: Record<string, unknown>;
|
|
223
|
+
};
|
|
224
|
+
declare function splitSignature(signature: Hex | string): {
|
|
225
|
+
v: number;
|
|
226
|
+
r: Hex;
|
|
227
|
+
s: Hex;
|
|
228
|
+
};
|
|
229
|
+
declare function prepareDelegatedAttestation(params: PrepareDelegatedAttestationParams): Promise<PrepareDelegatedAttestationResult>;
|
|
230
|
+
declare function submitDelegatedAttestation(params: SubmitDelegatedAttestationParams): Promise<SubmitDelegatedAttestationResult>;
|
|
231
|
+
|
|
232
|
+
declare function getAttestation(params: GetAttestationParams): Promise<AttestationQueryResult>;
|
|
233
|
+
declare function getAttestationsForDid(params: ListAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
234
|
+
declare function listAttestations(params: ListAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
235
|
+
type GetLatestAttestationsParams = {
|
|
236
|
+
provider: unknown;
|
|
237
|
+
easContractAddress: Hex;
|
|
238
|
+
schemas?: Hex[];
|
|
239
|
+
limit?: number;
|
|
240
|
+
fromBlock?: number;
|
|
241
|
+
};
|
|
242
|
+
declare function getLatestAttestations(params: GetLatestAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
243
|
+
declare function deduplicateReviews(attestations: AttestationQueryResult[]): AttestationQueryResult[];
|
|
244
|
+
declare function calculateAverageUserReviewRating(attestations: AttestationQueryResult[]): number;
|
|
245
|
+
declare function getMajorVersion(version: string): number;
|
|
246
|
+
|
|
247
|
+
declare function verifyProof(params: VerifyProofParams): Promise<VerifyProofResult>;
|
|
248
|
+
declare function verifyAttestation(params: VerifyAttestationParams): Promise<VerifyAttestationResult>;
|
|
249
|
+
|
|
250
|
+
declare function normalizeSchema(schema: SchemaField[] | string): SchemaField[];
|
|
251
|
+
declare function schemaToString(schema: SchemaField[] | string): string;
|
|
252
|
+
declare function encodeAttestationData(schema: SchemaField[] | string, data: Record<string, unknown>): Hex;
|
|
253
|
+
declare function decodeAttestationData(schema: SchemaField[] | string, encodedData: Hex): Record<string, unknown>;
|
|
254
|
+
declare function extractExpirationTime(data: Record<string, unknown>): bigint | number | undefined;
|
|
255
|
+
|
|
256
|
+
declare function verifySchemaExists(schemaRegistry: unknown, schemaUid: Hex): Promise<boolean>;
|
|
257
|
+
declare function getSchemaDetails(schemaRegistry: unknown, schemaUid: Hex): Promise<{
|
|
258
|
+
uid: Hex;
|
|
259
|
+
schema: string;
|
|
260
|
+
resolver: Hex;
|
|
261
|
+
revocable: boolean;
|
|
262
|
+
}>;
|
|
263
|
+
declare function formatSchemaUid(schemaUid: string): Hex;
|
|
264
|
+
|
|
265
|
+
declare function callControllerWitness(params: CallControllerWitnessParams): Promise<CallControllerWitnessResult>;
|
|
266
|
+
|
|
267
|
+
declare function getSupportedChainIds(): number[];
|
|
268
|
+
declare function isChainSupported(chainId: number): boolean;
|
|
269
|
+
declare function getChainConstants(chainId: number, purpose: ProofPurpose): ChainConstants;
|
|
270
|
+
declare function constructSeed(subjectDidHash: Hex, counterpartyDidHash: Hex, purpose: ProofPurpose): Uint8Array;
|
|
271
|
+
declare function hashSeed(seedBytes: Uint8Array, chainId: number): Hex;
|
|
272
|
+
declare function calculateTransferAmount(subject: string, counterparty: string, chainId: number, purpose: ProofPurpose): bigint;
|
|
273
|
+
declare function calculateTransferAmountFromAddresses(subjectAddress: string, counterpartyAddress: string, chainId: number, purpose: ProofPurpose): bigint;
|
|
274
|
+
declare function createTxEncodedValueProof(chainId: number, txHash: Hex, purpose: ProofPurpose): TxEncodedValueProof;
|
|
275
|
+
declare function formatTransferAmount(amount: bigint | number, chainId: number): string;
|
|
276
|
+
declare function getExplorerTxUrl(chainId: number, txHash: Hex): string;
|
|
277
|
+
declare function getExplorerAddressUrl(chainId: number, address: string): string;
|
|
278
|
+
|
|
279
|
+
declare function createTxInteractionProof(chainId: number, txHash: Hex): TxInteractionProof;
|
|
280
|
+
|
|
281
|
+
type CreatePopEip712ProofParams = {
|
|
282
|
+
signer: string;
|
|
283
|
+
authorizedEntity: string;
|
|
284
|
+
signingPurpose: ProofPurpose;
|
|
285
|
+
chainId: number;
|
|
286
|
+
creationTimestamp?: number;
|
|
287
|
+
expirationTimestamp?: number;
|
|
288
|
+
randomValue?: Hex;
|
|
289
|
+
statement?: string;
|
|
290
|
+
};
|
|
291
|
+
declare function createPopEip712Proof(params: CreatePopEip712ProofParams, signFn: (typedData: Record<string, unknown>) => Promise<Hex>): Promise<PopEip712Proof>;
|
|
292
|
+
|
|
293
|
+
type CreatePopJwsProofParams = {
|
|
294
|
+
issuer: Did;
|
|
295
|
+
audience: Did;
|
|
296
|
+
purpose: ProofPurpose;
|
|
297
|
+
issuedAt?: number;
|
|
298
|
+
expiresAt?: number;
|
|
299
|
+
nonce?: string;
|
|
300
|
+
};
|
|
301
|
+
declare function createPopJwsProof(params: CreatePopJwsProofParams, signFn: (payload: Record<string, unknown>, header: Record<string, unknown>) => Promise<string>): Promise<PopJwsProof>;
|
|
302
|
+
|
|
303
|
+
declare function createX402ReceiptProof(receipt: Record<string, unknown>): X402ReceiptProof;
|
|
304
|
+
declare function createX402OfferProof(offer: Record<string, unknown>): X402OfferProof;
|
|
305
|
+
|
|
306
|
+
declare function createEvidencePointerProof(url: string): EvidencePointerProof;
|
|
307
|
+
|
|
308
|
+
declare function parseDnsTxtRecord(record: string): {
|
|
309
|
+
version?: string;
|
|
310
|
+
controller?: Did;
|
|
311
|
+
[key: string]: string | undefined;
|
|
312
|
+
};
|
|
313
|
+
declare function buildDnsTxtRecord(controllerDid: Did): string;
|
|
314
|
+
|
|
315
|
+
declare function fetchDidDocument(domain: string): Promise<Record<string, unknown>>;
|
|
316
|
+
declare function extractAddressesFromDidDocument(didDocument: Record<string, unknown>): string[];
|
|
317
|
+
declare function verifyDidDocumentControllerDid(didDocument: Record<string, unknown>, expectedControllerDid: Did): {
|
|
318
|
+
valid: boolean;
|
|
319
|
+
reason?: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
declare function buildEip712Domain(name: string, version: string, chainId: number, verifyingContract: Hex): {
|
|
323
|
+
name: string;
|
|
324
|
+
version: string;
|
|
325
|
+
chainId: number;
|
|
326
|
+
verifyingContract: Hex;
|
|
327
|
+
};
|
|
328
|
+
declare function getOmaTrustProofEip712Types(): {
|
|
329
|
+
primaryType: string;
|
|
330
|
+
types: Record<string, Array<{
|
|
331
|
+
name: string;
|
|
332
|
+
type: string;
|
|
333
|
+
}>>;
|
|
334
|
+
};
|
|
335
|
+
declare function verifyEip712Signature(typedData: {
|
|
336
|
+
domain: Record<string, unknown>;
|
|
337
|
+
types: Record<string, unknown>;
|
|
338
|
+
message: Record<string, unknown>;
|
|
339
|
+
}, signature: Hex | string): {
|
|
340
|
+
valid: boolean;
|
|
341
|
+
signer?: string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export { extractExpirationTime as $, type AttestationQueryResult as A, type BuildDelegatedTypedDataFromEncodedParams as B, type CallControllerWitnessParams as C, type Did as D, type EvidencePointerProof as E, calculateTransferAmountFromAddresses as F, type GetAttestationParams as G, type Hex as H, callControllerWitness as I, constructSeed as J, createEvidencePointerProof as K, type ListAttestationsParams as L, createPopEip712Proof as M, createPopJwsProof as N, createTxEncodedValueProof as O, type PopEip712Proof as P, createTxInteractionProof as Q, createX402OfferProof as R, type SchemaField as S, type TxEncodedValueProof as T, createX402ReceiptProof as U, type VerifyAttestationParams as V, decodeAttestationData as W, type X402OfferProof as X, deduplicateReviews as Y, encodeAttestationData as Z, extractAddressesFromDidDocument as _, type CallControllerWitnessResult as a, fetchDidDocument as a0, formatSchemaUid as a1, formatTransferAmount as a2, getAttestation as a3, getAttestationsForDid as a4, getChainConstants as a5, getExplorerAddressUrl as a6, getExplorerTxUrl as a7, getLatestAttestations as a8, getMajorVersion as a9, getOmaTrustProofEip712Types as aa, getSchemaDetails as ab, getSupportedChainIds as ac, hashSeed as ad, isChainSupported as ae, listAttestations as af, normalizeSchema as ag, parseDnsTxtRecord as ah, prepareDelegatedAttestation as ai, schemaToString as aj, splitSignature as ak, submitAttestation as al, submitDelegatedAttestation as am, verifyAttestation as an, verifyDidDocumentControllerDid as ao, verifyEip712Signature as ap, verifyProof as aq, verifySchemaExists as ar, type ChainConstants as b, type CreatePopEip712ProofParams as c, type CreatePopJwsProofParams as d, type GetLatestAttestationsParams as e, type PopJwsProof as f, type PrepareDelegatedAttestationParams as g, type PrepareDelegatedAttestationResult as h, type ProofPurpose as i, type ProofType as j, type ProofWrapper as k, type SubmitAttestationParams as l, type SubmitAttestationResult as m, type SubmitDelegatedAttestationParams as n, type SubmitDelegatedAttestationResult as o, type TxInteractionProof as p, type VerifyAttestationResult as q, type VerifyProofParams as r, type VerifyProofResult as s, type X402ReceiptProof as t, buildDelegatedAttestationTypedData as u, buildDelegatedTypedDataFromEncoded as v, buildDnsTxtRecord as w, buildEip712Domain as x, calculateAverageUserReviewRating as y, calculateTransferAmount as z };
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
type Hex = `0x${string}`;
|
|
2
|
+
type Did = string;
|
|
3
|
+
type ProofType = "pop-jws" | "pop-eip712" | "x402-receipt" | "evidence-pointer" | "tx-encoded-value" | "tx-interaction" | "x402-offer";
|
|
4
|
+
type ProofPurpose = "shared-control" | "commercial-tx";
|
|
5
|
+
type SchemaField = {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
};
|
|
10
|
+
type AttestationQueryResult = {
|
|
11
|
+
uid: Hex;
|
|
12
|
+
schema: Hex;
|
|
13
|
+
attester: Hex;
|
|
14
|
+
recipient: Hex;
|
|
15
|
+
revocable: boolean;
|
|
16
|
+
revocationTime: bigint;
|
|
17
|
+
expirationTime: bigint;
|
|
18
|
+
time: bigint;
|
|
19
|
+
refUID: Hex;
|
|
20
|
+
data: Record<string, unknown>;
|
|
21
|
+
raw?: Hex;
|
|
22
|
+
};
|
|
23
|
+
type ProofWrapper = {
|
|
24
|
+
proofType: ProofType;
|
|
25
|
+
proofObject: unknown;
|
|
26
|
+
proofPurpose?: ProofPurpose;
|
|
27
|
+
version?: number;
|
|
28
|
+
issuedAt?: number;
|
|
29
|
+
expiresAt?: number;
|
|
30
|
+
};
|
|
31
|
+
type TxEncodedValueProof = ProofWrapper & {
|
|
32
|
+
proofType: "tx-encoded-value";
|
|
33
|
+
proofPurpose: ProofPurpose;
|
|
34
|
+
proofObject: {
|
|
35
|
+
chainId: string;
|
|
36
|
+
txHash: Hex;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type TxInteractionProof = ProofWrapper & {
|
|
40
|
+
proofType: "tx-interaction";
|
|
41
|
+
proofPurpose: "commercial-tx";
|
|
42
|
+
proofObject: {
|
|
43
|
+
chainId: string;
|
|
44
|
+
txHash: Hex;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type PopEip712Proof = ProofWrapper & {
|
|
48
|
+
proofType: "pop-eip712";
|
|
49
|
+
proofObject: {
|
|
50
|
+
domain: {
|
|
51
|
+
name: string;
|
|
52
|
+
version: string;
|
|
53
|
+
chainId: number;
|
|
54
|
+
verifyingContract?: Hex;
|
|
55
|
+
};
|
|
56
|
+
message: {
|
|
57
|
+
signer: string;
|
|
58
|
+
authorizedEntity: string;
|
|
59
|
+
signingPurpose: string;
|
|
60
|
+
creationTimestamp: number;
|
|
61
|
+
expirationTimestamp: number;
|
|
62
|
+
randomValue: Hex;
|
|
63
|
+
statement: string;
|
|
64
|
+
};
|
|
65
|
+
signature: Hex;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type PopJwsProof = ProofWrapper & {
|
|
69
|
+
proofType: "pop-jws";
|
|
70
|
+
proofObject: string;
|
|
71
|
+
};
|
|
72
|
+
type X402ReceiptProof = ProofWrapper & {
|
|
73
|
+
proofType: "x402-receipt";
|
|
74
|
+
proofPurpose: "commercial-tx";
|
|
75
|
+
proofObject: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
type X402OfferProof = ProofWrapper & {
|
|
78
|
+
proofType: "x402-offer";
|
|
79
|
+
proofPurpose: "commercial-tx";
|
|
80
|
+
proofObject: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
type EvidencePointerProof = ProofWrapper & {
|
|
83
|
+
proofType: "evidence-pointer";
|
|
84
|
+
proofPurpose: "shared-control";
|
|
85
|
+
proofObject: {
|
|
86
|
+
url: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
type ChainConstants = {
|
|
90
|
+
base: bigint;
|
|
91
|
+
range: bigint;
|
|
92
|
+
decimals: number;
|
|
93
|
+
nativeSymbol: string;
|
|
94
|
+
};
|
|
95
|
+
type SubmitAttestationParams = {
|
|
96
|
+
signer: unknown;
|
|
97
|
+
chainId: number;
|
|
98
|
+
easContractAddress: Hex;
|
|
99
|
+
schemaUid: Hex;
|
|
100
|
+
schema: SchemaField[] | string;
|
|
101
|
+
data: Record<string, unknown>;
|
|
102
|
+
revocable?: boolean;
|
|
103
|
+
expirationTime?: bigint | number;
|
|
104
|
+
refUid?: Hex;
|
|
105
|
+
value?: bigint | number;
|
|
106
|
+
};
|
|
107
|
+
type SubmitAttestationResult = {
|
|
108
|
+
uid: Hex;
|
|
109
|
+
txHash: Hex;
|
|
110
|
+
receipt?: unknown;
|
|
111
|
+
};
|
|
112
|
+
type PrepareDelegatedAttestationParams = {
|
|
113
|
+
chainId: number;
|
|
114
|
+
easContractAddress: Hex;
|
|
115
|
+
schemaUid: Hex;
|
|
116
|
+
schema: SchemaField[] | string;
|
|
117
|
+
data: Record<string, unknown>;
|
|
118
|
+
attester: Hex;
|
|
119
|
+
nonce: bigint | number;
|
|
120
|
+
revocable?: boolean;
|
|
121
|
+
expirationTime?: bigint | number;
|
|
122
|
+
refUid?: Hex;
|
|
123
|
+
value?: bigint | number;
|
|
124
|
+
deadline?: bigint | number;
|
|
125
|
+
};
|
|
126
|
+
type PrepareDelegatedAttestationResult = {
|
|
127
|
+
delegatedRequest: Record<string, unknown>;
|
|
128
|
+
typedData: {
|
|
129
|
+
domain: Record<string, unknown>;
|
|
130
|
+
types: Record<string, unknown>;
|
|
131
|
+
message: Record<string, unknown>;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
type BuildDelegatedTypedDataFromEncodedParams = {
|
|
135
|
+
chainId: number;
|
|
136
|
+
easContractAddress: Hex;
|
|
137
|
+
schemaUid: Hex;
|
|
138
|
+
encodedData: Hex;
|
|
139
|
+
recipient: Hex;
|
|
140
|
+
attester: Hex;
|
|
141
|
+
nonce: bigint | number;
|
|
142
|
+
revocable?: boolean;
|
|
143
|
+
expirationTime?: bigint | number;
|
|
144
|
+
refUid?: Hex;
|
|
145
|
+
value?: bigint | number;
|
|
146
|
+
deadline?: bigint | number;
|
|
147
|
+
};
|
|
148
|
+
type SubmitDelegatedAttestationParams = {
|
|
149
|
+
relayUrl: string;
|
|
150
|
+
prepared: PrepareDelegatedAttestationResult;
|
|
151
|
+
signature: Hex | string;
|
|
152
|
+
attester?: Hex;
|
|
153
|
+
};
|
|
154
|
+
type SubmitDelegatedAttestationResult = {
|
|
155
|
+
uid: Hex;
|
|
156
|
+
txHash?: Hex;
|
|
157
|
+
status: "submitted" | "confirmed";
|
|
158
|
+
};
|
|
159
|
+
type GetAttestationParams = {
|
|
160
|
+
uid: Hex;
|
|
161
|
+
provider: unknown;
|
|
162
|
+
easContractAddress: Hex;
|
|
163
|
+
schema?: SchemaField[] | string;
|
|
164
|
+
};
|
|
165
|
+
type ListAttestationsParams = {
|
|
166
|
+
did: Did;
|
|
167
|
+
provider: unknown;
|
|
168
|
+
easContractAddress: Hex;
|
|
169
|
+
schemas?: Hex[];
|
|
170
|
+
limit?: number;
|
|
171
|
+
fromBlock?: number;
|
|
172
|
+
toBlock?: number;
|
|
173
|
+
};
|
|
174
|
+
type VerifyAttestationParams = {
|
|
175
|
+
attestation: AttestationQueryResult;
|
|
176
|
+
provider?: unknown;
|
|
177
|
+
checks?: ProofType[];
|
|
178
|
+
context?: Record<string, unknown>;
|
|
179
|
+
};
|
|
180
|
+
type VerifyAttestationResult = {
|
|
181
|
+
valid: boolean;
|
|
182
|
+
checks: Record<string, boolean>;
|
|
183
|
+
reasons: string[];
|
|
184
|
+
};
|
|
185
|
+
type CallControllerWitnessParams = {
|
|
186
|
+
gatewayUrl: string;
|
|
187
|
+
attestationUid: Hex;
|
|
188
|
+
chainId: number;
|
|
189
|
+
easContract: Hex;
|
|
190
|
+
schemaUid: Hex;
|
|
191
|
+
subject: Did;
|
|
192
|
+
controller: Did;
|
|
193
|
+
timeoutMs?: number;
|
|
194
|
+
};
|
|
195
|
+
type CallControllerWitnessResult = {
|
|
196
|
+
ok: boolean;
|
|
197
|
+
method: "dns-txt" | "did-json";
|
|
198
|
+
details?: unknown;
|
|
199
|
+
};
|
|
200
|
+
type VerifyProofParams = {
|
|
201
|
+
proof: ProofWrapper;
|
|
202
|
+
provider?: unknown;
|
|
203
|
+
expectedSubject?: Did;
|
|
204
|
+
expectedController?: Did;
|
|
205
|
+
};
|
|
206
|
+
type VerifyProofResult = {
|
|
207
|
+
valid: boolean;
|
|
208
|
+
proofType: ProofType;
|
|
209
|
+
reason?: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare function submitAttestation(params: SubmitAttestationParams): Promise<SubmitAttestationResult>;
|
|
213
|
+
|
|
214
|
+
declare function buildDelegatedAttestationTypedData(params: PrepareDelegatedAttestationParams): {
|
|
215
|
+
domain: Record<string, unknown>;
|
|
216
|
+
types: Record<string, unknown>;
|
|
217
|
+
message: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
declare function buildDelegatedTypedDataFromEncoded(params: BuildDelegatedTypedDataFromEncodedParams): {
|
|
220
|
+
domain: Record<string, unknown>;
|
|
221
|
+
types: Record<string, unknown>;
|
|
222
|
+
message: Record<string, unknown>;
|
|
223
|
+
};
|
|
224
|
+
declare function splitSignature(signature: Hex | string): {
|
|
225
|
+
v: number;
|
|
226
|
+
r: Hex;
|
|
227
|
+
s: Hex;
|
|
228
|
+
};
|
|
229
|
+
declare function prepareDelegatedAttestation(params: PrepareDelegatedAttestationParams): Promise<PrepareDelegatedAttestationResult>;
|
|
230
|
+
declare function submitDelegatedAttestation(params: SubmitDelegatedAttestationParams): Promise<SubmitDelegatedAttestationResult>;
|
|
231
|
+
|
|
232
|
+
declare function getAttestation(params: GetAttestationParams): Promise<AttestationQueryResult>;
|
|
233
|
+
declare function getAttestationsForDid(params: ListAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
234
|
+
declare function listAttestations(params: ListAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
235
|
+
type GetLatestAttestationsParams = {
|
|
236
|
+
provider: unknown;
|
|
237
|
+
easContractAddress: Hex;
|
|
238
|
+
schemas?: Hex[];
|
|
239
|
+
limit?: number;
|
|
240
|
+
fromBlock?: number;
|
|
241
|
+
};
|
|
242
|
+
declare function getLatestAttestations(params: GetLatestAttestationsParams): Promise<AttestationQueryResult[]>;
|
|
243
|
+
declare function deduplicateReviews(attestations: AttestationQueryResult[]): AttestationQueryResult[];
|
|
244
|
+
declare function calculateAverageUserReviewRating(attestations: AttestationQueryResult[]): number;
|
|
245
|
+
declare function getMajorVersion(version: string): number;
|
|
246
|
+
|
|
247
|
+
declare function verifyProof(params: VerifyProofParams): Promise<VerifyProofResult>;
|
|
248
|
+
declare function verifyAttestation(params: VerifyAttestationParams): Promise<VerifyAttestationResult>;
|
|
249
|
+
|
|
250
|
+
declare function normalizeSchema(schema: SchemaField[] | string): SchemaField[];
|
|
251
|
+
declare function schemaToString(schema: SchemaField[] | string): string;
|
|
252
|
+
declare function encodeAttestationData(schema: SchemaField[] | string, data: Record<string, unknown>): Hex;
|
|
253
|
+
declare function decodeAttestationData(schema: SchemaField[] | string, encodedData: Hex): Record<string, unknown>;
|
|
254
|
+
declare function extractExpirationTime(data: Record<string, unknown>): bigint | number | undefined;
|
|
255
|
+
|
|
256
|
+
declare function verifySchemaExists(schemaRegistry: unknown, schemaUid: Hex): Promise<boolean>;
|
|
257
|
+
declare function getSchemaDetails(schemaRegistry: unknown, schemaUid: Hex): Promise<{
|
|
258
|
+
uid: Hex;
|
|
259
|
+
schema: string;
|
|
260
|
+
resolver: Hex;
|
|
261
|
+
revocable: boolean;
|
|
262
|
+
}>;
|
|
263
|
+
declare function formatSchemaUid(schemaUid: string): Hex;
|
|
264
|
+
|
|
265
|
+
declare function callControllerWitness(params: CallControllerWitnessParams): Promise<CallControllerWitnessResult>;
|
|
266
|
+
|
|
267
|
+
declare function getSupportedChainIds(): number[];
|
|
268
|
+
declare function isChainSupported(chainId: number): boolean;
|
|
269
|
+
declare function getChainConstants(chainId: number, purpose: ProofPurpose): ChainConstants;
|
|
270
|
+
declare function constructSeed(subjectDidHash: Hex, counterpartyDidHash: Hex, purpose: ProofPurpose): Uint8Array;
|
|
271
|
+
declare function hashSeed(seedBytes: Uint8Array, chainId: number): Hex;
|
|
272
|
+
declare function calculateTransferAmount(subject: string, counterparty: string, chainId: number, purpose: ProofPurpose): bigint;
|
|
273
|
+
declare function calculateTransferAmountFromAddresses(subjectAddress: string, counterpartyAddress: string, chainId: number, purpose: ProofPurpose): bigint;
|
|
274
|
+
declare function createTxEncodedValueProof(chainId: number, txHash: Hex, purpose: ProofPurpose): TxEncodedValueProof;
|
|
275
|
+
declare function formatTransferAmount(amount: bigint | number, chainId: number): string;
|
|
276
|
+
declare function getExplorerTxUrl(chainId: number, txHash: Hex): string;
|
|
277
|
+
declare function getExplorerAddressUrl(chainId: number, address: string): string;
|
|
278
|
+
|
|
279
|
+
declare function createTxInteractionProof(chainId: number, txHash: Hex): TxInteractionProof;
|
|
280
|
+
|
|
281
|
+
type CreatePopEip712ProofParams = {
|
|
282
|
+
signer: string;
|
|
283
|
+
authorizedEntity: string;
|
|
284
|
+
signingPurpose: ProofPurpose;
|
|
285
|
+
chainId: number;
|
|
286
|
+
creationTimestamp?: number;
|
|
287
|
+
expirationTimestamp?: number;
|
|
288
|
+
randomValue?: Hex;
|
|
289
|
+
statement?: string;
|
|
290
|
+
};
|
|
291
|
+
declare function createPopEip712Proof(params: CreatePopEip712ProofParams, signFn: (typedData: Record<string, unknown>) => Promise<Hex>): Promise<PopEip712Proof>;
|
|
292
|
+
|
|
293
|
+
type CreatePopJwsProofParams = {
|
|
294
|
+
issuer: Did;
|
|
295
|
+
audience: Did;
|
|
296
|
+
purpose: ProofPurpose;
|
|
297
|
+
issuedAt?: number;
|
|
298
|
+
expiresAt?: number;
|
|
299
|
+
nonce?: string;
|
|
300
|
+
};
|
|
301
|
+
declare function createPopJwsProof(params: CreatePopJwsProofParams, signFn: (payload: Record<string, unknown>, header: Record<string, unknown>) => Promise<string>): Promise<PopJwsProof>;
|
|
302
|
+
|
|
303
|
+
declare function createX402ReceiptProof(receipt: Record<string, unknown>): X402ReceiptProof;
|
|
304
|
+
declare function createX402OfferProof(offer: Record<string, unknown>): X402OfferProof;
|
|
305
|
+
|
|
306
|
+
declare function createEvidencePointerProof(url: string): EvidencePointerProof;
|
|
307
|
+
|
|
308
|
+
declare function parseDnsTxtRecord(record: string): {
|
|
309
|
+
version?: string;
|
|
310
|
+
controller?: Did;
|
|
311
|
+
[key: string]: string | undefined;
|
|
312
|
+
};
|
|
313
|
+
declare function buildDnsTxtRecord(controllerDid: Did): string;
|
|
314
|
+
|
|
315
|
+
declare function fetchDidDocument(domain: string): Promise<Record<string, unknown>>;
|
|
316
|
+
declare function extractAddressesFromDidDocument(didDocument: Record<string, unknown>): string[];
|
|
317
|
+
declare function verifyDidDocumentControllerDid(didDocument: Record<string, unknown>, expectedControllerDid: Did): {
|
|
318
|
+
valid: boolean;
|
|
319
|
+
reason?: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
declare function buildEip712Domain(name: string, version: string, chainId: number, verifyingContract: Hex): {
|
|
323
|
+
name: string;
|
|
324
|
+
version: string;
|
|
325
|
+
chainId: number;
|
|
326
|
+
verifyingContract: Hex;
|
|
327
|
+
};
|
|
328
|
+
declare function getOmaTrustProofEip712Types(): {
|
|
329
|
+
primaryType: string;
|
|
330
|
+
types: Record<string, Array<{
|
|
331
|
+
name: string;
|
|
332
|
+
type: string;
|
|
333
|
+
}>>;
|
|
334
|
+
};
|
|
335
|
+
declare function verifyEip712Signature(typedData: {
|
|
336
|
+
domain: Record<string, unknown>;
|
|
337
|
+
types: Record<string, unknown>;
|
|
338
|
+
message: Record<string, unknown>;
|
|
339
|
+
}, signature: Hex | string): {
|
|
340
|
+
valid: boolean;
|
|
341
|
+
signer?: string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export { extractExpirationTime as $, type AttestationQueryResult as A, type BuildDelegatedTypedDataFromEncodedParams as B, type CallControllerWitnessParams as C, type Did as D, type EvidencePointerProof as E, calculateTransferAmountFromAddresses as F, type GetAttestationParams as G, type Hex as H, callControllerWitness as I, constructSeed as J, createEvidencePointerProof as K, type ListAttestationsParams as L, createPopEip712Proof as M, createPopJwsProof as N, createTxEncodedValueProof as O, type PopEip712Proof as P, createTxInteractionProof as Q, createX402OfferProof as R, type SchemaField as S, type TxEncodedValueProof as T, createX402ReceiptProof as U, type VerifyAttestationParams as V, decodeAttestationData as W, type X402OfferProof as X, deduplicateReviews as Y, encodeAttestationData as Z, extractAddressesFromDidDocument as _, type CallControllerWitnessResult as a, fetchDidDocument as a0, formatSchemaUid as a1, formatTransferAmount as a2, getAttestation as a3, getAttestationsForDid as a4, getChainConstants as a5, getExplorerAddressUrl as a6, getExplorerTxUrl as a7, getLatestAttestations as a8, getMajorVersion as a9, getOmaTrustProofEip712Types as aa, getSchemaDetails as ab, getSupportedChainIds as ac, hashSeed as ad, isChainSupported as ae, listAttestations as af, normalizeSchema as ag, parseDnsTxtRecord as ah, prepareDelegatedAttestation as ai, schemaToString as aj, splitSignature as ak, submitAttestation as al, submitDelegatedAttestation as am, verifyAttestation as an, verifyDidDocumentControllerDid as ao, verifyEip712Signature as ap, verifyProof as aq, verifySchemaExists as ar, type ChainConstants as b, type CreatePopEip712ProofParams as c, type CreatePopJwsProofParams as d, type GetLatestAttestationsParams as e, type PopJwsProof as f, type PrepareDelegatedAttestationParams as g, type PrepareDelegatedAttestationResult as h, type ProofPurpose as i, type ProofType as j, type ProofWrapper as k, type SubmitAttestationParams as l, type SubmitAttestationResult as m, type SubmitDelegatedAttestationParams as n, type SubmitDelegatedAttestationResult as o, type TxInteractionProof as p, type VerifyAttestationResult as q, type VerifyProofParams as r, type VerifyProofResult as s, type X402ReceiptProof as t, buildDelegatedAttestationTypedData as u, buildDelegatedTypedDataFromEncoded as v, buildDnsTxtRecord as w, buildEip712Domain as x, calculateAverageUserReviewRating as y, calculateTransferAmount as z };
|