You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ipns/ipns-record.md
+56-45Lines changed: 56 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,52 +128,63 @@ and refer to IPNS addresses as `/ipns/{ipns-name}` (or `/ipns/{libp2p-key}`).
128
128
129
129
## IPNS Record
130
130
131
+
### Record Fields
132
+
131
133
A logical :dfn[IPNS Record] is a data structure containing the following fields:
132
134
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]`.
- 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:
- 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]`.
- 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]`.
- 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]`.
- 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.
- 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).
0 commit comments