Last active
December 24, 2018 11:14
-
-
Save VandeurenGlenn/5a5dcfcaf739d5f830637b2a4e949ebe to your computer and use it in GitHub Desktop.
Getting started with ipfsd-node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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