M
Meshkit

IPNS API

publishName, resolveName, resolveAndRetrieve, generateKey, listKeys — full reference.

publishName

publishName(
  value: string,
  options?: IpnsPublishOptions,
): Promise<IpnsPublishResult>

Publish an IPNS record on the primary node. value is a CID string or /ipfs/... path.

const { name, value } = await meshkit.publishName('Qm...', {
  key: 'latest',
  ttl: '1m',
});
// name: "Qm..." (the IPNS key hash)
// value: "/ipfs/Qm..."

IpnsPublishOptions

PropertyTypeDefaultDescription
keystring"self"Keystore label. Use the name from generateKey.
lifetimeIpnsDuration~48hRecord validity window.
ttlIpnsDurationCache hint for resolvers.
resolvebooleantrueResolve value before publishing.

IpnsPublishResult

PropertyTypeDescription
namestringIPNS name hash — use as /ipns/${name}.
valuestringPublished path, e.g. /ipfs/Qm....

resolveName

resolveName(name: string, options?: IpnsResolveOptions): Promise<string>

Resolve an IPNS name to an /ipfs/... path. Uses failover.

const path = await meshkit.resolveName('/ipns/Qm...');
console.log(path); // /ipfs/Qm...

IpnsResolveOptions

PropertyTypeDefaultDescription
recursivebooleanResolve until the result is not another IPNS name.
nocachebooleanBypass local cache — useful after publish to verify propagation.

resolveAndRetrieve

resolveAndRetrieve(name: string, options?: IpnsResolveOptions): Promise<Uint8Array>

Resolve an IPNS name and retrieve the content bytes in one call. Uses failover.

const bytes = await meshkit.resolveAndRetrieve('/ipns/Qm...');

generateKey

generateKey(name: string, options?: IpnsKeyGenOptions): Promise<IpnsKey>

Create a named signing key in the primary node's keystore. The returned id is the stable IPNS name.

const key = await meshkit.generateKey('blog-latest');
// key.id   — use as /ipns/<id>
// key.name — "blog-latest"

IpnsKeyGenOptions

PropertyTypeDefaultDescription
type'ed25519' | 'rsa'Key algorithm.
sizenumberKey size (for RSA).

listKeys

listKeys(): Promise<IpnsKey[]>

List all keys in the primary node's keystore, including the built-in "self" key.

const keys = await meshkit.listKeys();
// [{ id: '...', name: 'self' }, { id: '...', name: 'blog-latest' }]

IpnsKey

PropertyTypeDescription
idstringPublic key hash — the IPNS name.
namestringKeystore label, e.g. "self" or "blog-latest".

TTL constants

import { IPNS_TTL_FAST, IPNS_TTL_DEFAULT } from '@ipfs-meshkit/meshkit';
ConstantValueUse
IPNS_TTL_FAST"1m"Frequent updates
IPNS_TTL_DEFAULT"1h"Stable content

On this page