Skip to content

Commit

Permalink
fix: local key for datastore
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Jul 6, 2018
1 parent d7c90ef commit 439fcc0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"base32-encode": "^1.1.0",
"big.js": "^5.1.2",
"debug": "^3.1.0",
"interface-datastore": "^0.4.2",
"left-pad": "^1.3.0",
"nano-date": "^2.1.0",
"protons": "^1.0.1"
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const base32Encode = require('base32-encode')
const Big = require('big.js')
const NanoDate = require('nano-date').default
const { Key } = require('interface-datastore')

const debug = require('debug')
const log = debug('jsipns')
Expand Down Expand Up @@ -132,7 +133,7 @@ const rawStdEncoding = (key) => base32Encode(key, 'RFC4648', { padding: false })
* @param {Buffer} key peer identifier object.
* @returns {string}
*/
const getLocalKey = (key) => `/ipns/${rawStdEncoding(key)}`
const getLocalKey = (key) => new Key(`/ipns/${rawStdEncoding(key)}`)

/**
* Get key for sharing the record in the routing mechanism.
Expand Down
1 change: 0 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ describe('ipns', function () {
const datastoreKey = ipns.getLocalKey(fromB58String(ipfsId.id))

expect(datastoreKey).to.exist()
expect(datastoreKey).to.startsWith('/ipns/')
})

it('should get id keys correctly', () => {
Expand Down

0 comments on commit 439fcc0

Please sign in to comment.