mirror of
https://github.com/expo/node-vault.git
synced 2026-11-27 16:45:28 -10:00
20 lines
462 B
JavaScript
20 lines
462 B
JavaScript
// file: example/init.js
|
|
|
|
process.env.DEBUG = 'node-vault'; // switch on debug mode
|
|
|
|
const vault = require('./../src/index')();
|
|
|
|
vault.initialized()
|
|
.then((result) => {
|
|
console.log(result);
|
|
return vault.init({ secret_shares: 1, secret_threshold: 1 });
|
|
})
|
|
.then((result) => {
|
|
console.log(result);
|
|
vault.token = result.root_token;
|
|
const key = result.keys[0];
|
|
return vault.unseal({ secret_shares: 1, key });
|
|
})
|
|
.then(console.log)
|
|
.catch(console.error);
|