@unicitylabs/sphere-sdk 0.1.6 → 0.1.7

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.
@@ -370,8 +370,15 @@ var IndexedDBTokenStorageProvider = class {
370
370
  }
371
371
  const tokens = await this.getAllFromStore(STORE_TOKENS);
372
372
  for (const token of tokens) {
373
- const key = `_${token.id}`;
374
- data[key] = token.data;
373
+ if (token.id.startsWith("token-") || token.id.startsWith("nametag-")) {
374
+ continue;
375
+ }
376
+ if (token.id.startsWith("archived-")) {
377
+ data[token.id] = token.data;
378
+ } else {
379
+ const key = `_${token.id}`;
380
+ data[key] = token.data;
381
+ }
375
382
  }
376
383
  const tombstones = await this.getFromStore(STORE_META, "tombstones");
377
384
  if (tombstones) {
@@ -426,10 +433,14 @@ var IndexedDBTokenStorageProvider = class {
426
433
  if (data._invalid) {
427
434
  await this.putToStore(STORE_META, "invalid", data._invalid);
428
435
  }
436
+ const reservedKeys = ["_meta", "_tombstones", "_outbox", "_sent", "_invalid"];
429
437
  for (const [key, value] of Object.entries(data)) {
430
- if (key.startsWith("_") && key !== "_meta" && key !== "_tombstones" && key !== "_outbox" && key !== "_sent" && key !== "_invalid") {
438
+ if (reservedKeys.includes(key)) continue;
439
+ if (key.startsWith("_")) {
431
440
  const tokenId = key.slice(1);
432
441
  await this.putToStore(STORE_TOKENS, tokenId, { id: tokenId, data: value });
442
+ } else if (key.startsWith("archived-")) {
443
+ await this.putToStore(STORE_TOKENS, key, { id: key, data: value });
433
444
  }
434
445
  }
435
446
  if (data._tombstones) {