dWeb University

dPack Secret Key Storage

Install

npm install @dpack/secret-storage

Usage

Return for the secret_key storage in dDrive/dDatabase. To avoid local ownership conflicts, pass the local directory as the first argument. @dpack/secret-storage will check for a non-empty ownership file in the source directory storage.

var secretStore = require('@dpack/secret-storage')

var storage = {
  metadata: function (name, opts) {
    if (name === 'secret_key') return secretStore()(path.join(dir, '.dpack/metadata.ogd'), opts)
    return // other storage
  },
  content: function (name, opts) {
    return // other storage
  }
}

// store secret key in ~/.dpack/secret_keys
var vault = ddrive(storage)

API

secretStorage([dir])(ownershipFile, opts)

  • dir: directory to store keys under dir/.dpack/secret_keys. Defaults to users home directory.
  • ownershipFile: non-empty file that denotes ownership. This helps avoid local ownership conflicts of the same dPack.

dPack Secret Key Storage


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.