Skip to content

Commit

Permalink
feat: add libp2p id key
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Sep 6, 2018
1 parent 6c86530 commit 0b6b2fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const getIdKeys = (pid) => {

return {
pkKey: new Key(rawStdEncoding(Buffer.concat([pkBuffer, pid]))),
routingKey: new Key(`/ipns/${pid}`),
ipnsKey: new Key(rawStdEncoding(Buffer.concat([ipnsBuffer, pid])))
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ describe('ipns', function () {
expect(idKeys).to.exist()
expect(idKeys).to.have.a.property('pkKey')
expect(idKeys).to.have.a.property('ipnsKey')
expect(idKeys).to.have.a.property('routingKey')
expect(idKeys.pkKey).to.not.startsWith('/pk/')
expect(idKeys.ipnsKey).to.not.startsWith('/ipns/')
expect(idKeys.routingKey).to.not.startsWith('/ipns/')
})

it('should be able to embed a public key in an ipns record', (done) => {
Expand Down

0 comments on commit 0b6b2fd

Please sign in to comment.