Class: CerberusClient

CerberusClient

Cerberus client with CRUD operations for secure data and files.


new CerberusClient(options)

Parameters:
Name Type Description
options CerberusClientOptions

The options for the Cerberus client.

Source:
Example
var CerberusClient = require('cerberus-node-client')

var client = new CerberusClient({
  // string, The cerberus URL to use.
  hostUrl: YOUR_CERBERUS_HOST,

  // string, AWS region, required if authenticating to AWS China, otherwise defaults to us-west-2
  region: AWS_REGION,

  // boolean, defaults to false. When true will console.log many operations
  debug: true,

  // This will be used as the cerberus X-Vault-Token if supplied
  // OVERRIDDEN by process.env.CERBERUS_TOKEN
  // If present, normal authentication with cerberus will be skipped
  // You should normally only be using this in testing environments
  // When developing locally, it is easier to use process.env.CERBERUS_TOKEN
  token: 'Some_Auth_Token'
})

client.getSecureData('path/to/my/secret').then(secureConfig => {
  //do something with config
})

Methods


deleteFile(path)

deletes an uploaded file

Parameters:
Name Type Description
path string

The path the the uploaded file

Source:
Returns:

A promise that will be resolved when the file contents have been deleted

Type
Promise.<object>

deleteSecureData(path)

Deletes secure data.

Parameters:
Name Type Description
path string

The path for the secure data

Source:
Returns:

A promise that will be resolved when the delete is finished

Type
Promise.<object>

getSecureData(path)

Fetches secure data.

Parameters:
Name Type Description
path string

The path for the secure data

Source:
Returns:

A promise that when resolved supplies the secure data

Type
Promise.<object>

listFile(path)

lists the files under a path.

Parameters:
Name Type Description
path string

The path or partial path

Source:
Returns:

A promise that will be resolved when the list is finished supplying the {ListFileResult}

Type
Promise.<ListFileResult>

<async> listPathsForSecureData(path)

lists the keys under a secure data path.

If no keys are present {ListKeyResult} will have an empty array.

Parameters:
Name Type Description
path string

The path or partial path

Source:
Returns:

A promise that will be resolved when the list is finished supplying the results

Type
Promise.<ListKeyResult>

readFile(path)

Reads the contents of an uploaded file

Parameters:
Name Type Description
path string

The path the the uploaded file

Source:
Returns:

A promise that will be resolved when the file contents have been fetched

Type
Promise.<(Buffer|string)>

writeFile(path, data)

Uploads a file to a given path

Parameters:
Name Type Description
path string

The path

data string | Buffer

The file buffer or string

Source:
Returns:

A promise that will be resolved when the file contents have been uploaded

Type
Promise.<object>

writeSecureData(path, data)

Writes secure data.

Parameters:
Name Type Description
path string

The path for the secure data

data object

The secure data

Source:
Returns:

A promise that will be resolved when the write is finished

Type
Promise.<undefined>