@kynesyslabs/demosdk 4.0.13 → 4.0.15
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/build/abstraction/Identities.d.ts +65 -21
- package/build/abstraction/Identities.js +51 -50
- package/build/abstraction/Identities.js.map +1 -1
- package/build/bridge/nativeBridge.d.ts +3 -1
- package/build/bridge/nativeBridge.js +4 -3
- package/build/bridge/nativeBridge.js.map +1 -1
- package/build/contracts/ContractDeployer.js +5 -2
- package/build/contracts/ContractDeployer.js.map +1 -1
- package/build/contracts/ContractInteractor.js +4 -1
- package/build/contracts/ContractInteractor.js.map +1 -1
- package/build/d402/client/D402Client.d.ts +3 -1
- package/build/d402/client/D402Client.js +4 -3
- package/build/d402/client/D402Client.js.map +1 -1
- package/build/escrow/EscrowTransaction.d.ts +7 -2
- package/build/escrow/EscrowTransaction.js +9 -8
- package/build/escrow/EscrowTransaction.js.map +1 -1
- package/build/l2ps/anchor/anchor.d.ts +1 -0
- package/build/l2ps/anchor/anchor.js +4 -3
- package/build/l2ps/anchor/anchor.js.map +1 -1
- package/build/l2ps/binding/binding.d.ts +3 -1
- package/build/l2ps/binding/binding.js +3 -2
- package/build/l2ps/binding/binding.js.map +1 -1
- package/build/tlsnotary/TLSNotaryService.d.ts +2 -0
- package/build/tlsnotary/TLSNotaryService.js +11 -10
- package/build/tlsnotary/TLSNotaryService.js.map +1 -1
- package/build/types/blockchain/GCREdit.d.ts +0 -30
- package/build/types/blockchain/Transaction.d.ts +7 -0
- package/build/types/blockchain/Transaction.js.map +1 -1
- package/build/types/blockchain/rawTransaction.d.ts +2 -7
- package/build/types/web2/index.d.ts +1 -0
- package/build/utils/index.d.ts +2 -0
- package/build/utils/index.js +18 -0
- package/build/utils/index.js.map +1 -1
- package/build/websdk/DemosTokens.d.ts +42 -14
- package/build/websdk/DemosTokens.js +35 -30
- package/build/websdk/DemosTokens.js.map +1 -1
- package/build/websdk/DemosTransactions.d.ts +27 -9
- package/build/websdk/DemosTransactions.js +27 -26
- package/build/websdk/DemosTransactions.js.map +1 -1
- package/build/websdk/NonceManager.d.ts +56 -0
- package/build/websdk/NonceManager.js +87 -0
- package/build/websdk/NonceManager.js.map +1 -0
- package/build/websdk/Web2Calls.js +4 -2
- package/build/websdk/Web2Calls.js.map +1 -1
- package/build/websdk/demosclass.d.ts +145 -32
- package/build/websdk/demosclass.js +83 -10
- package/build/websdk/demosclass.js.map +1 -1
- package/build/websdk/programmatic/attest.js +40 -20
- package/build/websdk/programmatic/attest.js.map +1 -1
- package/build/websdk/programmatic/bridge.js +1 -1
- package/build/websdk/programmatic/bridge.js.map +1 -1
- package/build/websdk/programmatic/d402.js +1 -1
- package/build/websdk/programmatic/d402.js.map +1 -1
- package/build/websdk/programmatic/escrow.js +3 -3
- package/build/websdk/programmatic/escrow.js.map +1 -1
- package/build/websdk/programmatic/governance.js +6 -2
- package/build/websdk/programmatic/governance.js.map +1 -1
- package/build/websdk/programmatic/ipfs.js +10 -7
- package/build/websdk/programmatic/ipfs.js.map +1 -1
- package/build/websdk/programmatic/pay.js +2 -2
- package/build/websdk/programmatic/pay.js.map +1 -1
- package/build/websdk/programmatic/runner.js +5 -3
- package/build/websdk/programmatic/runner.js.map +1 -1
- package/build/websdk/programmatic/storage.js +4 -2
- package/build/websdk/programmatic/storage.js.map +1 -1
- package/build/websdk/programmatic/tokens.js +27 -13
- package/build/websdk/programmatic/tokens.js.map +1 -1
- package/build/websdk/programmatic/types.d.ts +1 -0
- package/build/websdk/programmatic/validator.js +7 -3
- package/build/websdk/programmatic/validator.js.map +1 -1
- package/package.json +2 -1
|
@@ -45,7 +45,9 @@ export declare class Identities {
|
|
|
45
45
|
* @param payload The payload to infer the identity from.
|
|
46
46
|
* @returns The validity data of the identity transaction.
|
|
47
47
|
*/
|
|
48
|
-
inferXmIdentity(demos: Demos, payload: InferFromSignaturePayload, referralCode?: string
|
|
48
|
+
inferXmIdentity(demos: Demos, payload: InferFromSignaturePayload, referralCode?: string, options?: {
|
|
49
|
+
nonce?: number;
|
|
50
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
49
51
|
/**
|
|
50
52
|
* Infer a web2 identity from a proof payload.
|
|
51
53
|
*
|
|
@@ -54,7 +56,9 @@ export declare class Identities {
|
|
|
54
56
|
*
|
|
55
57
|
* @returns The validity data of the identity transaction.
|
|
56
58
|
*/
|
|
57
|
-
inferWeb2Identity(demos: Demos, payload: Web2CoreTargetIdentityPayload
|
|
59
|
+
inferWeb2Identity(demos: Demos, payload: Web2CoreTargetIdentityPayload, options?: {
|
|
60
|
+
nonce?: number;
|
|
61
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
58
62
|
/**
|
|
59
63
|
* Remove a crosschain identity from the network.
|
|
60
64
|
*
|
|
@@ -62,7 +66,9 @@ export declare class Identities {
|
|
|
62
66
|
* @param payload The payload to remove the identity.
|
|
63
67
|
* @returns The response from the RPC call.
|
|
64
68
|
*/
|
|
65
|
-
removeXmIdentity(demos: Demos, payload: XMCoreTargetIdentityPayload
|
|
69
|
+
removeXmIdentity(demos: Demos, payload: XMCoreTargetIdentityPayload, options?: {
|
|
70
|
+
nonce?: number;
|
|
71
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
66
72
|
/**
|
|
67
73
|
* Remove a web2 identity from the network.
|
|
68
74
|
*
|
|
@@ -73,6 +79,8 @@ export declare class Identities {
|
|
|
73
79
|
removeWeb2Identity(demos: Demos, payload: {
|
|
74
80
|
context: string;
|
|
75
81
|
username: string;
|
|
82
|
+
}, options?: {
|
|
83
|
+
nonce?: number;
|
|
76
84
|
}): Promise<RPCResponseWithValidityData>;
|
|
77
85
|
/**
|
|
78
86
|
* Add a github identity to the GCR.
|
|
@@ -81,7 +89,9 @@ export declare class Identities {
|
|
|
81
89
|
* @param payload The payload to add the identity to.
|
|
82
90
|
* @returns The response from the RPC call.
|
|
83
91
|
*/
|
|
84
|
-
addGithubIdentity(demos: Demos, payload: GithubProof, referralCode?: string
|
|
92
|
+
addGithubIdentity(demos: Demos, payload: GithubProof, referralCode?: string, options?: {
|
|
93
|
+
nonce?: number;
|
|
94
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
85
95
|
/**
|
|
86
96
|
* Add a Web2 identity via TLSNotary attestation.
|
|
87
97
|
*
|
|
@@ -99,7 +109,9 @@ export declare class Identities {
|
|
|
99
109
|
* @param referralCode Optional referral code.
|
|
100
110
|
* @returns The response from the RPC call.
|
|
101
111
|
*/
|
|
102
|
-
addWeb2IdentityViaTLSN(demos: Demos, context: TLSNIdentityContext, proof: TLSNotaryPresentation, recvHash: string, proofRanges: TLSNProofRanges, revealedRecv: number[], username: string, userId: string | number, referralCode?: string
|
|
112
|
+
addWeb2IdentityViaTLSN(demos: Demos, context: TLSNIdentityContext, proof: TLSNotaryPresentation, recvHash: string, proofRanges: TLSNProofRanges, revealedRecv: number[], username: string, userId: string | number, referralCode?: string, options?: {
|
|
113
|
+
nonce?: number;
|
|
114
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
103
115
|
/**
|
|
104
116
|
* Remove a Web2 identity that was added via TLSNotary.
|
|
105
117
|
*
|
|
@@ -108,7 +120,9 @@ export declare class Identities {
|
|
|
108
120
|
* @param username The username to remove.
|
|
109
121
|
* @returns The response from the RPC call.
|
|
110
122
|
*/
|
|
111
|
-
removeWeb2IdentityViaTLSN(demos: Demos, context: TLSNIdentityContext, username: string
|
|
123
|
+
removeWeb2IdentityViaTLSN(demos: Demos, context: TLSNIdentityContext, username: string, options?: {
|
|
124
|
+
nonce?: number;
|
|
125
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
112
126
|
/**
|
|
113
127
|
* Add a twitter identity to the GCR.
|
|
114
128
|
*
|
|
@@ -116,7 +130,9 @@ export declare class Identities {
|
|
|
116
130
|
* @param payload The payload to add the identity to.
|
|
117
131
|
* @returns The response from the RPC call.
|
|
118
132
|
*/
|
|
119
|
-
addTwitterIdentity(demos: Demos, payload: TwitterProof, referralCode?: string
|
|
133
|
+
addTwitterIdentity(demos: Demos, payload: TwitterProof, referralCode?: string, options?: {
|
|
134
|
+
nonce?: number;
|
|
135
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
120
136
|
/**
|
|
121
137
|
* Add a discord identity to the GCR.
|
|
122
138
|
*
|
|
@@ -124,7 +140,9 @@ export declare class Identities {
|
|
|
124
140
|
* @param payload The payload to add the identity to.
|
|
125
141
|
* @returns The response from the RPC call.
|
|
126
142
|
*/
|
|
127
|
-
addDiscordIdentity(demos: Demos, payload: DiscordProof, referralCode?: string
|
|
143
|
+
addDiscordIdentity(demos: Demos, payload: DiscordProof, referralCode?: string, options?: {
|
|
144
|
+
nonce?: number;
|
|
145
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
128
146
|
/**
|
|
129
147
|
* Add a telegram identity to the GCR.
|
|
130
148
|
* This method is designed to work with telegram bot attestations.
|
|
@@ -134,7 +152,9 @@ export declare class Identities {
|
|
|
134
152
|
* @param referralCode Optional referral code for incentive points.
|
|
135
153
|
* @returns The response from the RPC call.
|
|
136
154
|
*/
|
|
137
|
-
addTelegramIdentity(demos: Demos, payload: TelegramSignedAttestation, referralCode?: string
|
|
155
|
+
addTelegramIdentity(demos: Demos, payload: TelegramSignedAttestation, referralCode?: string, options?: {
|
|
156
|
+
nonce?: number;
|
|
157
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
138
158
|
/**
|
|
139
159
|
* Build the proof payload a domain owner must host to prove control.
|
|
140
160
|
*
|
|
@@ -183,7 +203,9 @@ export declare class Identities {
|
|
|
183
203
|
* await identities.addDomainIdentity(demos, "example.com")
|
|
184
204
|
* ```
|
|
185
205
|
*/
|
|
186
|
-
addDomainIdentity(demos: Demos, hostname: string, referralCode?: string
|
|
206
|
+
addDomainIdentity(demos: Demos, hostname: string, referralCode?: string, options?: {
|
|
207
|
+
nonce?: number;
|
|
208
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
187
209
|
/**
|
|
188
210
|
* Remove a domain identity from the GCR (CCI).
|
|
189
211
|
*
|
|
@@ -191,7 +213,9 @@ export declare class Identities {
|
|
|
191
213
|
* @param hostname The domain to unlink (e.g. "example.com").
|
|
192
214
|
* @returns The response from the RPC call.
|
|
193
215
|
*/
|
|
194
|
-
removeDomainIdentity(demos: Demos, hostname: string
|
|
216
|
+
removeDomainIdentity(demos: Demos, hostname: string, options?: {
|
|
217
|
+
nonce?: number;
|
|
218
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
195
219
|
/**
|
|
196
220
|
* Build the canonical domain proof URL and hostname from a hostname or URL.
|
|
197
221
|
*
|
|
@@ -204,8 +228,12 @@ export declare class Identities {
|
|
|
204
228
|
* @example "[::1]" -> { proofUrl: "https://[::1]/.well-known/demos-cci.txt", hostname: "[::1]" }
|
|
205
229
|
*/
|
|
206
230
|
private buildDomainProof;
|
|
207
|
-
bindPqcIdentity(demos: Demos, algorithms?: "all" | PQCAlgorithm[]
|
|
208
|
-
|
|
231
|
+
bindPqcIdentity(demos: Demos, algorithms?: "all" | PQCAlgorithm[], options?: {
|
|
232
|
+
nonce?: number;
|
|
233
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
234
|
+
removePqcIdentity(demos: Demos, algorithms?: "all" | PQCAlgorithm[], options?: {
|
|
235
|
+
nonce?: number;
|
|
236
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
209
237
|
/**
|
|
210
238
|
* Get the identities associated with an address.
|
|
211
239
|
*
|
|
@@ -386,7 +414,9 @@ export declare class Identities {
|
|
|
386
414
|
* )
|
|
387
415
|
* ```
|
|
388
416
|
*/
|
|
389
|
-
addUnstoppableDomainIdentity(demos: Demos, signingAddress: string, signature: string, challenge: string, resolutionData: UnifiedDomainResolution, referralCode?: string
|
|
417
|
+
addUnstoppableDomainIdentity(demos: Demos, signingAddress: string, signature: string, challenge: string, resolutionData: UnifiedDomainResolution, referralCode?: string, options?: {
|
|
418
|
+
nonce?: number;
|
|
419
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
390
420
|
/**
|
|
391
421
|
* Remove an Unstoppable Domain identity from the GCR.
|
|
392
422
|
*
|
|
@@ -395,7 +425,9 @@ export declare class Identities {
|
|
|
395
425
|
*
|
|
396
426
|
* @returns The validity data response from the RPC
|
|
397
427
|
*/
|
|
398
|
-
removeUnstoppableDomainIdentity(demos: Demos, domain: string
|
|
428
|
+
removeUnstoppableDomainIdentity(demos: Demos, domain: string, options?: {
|
|
429
|
+
nonce?: number;
|
|
430
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
399
431
|
/**
|
|
400
432
|
* Get the Unstoppable Domain identities associated with an address.
|
|
401
433
|
*
|
|
@@ -428,7 +460,9 @@ export declare class Identities {
|
|
|
428
460
|
* @param payload The Nomis wallet identity data to be linked.
|
|
429
461
|
* @returns The RPC response for the identity inference operation.
|
|
430
462
|
*/
|
|
431
|
-
addNomisIdentity(demos: Demos, payload: NomisWalletIdentity
|
|
463
|
+
addNomisIdentity(demos: Demos, payload: NomisWalletIdentity, options?: {
|
|
464
|
+
nonce?: number;
|
|
465
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
432
466
|
/**
|
|
433
467
|
* Remove a Nomis wallet identity from the GCR.
|
|
434
468
|
*
|
|
@@ -436,7 +470,9 @@ export declare class Identities {
|
|
|
436
470
|
* @param payload The Nomis wallet identity data identifying the identity to remove.
|
|
437
471
|
* @returns The RPC response for the identity removal operation.
|
|
438
472
|
*/
|
|
439
|
-
removeNomisIdentity(demos: Demos, payload: NomisWalletIdentity
|
|
473
|
+
removeNomisIdentity(demos: Demos, payload: NomisWalletIdentity, options?: {
|
|
474
|
+
nonce?: number;
|
|
475
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
440
476
|
/**
|
|
441
477
|
* Fetch Human Passport score for an address.
|
|
442
478
|
*
|
|
@@ -474,7 +510,9 @@ export declare class Identities {
|
|
|
474
510
|
* })
|
|
475
511
|
* ```
|
|
476
512
|
*/
|
|
477
|
-
addHumanPassportIdentity(demos: Demos, payload: HumanPassportIdentityData
|
|
513
|
+
addHumanPassportIdentity(demos: Demos, payload: HumanPassportIdentityData, options?: {
|
|
514
|
+
nonce?: number;
|
|
515
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
478
516
|
/**
|
|
479
517
|
* Remove a Human Passport identity from the GCR.
|
|
480
518
|
*
|
|
@@ -482,7 +520,9 @@ export declare class Identities {
|
|
|
482
520
|
* @param address The EVM address of the Human Passport identity to remove.
|
|
483
521
|
* @returns The RPC response for the identity removal operation.
|
|
484
522
|
*/
|
|
485
|
-
removeHumanPassportIdentity(demos: Demos, address: string
|
|
523
|
+
removeHumanPassportIdentity(demos: Demos, address: string, options?: {
|
|
524
|
+
nonce?: number;
|
|
525
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
486
526
|
/**
|
|
487
527
|
* Retrieve the Ethos reputation score for a given wallet address.
|
|
488
528
|
*
|
|
@@ -513,7 +553,9 @@ export declare class Identities {
|
|
|
513
553
|
* @param payload The Ethos wallet identity data to be linked.
|
|
514
554
|
* @returns The RPC response for the identity inference operation.
|
|
515
555
|
*/
|
|
516
|
-
addEthosIdentity(demos: Demos, payload: EthosWalletIdentity
|
|
556
|
+
addEthosIdentity(demos: Demos, payload: EthosWalletIdentity, options?: {
|
|
557
|
+
nonce?: number;
|
|
558
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
517
559
|
/**
|
|
518
560
|
* Validates an Ethos identity removal payload.
|
|
519
561
|
* Only validates identifying fields (chain, subchain, address).
|
|
@@ -528,5 +570,7 @@ export declare class Identities {
|
|
|
528
570
|
* @param payload The identifying data for the Ethos identity to remove (chain, subchain, address).
|
|
529
571
|
* @returns The RPC response for the identity removal operation.
|
|
530
572
|
*/
|
|
531
|
-
removeEthosIdentity(demos: Demos, payload: EthosIdentityRemoveData
|
|
573
|
+
removeEthosIdentity(demos: Demos, payload: EthosIdentityRemoveData, options?: {
|
|
574
|
+
nonce?: number;
|
|
575
|
+
}): Promise<RPCResponseWithValidityData>;
|
|
532
576
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
import { uint8ArrayToHex, UnifiedCrypto } from "../encryption/index.js";
|
|
5
5
|
import { _required as required, DemosTransactions } from "../websdk/index.js";
|
|
6
|
+
import { resolveNonce } from "../utils/index.js";
|
|
6
7
|
export class Identities {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.formats = {
|
|
@@ -41,7 +42,7 @@ export class Identities {
|
|
|
41
42
|
*
|
|
42
43
|
* @returns The validity data of the identity transaction.
|
|
43
44
|
*/
|
|
44
|
-
async inferIdentity(demos, context, payload) {
|
|
45
|
+
async inferIdentity(demos, context, payload, options) {
|
|
45
46
|
if (context === "web2") {
|
|
46
47
|
// Skip validation for telegram as it uses custom attestation format, not URL proofs
|
|
47
48
|
if (payload.context !== "telegram" &&
|
|
@@ -78,7 +79,7 @@ export class Identities {
|
|
|
78
79
|
// Use the address' current nonce (+1) like every other native tx in
|
|
79
80
|
// this SDK — hardcoding nonce:1 only validated for a fresh account and
|
|
80
81
|
// broke the second identity op (e.g. remove after add).
|
|
81
|
-
const nonce = await demos.getAddressNonce(address);
|
|
82
|
+
const nonce = await resolveNonce(options?.nonce, () => demos.getAddressNonce(address));
|
|
82
83
|
tx.content = {
|
|
83
84
|
...tx.content,
|
|
84
85
|
type: "identity",
|
|
@@ -92,7 +93,7 @@ export class Identities {
|
|
|
92
93
|
payload: payload,
|
|
93
94
|
},
|
|
94
95
|
],
|
|
95
|
-
nonce: nonce
|
|
96
|
+
nonce: nonce,
|
|
96
97
|
timestamp: Date.now(),
|
|
97
98
|
};
|
|
98
99
|
const signedTx = await demos.sign(tx);
|
|
@@ -105,14 +106,14 @@ export class Identities {
|
|
|
105
106
|
* @param payload The payload to remove the identity from.
|
|
106
107
|
* @returns The response from the RPC call.
|
|
107
108
|
*/
|
|
108
|
-
async removeIdentity(demos, context, payload) {
|
|
109
|
+
async removeIdentity(demos, context, payload, options) {
|
|
109
110
|
const tx = DemosTransactions.empty();
|
|
110
111
|
const ed25519 = await demos.crypto.getIdentity("ed25519");
|
|
111
112
|
const address = uint8ArrayToHex(ed25519.publicKey);
|
|
112
113
|
// Use the address' current nonce (+1) like every other native tx in
|
|
113
114
|
// this SDK — hardcoding nonce:1 broke removing an identity once the
|
|
114
115
|
// account had already done one identity op (e.g. the add).
|
|
115
|
-
const nonce = await demos.getAddressNonce(address);
|
|
116
|
+
const nonce = await resolveNonce(options?.nonce, () => demos.getAddressNonce(address));
|
|
116
117
|
tx.content = {
|
|
117
118
|
...tx.content,
|
|
118
119
|
type: "identity",
|
|
@@ -126,7 +127,7 @@ export class Identities {
|
|
|
126
127
|
payload: payload,
|
|
127
128
|
},
|
|
128
129
|
],
|
|
129
|
-
nonce: nonce
|
|
130
|
+
nonce: nonce,
|
|
130
131
|
timestamp: Date.now(),
|
|
131
132
|
};
|
|
132
133
|
const signedTx = await demos.sign(tx);
|
|
@@ -139,11 +140,11 @@ export class Identities {
|
|
|
139
140
|
* @param payload The payload to infer the identity from.
|
|
140
141
|
* @returns The validity data of the identity transaction.
|
|
141
142
|
*/
|
|
142
|
-
async inferXmIdentity(demos, payload, referralCode) {
|
|
143
|
+
async inferXmIdentity(demos, payload, referralCode, options) {
|
|
143
144
|
return await this.inferIdentity(demos, "xm", {
|
|
144
145
|
...payload,
|
|
145
146
|
referralCode: referralCode,
|
|
146
|
-
});
|
|
147
|
+
}, options);
|
|
147
148
|
}
|
|
148
149
|
/**
|
|
149
150
|
* Infer a web2 identity from a proof payload.
|
|
@@ -153,8 +154,8 @@ export class Identities {
|
|
|
153
154
|
*
|
|
154
155
|
* @returns The validity data of the identity transaction.
|
|
155
156
|
*/
|
|
156
|
-
async inferWeb2Identity(demos, payload) {
|
|
157
|
-
return await this.inferIdentity(demos, "web2", payload);
|
|
157
|
+
async inferWeb2Identity(demos, payload, options) {
|
|
158
|
+
return await this.inferIdentity(demos, "web2", payload, options);
|
|
158
159
|
}
|
|
159
160
|
/**
|
|
160
161
|
* Remove a crosschain identity from the network.
|
|
@@ -163,8 +164,8 @@ export class Identities {
|
|
|
163
164
|
* @param payload The payload to remove the identity.
|
|
164
165
|
* @returns The response from the RPC call.
|
|
165
166
|
*/
|
|
166
|
-
async removeXmIdentity(demos, payload) {
|
|
167
|
-
return await this.removeIdentity(demos, "xm", payload);
|
|
167
|
+
async removeXmIdentity(demos, payload, options) {
|
|
168
|
+
return await this.removeIdentity(demos, "xm", payload, options);
|
|
168
169
|
}
|
|
169
170
|
/**
|
|
170
171
|
* Remove a web2 identity from the network.
|
|
@@ -173,8 +174,8 @@ export class Identities {
|
|
|
173
174
|
* @param payload The payload to remove the identity.
|
|
174
175
|
* @returns The response from the RPC call.
|
|
175
176
|
*/
|
|
176
|
-
async removeWeb2Identity(demos, payload) {
|
|
177
|
-
return await this.removeIdentity(demos, "web2", payload);
|
|
177
|
+
async removeWeb2Identity(demos, payload, options) {
|
|
178
|
+
return await this.removeIdentity(demos, "web2", payload, options);
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
181
|
* Add a github identity to the GCR.
|
|
@@ -183,7 +184,7 @@ export class Identities {
|
|
|
183
184
|
* @param payload The payload to add the identity to.
|
|
184
185
|
* @returns The response from the RPC call.
|
|
185
186
|
*/
|
|
186
|
-
async addGithubIdentity(demos, payload, referralCode) {
|
|
187
|
+
async addGithubIdentity(demos, payload, referralCode, options) {
|
|
187
188
|
const username = payload.split("/")[3];
|
|
188
189
|
const ghUser = await axios.get(`https://api.github.com/users/${username}`);
|
|
189
190
|
if (!ghUser.data.login) {
|
|
@@ -196,7 +197,7 @@ export class Identities {
|
|
|
196
197
|
userId: ghUser.data.id,
|
|
197
198
|
referralCode: referralCode,
|
|
198
199
|
};
|
|
199
|
-
return await this.inferIdentity(demos, "web2", githubPayload);
|
|
200
|
+
return await this.inferIdentity(demos, "web2", githubPayload, options);
|
|
200
201
|
}
|
|
201
202
|
/**
|
|
202
203
|
* Add a Web2 identity via TLSNotary attestation.
|
|
@@ -215,7 +216,7 @@ export class Identities {
|
|
|
215
216
|
* @param referralCode Optional referral code.
|
|
216
217
|
* @returns The response from the RPC call.
|
|
217
218
|
*/
|
|
218
|
-
async addWeb2IdentityViaTLSN(demos, context, proof, recvHash, proofRanges, revealedRecv, username, userId, referralCode) {
|
|
219
|
+
async addWeb2IdentityViaTLSN(demos, context, proof, recvHash, proofRanges, revealedRecv, username, userId, referralCode, options) {
|
|
219
220
|
const payload = {
|
|
220
221
|
context: context,
|
|
221
222
|
proof: proof,
|
|
@@ -226,7 +227,7 @@ export class Identities {
|
|
|
226
227
|
userId: String(userId),
|
|
227
228
|
referralCode,
|
|
228
229
|
};
|
|
229
|
-
return await this.inferIdentity(demos, "tlsn", payload);
|
|
230
|
+
return await this.inferIdentity(demos, "tlsn", payload, options);
|
|
230
231
|
}
|
|
231
232
|
/**
|
|
232
233
|
* Remove a Web2 identity that was added via TLSNotary.
|
|
@@ -236,11 +237,11 @@ export class Identities {
|
|
|
236
237
|
* @param username The username to remove.
|
|
237
238
|
* @returns The response from the RPC call.
|
|
238
239
|
*/
|
|
239
|
-
async removeWeb2IdentityViaTLSN(demos, context, username) {
|
|
240
|
+
async removeWeb2IdentityViaTLSN(demos, context, username, options) {
|
|
240
241
|
return await this.removeIdentity(demos, "tlsn", {
|
|
241
242
|
context: context,
|
|
242
243
|
username: username,
|
|
243
|
-
});
|
|
244
|
+
}, options);
|
|
244
245
|
}
|
|
245
246
|
/**
|
|
246
247
|
* Add a twitter identity to the GCR.
|
|
@@ -249,7 +250,7 @@ export class Identities {
|
|
|
249
250
|
* @param payload The payload to add the identity to.
|
|
250
251
|
* @returns The response from the RPC call.
|
|
251
252
|
*/
|
|
252
|
-
async addTwitterIdentity(demos, payload, referralCode) {
|
|
253
|
+
async addTwitterIdentity(demos, payload, referralCode, options) {
|
|
253
254
|
const data = await demos.web2.getTweet(payload);
|
|
254
255
|
if (!data.success) {
|
|
255
256
|
throw new Error(data.error);
|
|
@@ -264,7 +265,7 @@ export class Identities {
|
|
|
264
265
|
userId: data.tweet.userId,
|
|
265
266
|
referralCode: referralCode,
|
|
266
267
|
};
|
|
267
|
-
return await this.inferIdentity(demos, "web2", twitterPayload);
|
|
268
|
+
return await this.inferIdentity(demos, "web2", twitterPayload, options);
|
|
268
269
|
}
|
|
269
270
|
/**
|
|
270
271
|
* Add a discord identity to the GCR.
|
|
@@ -273,7 +274,7 @@ export class Identities {
|
|
|
273
274
|
* @param payload The payload to add the identity to.
|
|
274
275
|
* @returns The response from the RPC call.
|
|
275
276
|
*/
|
|
276
|
-
async addDiscordIdentity(demos, payload, referralCode) {
|
|
277
|
+
async addDiscordIdentity(demos, payload, referralCode, options) {
|
|
277
278
|
const data = await demos.web2.getDiscordMessage(payload);
|
|
278
279
|
if (!data.success) {
|
|
279
280
|
throw new Error(data.error);
|
|
@@ -289,7 +290,7 @@ export class Identities {
|
|
|
289
290
|
userId: msg.authorId,
|
|
290
291
|
referralCode: referralCode,
|
|
291
292
|
};
|
|
292
|
-
return await this.inferIdentity(demos, "web2", discordPayload);
|
|
293
|
+
return await this.inferIdentity(demos, "web2", discordPayload, options);
|
|
293
294
|
}
|
|
294
295
|
/**
|
|
295
296
|
* Add a telegram identity to the GCR.
|
|
@@ -300,7 +301,7 @@ export class Identities {
|
|
|
300
301
|
* @param referralCode Optional referral code for incentive points.
|
|
301
302
|
* @returns The response from the RPC call.
|
|
302
303
|
*/
|
|
303
|
-
async addTelegramIdentity(demos, payload, referralCode) {
|
|
304
|
+
async addTelegramIdentity(demos, payload, referralCode, options) {
|
|
304
305
|
const telegramPayload = {
|
|
305
306
|
context: "telegram",
|
|
306
307
|
proof: payload,
|
|
@@ -308,7 +309,7 @@ export class Identities {
|
|
|
308
309
|
userId: payload.payload.telegram_user_id,
|
|
309
310
|
referralCode: referralCode,
|
|
310
311
|
};
|
|
311
|
-
return await this.inferIdentity(demos, "web2", telegramPayload);
|
|
312
|
+
return await this.inferIdentity(demos, "web2", telegramPayload, options);
|
|
312
313
|
}
|
|
313
314
|
// SECTION: Domain Identities
|
|
314
315
|
/**
|
|
@@ -366,7 +367,7 @@ export class Identities {
|
|
|
366
367
|
* await identities.addDomainIdentity(demos, "example.com")
|
|
367
368
|
* ```
|
|
368
369
|
*/
|
|
369
|
-
async addDomainIdentity(demos, hostname, referralCode) {
|
|
370
|
+
async addDomainIdentity(demos, hostname, referralCode, options) {
|
|
370
371
|
const { proofUrl, hostname: host } = this.buildDomainProof(hostname);
|
|
371
372
|
// Fail fast if the well-known file is missing or unparseable, mirroring
|
|
372
373
|
// addTwitterIdentity's pre-fetch via getTweet.
|
|
@@ -395,7 +396,7 @@ export class Identities {
|
|
|
395
396
|
userId: host,
|
|
396
397
|
referralCode: referralCode,
|
|
397
398
|
};
|
|
398
|
-
return await this.inferIdentity(demos, "web2", domainPayload);
|
|
399
|
+
return await this.inferIdentity(demos, "web2", domainPayload, options);
|
|
399
400
|
}
|
|
400
401
|
/**
|
|
401
402
|
* Remove a domain identity from the GCR (CCI).
|
|
@@ -404,13 +405,13 @@ export class Identities {
|
|
|
404
405
|
* @param hostname The domain to unlink (e.g. "example.com").
|
|
405
406
|
* @returns The response from the RPC call.
|
|
406
407
|
*/
|
|
407
|
-
async removeDomainIdentity(demos, hostname) {
|
|
408
|
+
async removeDomainIdentity(demos, hostname, options) {
|
|
408
409
|
// Same canonicalisation as addDomainIdentity so add/remove round-trip.
|
|
409
410
|
const { hostname: host } = this.buildDomainProof(hostname);
|
|
410
411
|
return await this.removeIdentity(demos, "web2", {
|
|
411
412
|
context: "domain",
|
|
412
413
|
username: host,
|
|
413
|
-
});
|
|
414
|
+
}, options);
|
|
414
415
|
}
|
|
415
416
|
/**
|
|
416
417
|
* Build the canonical domain proof URL and hostname from a hostname or URL.
|
|
@@ -451,7 +452,7 @@ export class Identities {
|
|
|
451
452
|
};
|
|
452
453
|
}
|
|
453
454
|
// SECTION: PQC Identities
|
|
454
|
-
async bindPqcIdentity(demos, algorithms = "all") {
|
|
455
|
+
async bindPqcIdentity(demos, algorithms = "all", options) {
|
|
455
456
|
let addressTypes = [];
|
|
456
457
|
// Create the address types to bind
|
|
457
458
|
if (algorithms === "all") {
|
|
@@ -477,9 +478,9 @@ export class Identities {
|
|
|
477
478
|
signature: uint8ArrayToHex(signature.signature),
|
|
478
479
|
});
|
|
479
480
|
}
|
|
480
|
-
return await this.inferIdentity(demos, "pqc", payloads);
|
|
481
|
+
return await this.inferIdentity(demos, "pqc", payloads, options);
|
|
481
482
|
}
|
|
482
|
-
async removePqcIdentity(demos, algorithms = "all") {
|
|
483
|
+
async removePqcIdentity(demos, algorithms = "all", options) {
|
|
483
484
|
let addressTypes = [];
|
|
484
485
|
// Create the address types to remove
|
|
485
486
|
if (algorithms === "all") {
|
|
@@ -501,7 +502,7 @@ export class Identities {
|
|
|
501
502
|
address: uint8ArrayToHex(address.publicKey),
|
|
502
503
|
});
|
|
503
504
|
}
|
|
504
|
-
return await this.removeIdentity(demos, "pqc", payloads);
|
|
505
|
+
return await this.removeIdentity(demos, "pqc", payloads, options);
|
|
505
506
|
}
|
|
506
507
|
/**
|
|
507
508
|
* Get the identities associated with an address.
|
|
@@ -1009,7 +1010,7 @@ export class Identities {
|
|
|
1009
1010
|
* )
|
|
1010
1011
|
* ```
|
|
1011
1012
|
*/
|
|
1012
|
-
async addUnstoppableDomainIdentity(demos, signingAddress, signature, challenge, resolutionData, referralCode) {
|
|
1013
|
+
async addUnstoppableDomainIdentity(demos, signingAddress, signature, challenge, resolutionData, referralCode, options) {
|
|
1013
1014
|
const publicKey = await demos.getEd25519Address();
|
|
1014
1015
|
const signatureType = this.detectSignatureType(signingAddress);
|
|
1015
1016
|
// INFO: Prevent signing with non-owner address
|
|
@@ -1034,7 +1035,7 @@ export class Identities {
|
|
|
1034
1035
|
return await this.inferIdentity(demos, "ud", {
|
|
1035
1036
|
...udPayload,
|
|
1036
1037
|
referralCode,
|
|
1037
|
-
});
|
|
1038
|
+
}, options);
|
|
1038
1039
|
}
|
|
1039
1040
|
/**
|
|
1040
1041
|
* Remove an Unstoppable Domain identity from the GCR.
|
|
@@ -1044,8 +1045,8 @@ export class Identities {
|
|
|
1044
1045
|
*
|
|
1045
1046
|
* @returns The validity data response from the RPC
|
|
1046
1047
|
*/
|
|
1047
|
-
async removeUnstoppableDomainIdentity(demos, domain) {
|
|
1048
|
-
return await this.removeIdentity(demos, "ud", { domain });
|
|
1048
|
+
async removeUnstoppableDomainIdentity(demos, domain, options) {
|
|
1049
|
+
return await this.removeIdentity(demos, "ud", { domain }, options);
|
|
1049
1050
|
}
|
|
1050
1051
|
/**
|
|
1051
1052
|
* Get the Unstoppable Domain identities associated with an address.
|
|
@@ -1099,8 +1100,8 @@ export class Identities {
|
|
|
1099
1100
|
* @param payload The Nomis wallet identity data to be linked.
|
|
1100
1101
|
* @returns The RPC response for the identity inference operation.
|
|
1101
1102
|
*/
|
|
1102
|
-
async addNomisIdentity(demos, payload) {
|
|
1103
|
-
return await this.inferIdentity(demos, "nomis", payload);
|
|
1103
|
+
async addNomisIdentity(demos, payload, options) {
|
|
1104
|
+
return await this.inferIdentity(demos, "nomis", payload, options);
|
|
1104
1105
|
}
|
|
1105
1106
|
/**
|
|
1106
1107
|
* Remove a Nomis wallet identity from the GCR.
|
|
@@ -1109,8 +1110,8 @@ export class Identities {
|
|
|
1109
1110
|
* @param payload The Nomis wallet identity data identifying the identity to remove.
|
|
1110
1111
|
* @returns The RPC response for the identity removal operation.
|
|
1111
1112
|
*/
|
|
1112
|
-
async removeNomisIdentity(demos, payload) {
|
|
1113
|
-
return await this.removeIdentity(demos, "nomis", payload);
|
|
1113
|
+
async removeNomisIdentity(demos, payload, options) {
|
|
1114
|
+
return await this.removeIdentity(demos, "nomis", payload, options);
|
|
1114
1115
|
}
|
|
1115
1116
|
// ==================== Human Passport Identity ====================
|
|
1116
1117
|
/**
|
|
@@ -1180,11 +1181,11 @@ export class Identities {
|
|
|
1180
1181
|
* })
|
|
1181
1182
|
* ```
|
|
1182
1183
|
*/
|
|
1183
|
-
async addHumanPassportIdentity(demos, payload) {
|
|
1184
|
+
async addHumanPassportIdentity(demos, payload, options) {
|
|
1184
1185
|
if (payload.verificationMethod === 'onchain' && payload.chainId == null) {
|
|
1185
1186
|
throw new Error('chainId must be provided for onchain verification');
|
|
1186
1187
|
}
|
|
1187
|
-
return await this.inferIdentity(demos, "humanpassport", payload);
|
|
1188
|
+
return await this.inferIdentity(demos, "humanpassport", payload, options);
|
|
1188
1189
|
}
|
|
1189
1190
|
/**
|
|
1190
1191
|
* Remove a Human Passport identity from the GCR.
|
|
@@ -1193,8 +1194,8 @@ export class Identities {
|
|
|
1193
1194
|
* @param address The EVM address of the Human Passport identity to remove.
|
|
1194
1195
|
* @returns The RPC response for the identity removal operation.
|
|
1195
1196
|
*/
|
|
1196
|
-
async removeHumanPassportIdentity(demos, address) {
|
|
1197
|
-
return await this.removeIdentity(demos, "humanpassport", { address });
|
|
1197
|
+
async removeHumanPassportIdentity(demos, address, options) {
|
|
1198
|
+
return await this.removeIdentity(demos, "humanpassport", { address }, options);
|
|
1198
1199
|
}
|
|
1199
1200
|
// ==================== Ethos Identity ====================
|
|
1200
1201
|
/**
|
|
@@ -1317,9 +1318,9 @@ export class Identities {
|
|
|
1317
1318
|
* @param payload The Ethos wallet identity data to be linked.
|
|
1318
1319
|
* @returns The RPC response for the identity inference operation.
|
|
1319
1320
|
*/
|
|
1320
|
-
async addEthosIdentity(demos, payload) {
|
|
1321
|
+
async addEthosIdentity(demos, payload, options) {
|
|
1321
1322
|
this.validateEthosPayload(payload, true);
|
|
1322
|
-
return await this.inferIdentity(demos, "ethos", payload);
|
|
1323
|
+
return await this.inferIdentity(demos, "ethos", payload, options);
|
|
1323
1324
|
}
|
|
1324
1325
|
/**
|
|
1325
1326
|
* Validates an Ethos identity removal payload.
|
|
@@ -1362,9 +1363,9 @@ export class Identities {
|
|
|
1362
1363
|
* @param payload The identifying data for the Ethos identity to remove (chain, subchain, address).
|
|
1363
1364
|
* @returns The RPC response for the identity removal operation.
|
|
1364
1365
|
*/
|
|
1365
|
-
async removeEthosIdentity(demos, payload) {
|
|
1366
|
+
async removeEthosIdentity(demos, payload, options) {
|
|
1366
1367
|
this.validateEthosRemovePayload(payload);
|
|
1367
|
-
return await this.removeIdentity(demos, "ethos", payload);
|
|
1368
|
+
return await this.removeIdentity(demos, "ethos", payload, options);
|
|
1368
1369
|
}
|
|
1369
1370
|
}
|
|
1370
1371
|
//# sourceMappingURL=Identities.js.map
|