@explorins/pers-signer 1.0.17 → 1.0.25
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/browser.cjs.js +743 -9714
- package/dist/browser.cjs.js.map +1 -1
- package/dist/browser.d.ts +322 -315
- package/dist/browser.esm.js +725 -9693
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs.js +836 -10195
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +413 -329
- package/dist/index.esm.js +832 -10200
- package/dist/index.esm.js.map +1 -1
- package/dist/react-native.cjs.js +875 -10023
- package/dist/react-native.cjs.js.map +1 -1
- package/dist/react-native.d.ts +324 -316
- package/dist/react-native.esm.js +857 -10002
- package/dist/react-native.esm.js.map +1 -1
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _explorins_web3_ts_types from '@explorins/web3-ts/types';
|
|
2
|
-
import {
|
|
3
|
-
export { AnyTransactionData } from '@explorins/web3-ts/types';
|
|
2
|
+
import { LegacyTransaction, AnyTransactionData } from '@explorins/web3-ts/types';
|
|
3
|
+
export { AnyTransactionData, BaseTransaction, CounterfactualWalletEIP712Data, EIP1559Transaction, EIP2930Transaction, EIP712TransactionData, EIP712TypedData, LegacyTransaction } from '@explorins/web3-ts/types';
|
|
4
4
|
import * as _explorins_pers_shared_browser from '@explorins/pers-shared/browser';
|
|
5
|
-
import {
|
|
6
|
-
export { TransactionFormat, TransactionRequestResponseDTO, TransactionStatus } from '@explorins/pers-shared/browser';
|
|
5
|
+
import { CounterfactualWalletTransactionResponse, TransactionStatus, TransactionRequestResponseDTO, TenantPublicDTO, SessionAuthContextResponseDTO, TransactionFormat } from '@explorins/pers-shared/browser';
|
|
6
|
+
export { CampaignClaimDTO, CampaignDTO, SessionAuthResponseDTO, TRANSACTION_FORMATS, TRANSACTION_FORMAT_DESCRIPTIONS, TransactionFormat, TransactionRequestResponseDTO, TransactionStatus, TransactionSubmissionRequestDTO } from '@explorins/pers-shared/browser';
|
|
7
7
|
import { CounterfactualWalletTransactionResponse as CounterfactualWalletTransactionResponse$1 } from '@explorins/pers-shared';
|
|
8
8
|
import { AbstractSigner, Provider, TransactionRequest, TypedDataDomain, TypedDataField } from 'ethers';
|
|
9
9
|
|
|
@@ -40,13 +40,12 @@ interface JWTLoginResponse {
|
|
|
40
40
|
username: string;
|
|
41
41
|
org_id: string;
|
|
42
42
|
};
|
|
43
|
-
provider
|
|
43
|
+
provider?: string;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
type LoginResponse = JWTLoginResponse;
|
|
46
|
+
interface VerifyTokenRequest {
|
|
47
|
+
token: string;
|
|
48
48
|
}
|
|
49
|
-
type LoginResponse = JWTLoginResponse | WrappedProviderResponse;
|
|
50
49
|
interface VerifyTokenResponse {
|
|
51
50
|
valid: boolean;
|
|
52
51
|
provider: string;
|
|
@@ -64,62 +63,380 @@ interface VerifyTokenResponse {
|
|
|
64
63
|
};
|
|
65
64
|
tenantId: string;
|
|
66
65
|
}
|
|
66
|
+
interface SigningKey {
|
|
67
|
+
curve: string;
|
|
68
|
+
publicKey: string;
|
|
69
|
+
scheme: string;
|
|
70
|
+
}
|
|
71
|
+
interface Wallet {
|
|
72
|
+
address?: string;
|
|
73
|
+
chainId?: number;
|
|
74
|
+
custodial?: boolean;
|
|
75
|
+
dateCreated?: string;
|
|
76
|
+
externalId?: string;
|
|
77
|
+
id: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
network?: string;
|
|
80
|
+
provider?: string;
|
|
81
|
+
signingKey?: SigningKey;
|
|
82
|
+
status?: string;
|
|
83
|
+
tags?: string[];
|
|
84
|
+
}
|
|
67
85
|
interface ListWalletsRequest {
|
|
68
86
|
}
|
|
69
87
|
interface ListWalletsResponse {
|
|
70
88
|
success: true;
|
|
71
89
|
data: {
|
|
72
|
-
|
|
73
|
-
[key: string]: unknown;
|
|
90
|
+
items: Wallet[];
|
|
74
91
|
};
|
|
75
92
|
}
|
|
76
93
|
interface CompleteSignatureResponse {
|
|
77
94
|
success: true;
|
|
78
95
|
data: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
recid: number;
|
|
83
|
-
encoded: string;
|
|
84
|
-
} | string;
|
|
85
|
-
transaction?: unknown;
|
|
86
|
-
dateRequested?: string;
|
|
87
|
-
dateSigned?: string;
|
|
88
|
-
id?: string;
|
|
89
|
-
keyId?: string;
|
|
90
|
-
network?: string;
|
|
91
|
-
requestBody?: {
|
|
92
|
-
kind?: 'Eip712' | 'Hash' | string;
|
|
93
|
-
blockchainKind?: string;
|
|
94
|
-
[key: string]: unknown;
|
|
95
|
-
};
|
|
96
|
-
requester?: unknown;
|
|
97
|
-
status?: string;
|
|
98
|
-
walletId?: string;
|
|
99
|
-
[key: string]: unknown;
|
|
96
|
+
status: string;
|
|
97
|
+
challenge?: unknown;
|
|
98
|
+
signature?: number[];
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
interface HealthCheckResponse {
|
|
103
102
|
success: boolean;
|
|
104
103
|
}
|
|
105
|
-
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Types for WebAuthn provider abstraction
|
|
107
|
+
*/
|
|
108
|
+
interface WebAuthnAssertion {
|
|
109
|
+
kind: 'Fido2';
|
|
110
|
+
credentialAssertion: {
|
|
111
|
+
credId: string;
|
|
112
|
+
clientData: string;
|
|
113
|
+
authenticatorData: string;
|
|
114
|
+
signature: string;
|
|
115
|
+
userHandle?: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface WebAuthnAttestation {
|
|
119
|
+
id: string;
|
|
120
|
+
clientDataJSON: string;
|
|
121
|
+
attestationObject: string;
|
|
122
|
+
}
|
|
123
|
+
interface WebAuthnCredential {
|
|
124
|
+
id: string;
|
|
125
|
+
transports?: AuthenticatorTransport[];
|
|
126
|
+
}
|
|
127
|
+
interface WebAuthnSignChallenge {
|
|
128
|
+
challenge: string;
|
|
129
|
+
challengeIdentifier?: string;
|
|
130
|
+
allowCredentials?: {
|
|
131
|
+
webauthn?: WebAuthnCredential[];
|
|
132
|
+
key?: any[];
|
|
133
|
+
};
|
|
134
|
+
rpId?: string;
|
|
135
|
+
userVerification?: UserVerificationRequirement;
|
|
136
|
+
timeout?: number;
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}
|
|
139
|
+
interface WebAuthnCreateChallenge {
|
|
140
|
+
challenge: string;
|
|
141
|
+
user: {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
displayName: string;
|
|
145
|
+
};
|
|
146
|
+
rp: {
|
|
147
|
+
id: string;
|
|
148
|
+
name: string;
|
|
149
|
+
};
|
|
150
|
+
pubKeyCredParams: {
|
|
151
|
+
type: "public-key";
|
|
152
|
+
alg: number;
|
|
153
|
+
}[];
|
|
154
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
155
|
+
attestation?: AttestationConveyancePreference;
|
|
156
|
+
timeout?: number;
|
|
157
|
+
excludeCredentials?: {
|
|
158
|
+
id: string;
|
|
159
|
+
type: "public-key";
|
|
160
|
+
transports?: AuthenticatorTransport[];
|
|
161
|
+
}[];
|
|
162
|
+
[key: string]: any;
|
|
163
|
+
}
|
|
164
|
+
interface WebAuthnProvider {
|
|
165
|
+
create(challenge: WebAuthnCreateChallenge): Promise<WebAuthnAttestation>;
|
|
166
|
+
sign(challenge: WebAuthnSignChallenge): Promise<WebAuthnAssertion>;
|
|
167
|
+
}
|
|
168
|
+
interface WebAuthnConfig {
|
|
169
|
+
relyingParty: {
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
origin?: string;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Key service response types and interfaces
|
|
178
|
+
*/
|
|
179
|
+
/**
|
|
180
|
+
* Signature response from key signing operations
|
|
181
|
+
*/
|
|
182
|
+
interface SignResponse {
|
|
183
|
+
id: string;
|
|
184
|
+
keyId: string;
|
|
185
|
+
requester: {
|
|
186
|
+
userId: string;
|
|
187
|
+
appId: string;
|
|
188
|
+
};
|
|
189
|
+
requestBody: {
|
|
190
|
+
hash: string;
|
|
191
|
+
kind: "Hash";
|
|
192
|
+
};
|
|
193
|
+
status: "Signed";
|
|
194
|
+
signature: {
|
|
195
|
+
r: string;
|
|
196
|
+
s: string;
|
|
197
|
+
v: number;
|
|
198
|
+
encoded: string;
|
|
199
|
+
};
|
|
200
|
+
network: "KeyECDSA";
|
|
201
|
+
dateRequested: string;
|
|
202
|
+
dateSigned: string;
|
|
203
|
+
walletId: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Authentication response from login/register operations
|
|
207
|
+
*/
|
|
208
|
+
interface AuthResponse {
|
|
209
|
+
token: string;
|
|
210
|
+
message?: string;
|
|
211
|
+
status?: number;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Registration challenge response
|
|
215
|
+
*/
|
|
216
|
+
interface RegistrationChallenge {
|
|
217
|
+
temporaryAuthenticationToken: string;
|
|
218
|
+
challenge: any;
|
|
219
|
+
status?: number;
|
|
220
|
+
message?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Registration completion response
|
|
224
|
+
*/
|
|
225
|
+
interface RegistrationResult {
|
|
226
|
+
token: string;
|
|
227
|
+
walletId?: string;
|
|
228
|
+
status?: number;
|
|
229
|
+
message?: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Individual wallet item
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* Hash signing request
|
|
236
|
+
*/
|
|
237
|
+
interface HashSigningRequest {
|
|
238
|
+
kind: "Hash";
|
|
239
|
+
hash: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* EIP-712 typed data signing request
|
|
243
|
+
*/
|
|
244
|
+
interface TypedDataSigningRequest {
|
|
245
|
+
blockchainKind: "Evm";
|
|
246
|
+
kind: "Eip712";
|
|
247
|
+
types: Record<string, any[]>;
|
|
248
|
+
domain: any;
|
|
249
|
+
message: Record<string, any>;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Generic signing request
|
|
253
|
+
*/
|
|
254
|
+
type SigningRequest = HashSigningRequest | TypedDataSigningRequest;
|
|
255
|
+
/**
|
|
256
|
+
* Signing challenge response
|
|
257
|
+
*/
|
|
258
|
+
interface SigningChallenge {
|
|
259
|
+
requestBody: any;
|
|
260
|
+
challenge: {
|
|
261
|
+
challengeIdentifier: string;
|
|
262
|
+
[key: string]: any;
|
|
263
|
+
};
|
|
264
|
+
status?: number;
|
|
265
|
+
message?: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* User credentials for authentication
|
|
269
|
+
*/
|
|
270
|
+
interface UserCredentials {
|
|
271
|
+
username: string;
|
|
272
|
+
appId?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Relying party configuration for WebAuthn
|
|
276
|
+
*/
|
|
277
|
+
interface RelyingPartyConfig {
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
origin?: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Combined transaction status type that includes both PERS and additional statuses
|
|
285
|
+
*/
|
|
286
|
+
type CombinedTransactionStatus = TransactionStatus;
|
|
287
|
+
/**
|
|
288
|
+
* Transaction statuses that allow signing
|
|
289
|
+
*/
|
|
290
|
+
declare const SIGNABLE_STATUSES: readonly [TransactionStatus.PENDING_SIGNATURE, TransactionStatus.CREATED];
|
|
291
|
+
/**
|
|
292
|
+
* Transaction status information for UI display
|
|
293
|
+
*/
|
|
294
|
+
interface TransactionStatusInfo {
|
|
295
|
+
transactionId: string;
|
|
296
|
+
transactionStatus: CombinedTransactionStatus;
|
|
297
|
+
message: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Transaction signing result
|
|
301
|
+
*/
|
|
302
|
+
interface TransactionSigningResult {
|
|
303
|
+
success: boolean;
|
|
304
|
+
transactionId: string;
|
|
305
|
+
signature?: string;
|
|
306
|
+
signingData?: CounterfactualWalletTransactionResponse | LegacyTransaction;
|
|
307
|
+
error?: string;
|
|
308
|
+
statusInfo?: TransactionStatusInfo;
|
|
309
|
+
shouldShowStatus?: boolean;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Transaction submission result for internal processing
|
|
313
|
+
*/
|
|
314
|
+
interface SubmissionResult {
|
|
315
|
+
submitResult: TransactionRequestResponseDTO;
|
|
316
|
+
shouldRedirect: boolean;
|
|
317
|
+
redirectUrl?: string;
|
|
318
|
+
transactionHash: string | null;
|
|
319
|
+
success: boolean;
|
|
320
|
+
error?: string;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Metadata for transaction parameters - string values only
|
|
324
|
+
*/
|
|
325
|
+
/**
|
|
326
|
+
* Authentication tokens required for transaction signing
|
|
327
|
+
*/
|
|
328
|
+
interface SigningAuthTokens {
|
|
329
|
+
signerAuthToken: string;
|
|
330
|
+
persAccessToken: string;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Transaction signing parameters
|
|
334
|
+
*/
|
|
335
|
+
interface TransactionSigningParams {
|
|
336
|
+
transactionId: string;
|
|
337
|
+
tenantId: string;
|
|
338
|
+
authTokens: SigningAuthTokens;
|
|
339
|
+
ethersProviderUrl: string;
|
|
340
|
+
returnUrl?: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Wallet list response from WalletService
|
|
345
|
+
*/
|
|
346
|
+
interface WalletListResponse {
|
|
347
|
+
items: WalletItem[];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Individual wallet item from wallet list - compatible with KeyWallet constructor
|
|
351
|
+
*/
|
|
352
|
+
interface WalletItem {
|
|
353
|
+
id: string;
|
|
354
|
+
address: string;
|
|
355
|
+
network: string;
|
|
356
|
+
status: string;
|
|
357
|
+
signingKey?: unknown;
|
|
358
|
+
dateCreated?: string;
|
|
359
|
+
custodial?: boolean;
|
|
360
|
+
tags?: string[];
|
|
361
|
+
boundToEvmNetwork?: boolean;
|
|
362
|
+
[key: string]: unknown;
|
|
363
|
+
}
|
|
364
|
+
interface GetWalletResponse {
|
|
365
|
+
id: string;
|
|
366
|
+
signingKey: {
|
|
367
|
+
publicKey: string;
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
type WalletMetadata = GetWalletResponse & {
|
|
371
|
+
boundToEvmNetwork: boolean;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Error codes for transaction signing operations
|
|
376
|
+
*/
|
|
377
|
+
declare enum TransactionSigningErrorCode {
|
|
378
|
+
INVALID_TOKENS = "INVALID_TOKENS",
|
|
379
|
+
TRANSACTION_NOT_FOUND = "TRANSACTION_NOT_FOUND",
|
|
380
|
+
TRANSACTION_NOT_PENDING = "TRANSACTION_NOT_PENDING",
|
|
381
|
+
WALLET_NOT_AVAILABLE = "WALLET_NOT_AVAILABLE",
|
|
382
|
+
WEBAUTHN_OPERATION_IN_PROGRESS = "WEBAUTHN_OPERATION_IN_PROGRESS",
|
|
383
|
+
SIGNING_CANCELLED = "SIGNING_CANCELLED",
|
|
384
|
+
PERS_AUTH_FAILED = "PERS_AUTH_FAILED",
|
|
385
|
+
AUTH_FAILED = "AUTH_FAILED",
|
|
386
|
+
TRANSACTION_NOT_READY = "TRANSACTION_NOT_READY",
|
|
387
|
+
SUBMISSION_FAILED = "SUBMISSION_FAILED",
|
|
388
|
+
SERVER_ERROR = "SERVER_ERROR",
|
|
389
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Structured error for transaction signing operations
|
|
393
|
+
*/
|
|
394
|
+
interface TransactionSigningError extends Error {
|
|
395
|
+
code: TransactionSigningErrorCode;
|
|
396
|
+
transactionId?: string;
|
|
397
|
+
originalError?: unknown;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Signing status types for type-safe status updates
|
|
402
|
+
* Using const pattern instead of enum for better bundling compatibility
|
|
403
|
+
*/
|
|
404
|
+
declare const SigningStatus: {
|
|
405
|
+
readonly INITIALIZING: "initializing";
|
|
406
|
+
readonly AUTHENTICATING: "authenticating";
|
|
407
|
+
readonly PREPARING: "preparing";
|
|
408
|
+
readonly SIGNING: "signing";
|
|
409
|
+
readonly SUBMITTING: "submitting";
|
|
410
|
+
readonly COMPLETED: "completed";
|
|
411
|
+
readonly ERROR: "error";
|
|
412
|
+
readonly EXPIRED: "expired";
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* Type for signing status values
|
|
416
|
+
*/
|
|
417
|
+
type SigningStatus = typeof SigningStatus[keyof typeof SigningStatus];
|
|
418
|
+
/**
|
|
419
|
+
* Status update data interface
|
|
420
|
+
*/
|
|
421
|
+
interface StatusUpdateData {
|
|
422
|
+
transactionId?: string;
|
|
423
|
+
transactionHash?: string;
|
|
424
|
+
error?: string;
|
|
425
|
+
[key: string]: any;
|
|
426
|
+
}
|
|
106
427
|
/**
|
|
107
|
-
*
|
|
428
|
+
* Status update callback interface for tracking transaction progress
|
|
429
|
+
*
|
|
430
|
+
* @interface StatusCallback
|
|
431
|
+
* @property {function} onStatusUpdate - Callback function that receives type-safe status updates
|
|
108
432
|
*/
|
|
109
|
-
interface
|
|
110
|
-
|
|
111
|
-
sign(challenge: any): Promise<any>;
|
|
112
|
-
}
|
|
113
|
-
interface WebAuthnConfig {
|
|
114
|
-
relyingParty: {
|
|
115
|
-
id: string;
|
|
116
|
-
name: string;
|
|
117
|
-
origin?: string;
|
|
118
|
-
};
|
|
433
|
+
interface StatusCallback {
|
|
434
|
+
onStatusUpdate?: (status: SigningStatus, message: string, data?: StatusUpdateData) => void;
|
|
119
435
|
}
|
|
120
436
|
|
|
121
437
|
/**
|
|
122
|
-
*
|
|
438
|
+
* Central type definitions for the blockchain signer shared library
|
|
439
|
+
* Single source of truth for all type exports
|
|
123
440
|
*/
|
|
124
441
|
|
|
125
442
|
/**
|
|
@@ -129,18 +446,8 @@ interface AuthenticatedUser {
|
|
|
129
446
|
identifier: string;
|
|
130
447
|
signerAuthToken: string;
|
|
131
448
|
persAccessToken: string;
|
|
132
|
-
tenantId: string;
|
|
133
449
|
expiresAt: number;
|
|
134
450
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Service configuration options
|
|
137
|
-
*/
|
|
138
|
-
interface ServiceConfig {
|
|
139
|
-
apiUrl: string;
|
|
140
|
-
environment: 'development' | 'staging' | 'production';
|
|
141
|
-
timeout?: number;
|
|
142
|
-
retryAttempts?: number;
|
|
143
|
-
}
|
|
144
451
|
/**
|
|
145
452
|
* Error types for service operations
|
|
146
453
|
*/
|
|
@@ -161,7 +468,7 @@ declare class WalletService {
|
|
|
161
468
|
* @param signerToken - Signer JWT token
|
|
162
469
|
* @returns Promise resolving to wallet data
|
|
163
470
|
*/
|
|
164
|
-
static listWallets(signerToken: string): Promise<
|
|
471
|
+
static listWallets(signerToken: string): Promise<Wallet[]>;
|
|
165
472
|
}
|
|
166
473
|
|
|
167
474
|
/**
|
|
@@ -179,18 +486,12 @@ declare class PersService {
|
|
|
179
486
|
private static tenantCache;
|
|
180
487
|
private static currentProjectKey;
|
|
181
488
|
private static currentTenantId;
|
|
182
|
-
private static useStaging;
|
|
183
489
|
private static readonly TENANT_CACHE_TTL;
|
|
184
490
|
/**
|
|
185
491
|
* Configure the PERS API settings
|
|
186
492
|
* @param config - The configuration object
|
|
187
493
|
*/
|
|
188
494
|
static configure(config: Partial<PersApiConfig>): void;
|
|
189
|
-
/**
|
|
190
|
-
* Enable staging mode when project key is not available
|
|
191
|
-
* @param enableStaging Whether to use staging environment
|
|
192
|
-
*/
|
|
193
|
-
static setStagingMode(enableStaging: boolean): void;
|
|
194
495
|
/**
|
|
195
496
|
* Get current configuration
|
|
196
497
|
*/
|
|
@@ -201,21 +502,21 @@ declare class PersService {
|
|
|
201
502
|
* @param authToken - Optional auth token for authentication
|
|
202
503
|
* @returns Promise with tenant public information
|
|
203
504
|
*/
|
|
204
|
-
static getTenantById(tenantId: string, authToken
|
|
505
|
+
static getTenantById(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
205
506
|
/**
|
|
206
507
|
* Initialize tenant configuration from JWT
|
|
207
508
|
* @param tenantId - The tenant ID from JWT payload
|
|
208
509
|
* @param authToken - Optional auth token for authentication
|
|
209
510
|
* @returns Promise with tenant information
|
|
210
511
|
*/
|
|
211
|
-
static initializeTenant(tenantId: string, authToken
|
|
512
|
+
static initializeTenant(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
212
513
|
/**
|
|
213
514
|
* Ensure tenant is initialized and current, with automatic revalidation
|
|
214
515
|
* @param tenantId - The tenant ID to ensure is initialized
|
|
215
516
|
* @param authToken - Optional auth token for authentication
|
|
216
517
|
* @returns Promise with tenant information
|
|
217
518
|
*/
|
|
218
|
-
static ensureTenantInitialized(tenantId: string, authToken
|
|
519
|
+
static ensureTenantInitialized(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
219
520
|
/**
|
|
220
521
|
* Get the current project key (either from tenant or fallback)
|
|
221
522
|
* @param tenantId - Optional tenant ID to ensure is initialized
|
|
@@ -229,7 +530,7 @@ declare class PersService {
|
|
|
229
530
|
/**
|
|
230
531
|
* Authenticates a user with the PERS backend using their auth token
|
|
231
532
|
*
|
|
232
|
-
* @param authToken - The authentication token received from
|
|
533
|
+
* @param authToken - The authentication token received from backend after login/registration
|
|
233
534
|
* @param tenantId - Optional tenant ID for automatic initialization
|
|
234
535
|
* @returns A promise that resolves to the authentication response
|
|
235
536
|
* @throws If the request fails
|
|
@@ -271,113 +572,6 @@ declare class PersService {
|
|
|
271
572
|
static getTransactionDataForSigning(transactionResponse: TransactionRequestResponseDTO): _explorins_pers_shared_browser.CounterfactualWalletTransactionResponse | _explorins_web3_ts_types.LegacyTransaction;
|
|
272
573
|
}
|
|
273
574
|
|
|
274
|
-
/**
|
|
275
|
-
* Key service response types and interfaces
|
|
276
|
-
*/
|
|
277
|
-
/**
|
|
278
|
-
* Signature response from key signing operations
|
|
279
|
-
*/
|
|
280
|
-
interface SignResponse {
|
|
281
|
-
id: string;
|
|
282
|
-
keyId: string;
|
|
283
|
-
requester: {
|
|
284
|
-
userId: string;
|
|
285
|
-
appId: string;
|
|
286
|
-
};
|
|
287
|
-
requestBody: {
|
|
288
|
-
hash: string;
|
|
289
|
-
kind: "Hash";
|
|
290
|
-
};
|
|
291
|
-
status: "Signed";
|
|
292
|
-
signature: {
|
|
293
|
-
r: string;
|
|
294
|
-
s: string;
|
|
295
|
-
v: number;
|
|
296
|
-
encoded: string;
|
|
297
|
-
};
|
|
298
|
-
network: "KeyECDSA";
|
|
299
|
-
dateRequested: string;
|
|
300
|
-
dateSigned: string;
|
|
301
|
-
walletId: string;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Authentication response from login/register operations
|
|
305
|
-
*/
|
|
306
|
-
interface AuthResponse {
|
|
307
|
-
token: string;
|
|
308
|
-
message?: string;
|
|
309
|
-
status?: number;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Registration challenge response
|
|
313
|
-
*/
|
|
314
|
-
interface RegistrationChallenge {
|
|
315
|
-
temporaryAuthenticationToken: string;
|
|
316
|
-
challenge: any;
|
|
317
|
-
status?: number;
|
|
318
|
-
message?: string;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Registration completion response
|
|
322
|
-
*/
|
|
323
|
-
interface RegistrationResult {
|
|
324
|
-
token: string;
|
|
325
|
-
walletId?: string;
|
|
326
|
-
status?: number;
|
|
327
|
-
message?: string;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Individual wallet item
|
|
331
|
-
*/
|
|
332
|
-
/**
|
|
333
|
-
* Hash signing request
|
|
334
|
-
*/
|
|
335
|
-
interface HashSigningRequest {
|
|
336
|
-
kind: "Hash";
|
|
337
|
-
hash: string;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* EIP-712 typed data signing request
|
|
341
|
-
*/
|
|
342
|
-
interface TypedDataSigningRequest {
|
|
343
|
-
blockchainKind: "Evm";
|
|
344
|
-
kind: "Eip712";
|
|
345
|
-
types: Record<string, any[]>;
|
|
346
|
-
domain: any;
|
|
347
|
-
message: Record<string, any>;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Generic signing request
|
|
351
|
-
*/
|
|
352
|
-
type SigningRequest = HashSigningRequest | TypedDataSigningRequest;
|
|
353
|
-
/**
|
|
354
|
-
* Signing challenge response
|
|
355
|
-
*/
|
|
356
|
-
interface SigningChallenge {
|
|
357
|
-
requestBody: any;
|
|
358
|
-
challenge: {
|
|
359
|
-
challengeIdentifier: string;
|
|
360
|
-
[key: string]: any;
|
|
361
|
-
};
|
|
362
|
-
status?: number;
|
|
363
|
-
message?: string;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* User credentials for authentication
|
|
367
|
-
*/
|
|
368
|
-
interface UserCredentials {
|
|
369
|
-
username: string;
|
|
370
|
-
appId?: string;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Relying party configuration for WebAuthn
|
|
374
|
-
*/
|
|
375
|
-
interface RelyingPartyConfig {
|
|
376
|
-
id: string;
|
|
377
|
-
name: string;
|
|
378
|
-
origin?: string;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
575
|
/**
|
|
382
576
|
* Signing service for cryptographic operations
|
|
383
577
|
* Handles hash signing and typed data signing with WebAuthn
|
|
@@ -422,21 +616,11 @@ declare class SigningService {
|
|
|
422
616
|
signBatch(authToken: string, walletId: string, requests: SigningRequest[]): Promise<CompleteSignatureResponse['data'][]>;
|
|
423
617
|
}
|
|
424
618
|
|
|
425
|
-
interface GetWalletResponse {
|
|
426
|
-
id: string;
|
|
427
|
-
signingKey: {
|
|
428
|
-
publicKey: string;
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
619
|
type WalletOptions = {
|
|
433
620
|
wallet: WalletMetadata;
|
|
434
621
|
authToken: string;
|
|
435
622
|
signingService: SigningService;
|
|
436
623
|
};
|
|
437
|
-
type WalletMetadata = GetWalletResponse & {
|
|
438
|
-
boundToEvmNetwork: boolean;
|
|
439
|
-
};
|
|
440
624
|
declare class KeyWallet extends AbstractSigner {
|
|
441
625
|
private options;
|
|
442
626
|
private address?;
|
|
@@ -459,66 +643,6 @@ declare class KeyWallet extends AbstractSigner {
|
|
|
459
643
|
signPersTransaction(transactionData: AnyTransactionData): Promise<string>;
|
|
460
644
|
}
|
|
461
645
|
|
|
462
|
-
/**
|
|
463
|
-
* Combined transaction status type that includes both PERS and additional statuses
|
|
464
|
-
*/
|
|
465
|
-
type CombinedTransactionStatus = TransactionStatus;
|
|
466
|
-
/**
|
|
467
|
-
* Transaction statuses that allow signing
|
|
468
|
-
*/
|
|
469
|
-
declare const SIGNABLE_STATUSES: readonly [TransactionStatus.PENDING_SIGNATURE, TransactionStatus.CREATED];
|
|
470
|
-
/**
|
|
471
|
-
* Transaction status information for UI display
|
|
472
|
-
*/
|
|
473
|
-
interface TransactionStatusInfo {
|
|
474
|
-
transactionId: string;
|
|
475
|
-
transactionStatus: CombinedTransactionStatus;
|
|
476
|
-
message: string;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Transaction signing result
|
|
480
|
-
*/
|
|
481
|
-
interface TransactionSigningResult {
|
|
482
|
-
success: boolean;
|
|
483
|
-
transactionId: string;
|
|
484
|
-
signature?: string;
|
|
485
|
-
signingData?: CounterfactualWalletTransactionResponse | LegacyTransaction;
|
|
486
|
-
error?: string;
|
|
487
|
-
statusInfo?: TransactionStatusInfo;
|
|
488
|
-
shouldShowStatus?: boolean;
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Transaction submission result for internal processing
|
|
492
|
-
*/
|
|
493
|
-
interface SubmissionResult {
|
|
494
|
-
submitResult: TransactionRequestResponseDTO;
|
|
495
|
-
shouldRedirect: boolean;
|
|
496
|
-
redirectUrl?: string;
|
|
497
|
-
transactionHash: string | null;
|
|
498
|
-
success: boolean;
|
|
499
|
-
error?: string;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Metadata for transaction parameters - string values only
|
|
503
|
-
*/
|
|
504
|
-
/**
|
|
505
|
-
* Authentication tokens required for transaction signing
|
|
506
|
-
*/
|
|
507
|
-
interface SigningAuthTokens {
|
|
508
|
-
signerAuthToken: string;
|
|
509
|
-
persAccessToken: string;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Transaction signing parameters
|
|
513
|
-
*/
|
|
514
|
-
interface TransactionSigningParams {
|
|
515
|
-
transactionId: string;
|
|
516
|
-
tenantId: string;
|
|
517
|
-
authTokens: SigningAuthTokens;
|
|
518
|
-
ethersProviderUrl: string;
|
|
519
|
-
returnUrl?: string;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
646
|
/**
|
|
523
647
|
* Service for orchestrating transaction signing operations
|
|
524
648
|
* Handles the complete flow from transaction preparation to submission
|
|
@@ -554,32 +678,6 @@ declare class TransactionSigningService {
|
|
|
554
678
|
signTransaction(params: TransactionSigningParams, signingData: CounterfactualWalletTransactionResponse | LegacyTransaction): Promise<TransactionSigningResult>;
|
|
555
679
|
}
|
|
556
680
|
|
|
557
|
-
/**
|
|
558
|
-
* Error codes for transaction signing operations
|
|
559
|
-
*/
|
|
560
|
-
declare enum TransactionSigningErrorCode {
|
|
561
|
-
INVALID_TOKENS = "INVALID_TOKENS",
|
|
562
|
-
TRANSACTION_NOT_FOUND = "TRANSACTION_NOT_FOUND",
|
|
563
|
-
TRANSACTION_NOT_PENDING = "TRANSACTION_NOT_PENDING",
|
|
564
|
-
WALLET_NOT_AVAILABLE = "WALLET_NOT_AVAILABLE",
|
|
565
|
-
WEBAUTHN_OPERATION_IN_PROGRESS = "WEBAUTHN_OPERATION_IN_PROGRESS",
|
|
566
|
-
SIGNING_CANCELLED = "SIGNING_CANCELLED",
|
|
567
|
-
PERS_AUTH_FAILED = "PERS_AUTH_FAILED",
|
|
568
|
-
AUTH_FAILED = "AUTH_FAILED",
|
|
569
|
-
TRANSACTION_NOT_READY = "TRANSACTION_NOT_READY",
|
|
570
|
-
SUBMISSION_FAILED = "SUBMISSION_FAILED",
|
|
571
|
-
SERVER_ERROR = "SERVER_ERROR",
|
|
572
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Structured error for transaction signing operations
|
|
576
|
-
*/
|
|
577
|
-
interface TransactionSigningError extends Error {
|
|
578
|
-
code: TransactionSigningErrorCode;
|
|
579
|
-
transactionId?: string;
|
|
580
|
-
originalError?: unknown;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
681
|
/**
|
|
584
682
|
* Handles all error-related operations for transaction signing
|
|
585
683
|
*/
|
|
@@ -626,11 +724,9 @@ declare class TransactionErrorHandler {
|
|
|
626
724
|
error?: {
|
|
627
725
|
code?: string;
|
|
628
726
|
message?: string;
|
|
629
|
-
developerMessage?: string;
|
|
630
727
|
};
|
|
631
728
|
code?: string;
|
|
632
729
|
message?: string;
|
|
633
|
-
developerMessage?: string;
|
|
634
730
|
}, transactionId: string): never;
|
|
635
731
|
/**
|
|
636
732
|
* Process PERS API errors and handle TRANSACTION_NOT_PENDING cases
|
|
@@ -789,28 +885,6 @@ declare function setHttpClient(client: HttpClient): void;
|
|
|
789
885
|
*/
|
|
790
886
|
declare function getHttpClient(): HttpClient;
|
|
791
887
|
|
|
792
|
-
/**
|
|
793
|
-
* Wallet list response from WalletService
|
|
794
|
-
*/
|
|
795
|
-
interface WalletListResponse {
|
|
796
|
-
items: WalletItem[];
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* Individual wallet item from wallet list - compatible with KeyWallet constructor
|
|
800
|
-
*/
|
|
801
|
-
interface WalletItem {
|
|
802
|
-
id: string;
|
|
803
|
-
address: string;
|
|
804
|
-
network: string;
|
|
805
|
-
status: string;
|
|
806
|
-
signingKey?: unknown;
|
|
807
|
-
dateCreated?: string;
|
|
808
|
-
custodial?: boolean;
|
|
809
|
-
tags?: string[];
|
|
810
|
-
boundToEvmNetwork?: boolean;
|
|
811
|
-
[key: string]: unknown;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
888
|
/**
|
|
815
889
|
* PERS Blockchain Signer SDK
|
|
816
890
|
*
|
|
@@ -849,12 +923,14 @@ interface WalletItem {
|
|
|
849
923
|
* @property {WebAuthnProvider} webAuthnProvider - WebAuthn provider for secure authentication
|
|
850
924
|
* @property {string} [apiUrl] - Custom API base URL (defaults to production)
|
|
851
925
|
* @property {string} [relyingPartyName] - WebAuthn relying party name for authentication
|
|
926
|
+
* @property {StatusCallback} [globalStatusCallback] - Optional global status callback for all operations
|
|
852
927
|
*/
|
|
853
928
|
interface ExtendedPersSignerConfig {
|
|
854
929
|
ethersProviderUrl?: string;
|
|
855
930
|
webAuthnProvider: WebAuthnProvider;
|
|
856
931
|
apiUrl?: string;
|
|
857
932
|
relyingPartyName?: string;
|
|
933
|
+
globalStatusCallback?: StatusCallback;
|
|
858
934
|
}
|
|
859
935
|
interface PersSignerConfig extends Omit<ExtendedPersSignerConfig, 'webAuthnProvider'> {
|
|
860
936
|
}
|
|
@@ -884,6 +960,11 @@ declare class PersSignerSDK {
|
|
|
884
960
|
* @throws {Error} If required configuration is missing
|
|
885
961
|
*/
|
|
886
962
|
constructor(config: ExtendedPersSignerConfig);
|
|
963
|
+
/**
|
|
964
|
+
* Helper method to trigger both global and method-specific status callbacks
|
|
965
|
+
* @private
|
|
966
|
+
*/
|
|
967
|
+
private triggerStatusUpdate;
|
|
887
968
|
/**
|
|
888
969
|
* Authenticate user and cache session for 5 minutes
|
|
889
970
|
*
|
|
@@ -891,20 +972,23 @@ declare class PersSignerSDK {
|
|
|
891
972
|
* and caches the authenticated user session to avoid repeated authentication.
|
|
892
973
|
*
|
|
893
974
|
* @param {string} jwtToken - JWT token containing user identifier and tenant info
|
|
975
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
894
976
|
* @returns {Promise<AuthenticatedUser>} Authenticated user with access tokens
|
|
895
977
|
* @throws {Error} If JWT is invalid, expired, or authentication fails
|
|
896
978
|
*
|
|
897
979
|
* @example
|
|
898
980
|
* ```typescript
|
|
899
981
|
* try {
|
|
900
|
-
* const user = await sdk.loginUser(jwtToken
|
|
982
|
+
* const user = await sdk.loginUser(jwtToken, {
|
|
983
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
984
|
+
* });
|
|
901
985
|
* console.log('Authenticated:', user.identifier);
|
|
902
986
|
* } catch (error) {
|
|
903
987
|
* console.error('Authentication failed:', error.message);
|
|
904
988
|
* }
|
|
905
989
|
* ```
|
|
906
990
|
*/
|
|
907
|
-
loginUser(jwtToken: string): Promise<AuthenticatedUser>;
|
|
991
|
+
loginUser(jwtToken: string, statusCallback?: StatusCallback): Promise<AuthenticatedUser>;
|
|
908
992
|
/**
|
|
909
993
|
* Sign a PERS transaction (legacy compatibility method)
|
|
910
994
|
*
|
|
@@ -913,13 +997,16 @@ declare class PersSignerSDK {
|
|
|
913
997
|
* maintained for backward compatibility.
|
|
914
998
|
*
|
|
915
999
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1000
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
916
1001
|
* @returns {Promise<TransactionSigningResult>} Signing result with signature and metadata
|
|
917
1002
|
* @throws {Error} If authentication fails, transaction ID missing, or signing fails
|
|
918
1003
|
*
|
|
919
1004
|
* @example
|
|
920
1005
|
* ```typescript
|
|
921
1006
|
* try {
|
|
922
|
-
* const result = await sdk.signPersTransaction(jwtToken
|
|
1007
|
+
* const result = await sdk.signPersTransaction(jwtToken, {
|
|
1008
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1009
|
+
* });
|
|
923
1010
|
* if (result.success) {
|
|
924
1011
|
* console.log('Transaction signed:', result.signature);
|
|
925
1012
|
* }
|
|
@@ -928,7 +1015,7 @@ declare class PersSignerSDK {
|
|
|
928
1015
|
* }
|
|
929
1016
|
* ```
|
|
930
1017
|
*/
|
|
931
|
-
signPersTransaction(jwtToken: string): Promise<TransactionSigningResult>;
|
|
1018
|
+
signPersTransaction(jwtToken: string, statusCallback?: StatusCallback): Promise<TransactionSigningResult>;
|
|
932
1019
|
/**
|
|
933
1020
|
* Sign a transaction with provided signing data
|
|
934
1021
|
*
|
|
@@ -937,17 +1024,20 @@ declare class PersSignerSDK {
|
|
|
937
1024
|
*
|
|
938
1025
|
* @param {CounterfactualWalletTransactionResponse | LegacyTransaction} signingData - Transaction data to sign
|
|
939
1026
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1027
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
940
1028
|
* @returns {Promise<TransactionSigningResult>} Signing result with signature and metadata
|
|
941
1029
|
* @throws {Error} If authentication fails, transaction ID missing, or signing fails
|
|
942
1030
|
*
|
|
943
1031
|
* @example
|
|
944
1032
|
* ```typescript
|
|
945
1033
|
* const signingData = await getTransactionData(transactionId);
|
|
946
|
-
* const result = await sdk.signTransaction(signingData, jwtToken
|
|
1034
|
+
* const result = await sdk.signTransaction(signingData, jwtToken, {
|
|
1035
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1036
|
+
* });
|
|
947
1037
|
* console.log('Signed transaction:', result.signature);
|
|
948
1038
|
* ```
|
|
949
1039
|
*/
|
|
950
|
-
signTransaction(signingData: CounterfactualWalletTransactionResponse$1 | LegacyTransaction, jwtToken: string): Promise<TransactionSigningResult>;
|
|
1040
|
+
signTransaction(signingData: CounterfactualWalletTransactionResponse$1 | LegacyTransaction, jwtToken: string, statusCallback?: StatusCallback): Promise<TransactionSigningResult>;
|
|
951
1041
|
/**
|
|
952
1042
|
* Complete transaction flow: sign and submit in one call
|
|
953
1043
|
*
|
|
@@ -956,13 +1046,18 @@ declare class PersSignerSDK {
|
|
|
956
1046
|
* transaction lifecycle automatically.
|
|
957
1047
|
*
|
|
958
1048
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1049
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
959
1050
|
* @returns {Promise<SubmissionResult>} Submission result with transaction hash and status
|
|
960
1051
|
* @throws {Error} If authentication, signing, or submission fails
|
|
961
1052
|
*
|
|
962
1053
|
* @example
|
|
963
1054
|
* ```typescript
|
|
964
1055
|
* try {
|
|
965
|
-
* const result = await sdk.signAndSubmitPersTransaction(jwtToken
|
|
1056
|
+
* const result = await sdk.signAndSubmitPersTransaction(jwtToken, {
|
|
1057
|
+
* onStatusUpdate: (status, message) => {
|
|
1058
|
+
* console.log(`Status: ${status} - ${message}`);
|
|
1059
|
+
* }
|
|
1060
|
+
* });
|
|
966
1061
|
* if (result.success) {
|
|
967
1062
|
* console.log('Transaction completed:', result.transactionHash);
|
|
968
1063
|
* if (result.shouldRedirect) {
|
|
@@ -974,7 +1069,7 @@ declare class PersSignerSDK {
|
|
|
974
1069
|
* }
|
|
975
1070
|
* ```
|
|
976
1071
|
*/
|
|
977
|
-
signAndSubmitPersTransaction(jwtToken: string): Promise<SubmissionResult>;
|
|
1072
|
+
signAndSubmitPersTransaction(jwtToken: string, statusCallback?: StatusCallback): Promise<SubmissionResult>;
|
|
978
1073
|
/**
|
|
979
1074
|
* Submit a signed transaction to the blockchain
|
|
980
1075
|
*
|
|
@@ -984,17 +1079,20 @@ declare class PersSignerSDK {
|
|
|
984
1079
|
*
|
|
985
1080
|
* @param {TransactionSigningResult} signingResult - Result from a successful transaction signing
|
|
986
1081
|
* @param {string} jwtToken - JWT token containing tenant and user info
|
|
1082
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
987
1083
|
* @returns {Promise<SubmissionResult>} Submission result with transaction hash and status
|
|
988
1084
|
* @throws {Error} If signing result is invalid, JWT is missing tenantId, or submission fails
|
|
989
1085
|
*
|
|
990
1086
|
* @example
|
|
991
1087
|
* ```typescript
|
|
992
1088
|
* const signedTx = await sdk.signPersTransaction(jwtToken);
|
|
993
|
-
* const result = await sdk.submitTransaction(signedTx, jwtToken
|
|
1089
|
+
* const result = await sdk.submitTransaction(signedTx, jwtToken, {
|
|
1090
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1091
|
+
* });
|
|
994
1092
|
* console.log('Transaction submitted:', result.transactionHash);
|
|
995
1093
|
* ```
|
|
996
1094
|
*/
|
|
997
|
-
submitTransaction(signingResult: TransactionSigningResult, jwtToken: string): Promise<SubmissionResult>;
|
|
1095
|
+
submitTransaction(signingResult: TransactionSigningResult, jwtToken: string, statusCallback?: StatusCallback): Promise<SubmissionResult>;
|
|
998
1096
|
/**
|
|
999
1097
|
* Clear user authentication cache
|
|
1000
1098
|
*
|
|
@@ -1035,14 +1133,6 @@ declare class PersSignerSDK {
|
|
|
1035
1133
|
*/
|
|
1036
1134
|
declare function createPersSignerSDK(config: ExtendedPersSignerConfig): PersSignerSDK;
|
|
1037
1135
|
|
|
1038
|
-
/**
|
|
1039
|
-
* Authenticated user with all required tokens
|
|
1040
|
-
*/
|
|
1041
|
-
interface SignerAuthenticatedUser {
|
|
1042
|
-
identifier: string;
|
|
1043
|
-
signerAuthToken: string;
|
|
1044
|
-
persAccessToken: string;
|
|
1045
|
-
}
|
|
1046
1136
|
/**
|
|
1047
1137
|
* Authentication service for user login and registration
|
|
1048
1138
|
* Uses constructor-based dependency injection for WebAuthn provider
|
|
@@ -1050,7 +1140,6 @@ interface SignerAuthenticatedUser {
|
|
|
1050
1140
|
*/
|
|
1051
1141
|
declare class AuthenticationService {
|
|
1052
1142
|
private signerToken;
|
|
1053
|
-
private config;
|
|
1054
1143
|
private webAuthnProvider;
|
|
1055
1144
|
constructor(config: ExtendedPersSignerConfig);
|
|
1056
1145
|
/**
|
|
@@ -1066,11 +1155,11 @@ declare class AuthenticationService {
|
|
|
1066
1155
|
*/
|
|
1067
1156
|
verifyToken(token: string): Promise<VerifyTokenResponse>;
|
|
1068
1157
|
/**
|
|
1069
|
-
*
|
|
1070
|
-
* @param persToken - PERS JWT token
|
|
1071
|
-
* @returns Promise resolving to
|
|
1158
|
+
* Register user with unified flow
|
|
1159
|
+
* @param persToken - PERS JWT token
|
|
1160
|
+
* @returns Promise resolving to authenticated user data
|
|
1072
1161
|
*/
|
|
1073
|
-
|
|
1162
|
+
registerUser(persToken: string): Promise<JWTLoginResponse>;
|
|
1074
1163
|
/**
|
|
1075
1164
|
* Get current signer token
|
|
1076
1165
|
* @returns The current signer JWT token
|
|
@@ -1081,14 +1170,6 @@ declare class AuthenticationService {
|
|
|
1081
1170
|
* @param token - Signer JWT token
|
|
1082
1171
|
*/
|
|
1083
1172
|
setSignerToken(token: string): void;
|
|
1084
|
-
/**
|
|
1085
|
-
* Complete registration with WebAuthn challenge data (v1 API format)
|
|
1086
|
-
* @param tmpAuthToken - Temporary auth token from init registration (temporaryAuthenticationToken)
|
|
1087
|
-
* @param signedChallenge - WebAuthn credential response (will be restructured for backend)
|
|
1088
|
-
* @param persToken - PERS JWT token (authToken)
|
|
1089
|
-
* @returns Promise resolving to registration result
|
|
1090
|
-
*/
|
|
1091
|
-
completeRegistrationWithChallenge(tmpAuthToken: string | null, signedChallenge: any, persToken: string): Promise<JWTLoginResponse | unknown>;
|
|
1092
1173
|
/**
|
|
1093
1174
|
* Combined authentication flow - handles both login and registration
|
|
1094
1175
|
* @param identifier - User identifier (email/userId)
|
|
@@ -1097,7 +1178,7 @@ declare class AuthenticationService {
|
|
|
1097
1178
|
* @param relyingPartyConfig - Configuration for WebAuthn relying party
|
|
1098
1179
|
* @returns Promise resolving to authenticated user with signer token
|
|
1099
1180
|
*/
|
|
1100
|
-
combinedAuthentication(identifier: string, persAccessToken: string): Promise<
|
|
1181
|
+
combinedAuthentication(identifier: string, persAccessToken: string): Promise<AuthenticatedUser>;
|
|
1101
1182
|
}
|
|
1102
1183
|
|
|
1103
1184
|
/**
|
|
@@ -1113,7 +1194,8 @@ declare class HealthService {
|
|
|
1113
1194
|
}
|
|
1114
1195
|
|
|
1115
1196
|
/**
|
|
1116
|
-
* Browser-specific WebAuthn provider using
|
|
1197
|
+
* Browser-specific WebAuthn provider using native browser APIs
|
|
1198
|
+
* Fully agnostic implementation without external SDK dependencies
|
|
1117
1199
|
*/
|
|
1118
1200
|
|
|
1119
1201
|
/**
|
|
@@ -1122,7 +1204,8 @@ declare class HealthService {
|
|
|
1122
1204
|
declare function getBrowserWebAuthnProvider(): Promise<WebAuthnProvider>;
|
|
1123
1205
|
|
|
1124
1206
|
/**
|
|
1125
|
-
* React Native-specific WebAuthn provider using
|
|
1207
|
+
* React Native-specific WebAuthn provider using react-native-passkey
|
|
1208
|
+
* Fully agnostic implementation without external SDK dependencies
|
|
1126
1209
|
* Falls back to browser implementation for React Native Web (Expo Web)
|
|
1127
1210
|
*/
|
|
1128
1211
|
|
|
@@ -1137,6 +1220,7 @@ declare function getReactNativeWebAuthnProvider(): Promise<WebAuthnProvider>;
|
|
|
1137
1220
|
* Browser-compatible JWT handling without external dependencies
|
|
1138
1221
|
*/
|
|
1139
1222
|
interface JWTPayload {
|
|
1223
|
+
iss?: string;
|
|
1140
1224
|
email?: string;
|
|
1141
1225
|
identifierEmail?: string;
|
|
1142
1226
|
userId?: string;
|
|
@@ -1209,5 +1293,5 @@ declare class UserCache {
|
|
|
1209
1293
|
static cleanup(): number;
|
|
1210
1294
|
}
|
|
1211
1295
|
|
|
1212
|
-
export { AuthenticationService, FetchHttpClient, HealthService, KeyWallet, PersService, PersSignerSDK, ReactNativeConfigProvider, SIGNABLE_STATUSES, SigningService, StaticConfigProvider, TransactionErrorHandler, TransactionSigningErrorCode, TransactionSigningService, TransactionSubmissionHandler, TransactionValidator, UserCache, WalletService, WebAuthnCoordinator, WebConfigProvider, createPersSignerSDK, extractJWTFromToken, getBrowserWebAuthnProvider, getConfigProvider, getHttpClient, getJWTPayload, getReactNativeWebAuthnProvider, getServiceConfig, isJWTExpired, setConfigProvider, setHttpClient };
|
|
1213
|
-
export type { AuthResponse, AuthenticatedUser, CombinedTransactionStatus, ConfigProvider, HashSigningRequest, HttpClient, HttpRequestOptions, HttpResponse, JWTExtractionResult, JWTPayload, ListWalletsRequest, ListWalletsResponse, LoginRequest, LoginResponse, PersSignerConfig, RegistrationChallenge, RegistrationResult, RelyingPartyConfig,
|
|
1296
|
+
export { AuthenticationService, FetchHttpClient, HealthService, KeyWallet, PersService, PersSignerSDK, ReactNativeConfigProvider, SIGNABLE_STATUSES, SigningService, SigningStatus, StaticConfigProvider, TransactionErrorHandler, TransactionSigningErrorCode, TransactionSigningService, TransactionSubmissionHandler, TransactionValidator, UserCache, WalletService, WebAuthnCoordinator, WebConfigProvider, createPersSignerSDK, extractJWTFromToken, getBrowserWebAuthnProvider, getConfigProvider, getHttpClient, getJWTPayload, getReactNativeWebAuthnProvider, getServiceConfig, isJWTExpired, setConfigProvider, setHttpClient };
|
|
1297
|
+
export type { AuthResponse, AuthenticatedUser, CombinedTransactionStatus, CompleteSignatureResponse, ConfigProvider, HashSigningRequest, HealthCheckResponse, HttpClient, HttpRequestOptions, HttpResponse, JWTExtractionResult, JWTPayload, ListWalletsRequest, ListWalletsResponse, LoginRequest, LoginResponse, PersSignerConfig, RegistrationChallenge, RegistrationResult, RelyingPartyConfig, ServiceError, SignResponse, SignerApiError, SignerApiResponse, SigningAuthTokens, SigningChallenge, SigningRequest, StatusCallback, StatusUpdateData, SubmissionResult, TransactionSigningError, TransactionSigningParams, TransactionSigningResult, TransactionStatusInfo, TypedDataSigningRequest, UserCredentials, VerifyTokenRequest, VerifyTokenResponse, WalletItem, WalletListResponse, WebAuthnConfig, WebAuthnProvider };
|