{"_id":"@bryopsida/key-store","_rev":"4-3a48328ea61851d04aa7a16851331f44","name":"@bryopsida/key-store","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.1":{"name":"@bryopsida/key-store","version":"0.1.1","description":"A extendable TypeScript Node.JS library that provides a basic key store for data encryption keys","main":"lib/index.js","exports":"./lib/app.js","type":"module","engines":{"npm":">=8.0.0","node":">=18.0.0"},"scripts":{"prepack":"npm run build","build":"node_modules/typescript/bin/tsc --project ./","build:docs":"typedoc src/baseKeyStore.ts src/fileKeyStore.ts src/dataEncryption.ts","test":"NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage --testPathPattern='test/.*\\.spec\\.ts'","lint":"eslint --ext .ts src/ test/ && prettier --check .","lint:fix":"eslint --ext .ts src/ test/ --fix && prettier --write ."},"repository":{"type":"git","url":"git+https://github.com/bryopsida/key-store.git"},"keywords":["crypto","typescript","keystore","data-encryption-keys","node.js","minimal-dependencies"],"author":"","license":"Unlicense","bugs":{"url":"https://github.com/bryopsida/key-store/issues"},"homepage":"https://github.com/bryopsida/key-store#readme","devDependencies":{"@jest/globals":"29.4.1","@types/jest":"^29.0.0","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.15.0","@typescript-eslint/parser":"^5.15.0","eslint":"^8.30.0","eslint-config-prettier":"^8.5.0","eslint-plugin-github":"^4.6.0","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","eslint-plugin-standard":"^5.0.0","jest":"^29.0.0","prettier":"2.8.3","standard":"^17.0.0","ts-jest":"29.x","ts-node":"^10.7.0","typedoc":"^0.23.23","typescript":"^4.6.2"},"types":"./lib/index.d.ts","gitHead":"2fbf23404934462188651523a6e8f508853d2da6","_id":"@bryopsida/key-store@0.1.1","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-vMXF/iE3umdB0zaScsEOQCR0zl8p4gDq1KsQJRFbNHC41IQMJkaqJ1Qyr4JLzwnOMg8+k7ke7hiseWLqpaeRHA==","shasum":"260e73627a55962445f1523a08a087b9ccffefa5","tarball":"https://registry.npmjs.org/@bryopsida/key-store/-/key-store-0.1.1.tgz","fileCount":21,"unpackedSize":24503,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICBE9BFBPn4M/veqmHWK00iijpZuY/6UY6S6t0GNtH/rAiAzBql6MgThO+wbB49G8XMTe/ov35eaFG1ovx5a9fXROA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4BnlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqL2w/6Ajn6J0UMr1Lt0WYP4DrB1nJdfCcA2bdYYa11ax49dBgjXuoB\r\naB6ldyESqQeCppH0/juy61mBZLHUoqMgQPDZSXm5vfzMN9UFb/qP9RJ2QIUW\r\ndu843+O0MdTmurKbhGKGOJ3PvgoY8pihHoSQVRq5JW+Z0/7s7sCE/A0oLBzT\r\nNoTF2LNymY4ir8Tl/O3xM9+ub5PwG8JNLmx2ez5ttZYGkGSzNHOAF+Nvzpky\r\ny9rDME/B6JhDH6mHhVycwOtTBXQ4CAkF3CDBSYLPWk6IuZt2pv/NdMVyTFMt\r\nVUlc4UMX6Bmmr6iAE5u03vmcH/Z6R087dcCYLyz24S/noDEukEf2NbytGXMS\r\n+tYj+BWeutROk9gNINVqQTPjs33SbgYV47Vm1ufCWjrjUUDG3/tfSCj5bnBj\r\nkTjg+g5jqRJbEs6p7t1bNoyW2T5Hjh37S3zp5HgcR0WgrEbWu/xGtErjLGJT\r\nwz0G/Zop3a46o+SeolE+iVOGfwxzrM97GhRkeh51eO21juksOoyYhJ2ZQIoH\r\nvxwxJCrquCaToHDs0CIMHIyGo3e74UtpAIczBl2PoQ6zlXT+5X2zShIG9SiD\r\nFJCUOhdienlzqmlmaGOwVJ8P0ylCJWLv25+3WdTK8k70+tSahFJpq9PFhduJ\r\nDvTs07I5EKQPQ8EBH3hHD1UQnNTnOYRVfEs=\r\n=QADO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akboyd88","email":"akboyd88@gmail.com"},"directories":{},"maintainers":[{"name":"akboyd88","email":"akboyd88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/key-store_0.1.1_1675631077053_0.8354815008973642"},"_hasShrinkwrap":false},"0.1.2":{"name":"@bryopsida/key-store","version":"0.1.2","description":"A extendable TypeScript Node.JS library that provides a basic key store for data encryption keys","main":"lib/index.js","exports":"./lib/app.js","type":"module","engines":{"npm":">=8.0.0","node":">=18.0.0"},"scripts":{"prepack":"npm run build","build":"node_modules/typescript/bin/tsc --project ./","build:docs":"typedoc src/baseKeyStore.ts src/fileKeyStore.ts src/dataEncryption.ts","test":"NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage --testPathPattern='test/.*\\.spec\\.ts'","lint":"eslint --ext .ts src/ test/ && prettier --check .","lint:fix":"eslint --ext .ts src/ test/ --fix && prettier --write ."},"repository":{"type":"git","url":"git+https://github.com/bryopsida/key-store.git"},"keywords":["crypto","typescript","keystore","data-encryption-keys","node.js","minimal-dependencies"],"author":"","license":"Unlicense","bugs":{"url":"https://github.com/bryopsida/key-store/issues"},"homepage":"https://github.com/bryopsida/key-store#readme","devDependencies":{"@jest/globals":"29.4.1","@types/jest":"^29.0.0","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.15.0","@typescript-eslint/parser":"^5.15.0","eslint":"^8.30.0","eslint-config-prettier":"^8.5.0","eslint-plugin-github":"^4.6.0","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","eslint-plugin-standard":"^5.0.0","jest":"^29.0.0","prettier":"2.8.3","standard":"^17.0.0","ts-jest":"29.x","ts-node":"^10.7.0","typedoc":"^0.23.23","typescript":"^4.6.2"},"types":"./lib/index.d.ts","gitHead":"f7c882267692ea945863f013c5132f9da3e0a6f9","_id":"@bryopsida/key-store@0.1.2","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-/bC8Q7ApfL1tZaGmsdNilAw/dMv5BxolPInLsCIf7+YKKrYG7hnzJP6VkA65FQGbuQoY7vD6FxzbpNqHKTfVIQ==","shasum":"842121594e3634889d0a1b080d64c8f4555e6593","tarball":"https://registry.npmjs.org/@bryopsida/key-store/-/key-store-0.1.2.tgz","fileCount":21,"unpackedSize":24555,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF2TeQwRWVPw3cohq44cy1+KC730RIOT36SLd6vMXJXNAiEAnz/MZHkBUklt5lIpO3SFF2H55rSaHxT/UcG+8jMB8JY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4B2qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/iw//T0NeVrIkautbgU5zgqaf9OVh5b9fORHyuCWeqtHccsewxkni\r\ntozslERT9dhkkqtGRUNDWb3y2u7PDAt11EzqXy81cq43MXklcWvk/8QOWr0E\r\nQDgVX9pZtKDNZsH+ACzjj8WFlZlJCVcMM1TeJHzlThzgu1yCOqKJsepIP/Q3\r\nWq7l0V8KD1v6uKxiE9hlDbw0Ql3RZin9YrsP5A7BW05lvj87QlcJbLPxrzsE\r\nv0xr4ax+LbJST1n6FhzA/hFtL2f2g5VAFyB6kHdj/lK8UX7lVOwUdNxbwia7\r\nrEAqMyjtVtQZEgEneSlwguiJ+rJJ+u5Q8hbfjg6IE10ANLhPqpEoZ3e2dAaH\r\nW2yNdhFaF49hjRM0FIiak+8n27kMBUI1zIEQ4roehv4n/covxx++Z8LbKvcL\r\nJ23BDIisTsmD9I0pEinjrhfhWrWIrwAKd8hoPanVHcB+ABsTEbsbla4g7fUh\r\nwwE6fLk/3U0Rmv2uRtBhpWIJR8ptA+xW2/g5phz1TpOJkf7k5vCjdm3GD8Yh\r\nftvs5GYDeL6EHQc2CoxtoK9ATN4A5UsgxybeXrXK051jJU1GAc9KfAT40kBI\r\nXaGaJBOC1Ct6HJzsuTbKR8A3JRvYVN8KIzoNehtrAby2+8OmELA+qeps2r7W\r\nni4LLQOO3F/9waOO6FqS8AEHyZadbPkA5mA=\r\n=5qOM\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akboyd88","email":"akboyd88@gmail.com"},"directories":{},"maintainers":[{"name":"akboyd88","email":"akboyd88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/key-store_0.1.2_1675632042476_0.14996960860151654"},"_hasShrinkwrap":false},"0.1.3":{"name":"@bryopsida/key-store","version":"0.1.3","description":"A extendable TypeScript Node.JS library that provides a basic key store for data encryption keys","main":"lib/index.js","exports":"./lib/index.js","type":"module","engines":{"npm":">=8.0.0","node":">=18.0.0"},"scripts":{"prepack":"npm run build","build":"node_modules/typescript/bin/tsc --project ./","build:docs":"typedoc src/baseKeyStore.ts src/fileKeyStore.ts src/dataEncryption.ts","test":"NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage --testPathPattern='test/.*\\.spec\\.ts'","lint":"eslint --ext .ts src/ test/ && prettier --check .","lint:fix":"eslint --ext .ts src/ test/ --fix && prettier --write ."},"repository":{"type":"git","url":"git+https://github.com/bryopsida/key-store.git"},"keywords":["crypto","typescript","keystore","data-encryption-keys","node.js","minimal-dependencies"],"author":"","license":"Unlicense","bugs":{"url":"https://github.com/bryopsida/key-store/issues"},"homepage":"https://github.com/bryopsida/key-store#readme","devDependencies":{"@jest/globals":"29.4.1","@types/jest":"^29.0.0","@types/node":"^18.11.18","@typescript-eslint/eslint-plugin":"^5.15.0","@typescript-eslint/parser":"^5.15.0","eslint":"^8.30.0","eslint-config-prettier":"^8.5.0","eslint-plugin-github":"^4.6.0","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","eslint-plugin-standard":"^5.0.0","jest":"^29.0.0","prettier":"2.8.3","standard":"^17.0.0","ts-jest":"29.x","ts-node":"^10.7.0","typedoc":"^0.23.23","typescript":"^4.6.2"},"types":"./lib/index.d.ts","gitHead":"8e490f1ffd69fdfa3f0d4f13447f4bb4f6025d77","_id":"@bryopsida/key-store@0.1.3","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Y95KRNsNA0W2O4uXsKvj3LMmKnQmwYdSAh1j5bQ5YeYEKAZjD0uK08tYJgCZTSgsYClLsyda7Xi4alON1jRAhw==","shasum":"9dd11991731ace73f1f746fde6683d975adb8d11","tarball":"https://registry.npmjs.org/@bryopsida/key-store/-/key-store-0.1.3.tgz","fileCount":21,"unpackedSize":24557,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBsEw24CSLT2iejJG/ERxMBL5Ny8sCmasO+M+VIkEDjRAiAgRpn3+uIasAj1gn7DMehjidKbfRmEDqmUJcSu7rxTsg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4CGmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoG7g/+MKPI6PkEYLAPr07OQpxg3FjfG3ALo9oNe1Fou1SM13K7/+xQ\r\nDb6ysSx1lIQeSEd00vvHpiYfsSPfYYqSdiwgC3eVVCLjtWj1+dWbt42le6Vf\r\noWd/fP4ZWJ0LU61uOOP4QQGs0xAStguIhy72KHJcX5sXVvMYkFlIrRFq0rbL\r\nS7X/hl0+XEbOo2pkKqjC4xWKTjRQMIJ78AcRf8b5KWnoEgqBA6G/6XieLENm\r\nhDaWD2vVS9T6glNH1PanhXrAAHgyir+YDg1zfULFybgv5hE3o+FH/wgASHgn\r\n37YhzBo2OJGDkUmHsBEBdE4HQbdfM2OnFJn43aQG41FVJ4VDMSzoy/i6dbb+\r\nHM4KVb++Xu9T4Qw8hfmebOqKAVZZfbjzeh1nMSUqXgvxs4gg3v43fcc67fUD\r\neqd3SoUb+y7HM0VhuqOvRwYh4GRL4p5koRor3JbC7eeFfC/VZzzOxVeceA0Z\r\n1E+3IGDO4NX7/dRnr21WwIqJOFyvs291c4TRZiqVZyFn+AsG37PDV2CD+VmJ\r\nPsQ6P+0x9E9f5NjEZkffhHW4Yp3aq4Ph/x+rD3D/AvBntVangc5lfvdQTHqO\r\nTTIRZjdZ6S3Pc9QD7GPmtI3t5uDgrZbqIuaF0ugpiBMk5jjamGt+giDW2otU\r\ncUxCDd1iWF8wcOmCrqUKAejWF7QWuaf7t1Y=\r\n=zMc1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akboyd88","email":"akboyd88@gmail.com"},"directories":{},"maintainers":[{"name":"akboyd88","email":"akboyd88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/key-store_0.1.3_1675633062389_0.45836170086526384"},"_hasShrinkwrap":false},"0.1.4":{"name":"@bryopsida/key-store","version":"0.1.4","description":"A extendable TypeScript Node.JS library that provides a basic key store for data encryption keys","main":"lib/index.js","exports":"./lib/index.js","type":"module","engines":{"npm":">=8.0.0","node":">=18.0.0"},"scripts":{"prepack":"npm run build","build":"node_modules/typescript/bin/tsc --project ./","build:docs":"typedoc src/baseKeyStore.ts src/fileKeyStore.ts src/dataEncryption.ts","test":"NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --coverage --testPathPattern='test/.*\\.spec\\.ts'","lint":"eslint --ext .ts src/ test/ && prettier --check .","lint:fix":"eslint --ext .ts src/ test/ --fix && prettier --write ."},"repository":{"type":"git","url":"git+https://github.com/bryopsida/key-store.git"},"keywords":["crypto","typescript","keystore","data-encryption-keys","node.js","minimal-dependencies"],"author":"","license":"Unlicense","bugs":{"url":"https://github.com/bryopsida/key-store/issues"},"homepage":"https://github.com/bryopsida/key-store#readme","devDependencies":{"@jest/globals":"29.7.0","@types/jest":"^29.0.0","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^5.15.0","@typescript-eslint/parser":"^5.15.0","eslint":"^8.30.0","eslint-config-prettier":"^9.0.0","eslint-plugin-github":"^4.6.0","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^6.0.0","eslint-plugin-standard":"^5.0.0","jest":"^29.0.0","prettier":"2.8.8","standard":"^17.0.0","ts-jest":"29.x","ts-node":"^10.7.0","typedoc":"^0.25.0","typescript":"^5.0.0"},"gitHead":"03102637d8b2fd56c0cc9fb43ea24008f254abce","_id":"@bryopsida/key-store@0.1.4","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-cv/hRUCvXk0XcaWge9E/meNG1AtzrLBavW80jCo1jS5OfZ+ufxc1179qNwodhgFpKXw8gpGXTrANlD4oPM/b/Q==","shasum":"03d14c1fd3284c9f062b4a3c74d95768432ffab7","tarball":"https://registry.npmjs.org/@bryopsida/key-store/-/key-store-0.1.4.tgz","fileCount":21,"unpackedSize":24554,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC//8OOuQlRDkNulmlco3bibK4XkXKhSgu9E1l9KsVGbwIgfxDlcIMfsjaS04kE8d5tS3ERyrew3v8QHqLrMUDCHM0="}]},"_npmUser":{"name":"akboyd88","email":"akboyd88@gmail.com"},"directories":{},"maintainers":[{"name":"akboyd88","email":"akboyd88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/key-store_0.1.4_1695859102504_0.25569683344114336"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-05T21:04:36.987Z","0.1.1":"2023-02-05T21:04:37.223Z","modified":"2024-04-07T16:41:40.800Z","0.1.2":"2023-02-05T21:20:42.630Z","0.1.3":"2023-02-05T21:37:42.573Z","0.1.4":"2023-09-27T23:58:22.719Z"},"maintainers":[{"email":"noreply@curium.rocks","name":"curium-deployer"},{"email":"npm.feel170@passinbox.com","name":"akboyd88"}],"description":"A extendable TypeScript Node.JS library that provides a basic key store for data encryption keys","homepage":"https://github.com/bryopsida/key-store#readme","keywords":["crypto","typescript","keystore","data-encryption-keys","node.js","minimal-dependencies"],"repository":{"type":"git","url":"git+https://github.com/bryopsida/key-store.git"},"bugs":{"url":"https://github.com/bryopsida/key-store/issues"},"license":"Unlicense","readme":"# Key-Store\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=coverage)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_key-store&metric=bugs)](https://sonarcloud.io/summary/new_code?id=bryopsida_key-store)\n\n## What is this?\n\nThis is a typescript library that can be used to create a key store for managing root and data encryption keys. A basic file store key store is included but it can also be extended to persist to a shared store such as redis.\nWhat problem does this solve? This was intiailly created as part of a data munging project in which I needed to be able to dynamically encrypt credentials and share them across a distributed system using redis.\n\n### How do I use it?\n\nTo create your own store extend from the BaseKeyStore and implement the required key slot functions. For example:\n\n```typescript\nimport { writeFile, mkdir, access, readFile, unlink, rm } from 'fs/promises'\nimport { resolveHome } from './resolve.js'\nimport {\n  BaseKeyStore,\n  IKeyStoreContextProvider,\n  IKeyStoreValueProvider,\n} from './baseKeyStore'\n\n/**\n * A implementation of BaseKeyStore that stores the sealed\n * keys into a desiginated spot in the file system, consumers\n * of the class supply providers that give the password, salt\n * and context to use for AAED\n */\nexport class FileKeyStore extends BaseKeyStore {\n  private readonly keyStorePath: string\n\n  /**\n   *\n   * @param {string} keyStorePath path to the folder where keys will be saved\n   * @param {IKeyStoreValueProvider} keyStorePasswordProvider provide the password used to seal keys\n   * @param {IKeyStoreValueProvider} keyStoreSaltProvider provide the salt used to seal keys\n   * @param {IKeyStoreContextProvider} keyStoreContextProvider provider that will give the appropriate context based on key id\n   */\n  constructor(\n    keyStorePath: string,\n    keyStorePasswordProvider: IKeyStoreValueProvider,\n    keyStoreSaltProvider: IKeyStoreValueProvider,\n    keyStoreContextProvider: IKeyStoreContextProvider\n  ) {\n    super(\n      keyStorePasswordProvider,\n      keyStoreSaltProvider,\n      keyStoreContextProvider\n    )\n    this.keyStorePath = resolveHome(keyStorePath)\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  protected hasKeyInSlot(keySlot: string): Promise<boolean> {\n    return access(this.keyStorePath + '/' + keySlot)\n      .then(() => true)\n      .catch(() => false)\n  }\n\n  private async createKeyStoreDirIfNotExists(): Promise<void> {\n    await access(this.keyStorePath).catch(async () => {\n      await mkdir(this.keyStorePath, { recursive: true })\n    })\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  protected async putKeyInSlot(keySlot: string, key: Buffer): Promise<void> {\n    await this.createKeyStoreDirIfNotExists()\n    await writeFile(this.keyStorePath + '/' + keySlot, key)\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  protected async getKeyInSlot(keySlot: string): Promise<Buffer> {\n    return readFile(this.keyStorePath + '/' + keySlot)\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  protected async deleteKeySlot(keySlot: string): Promise<void> {\n    await unlink(this.keyStorePath + '/' + keySlot)\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  protected async clearKeySlots(): Promise<void> {\n    await rm(this.keyStorePath, { recursive: true, force: true, maxRetries: 3 })\n  }\n\n  /**\n   * @Inheritdoc\n   */\n  async close(): Promise<void> {\n    // nothing to do\n  }\n}\n```\n\nYou can then use the store like this (snippet from a test):\n\n```typescript\nconst storeDir = tmpdir()\nconst key = randomBytes(32)\nconst salt = randomBytes(16)\nconst context = randomBytes(32)\n\n// create a keystore\nconst keystore = new FileKeyStore(\n  storeDir + '/keystore',\n  () => Promise.resolve(key),\n  () => Promise.resolve(salt),\n  () => Promise.resolve(context)\n)\n\n// create random data to act as key store\nconst dek = randomBytes(32)\nconst id = randomUUID()\n\n// save it\nawait keystore.saveSealedDataEncKey(id, dek)\n\n// ask for it back\nconst fetchedDek = await keystore.fetchSealedDataEncKey(id)\n\n// should be the same\nexpect(fetchedDek).toEqual(dek)\n```\n","readmeFilename":"README.md"}