@explorins/pers-signer 1.0.17 → 1.0.18

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/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _explorins_web3_ts_types from '@explorins/web3-ts/types';
2
- import { AnyTransactionData, LegacyTransaction } from '@explorins/web3-ts/types';
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 { TenantPublicDTO, SessionAuthContextResponseDTO, TransactionFormat, TransactionRequestResponseDTO, TransactionStatus, CounterfactualWalletTransactionResponse } from '@explorins/pers-shared/browser';
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
 
@@ -47,6 +47,9 @@ interface WrappedProviderResponse {
47
47
  data: unknown;
48
48
  }
49
49
  type LoginResponse = JWTLoginResponse | WrappedProviderResponse;
50
+ interface VerifyTokenRequest {
51
+ token: string;
52
+ }
50
53
  interface VerifyTokenResponse {
51
54
  valid: boolean;
52
55
  provider: string;
@@ -64,6 +67,19 @@ interface VerifyTokenResponse {
64
67
  };
65
68
  tenantId: string;
66
69
  }
70
+ interface InitRegistrationRequest {
71
+ authToken: string;
72
+ }
73
+ interface InitRegistrationResponse {
74
+ success: true;
75
+ data: {
76
+ challenge?: string;
77
+ temporaryAuthenticationToken?: string;
78
+ user?: object;
79
+ [key: string]: unknown;
80
+ };
81
+ }
82
+ type CompleteRegistrationResponse = JWTLoginResponse | WrappedProviderResponse;
67
83
  interface ListWalletsRequest {
68
84
  }
