Skip to content

Instantly share code, notes, and snippets.

@VandeurenGlenn
Last active December 24, 2018 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VandeurenGlenn/5a5dcfcaf739d5f830637b2a4e949ebe to your computer and use it in GitHub Desktop.
Save VandeurenGlenn/5a5dcfcaf739d5f830637b2a4e949ebe to your computer and use it in GitHub Desktop.
Getting started with ipfsd-node
import ipfsdNode from 'ipfsd-node';
(async () => {
const ipfsd = await ipfsdNode({
bootstrap: 'earth',
sharding: true,
relayHop: true,
flags: ['--enable-pubsub-experiment'],
repoPath: 'path/to/repo',
cleanup: false
});
const { ipfs, addresses } = await ipfsd.start();
ipfs.add()
ipfs.get()
})()
const client = ecdh();
const server = ecdh();
const sharedClient = client.derive(server.public);
const sharedServer = server.derive(client.public);
client.encrypt('this is a test')
.then(cipher => server.decrypt(cipher))
.then(data => tape.equal(data, 'this is a test', 'encrypt/decrypt'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment