Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw errcode(new Error(errMsg), 'ERR_DETERMINING_PUBLISHED_RECORD')
}
}
// Determinate the record sequence number
let seqNumber = 0
if (record && record.sequence !== undefined) {
seqNumber = record.value.toString() !== value ? record.sequence + 1 : record.sequence
}
let entryData
try {
// Create record
entryData = await ipns.create(privKey, value, seqNumber, validity)
} catch (err) {
const errMsg = `ipns record for ${value} could not be created`
log.error(err)
throw errcode(new Error(errMsg), 'ERR_CREATING_IPNS_RECORD')
}
// TODO IMPROVEMENT - set ttl (still experimental feature for go)
try {
// Marshal record
const data = ipns.marshal(entryData)
// Store the new record
await this._datastore.put(ipns.getLocalKey(peerId.id), data)