Skip to content

Commit 7fc4b20

Browse files
committed
chore: linkable ipns record field headers
1 parent e5bbe2a commit 7fc4b20

File tree

1 file changed

+56
-45
lines changed

1 file changed

+56
-45
lines changed

src/ipns/ipns-record.md

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -128,52 +128,63 @@ and refer to IPNS addresses as `/ipns/{ipns-name}` (or `/ipns/{libp2p-key}`).
128128

129129
## IPNS Record
130130

131+
### Record Fields
132+
131133
A logical :dfn[IPNS Record] is a data structure containing the following fields:
132134

133-
- **Value** (bytes)
134-
- It can be any content path, such as a `/ipns/{ipns-key}` path to another IPNS record, a [DNSLink](https://dnslink.dev/) path (`/ipns/example.com`) or an immutable IPFS path (`/ipfs/baf...`).
135-
- Implementations MUST include this value inside the DAG-CBOR document in `IpnsEntry.data[Value]`.
136-
137-
- **Validity Type** (uint64)
138-
- Defines the conditions under which the record is valid.
139-
- The only supported value is `0`, which indicates the `validity` field contains the expiration date after which the IPNS record becomes invalid.
140-
- Implementations MUST support `ValidityType = 0` and include this value inside the DAG-CBOR document at `IpnsEntry.data[ValidityType]`.
141-
142-
- **Validity** (bytes)
143-
- When `ValidityType = 0`
144-
- Expiration date of the record with nanoseconds precision. Expiration time should match the publishing medium's window.
145-
- For example, IPNS records published on the DHT should have an expiration time set to within 48 hours after publication. Setting the expiration time to longer than 48 hours will not have any effect, as DHT peers only keep records for up to 48 hours.
146-
- Represented as an ASCII string that follows notation from :cite[rfc3339] (`1970-01-01T00:00:00.000000001Z`).
147-
- Implementations MUST include this value inside the DAG-CBOR document at `IpnsEntry.data[Validity]`.
148-
149-
- **Sequence** (uint64)
150-
- Represents the current version of the record (starts at 0).
151-
- Implementations MUST include this value in inside the DAG-CBOR document at `IpnsEntry.data[Sequence]`.
152-
153-
- **TTL** (uint64)
154-
- A hint for how long (in nanoseconds) the record should be cached before going back to, for instance the DHT, in order to check if it has been updated. The function and trade-offs of this value are analogous to the TTL of DNS record.
155-
- Implementations MUST include this value inside the DAG-CBOR document at `IpnsEntry.data[TTL]`.
156-
- Suggested default: 1 hour (3 600 000 000 000 nanoseconds).
157-
158-
- **Public Key** (bytes)
159-
- Public key used to sign this record.
160-
- If public key is small enough to fit in IPNS name (e.g., Ed25519 keys inlined using `identity` multihash), `IpnsEntry.pubKey` field is redundant and MAY be skipped to save space.
161-
- The public key MUST be included if it cannot be extracted from the IPNS name (e.g., legacy RSA keys). Implementers MUST follow key serialization defined in [PeerID specs](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#key-types).
162-
163-
- **Signature** (bytes)
164-
- Provides the cryptographic proof that the IPNS record was created by the owner of the private key.
165-
- Implementations MUST include this value in `IpnsEntry.signatureV2` and follow signature creation and verification as described in [Record Creation](#record-creation) and [Record Verification](#record-verification).
166-
167-
- **Extensible Data** (DAG-CBOR)
168-
- Extensible record data in [DAG-CBOR](https://ipld.io/specs/codecs/dag-cbor/spec/) format.
169-
- The default set of fields can be augmented with additional information.
170-
- Implementations MAY leverage this, but otherwise MUST ignore unexpected fields.
171-
- A good practice is to:
172-
- prefix custom field names with `_` to avoid collisions with any new
173-
mandatory fields that may be added in a future version of this
174-
specification.
175-
- and/or create own namespace by setting value to DAG-CBOR:
176-
`IpnsEntry.data[_namespace][customfield]`.
135+
#### :dfn[Value]{also="ipns-record-value"} (bytes)
136+
137+
- It can be any content path, such as a `/ipns/{ipns-key}` path to another IPNS record, a [DNSLink](https://dnslink.dev/) path (`/ipns/example.com`) or an immutable IPFS path (`/ipfs/baf...`).
138+
- Implementations MUST include this value inside the DAG-CBOR document in `IpnsEntry.data[Value]`.
139+
140+
#### :dfn[Validity Type]{also="ipns-record-validity-type"} (uint64)
141+
142+
- Defines the conditions under which the record is valid.
143+
- The only supported value is `0`, which indicates the `validity` field contains the expiration date after which the IPNS record becomes invalid.
144+
- Implementations MUST support `ValidityType = 0` and include this value inside the DAG-CBOR document at `IpnsEntry.data[ValidityType]`.
145+
146+
#### :dfn[Validity]{also="ipns-record-validity"} (bytes)
147+
148+
- When `ValidityType = 0`
149+
- Expiration date of the record with nanoseconds precision. Expiration time should match the publishing medium's window.
150+
- For example, IPNS records published on the DHT should have an expiration time set to within 48 hours after publication. Setting the expiration time to longer than 48 hours will not have any effect, as DHT peers only keep records for up to 48 hours.
151+
- Represented as an ASCII string that follows notation from :cite[rfc3339] (`1970-01-01T00:00:00.000000001Z`).
152+
- Implementations MUST include this value inside the DAG-CBOR document at `IpnsEntry.data[Validity]`.
153+
154+
#### :dfn[Sequence]{also="ipns-record-sequence"} (uint64)
155+
156+
- Represents the current version of the record (starts at 0).
157+
- Implementations MUST include this value in inside the DAG-CBOR document at `IpnsEntry.data[Sequence]`.
158+
159+
#### :dfn[TTL]{also="ipns-record-ttl"} (uint64)
160+
161+
- A hint for how long (in nanoseconds) the record should be cached before going back to, for instance the DHT, in order to check if it has been updated. The function and trade-offs of this value are analogous to the TTL of DNS record.
162+
- Implementations MUST include this value inside the DAG-CBOR document at `IpnsEntry.data[TTL]`.
163+
- Suggested default: 1 hour (3 600 000 000 000 nanoseconds).
164+
165+
#### :dfn[Public Key]{also="ipns-record-public-key"} (bytes)
166+
167+
- Public key used to sign this record.
168+
- If public key is small enough to fit in IPNS name (e.g., Ed25519 keys inlined using `identity` multihash), `IpnsEntry.pubKey` field is redundant and MAY be skipped to save space.
169+
- The public key MUST be included if it cannot be extracted from the IPNS name (e.g., legacy RSA keys). Implementers MUST follow key serialization defined in [PeerID specs](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#key-types).
170+
- List of supported key types listed in [IPNS Keys](#ipns-keys) section.
171+
172+
#### :dfn[Signature]{also="ipns-record-signature"} (bytes)
173+
174+
- Provides the cryptographic proof that the IPNS record was created by the owner of the private key.
175+
- Implementations MUST include this value in `IpnsEntry.signatureV2` and follow signature creation and verification as described in [Record Creation](#record-creation) and [Record Verification](#record-verification).
176+
177+
#### :dfn[Extensible Data]{also="ipns-record-extensible-data"} (DAG-CBOR)
178+
179+
- Extensible record data in [DAG-CBOR](https://ipld.io/specs/codecs/dag-cbor/spec/) format.
180+
- The default set of fields can be augmented with additional information.
181+
- Implementations MAY leverage this, but otherwise MUST ignore unexpected fields.
182+
- A good practice is to:
183+
- prefix custom field names with `_` to avoid collisions with any new
184+
mandatory fields that may be added in a future version of this
185+
specification.
186+
- and/or create own namespace by setting value to DAG-CBOR:
187+
`IpnsEntry.data[_namespace][customfield]`.
177188

178189
IPNS records are stored locally, as well as spread across the network, in order to be accessible to everyone.
179190

@@ -234,7 +245,7 @@ requirements present in [Record Creation](#record-creation) section.
234245

235246
:::
236247

237-
### Record Size Limit
248+
#### Record Size Limit
238249

239250
IPNS implementations MUST support sending and receiving a serialized
240251
`IpnsEntry` less than or equal to **10 KiB** in size.

0 commit comments

Comments
 (0)