ipfs / js-ipns

Utilities for creating, parsing, and validating IPNS records

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example doesn't work with PeerId

npfoss opened this issue · comments

const PeerId = require('peer-id')
const ipns = require('ipns')

const pid = await PeerId.create({ bits: 2048, keyType: 'rsa' })

let value = 'test value 1'
let sequenceNumber = 42
let lifetime = 365 * 24 * 60 * 60 * 1000
let privateKey = pid.privKey

let record = await ipns.create(privateKey, value, sequenceNumber, lifetime)
console.log(record)

The above code will just hang forever when run with the most recent versions of js-peer-d and js-ipns.

@vasco-santos I'm sorry, I hate to @ people, but I'm working under a deadline and really need to get some combination of PeerIds and IPNS working as soon as possible. I'd be very happy to write any PR necessary if you'd just point me in the right direction---I already tried and had trouble finding my way around.

For the time being you have to use v0.12.x of PeerId (eg. the callback version, not async/await as shown in your example) as that's what the latest stable version of libp2p uses.

Ah I see, that was exactly the problem, thank you!