Skip to content

Commit 3d868fe

Browse files
authored
feat: add libp2p id key (#6)
1 parent 6c86530 commit 3d868fe

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ const getIdKeys = (pid) => {
210210

211211
return {
212212
pkKey: new Key(rawStdEncoding(Buffer.concat([pkBuffer, pid]))),
213+
routingKey: new Key(`/ipns/${pid}`), // Added on https://github.com/ipfs/js-ipns/pull/6#issue-213631461 (ipnsKey will be deprecated in a future release)
213214
ipnsKey: new Key(rawStdEncoding(Buffer.concat([ipnsBuffer, pid])))
214215
}
215216
}

test/index.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ describe('ipns', function () {
170170
expect(idKeys).to.exist()
171171
expect(idKeys).to.have.a.property('pkKey')
172172
expect(idKeys).to.have.a.property('ipnsKey')
173+
expect(idKeys).to.have.a.property('routingKey')
173174
expect(idKeys.pkKey).to.not.startsWith('/pk/')
174175
expect(idKeys.ipnsKey).to.not.startsWith('/ipns/')
176+
expect(idKeys.routingKey).to.not.startsWith('/ipns/')
175177
})
176178

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

0 commit comments

Comments
 (0)