@explorins/pers-signer 1.0.18 → 1.0.26
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 +730 -9709
- package/dist/browser.cjs.js.map +1 -1
- package/dist/browser.d.ts +252 -301
- package/dist/browser.esm.js +712 -9680
- package/dist/browser.esm.js.map +1 -1
- package/dist/index.cjs.js +813 -10180
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +177 -109
- package/dist/index.esm.js +814 -10182
- package/dist/index.esm.js.map +1 -1
- package/dist/react-native.cjs.js +862 -10018
- package/dist/react-native.cjs.js.map +1 -1
- package/dist/react-native.d.ts +254 -302
- package/dist/react-native.esm.js +844 -9989
- package/dist/react-native.esm.js.map +1 -1
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -40,13 +40,9 @@ interface JWTLoginResponse {
|
|
|
40
40
|
username: string;
|
|
41
41
|
org_id: string;
|
|
42
42
|
};
|
|
43
|
-
provider
|
|
44
|
-
}
|
|
45
|
-
interface WrappedProviderResponse {
|
|
46
|
-
success: true;
|
|
47
|
-
data: unknown;
|
|
43
|
+
provider?: string;
|
|
48
44
|
}
|
|
49
|
-
type LoginResponse = JWTLoginResponse
|
|
45
|
+
type LoginResponse = JWTLoginResponse;
|
|
50
46
|
interface VerifyTokenRequest {
|
|
51
47
|
token: string;
|
|
52
48
|
}
|
|
@@ -67,69 +63,39 @@ interface VerifyTokenResponse {
|
|
|
67
63
|
};
|
|
68
64
|
tenantId: string;
|
|
69
65
|
}
|
|
70
|
-
interface
|
|
71
|
-
|
|
66
|
+
interface SigningKey {
|
|
67
|
+
curve: string;
|
|
68
|
+
publicKey: string;
|
|
69
|
+
scheme: string;
|
|
72
70
|
}
|
|
73
|
-
interface
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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[];
|
|
81
84
|
}
|
|
82
|
-
type CompleteRegistrationResponse = JWTLoginResponse | WrappedProviderResponse;
|
|
83
85
|
interface ListWalletsRequest {
|
|
84
86
|
}
|
|
85
87
|
interface ListWalletsResponse {
|
|
86
88
|
success: true;
|
|
87
89
|
data: {
|
|
88
|
-
|
|
89
|
-
[key: string]: unknown;
|
|
90
|
+
items: Wallet[];
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
interface InitSignatureRequest {
|
|
93
|
-
walletId: string;
|
|
94
|
-
request: unknown;
|
|
95
|
-
}
|
|
96
|
-
interface InitSignatureResponse {
|
|
97
|
-
success: true;
|
|
98
|
-
data: {
|
|
99
|
-
requestBody: unknown;
|
|
100
|
-
challenge: unknown;
|
|
101
|
-
[key: string]: unknown;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
interface CompleteSignatureRequest {
|
|
105
|
-
walletId: string;
|
|
106
|
-
requestBody: unknown;
|
|
107
|
-
signedChallenge: unknown;
|
|
108
|
-
}
|
|
109
93
|
interface CompleteSignatureResponse {
|
|
110
94
|
success: true;
|
|
111
95
|
data: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
recid: number;
|
|
116
|
-
encoded: string;
|
|
117
|
-
} | string;
|
|
118
|
-
transaction?: unknown;
|
|
119
|
-
dateRequested?: string;
|
|
120
|
-
dateSigned?: string;
|
|
121
|
-
id?: string;
|
|
122
|
-
keyId?: string;
|
|
123
|
-
network?: string;
|
|
124
|
-
requestBody?: {
|
|
125
|
-
kind?: 'Eip712' | 'Hash' | string;
|
|
126
|
-
blockchainKind?: string;
|
|
127
|
-
[key: string]: unknown;
|
|
128
|
-
};
|
|
129
|
-
requester?: unknown;
|
|
130
|
-
status?: string;
|
|
131
|
-
walletId?: string;
|
|
132
|
-
[key: string]: unknown;
|
|
96
|
+
status: string;
|
|
97
|
+
challenge?: unknown;
|
|
98
|
+
signature?: number[];
|
|
133
99
|
};
|
|
134
100
|
}
|
|
135
101
|
interface HealthCheckResponse {
|
|
@@ -139,9 +105,65 @@ interface HealthCheckResponse {
|
|
|
139
105
|
/**
|
|
140
106
|
* Types for WebAuthn provider abstraction
|
|
141
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
|
+
}
|
|
142
164
|
interface WebAuthnProvider {
|
|
143
|
-
create(challenge:
|
|
144
|
-
sign(challenge:
|
|
165
|
+
create(challenge: WebAuthnCreateChallenge): Promise<WebAuthnAttestation>;
|
|
166
|
+
sign(challenge: WebAuthnSignChallenge): Promise<WebAuthnAssertion>;
|
|
145
167
|
}
|
|
146
168
|
interface WebAuthnConfig {
|
|
147
169
|
relyingParty: {
|
|
@@ -339,6 +361,15 @@ interface WalletItem {
|
|
|
339
361
|
boundToEvmNetwork?: boolean;
|
|
340
362
|
[key: string]: unknown;
|
|
341
363
|
}
|
|
364
|
+
interface GetWalletResponse {
|
|
365
|
+
id: string;
|
|
366
|
+
signingKey: {
|
|
367
|
+
publicKey: string;
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
type WalletMetadata = GetWalletResponse & {
|
|
371
|
+
boundToEvmNetwork: boolean;
|
|
372
|
+
};
|
|
342
373
|
|
|
343
374
|
/**
|
|
344
375
|
* Error codes for transaction signing operations
|
|
@@ -366,6 +397,43 @@ interface TransactionSigningError extends Error {
|
|
|
366
397
|
originalError?: unknown;
|
|
367
398
|
}
|
|
368
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
|
+
}
|
|
427
|
+
/**
|
|
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
|
|
432
|
+
*/
|
|
433
|
+
interface StatusCallback {
|
|
434
|
+
onStatusUpdate?: (status: SigningStatus, message: string, data?: StatusUpdateData) => void;
|
|
435
|
+
}
|
|
436
|
+
|
|
369
437
|
/**
|
|
370
438
|
* Central type definitions for the blockchain signer shared library
|
|
371
439
|
* Single source of truth for all type exports
|
|
@@ -400,7 +468,7 @@ declare class WalletService {
|
|
|
400
468
|
* @param signerToken - Signer JWT token
|
|
401
469
|
* @returns Promise resolving to wallet data
|
|
402
470
|
*/
|
|
403
|
-
static listWallets(signerToken: string): Promise<
|
|
471
|
+
static listWallets(signerToken: string): Promise<Wallet[]>;
|
|
404
472
|
}
|
|
405
473
|
|
|
406
474
|
/**
|
|
@@ -418,18 +486,12 @@ declare class PersService {
|
|
|
418
486
|
private static tenantCache;
|
|
419
487
|
private static currentProjectKey;
|
|
420
488
|
private static currentTenantId;
|
|
421
|
-
private static useStaging;
|
|
422
489
|
private static readonly TENANT_CACHE_TTL;
|
|
423
490
|
/**
|
|
424
491
|
* Configure the PERS API settings
|
|
425
492
|
* @param config - The configuration object
|
|
426
493
|
*/
|
|
427
494
|
static configure(config: Partial<PersApiConfig>): void;
|
|
428
|
-
/**
|
|
429
|
-
* Enable staging mode when project key is not available
|
|
430
|
-
* @param enableStaging Whether to use staging environment
|
|
431
|
-
*/
|
|
432
|
-
static setStagingMode(enableStaging: boolean): void;
|
|
433
495
|
/**
|
|
434
496
|
* Get current configuration
|
|
435
497
|
*/
|
|
@@ -440,21 +502,21 @@ declare class PersService {
|
|
|
440
502
|
* @param authToken - Optional auth token for authentication
|
|
441
503
|
* @returns Promise with tenant public information
|
|
442
504
|
*/
|
|
443
|
-
static getTenantById(tenantId: string, authToken
|
|
505
|
+
static getTenantById(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
444
506
|
/**
|
|
445
507
|
* Initialize tenant configuration from JWT
|
|
446
508
|
* @param tenantId - The tenant ID from JWT payload
|
|
447
509
|
* @param authToken - Optional auth token for authentication
|
|
448
510
|
* @returns Promise with tenant information
|
|
449
511
|
*/
|
|
450
|
-
static initializeTenant(tenantId: string, authToken
|
|
512
|
+
static initializeTenant(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
451
513
|
/**
|
|
452
514
|
* Ensure tenant is initialized and current, with automatic revalidation
|
|
453
515
|
* @param tenantId - The tenant ID to ensure is initialized
|
|
454
516
|
* @param authToken - Optional auth token for authentication
|
|
455
517
|
* @returns Promise with tenant information
|
|
456
518
|
*/
|
|
457
|
-
static ensureTenantInitialized(tenantId: string, authToken
|
|
519
|
+
static ensureTenantInitialized(tenantId: string, authToken: string): Promise<TenantPublicDTO>;
|
|
458
520
|
/**
|
|
459
521
|
* Get the current project key (either from tenant or fallback)
|
|
460
522
|
* @param tenantId - Optional tenant ID to ensure is initialized
|
|
@@ -468,7 +530,7 @@ declare class PersService {
|
|
|
468
530
|
/**
|
|
469
531
|
* Authenticates a user with the PERS backend using their auth token
|
|
470
532
|
*
|
|
471
|
-
* @param authToken - The authentication token received from
|
|
533
|
+
* @param authToken - The authentication token received from backend after login/registration
|
|
472
534
|
* @param tenantId - Optional tenant ID for automatic initialization
|
|
473
535
|
* @returns A promise that resolves to the authentication response
|
|
474
536
|
* @throws If the request fails
|
|
@@ -554,21 +616,11 @@ declare class SigningService {
|
|
|
554
616
|
signBatch(authToken: string, walletId: string, requests: SigningRequest[]): Promise<CompleteSignatureResponse['data'][]>;
|
|
555
617
|
}
|
|
556
618
|
|
|
557
|
-
interface GetWalletResponse {
|
|
558
|
-
id: string;
|
|
559
|
-
signingKey: {
|
|
560
|
-
publicKey: string;
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
|
|
564
619
|
type WalletOptions = {
|
|
565
620
|
wallet: WalletMetadata;
|
|
566
621
|
authToken: string;
|
|
567
622
|
signingService: SigningService;
|
|
568
623
|
};
|
|
569
|
-
type WalletMetadata = GetWalletResponse & {
|
|
570
|
-
boundToEvmNetwork: boolean;
|
|
571
|
-
};
|
|
572
624
|
declare class KeyWallet extends AbstractSigner {
|
|
573
625
|
private options;
|
|
574
626
|
private address?;
|
|
@@ -672,11 +724,9 @@ declare class TransactionErrorHandler {
|
|
|
672
724
|
error?: {
|
|
673
725
|
code?: string;
|
|
674
726
|
message?: string;
|
|
675
|
-
developerMessage?: string;
|
|
676
727
|
};
|
|
677
728
|
code?: string;
|
|
678
729
|
message?: string;
|
|
679
|
-
developerMessage?: string;
|
|
680
730
|
}, transactionId: string): never;
|
|
681
731
|
/**
|
|
682
732
|
* Process PERS API errors and handle TRANSACTION_NOT_PENDING cases
|
|
@@ -873,12 +923,14 @@ declare function getHttpClient(): HttpClient;
|
|
|
873
923
|
* @property {WebAuthnProvider} webAuthnProvider - WebAuthn provider for secure authentication
|
|
874
924
|
* @property {string} [apiUrl] - Custom API base URL (defaults to production)
|
|
875
925
|
* @property {string} [relyingPartyName] - WebAuthn relying party name for authentication
|
|
926
|
+
* @property {StatusCallback} [globalStatusCallback] - Optional global status callback for all operations
|
|
876
927
|
*/
|
|
877
928
|
interface ExtendedPersSignerConfig {
|
|
878
929
|
ethersProviderUrl?: string;
|
|
879
930
|
webAuthnProvider: WebAuthnProvider;
|
|
880
931
|
apiUrl?: string;
|
|
881
932
|
relyingPartyName?: string;
|
|
933
|
+
globalStatusCallback?: StatusCallback;
|
|
882
934
|
}
|
|
883
935
|
interface PersSignerConfig extends Omit<ExtendedPersSignerConfig, 'webAuthnProvider'> {
|
|
884
936
|
}
|
|
@@ -908,6 +960,11 @@ declare class PersSignerSDK {
|
|
|
908
960
|
* @throws {Error} If required configuration is missing
|
|
909
961
|
*/
|
|
910
962
|
constructor(config: ExtendedPersSignerConfig);
|
|
963
|
+
/**
|
|
964
|
+
* Helper method to trigger both global and method-specific status callbacks
|
|
965
|
+
* @private
|
|
966
|
+
*/
|
|
967
|
+
private triggerStatusUpdate;
|
|
911
968
|
/**
|
|
912
969
|
* Authenticate user and cache session for 5 minutes
|
|
913
970
|
*
|
|
@@ -915,20 +972,23 @@ declare class PersSignerSDK {
|
|
|
915
972
|
* and caches the authenticated user session to avoid repeated authentication.
|
|
916
973
|
*
|
|
917
974
|
* @param {string} jwtToken - JWT token containing user identifier and tenant info
|
|
975
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
918
976
|
* @returns {Promise<AuthenticatedUser>} Authenticated user with access tokens
|
|
919
977
|
* @throws {Error} If JWT is invalid, expired, or authentication fails
|
|
920
978
|
*
|
|
921
979
|
* @example
|
|
922
980
|
* ```typescript
|
|
923
981
|
* try {
|
|
924
|
-
* const user = await sdk.loginUser(jwtToken
|
|
982
|
+
* const user = await sdk.loginUser(jwtToken, {
|
|
983
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
984
|
+
* });
|
|
925
985
|
* console.log('Authenticated:', user.identifier);
|
|
926
986
|
* } catch (error) {
|
|
927
987
|
* console.error('Authentication failed:', error.message);
|
|
928
988
|
* }
|
|
929
989
|
* ```
|
|
930
990
|
*/
|
|
931
|
-
loginUser(jwtToken: string): Promise<AuthenticatedUser>;
|
|
991
|
+
loginUser(jwtToken: string, statusCallback?: StatusCallback): Promise<AuthenticatedUser>;
|
|
932
992
|
/**
|
|
933
993
|
* Sign a PERS transaction (legacy compatibility method)
|
|
934
994
|
*
|
|
@@ -937,13 +997,16 @@ declare class PersSignerSDK {
|
|
|
937
997
|
* maintained for backward compatibility.
|
|
938
998
|
*
|
|
939
999
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1000
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
940
1001
|
* @returns {Promise<TransactionSigningResult>} Signing result with signature and metadata
|
|
941
1002
|
* @throws {Error} If authentication fails, transaction ID missing, or signing fails
|
|
942
1003
|
*
|
|
943
1004
|
* @example
|
|
944
1005
|
* ```typescript
|
|
945
1006
|
* try {
|
|
946
|
-
* const result = await sdk.signPersTransaction(jwtToken
|
|
1007
|
+
* const result = await sdk.signPersTransaction(jwtToken, {
|
|
1008
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1009
|
+
* });
|
|
947
1010
|
* if (result.success) {
|
|
948
1011
|
* console.log('Transaction signed:', result.signature);
|
|
949
1012
|
* }
|
|
@@ -952,7 +1015,7 @@ declare class PersSignerSDK {
|
|
|
952
1015
|
* }
|
|
953
1016
|
* ```
|
|
954
1017
|
*/
|
|
955
|
-
signPersTransaction(jwtToken: string): Promise<TransactionSigningResult>;
|
|
1018
|
+
signPersTransaction(jwtToken: string, statusCallback?: StatusCallback): Promise<TransactionSigningResult>;
|
|
956
1019
|
/**
|
|
957
1020
|
* Sign a transaction with provided signing data
|
|
958
1021
|
*
|
|
@@ -961,17 +1024,20 @@ declare class PersSignerSDK {
|
|
|
961
1024
|
*
|
|
962
1025
|
* @param {CounterfactualWalletTransactionResponse | LegacyTransaction} signingData - Transaction data to sign
|
|
963
1026
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1027
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
964
1028
|
* @returns {Promise<TransactionSigningResult>} Signing result with signature and metadata
|
|
965
1029
|
* @throws {Error} If authentication fails, transaction ID missing, or signing fails
|
|
966
1030
|
*
|
|
967
1031
|
* @example
|
|
968
1032
|
* ```typescript
|
|
969
1033
|
* const signingData = await getTransactionData(transactionId);
|
|
970
|
-
* const result = await sdk.signTransaction(signingData, jwtToken
|
|
1034
|
+
* const result = await sdk.signTransaction(signingData, jwtToken, {
|
|
1035
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1036
|
+
* });
|
|
971
1037
|
* console.log('Signed transaction:', result.signature);
|
|
972
1038
|
* ```
|
|
973
1039
|
*/
|
|
974
|
-
signTransaction(signingData: CounterfactualWalletTransactionResponse$1 | LegacyTransaction, jwtToken: string): Promise<TransactionSigningResult>;
|
|
1040
|
+
signTransaction(signingData: CounterfactualWalletTransactionResponse$1 | LegacyTransaction, jwtToken: string, statusCallback?: StatusCallback): Promise<TransactionSigningResult>;
|
|
975
1041
|
/**
|
|
976
1042
|
* Complete transaction flow: sign and submit in one call
|
|
977
1043
|
*
|
|
@@ -980,13 +1046,18 @@ declare class PersSignerSDK {
|
|
|
980
1046
|
* transaction lifecycle automatically.
|
|
981
1047
|
*
|
|
982
1048
|
* @param {string} jwtToken - JWT token containing transaction ID and user info
|
|
1049
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
983
1050
|
* @returns {Promise<SubmissionResult>} Submission result with transaction hash and status
|
|
984
1051
|
* @throws {Error} If authentication, signing, or submission fails
|
|
985
1052
|
*
|
|
986
1053
|
* @example
|
|
987
1054
|
* ```typescript
|
|
988
1055
|
* try {
|
|
989
|
-
* 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
|
+
* });
|
|
990
1061
|
* if (result.success) {
|
|
991
1062
|
* console.log('Transaction completed:', result.transactionHash);
|
|
992
1063
|
* if (result.shouldRedirect) {
|
|
@@ -998,7 +1069,7 @@ declare class PersSignerSDK {
|
|
|
998
1069
|
* }
|
|
999
1070
|
* ```
|
|
1000
1071
|
*/
|
|
1001
|
-
signAndSubmitPersTransaction(jwtToken: string): Promise<SubmissionResult>;
|
|
1072
|
+
signAndSubmitPersTransaction(jwtToken: string, statusCallback?: StatusCallback): Promise<SubmissionResult>;
|
|
1002
1073
|
/**
|
|
1003
1074
|
* Submit a signed transaction to the blockchain
|
|
1004
1075
|
*
|
|
@@ -1008,17 +1079,20 @@ declare class PersSignerSDK {
|
|
|
1008
1079
|
*
|
|
1009
1080
|
* @param {TransactionSigningResult} signingResult - Result from a successful transaction signing
|
|
1010
1081
|
* @param {string} jwtToken - JWT token containing tenant and user info
|
|
1082
|
+
* @param {StatusCallback} [statusCallback] - Optional callback for status updates
|
|
1011
1083
|
* @returns {Promise<SubmissionResult>} Submission result with transaction hash and status
|
|
1012
1084
|
* @throws {Error} If signing result is invalid, JWT is missing tenantId, or submission fails
|
|
1013
1085
|
*
|
|
1014
1086
|
* @example
|
|
1015
1087
|
* ```typescript
|
|
1016
1088
|
* const signedTx = await sdk.signPersTransaction(jwtToken);
|
|
1017
|
-
* const result = await sdk.submitTransaction(signedTx, jwtToken
|
|
1089
|
+
* const result = await sdk.submitTransaction(signedTx, jwtToken, {
|
|
1090
|
+
* onStatusUpdate: (status, message) => console.log(`${status}: ${message}`)
|
|
1091
|
+
* });
|
|
1018
1092
|
* console.log('Transaction submitted:', result.transactionHash);
|
|
1019
1093
|
* ```
|
|
1020
1094
|
*/
|
|
1021
|
-
submitTransaction(signingResult: TransactionSigningResult, jwtToken: string): Promise<SubmissionResult>;
|
|
1095
|
+
submitTransaction(signingResult: TransactionSigningResult, jwtToken: string, statusCallback?: StatusCallback): Promise<SubmissionResult>;
|
|
1022
1096
|
/**
|
|
1023
1097
|
* Clear user authentication cache
|
|
1024
1098
|
*
|
|
@@ -1066,7 +1140,6 @@ declare function createPersSignerSDK(config: ExtendedPersSignerConfig): PersSign
|
|
|
1066
1140
|
*/
|
|
1067
1141
|
declare class AuthenticationService {
|
|
1068
1142
|
private signerToken;
|
|
1069
|
-
private config;
|
|
1070
1143
|
private webAuthnProvider;
|
|
1071
1144
|
constructor(config: ExtendedPersSignerConfig);
|
|
1072
1145
|
/**
|
|
@@ -1082,11 +1155,11 @@ declare class AuthenticationService {
|
|
|
1082
1155
|
*/
|
|
1083
1156
|
verifyToken(token: string): Promise<VerifyTokenResponse>;
|
|
1084
1157
|
/**
|
|
1085
|
-
*
|
|
1086
|
-
* @param persToken - PERS JWT token
|
|
1087
|
-
* @returns Promise resolving to
|
|
1158
|
+
* Register user with unified flow
|
|
1159
|
+
* @param persToken - PERS JWT token
|
|
1160
|
+
* @returns Promise resolving to authenticated user data
|
|
1088
1161
|
*/
|
|
1089
|
-
|
|
1162
|
+
registerUser(persToken: string): Promise<JWTLoginResponse>;
|
|
1090
1163
|
/**
|
|
1091
1164
|
* Get current signer token
|
|
1092
1165
|
* @returns The current signer JWT token
|
|
@@ -1097,14 +1170,6 @@ declare class AuthenticationService {
|
|
|
1097
1170
|
* @param token - Signer JWT token
|
|
1098
1171
|
*/
|
|
1099
1172
|
setSignerToken(token: string): void;
|
|
1100
|
-
/**
|
|
1101
|
-
* Complete registration with WebAuthn challenge data (v1 API format)
|
|
1102
|
-
* @param tmpAuthToken - Temporary auth token from init registration (temporaryAuthenticationToken)
|
|
1103
|
-
* @param signedChallenge - WebAuthn credential response (will be restructured for backend)
|
|
1104
|
-
* @param persToken - PERS JWT token (authToken)
|
|
1105
|
-
* @returns Promise resolving to registration result
|
|
1106
|
-
*/
|
|
1107
|
-
completeRegistrationWithChallenge(tmpAuthToken: string | null, signedChallenge: any, persToken: string): Promise<JWTLoginResponse | unknown>;
|
|
1108
1173
|
/**
|
|
1109
1174
|
* Combined authentication flow - handles both login and registration
|
|
1110
1175
|
* @param identifier - User identifier (email/userId)
|
|
@@ -1129,7 +1194,8 @@ declare class HealthService {
|
|
|
1129
1194
|
}
|
|
1130
1195
|
|
|
1131
1196
|
/**
|
|
1132
|
-
* Browser-specific WebAuthn provider using
|
|
1197
|
+
* Browser-specific WebAuthn provider using native browser APIs
|
|
1198
|
+
* Fully agnostic implementation without external SDK dependencies
|
|
1133
1199
|
*/
|
|
1134
1200
|
|
|
1135
1201
|
/**
|
|
@@ -1138,7 +1204,8 @@ declare class HealthService {
|
|
|
1138
1204
|
declare function getBrowserWebAuthnProvider(): Promise<WebAuthnProvider>;
|
|
1139
1205
|
|
|
1140
1206
|
/**
|
|
1141
|
-
* React Native-specific WebAuthn provider using
|
|
1207
|
+
* React Native-specific WebAuthn provider using react-native-passkey
|
|
1208
|
+
* Fully agnostic implementation without external SDK dependencies
|
|
1142
1209
|
* Falls back to browser implementation for React Native Web (Expo Web)
|
|
1143
1210
|
*/
|
|
1144
1211
|
|
|
@@ -1153,6 +1220,7 @@ declare function getReactNativeWebAuthnProvider(): Promise<WebAuthnProvider>;
|
|
|
1153
1220
|
* Browser-compatible JWT handling without external dependencies
|
|
1154
1221
|
*/
|
|
1155
1222
|
interface JWTPayload {
|
|
1223
|
+
iss?: string;
|
|
1156
1224
|
email?: string;
|
|
1157
1225
|
identifierEmail?: string;
|
|
1158
1226
|
userId?: string;
|
|
@@ -1225,5 +1293,5 @@ declare class UserCache {
|
|
|
1225
1293
|
static cleanup(): number;
|
|
1226
1294
|
}
|
|
1227
1295
|
|
|
1228
|
-
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 };
|
|
1229
|
-
export type { AuthResponse, AuthenticatedUser, CombinedTransactionStatus,
|
|
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 };
|