@explorins/pers-signer 1.0.8 → 1.0.11

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.d.ts CHANGED
@@ -81,14 +81,6 @@ declare class PersService {
81
81
  * @returns The project key to use for API calls
82
82
  */
83
83
  private static getProjectKey;
84
- /**
85
- * Get cached tenant data (platform-agnostic)
86
- */
87
- private static getTenantFromStorage;
88
- /**
89
- * Store tenant data (platform-agnostic)
90
- */
91
- private static storeTenantInStorage;
92
84
  /**
93
85
  * Clear tenant cache and reset project key
94
86
  */
@@ -309,18 +309,6 @@ class PersService {
309
309
  if (cached) {
310
310
  return cached;
311
311
  }
312
- // Check storage cache (if available)
313
- const storedTenant = this.getTenantFromStorage(tenantId);
314
- if (storedTenant) {
315
- // Restore to memory cache
316
- this.tenantCache.set(tenantId, storedTenant);
317
- // Update current project key
318
- const projectKey = storedTenant.projectApiKey || storedTenant.projectKey || storedTenant.apiKey;
319
- if (projectKey) {
320
- this.currentProjectKey = projectKey;
321
- }
322
- return storedTenant;
323
- }
324
312
  try {
325
313
  const headers = {
326
314
  'accept': 'application/json',
@@ -357,9 +345,8 @@ class PersService {
357
345
  }
358
346
  }
359
347
  const tenantData = await response.json();
360
- // Cache the tenant data
348
+ // Cache the tenant data in memory only
361
349
  this.tenantCache.set(tenantId, tenantData);
362
- this.storeTenantInStorage(tenantId, tenantData);
363
350
  // Update current project key (check multiple possible property names)
364
351
  this.currentProjectKey = tenantData.projectKey || tenantData.projectApiKey || tenantData.apiKey;
365
352
  return tenantData;
@@ -378,7 +365,7 @@ class PersService {
378
365
  static async initializeTenant(tenantId, authToken) {
379
366
  const tenantData = await this.getTenantById(tenantId, authToken);
380
367
  // Update service configuration with tenant's project key
381
- const projectKey = tenantData.projectApiKey || tenantData.projectKey || tenantData.apiKey;
368
+ const projectKey = tenantData.projectApiKey;
382
369
  if (projectKey) {
383
370
  this.currentProjectKey = projectKey;
384
371
  }
@@ -398,56 +385,12 @@ class PersService {
398
385
  console.error('No project key available. Current tenant cache:', Array.from(this.tenantCache.keys()));
399
386
  throw new Error('No project key available. Please initialize tenant or configure project key.');
400
387
  }
401
- /**
402
- * Get cached tenant data (platform-agnostic)
403
- */
404
- static getTenantFromStorage(tenantId) {
405
- try {
406
- // Only use localStorage if available (web environment)
407
- if (typeof localStorage !== 'undefined') {
408
- const cached = localStorage.getItem(`tenant_${tenantId}`);
409
- if (cached) {
410
- const tenantData = JSON.parse(cached);
411
- return tenantData;
412
- }
413
- }
414
- }
415
- catch (error) {
416
- console.warn('Failed to parse cached tenant data:', error);
417
- }
418
- return null;
419
- }
420
- /**
421
- * Store tenant data (platform-agnostic)
422
- */
423
- static storeTenantInStorage(tenantId, tenantData) {
424
- try {
425
- // Only use localStorage if available (web environment)
426
- if (typeof localStorage !== 'undefined') {
427
- localStorage.setItem(`tenant_${tenantId}`, JSON.stringify(tenantData));
428
- }
429
- }
430
- catch (error) {
431
- // Silent fail for storage issues
432
- }
433
- }
434
388
  /**
435
389
  * Clear tenant cache and reset project key
436
390
  */
437
391
  static clearTenantCache() {
438
392
  this.tenantCache.clear();
439
393
  this.currentProjectKey = null;
440
- // Clear from cache as well (platform-agnostic)
441
- const keysToRemove = [];
442
- if (typeof localStorage !== 'undefined') {
443
- for (let i = 0; i < localStorage.length; i++) {
444
- const key = localStorage.key(i);
445
- if (key?.startsWith('tenant_')) {
446
- keysToRemove.push(key);
447
- }
448
- }
449
- }
450
- keysToRemove.forEach(key => localStorage.removeItem(key));
451
394
  }
452
395
  /**
453
396
  * Authenticates a user with the PERS backend using their auth token
@@ -1351,9 +1294,8 @@ class TransactionSigningService {
1351
1294
  // Validate transaction status is signable
1352
1295
  const isSignable = SIGNABLE_STATUSES.some(status => status === transactionStatus);
1353
1296
  if (!isSignable) {
1354
- // Create and store status info for UI using TransactionErrorHandler
1297
+ // Create status info for UI using TransactionErrorHandler
1355
1298
  const statusInfo = TransactionErrorHandler.createStatusInfo(transactionId, transactionStatus);
1356
- localStorage.setItem('transaction_status', JSON.stringify(statusInfo));
1357
1299
  throw { shouldShowStatus: true, statusInfo };
1358
1300
  }
1359
1301
  // Authenticate with PERS using backend signer token to set up signing account
@@ -1363,7 +1305,6 @@ class TransactionSigningService {
1363
1305
  // Update PERS access token with the new one that has signing account linked
1364
1306
  const newPersAccessToken = persSignerAuth.accessToken;
1365
1307
  if (newPersAccessToken) {
1366
- localStorage.setItem('pers_access_token', newPersAccessToken);
1367
1308
  updatedPersAccessToken = newPersAccessToken;
1368
1309
  }
1369
1310
  }
@@ -1388,12 +1329,7 @@ class TransactionSigningService {
1388
1329
  * Validate and prepare wallet for signing
1389
1330
  */
1390
1331
  async prepareWallet(authTokens, ethersProviderUrl) {
1391
- // Check if wallet registration previously failed
1392
- const walletRegistrationFailed = localStorage.getItem('wallet_registration_failed') === 'true';
1393
- if (walletRegistrationFailed) {
1394
- const errorDetails = localStorage.getItem('wallet_error_details') || 'Unknown wallet error';
1395
- throw TransactionErrorHandler.createError(TransactionSigningErrorCode.WALLET_NOT_AVAILABLE, `Wallet not available for transaction signing. Registration failed: ${errorDetails}. Please refresh the page and complete wallet setup.`);
1396
- }
1332
+ // Wallet validation will be handled through API responses - no localStorage needed
1397
1333
  let walletData;
1398
1334
  try {
1399
1335
  walletData = await WalletService.listWallets(authTokens.backendAuthToken);