Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

feat: support Base36 #112

Merged
merged 1 commit into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {
"buffer": "^5.5.0",
"class-is": "^1.1.0",
"multibase": "~0.7.0",
"multibase": "^1.0.0",
"multicodec": "^1.0.1",
"multihashes": "~0.4.17"
},
Expand Down
13 changes: 13 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ describe('CID', () => {
expect(cid.toBaseEncodedString()).to.be.eql(cidStr)
})

it('handles ED25519 PeerID as CID in Base36', () => {
const peerIdStr = 'k51qzi5uqu5dj16qyiq0tajolkojyl9qdkr254920wxv7ghtuwcz593tp69z9m'

const cid = new CID(peerIdStr)

expect(cid).to.have.property('codec', 'libp2p-key')
expect(cid).to.have.property('version', 1)
expect(cid).to.have.property('multihash')
expect(cid).to.have.property('multibaseName', 'base36')

expect(cid.toBaseEncodedString()).to.be.eql(peerIdStr)
})

it('create by parts', () => {
const cid = new CID(1, 'dag-cbor', hash)

Expand Down