The original private-box SSB encryption format, for ssb-db2
npm install ssb-boxThis module implements the original "private-box" encryption format for SSB. You can use this module as an ssb-db2 plugin, or you can use it as a standalone tool to encrypt and decrypt messages.
- Requires Node.js 12 or higher
``bash`
npm install ssb-box
YOU MOST LIKELY DON'T NEED TO DO THIS, because ssb-db2 bundles ssb-box already. But maybe one day ssb-db2 won't bundle it anymore, and then you _would_ have to do this.
- Requires secret-stack@^6.2.0ssb-db2@>=5.0.0
- Requires
`diff`
SecretStack({appKey: require('ssb-caps').shs})
.use(require('ssb-master'))
+ .use(require('ssb-db2'))
+ .use(require('ssb-box'))
.use(require('ssb-conn'))
.use(require('ssb-blobs'))
.call(null, config)
This module conforms with ssb-encryption-format so with ssb-box you can use all the methods specified by ssb-encryption-format.
`js
const ssbKeys = require('ssb-keys');
const boxFormat = require('ssb-box/format');
const keys = ssbKeys.generate('ed25519', 'alice');
const opts = {recps: [keys.id], keys};
const plaintext = Buffer.from('hello');
console.log(plaintext);
//
const ciphertext = boxFormat.encrypt(plaintext, opts);
console.log(ciphertext);
//
const decrypted = boxFormat.decrypt(ciphertext, opts);
console.log(decrypted);
//
``
LGPL-3.0-only