1.0.2 • Published 1 year ago

@exodus/deferring-storage v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@exodus/deferring-storage

Usage

Wraps a storage to defers access besides clearing or deleting until it is released. Can be used to replicate the behavior of the encrypted storage in platforms that don't use the encrypted storage.

// adapters.js

const createUnlockableStorage = (storage) => {
  const deferringStorage = createDeferringStorage(storage)
  return {
    ...deferringStorage,
    unlock: () => deferringStorage.release(),
  }
}

const createAdapters = () => {
  const storage = createUnlockableStorage(storage)
  const migrateableStorage = createUnlockableStorage(storage)

  return {
    storage,
    migrateableStorage,
  }
}
1.0.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago