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
We have to document legacy signature, because it is the only reason for
copying 'data' fields into the main protobuf.
Added section about backward compatibility so our approach is more clear.
// deserialized copies of data[validityType] and data[validity]
@@ -216,6 +217,16 @@ Records over the limit MAY be ignored. Handling records larger than the
216
217
limit is not recommended so as to keep compatibility with implementations and
217
218
transports that follow this specification.
218
219
220
+
### Backward Compatibility
221
+
222
+
Implementations that want to interop with the public IPFS swarm MUST maintain
223
+
backward compatibility. This means changes made to `IpnsEntry` protobuf or
224
+
validation logic should always be additive.
225
+
226
+
Future changes to this spec should include design decisions that allow legacy
227
+
nodes to gracefully ignore new fields and verify compatible records using
228
+
legacy logic.
229
+
219
230
## Protocol
220
231
221
232
### Overview
@@ -243,8 +254,7 @@ Finally, the network nodes may also republish their records, so that the records
243
254
244
255
### Record Creation
245
256
246
-
IPNS record MUST be serialized as `IpnsEntry` protobuf and `IpfsEntry.data` MUST be signed using the private key.
247
-
257
+
IPNS record MUST be serialized as `IpnsEntry` protobuf, and `IpfsEntry.data` MUST be signed using the private key.
248
258
Creating a new IPNS record MUST follow the below steps:
249
259
250
260
1. Create `IpnsEntry` and set `value`, `validity`, `validityType`, `sequence`, and `ttl`
@@ -256,9 +266,13 @@ Creating a new IPNS record MUST follow the below steps:
256
266
- The order of fields impacts signature verification. If you are using an alternative CBOR implementation, make sure the CBOR field order follows [RFC7049](https://www.rfc-editor.org/rfc/rfc7049) sorting rules: length and then bytewise. The order of fields impacts signature verification.
257
267
4. If your public key can't be inlined inside the IPNS Name, include a serialized copy in `IpnsEntry.pubKey`
258
268
- This step SHOULD be skipped for Ed25519, and any other key types that are inlined inside of [IPNS Name](#ipns-name) itself.
259
-
6. Create bytes for signing by concatenating `ipns-signature:` prefix (bytes in hex: `69706e732d7369676e61747572653a`) with raw CBOR bytes from `IpnsEntry.data`
260
-
7. Sign concatenated bytes from the previous step using the private key, and store the signature in `IpnsEntry.signatureV2`
261
-
8. Confirm that the serialized `IpnsEntry` bytes sum to less than or equal to [the size limit](#record-size-limit).
269
+
5. Create `IpnsEntry.signatureV2`
270
+
- Create bytes for signing by concatenating `ipns-signature:` prefix (bytes in hex: `69706e732d7369676e61747572653a`) with raw CBOR bytes from `IpnsEntry.data`
271
+
- Sign concatenated bytes from the previous step using the private key, and store the signature in `IpnsEntry.signatureV2`
272
+
6. Create `IpnsEntry.signatureV1` (backward compatibility, for legacy software)
273
+
- Create bytes for signing by concatenating `IpnsEntry.value` + `IpnsEntry.validity` + `string(IpnsEntry.validityType)`
274
+
- Sign concatenated bytes from the previous step using the private key, and store the legacy signature in `IpnsEntry.signatureV1`
275
+
7. Confirm that the serialized `IpnsEntry` bytes sum to less than or equal to [the size limit](#record-size-limit).
0 commit comments