IPNS Record definitions
$ npm i ipns
Loading this module through a script tag will make it's exports available as Ipns
in the global namespace.
<script src="https://unpkg.com/ipns/dist/index.min.js"></script>
This module contains all the necessary code for creating, understanding and validating IPNS records.
import * as ipns from 'ipns'
const ipnsRecord = await ipns.createIPNSRecord(privateKey, value, sequenceNumber, lifetime)
import { validate } from 'ipns/validator'
await validate(publicKey, marshalledRecord)
// if no error thrown, the record is valid
This is useful when validating IPNS names that use RSA keys, whose public key is embedded in the record (rather than in the routing key as with Ed25519).
import { ipnsValidator } from 'ipns/validator'
await ipnsValidator(routingKey, marshalledRecord)
import * as ipns from 'ipns'
const publicKey = await ipns.extractPublicKeyFromIPNSRecord(peerId, ipnsRecord)
import * as ipns from 'ipns'
const ipnsRecord = await ipns.createIPNSRecord(privateKey, value, sequenceNumber, lifetime)
// ...
const marshalledData = ipns.marshalIPNSRecord(ipnsRecord)
// ...
Returns the record data serialized.
import * as ipns from 'ipns'
const ipnsRecord = ipns.unmarshalIPNSRecord(storedData)
Returns the IPNSRecord
after being deserialized.
Namespace constants for records.
ipns.namespace
// '/ipns/'
ipns.namespaceLength
// 6
Licensed under either of
- Apache 2.0, (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)
- MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
Contributions welcome! Please check out the issues.
Also see our contributing document for more information on how we work, and about contributing in general.
Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.