helia
    Preparing search index...

    Interface IPNS

    interface IPNS {
        routers: IPNSRouting[];
        publish(
            keyName: string,
            value:
                | string
                | CID<unknown, number, number, Version>
                | PeerId
                | PublicKey
                | MultihashDigest<0 | 18>,
            options?: PublishOptions,
        ): Promise<IPNSPublishResult>;
        resolve(
            key:
                | CID<unknown, 114, 0 | 18, 1>
                | PeerId
                | PublicKey
                | MultihashDigest<0 | 18>,
            options?: ResolveOptions,
        ): Promise<IPNSResolveResult>;
        unpublish(keyName: string, options?: AbortOptions): Promise<void>;
    }
    Index

    Properties

    Methods

    Properties

    routers: IPNSRouting[]

    Configured routing subsystems used to publish/resolve IPNS names

    Methods

    • Creates and publishes an IPNS record that will resolve the passed value signed by a key stored in the libp2p keychain under the passed key name.

      It is possible to create a recursive IPNS record by passing:

      • A PeerId,
      • A PublicKey
      • A CID with the libp2p-key codec and Identity or SHA256 hash algorithms
      • A Multihash with the Identity or SHA256 hash algorithms
      • A string IPNS key (e.g. /ipns/Qmfoo)

      Parameters

      Returns Promise<IPNSPublishResult>

      import { createHelia } from 'helia'
      import { ipns } from '@helia/ipns'

      const helia = await createHelia()
      const name = ipns(helia)

      const result = await name.publish('my-key-name', cid, {
      signal: AbortSignal.timeout(5_000)
      })

      console.info(result) // { answer: ... }
    • Stop republishing of an IPNS record

      This will delete the last signed IPNS record from the datastore, but the key will remain in the keychain.

      Note that the record may still be resolved by other peers until it expires or is no longer valid.

      Parameters

      Returns Promise<void>