helia
    Preparing search index...

    Interface IPNS

    interface IPNS {
        routers: IPNSRouting[];
        publish(
            keyName: string,
            value:
                | string
                | MultihashDigest<number>
                | CID<unknown, number, number, Version>
                | PublicKey,
            options?: PublishOptions,
        ): Promise<IPNSPublishResult>;
        resolve(
            name:
                | string
                | MultihashDigest<number>
                | CID<unknown, number, number, Version>
                | PublicKey,
            options?: IPNSResolveOptions,
        ): AsyncGenerator<IPNSResolveResult>;
        unpublish(keyName: string, options?: AbortOptions): Promise<void>;
    }
    Index
    routers: IPNSRouting[]

    Configured routing subsystems used to publish/resolve IPNS names

    • 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.

      If the key does not exist, a new Ed25519 key will be created. To use a different key types, ensure the key is created and stored in the keychain before invoking this method.

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

      • A CID with the libp2p-key codec
      • A Multihash
      • 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.

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

      Parameters

      Returns Promise<void>