69
85
  interface ListWalletsResponse {
@@ -73,6 +89,23 @@ interface ListWalletsResponse {
73
89
  [key: string]: unknown;
74
90
  };
75
91
  }
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
+ }
76
109
  interface CompleteSignatureResponse {
77
110
  success: true;
78
111
  data: {
@@ -119,27 +152,233 @@ interface WebAuthnConfig {
119
152
  }
120
153
 
121
154
  /**
122
- * Shared type definitions for the blockchain signer shared library
155
+ * Key service response types and interfaces
156
+ */
157
+ /**
158
+ * Signature response from key signing operations
159
+ */
160
+ interface SignResponse {
161
+ id: string;
162
+ keyId: string;
163
+ requester: {
164
+ userId: string;
165
+ appId: string;
166
+ };
167
+ requestBody: {
168
+ hash: string;
169
+ kind: "Hash";
170
+ };
171
+ status: "Signed";
172
+ signature: {
173
+ r: string;
174
+ s: string;
175
+ v: number;
176
+ encoded: string;
177
+ };
178
+ network: "KeyECDSA";
179
+ dateRequested: string;
180
+ dateSigned: string;
181
+ walletId: string;
182
+ }
183
+ /**
184
+ * Authentication response from login/register operations
185
+ */
186
+ interface AuthResponse {
187
+ token: string;
188
+ message?: string;
189
+ status?: number;
190
+ }
191
+ /**
192
+ * Registration challenge response
193
+ */
194
+ interface RegistrationChallenge {
195
+ temporaryAuthenticationToken: string;
196
+ challenge: any;
197
+ status?: number;
198
+ message?: string;
199
+ }
200
+ /**
201
+ * Registration completion response
202
+ */
203
+ interface RegistrationResult {
204
+ token: string;
205
+ walletId?: string;
206
+ status?: number;
207
+ message?: string;
208
+ }
209
+ /**
210
+ * Individual wallet item
211
+ */
212
+ /**
213
+ * Hash signing request
214
+ */
215
+ interface HashSigningRequest {
216
+ kind: "Hash";
217
+ hash: string;
218
+ }
219
+ /**
220
+ * EIP-712 typed data signing request
221
+ */
222
+ interface TypedDataSigningRequest {
223
+ blockchainKind: "Evm";
224
+ kind: "Eip712";
225
+ types: Record<string, any[]>;
226
+ domain: any;
227
+ message: Record<string, any>;
228
+ }
229
+ /**
230
+ * Generic signing request
231
+ */
232
+ type SigningRequest = HashSigningRequest | TypedDataSigningRequest;
233
+ /**
234
+ * Signing challenge response
235
+ */
236
+ interface SigningChallenge {
237
+ requestBody: any;
238
+ challenge: {
239
+ challengeIdentifier: string;
240
+ [key: string]: any;
241
+ };
242
+ status?: number;
243
+ message?: string;
244
+ }
245
+ /**
246
+ * User credentials for authentication
247
+ */
248
+ interface UserCredentials {
249
+ username: string;
250
+ appId?: string;
251
+ }
252
+ /**
253
+ * Relying party configuration for WebAuthn
123
254
  */
255
+ interface RelyingPartyConfig {
256
+ id: string;
257
+ name: string;
258
+ origin?: string;
259
+ }
124
260
 
125
261
  /**
126
- * Authentication types for 3-function split architecture
262
+ * Combined transaction status type that includes both PERS and additional statuses
127
263
  */
128
- interface AuthenticatedUser {
129
- identifier: string;
264
+ type CombinedTransactionStatus = TransactionStatus;
265
+ /**
266
+ * Transaction statuses that allow signing
267
+ */
268
+ declare const SIGNABLE_STATUSES: readonly [TransactionStatus.PENDING_SIGNATURE, TransactionStatus.CREATED];
269
+ /**
270
+ * Transaction status information for UI display
271
+ */
272
+ interface TransactionStatusInfo {
273
+ transactionId: string;
274
+ transactionStatus: CombinedTransactionStatus;
275
+ message: string;
276
+ }
277
+ /**
278
+ * Transaction signing result
279
+ */
280
+ interface TransactionSigningResult {
281
+ success: boolean;
282
+ transactionId: string;
283
+ signature?: string;
284
+ signingData?: CounterfactualWalletTransactionResponse | LegacyTransaction;
285
+ error?: string;
286
+ statusInfo?: TransactionStatusInfo;
287
+ shouldShowStatus?: boolean;
288
+ }
289
+ /**
290
+ * Transaction submission result for internal processing
291
+ */
292
+ interface SubmissionResult {
293
+ submitResult: TransactionRequestResponseDTO;
294
+ shouldRedirect: boolean;
295
+ redirectUrl?: string;
296
+ transactionHash: string | null;
297
+ success: boolean;
298
+ error?: string;
299
+ }
300
+ /**
301
+ * Metadata for transaction parameters - string values only
302
+ */
303
+ /**
304
+ * Authentication tokens required for transaction signing
305
+ */
306
+ interface SigningAuthTokens {
130
307
  signerAuthToken: string;
131
308
  persAccessToken: string;
309
+ }
310
+ /**
311
+ * Transaction signing parameters
312
+ */
313
+ interface TransactionSigningParams {
314
+ transactionId: string;
132
315
  tenantId: string;
133
- expiresAt: number;
316
+ authTokens: SigningAuthTokens;
317
+ ethersProviderUrl: string;
318
+ returnUrl?: string;
134
319
  }
320
+
135
321
  /**
136
- * Service configuration options
322
+ * Wallet list response from WalletService
137
323
  */
138
- interface ServiceConfig {
139
- apiUrl: string;
140
- environment: 'development' | 'staging' | 'production';
141
- timeout?: number;
142
- retryAttempts?: number;
324
+ interface WalletListResponse {
325
+ items: WalletItem[];
326
+ }
327
+ /**
328
+ * Individual wallet item from wallet list - compatible with KeyWallet constructor
329
+ */
330
+ interface WalletItem {
331
+ id: string;
332
+ address: string;
333
+ network: string;
334
+ status: string;
335
+ signingKey?: unknown;
336
+ dateCreated?: string;
337
+ custodial?: boolean;
338
+ tags?: string[];
339
+ boundToEvmNetwork?: boolean;
340
+ [key: string]: unknown;
341
+ }
342
+
343
+ /**
344
+ * Error codes for transaction signing operations
345
+ */
346
+ declare enum TransactionSigningErrorCode {
347
+ INVALID_TOKENS = "INVALID_TOKENS",
348
+ TRANSACTION_NOT_FOUND = "TRANSACTION_NOT_FOUND",
349
+ TRANSACTION_NOT_PENDING = "TRANSACTION_NOT_PENDING",
350
+ WALLET_NOT_AVAILABLE = "WALLET_NOT_AVAILABLE",
351
+ WEBAUTHN_OPERATION_IN_PROGRESS = "WEBAUTHN_OPERATION_IN_PROGRESS",
352
+ SIGNING_CANCELLED = "SIGNING_CANCELLED",
353
+ PERS_AUTH_FAILED = "PERS_AUTH_FAILED",
354
+ AUTH_FAILED = "AUTH_FAILED",
355
+ TRANSACTION_NOT_READY = "TRANSACTION_NOT_READY",
356
+ SUBMISSION_FAILED = "SUBMISSION_FAILED",
357
+ SERVER_ERROR = "SERVER_ERROR",
358
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
359
+ }
360
+ /**
361
+ * Structured error for transaction signing operations
362
+ */
363
+ interface TransactionSigningError extends Error {
364
+ code: TransactionSigningErrorCode;
365
+ transactionId?: string;
366
+ originalError?: unknown;
367
+ }
368
+
369
+ /**
370
+ * Central type definitions for the blockchain signer shared library
371
+ * Single source of truth for all type exports
372
+ */
373
+
374
+ /**
375
+ * Authentication types for 3-function split architecture
376
+ */
377
+ interface AuthenticatedUser {
378
+ identifier: string;
379
+ signerAuthToken: string;
380
+ persAccessToken: string;
381
+ expiresAt: number;
143
382
  }
144
383
  /**
145
384
  * Error types for service operations
@@ -271,113 +510,6 @@ declare class PersService {
271
510
  static getTransactionDataForSigning(transactionResponse: TransactionRequestResponseDTO): _explorins_pers_shared_browser.CounterfactualWalletTransactionResponse | _explorins_web3_ts_types.LegacyTransaction;
272
511
  }
273
512
 
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
513
  /**
382
514
  * Signing service for cryptographic operations
383
515
  * Handles hash signing and typed data signing with WebAuthn
@@ -459,66 +591,6 @@ declare class KeyWallet extends AbstractSigner {
459
591
  signPersTransaction(transactionData: AnyTransactionData): Promise<string>;
460
592
  }
461
593
 
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
594
  /**
523
595
  * Service for orchestrating transaction signing operations
524
596
  * Handles the complete flow from transaction preparation to submission
@@ -554,32 +626,6 @@ declare class TransactionSigningService {
554
626
  signTransaction(params: TransactionSigningParams, signingData: CounterfactualWalletTransactionResponse | LegacyTransaction): Promise<TransactionSigningResult>;
555
627
  }
556
628
 
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
629
  /**
584
630
  * Handles all error-related operations for transaction signing
585
631
  */
@@ -789,28 +835,6 @@ declare function setHttpClient(client: HttpClient): void;
789
835
  */
790
836
  declare function getHttpClient(): HttpClient;
791
837
 
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
838
  /**
815
839
  * PERS Blockchain Signer SDK
816
840
  *
@@ -1035,14 +1059,6 @@ declare class PersSignerSDK {
1035
1059
  */
1036
1060
  declare function createPersSignerSDK(config: ExtendedPersSignerConfig): PersSignerSDK;
1037
1061
 
1038
- /**
1039
- * Authenticated user with all required tokens
1040
- */
1041
- interface SignerAuthenticatedUser {
1042
- identifier: string;
1043
- signerAuthToken: string;
1044
- persAccessToken: string;
1045
- }
1046
1062
  /**
1047
1063
  * Authentication service for user login and registration
1048
1064
  * Uses constructor-based dependency injection for WebAuthn provider
@@ -1097,7 +1113,7 @@ declare class AuthenticationService {
1097
1113
  * @param relyingPartyConfig - Configuration for WebAuthn relying party
1098
1114
  * @returns Promise resolving to authenticated user with signer token
1099
1115
  */
1100
- combinedAuthentication(identifier: string, persAccessToken: string): Promise<SignerAuthenticatedUser>;
1116
+ combinedAuthentication(identifier: string, persAccessToken: string): Promise<AuthenticatedUser>;
1101
1117
  }
1102
1118
 
1103
1119
  /**
@@ -1210,4 +1226,4 @@ declare class UserCache {
1210
1226
  }
1211
1227
 
1212
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 };
1213
- export type { AuthResponse, AuthenticatedUser, CombinedTransactionStatus, ConfigProvider, HashSigningRequest, HttpClient, HttpRequestOptions, HttpResponse, JWTExtractionResult, JWTPayload, ListWalletsRequest, ListWalletsResponse, LoginRequest, LoginResponse, PersSignerConfig, RegistrationChallenge, RegistrationResult, RelyingPartyConfig, ServiceConfig, ServiceError, SignResponse, SignerApiError, SignerApiResponse, SigningAuthTokens, SigningChallenge, SigningRequest, SubmissionResult, TransactionSigningError, TransactionSigningParams, TransactionSigningResult, TransactionStatusInfo, TypedDataSigningRequest, UserCredentials, WalletItem, WalletListResponse, WebAuthnConfig, WebAuthnProvider };
1229
+ export type { AuthResponse, AuthenticatedUser, CombinedTransactionStatus, CompleteRegistrationResponse, CompleteSignatureRequest, CompleteSignatureResponse, ConfigProvider, HashSigningRequest, HealthCheckResponse, HttpClient, HttpRequestOptions, HttpResponse, InitRegistrationRequest, InitRegistrationResponse, InitSignatureRequest, InitSignatureResponse, JWTExtractionResult, JWTPayload, ListWalletsRequest, ListWalletsResponse, LoginRequest, LoginResponse, PersSignerConfig, RegistrationChallenge, RegistrationResult, RelyingPartyConfig, ServiceError, SignResponse, SignerApiError, SignerApiResponse, SigningAuthTokens, SigningChallenge, SigningRequest, SubmissionResult, TransactionSigningError, TransactionSigningParams, TransactionSigningResult, TransactionStatusInfo, TypedDataSigningRequest, UserCredentials, VerifyTokenRequest, VerifyTokenResponse, WalletItem, WalletListResponse, WebAuthnConfig, WebAuthnProvider };