Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
chore: use peer id bytes instead of computing it again
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Nov 13, 2018
1 parent 73d3686 commit 5a07d44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/core/components/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ module.exports = function init (self) {
cb(null, true)
}
},
// Setup offline routing for IPNS. This is primarily used for offline ipns modifications, such as the initializeKeyspace feature.
// Setup the offline routing for IPNS.
// This is primarily used for offline ipns modifications, such as the initializeKeyspace feature.
(_, cb) => {
const offlineDatastore = new OfflineDatastore(self._repo)

Expand Down
3 changes: 1 addition & 2 deletions src/core/ipns/resolver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

const ipns = require('ipns')
const { fromB58String } = require('multihashes')
const Record = require('libp2p-record').Record
const PeerId = require('peer-id')
const errcode = require('err-code')
Expand Down Expand Up @@ -91,7 +90,7 @@ class IpnsResolver {
// resolve ipns entries from the provided routing
_resolveName (name, callback) {
const peerId = PeerId.createFromB58String(name)
const { routingKey } = ipns.getIdKeys(fromB58String(name))
const { routingKey } = ipns.getIdKeys(peerId.toBytes())

// TODO DHT - get public key from routing?
// https://github.com/ipfs/go-ipfs/blob/master/namesys/routing.go#L70
Expand Down

0 comments on commit 5a07d44

Please sign in to comment.