@@ -4,41 +4,45 @@ import (
44 "errors"
55)
66
7- // ErrExpiredRecord should be returned when an ipns record is
8- // invalid due to being too old
7+ // ErrExpiredRecord is returned when an IPNS Record is invalid due to being expired.
98var ErrExpiredRecord = errors .New ("expired record" )
109
11- // ErrUnrecognizedValidity is returned when an IpnsRecord has an
12- // unknown validity type.
10+ // ErrUnrecognizedValidity is returned when an IPNS Record has an unknown validity type.
1311var ErrUnrecognizedValidity = errors .New ("unrecognized validity type" )
1412
15- // ErrInvalidPath should be returned when an ipns record path
16- // is not in a valid format
13+ // ErrInvalidValidity is returned when an IPNS Record has a known validity type,
14+ // but the validity value is invalid.
15+ var ErrInvalidValidity = errors .New ("invalid validity" )
16+
17+ // ErrInvalidPath is returned when an IPNS Record has an invalid path.
1718var ErrInvalidPath = errors .New ("record path invalid" )
1819
19- // ErrSignature should be returned when an ipns record fails
20- // signature verification
20+ // ErrInvalidPublicKey is returned when an IPNS Record has an invalid public key,
21+ var ErrInvalidPublicKey = errors .New ("record public key invalid" )
22+
23+ // ErrSignature is returned when an IPNS Record fails signature verification.
2124var ErrSignature = errors .New ("record signature verification failed" )
2225
23- // ErrKeyFormat should be returned when an ipns record key is
24- // incorrectly formatted (not a peer ID)
26+ // ErrKeyFormat is returned when an IPNS Record key is incorrectly formatted.
2527var ErrKeyFormat = errors .New ("record key could not be parsed into peer ID" )
2628
27- // ErrPublicKeyNotFound should be returned when the public key
28- // corresponding to the ipns record path cannot be retrieved
29- // from the peer store
30- var ErrPublicKeyNotFound = errors .New ("public key not found in peer store" )
29+ // ErrPublicKeyNotFound is returned when the public key is not found.
30+ var ErrPublicKeyNotFound = errors .New ("public key not found" )
3131
32- // ErrPublicKeyMismatch should be returned when the public key embedded in the
33- // record doesn't match the expected public key.
34- var ErrPublicKeyMismatch = errors .New ("public key in record did not match expected pubkey " )
32+ // ErrPublicKeyMismatch is returned when the public key embedded in the IPNS
33+ // Record doesn't match the expected public key.
34+ var ErrPublicKeyMismatch = errors .New ("public key in record did not match expected public key " )
3535
36- // ErrBadRecord should be returned when an ipns record cannot be unmarshalled
36+ // ErrBadRecord is returned when an IPNS Record cannot be unmarshalled.
3737var ErrBadRecord = errors .New ("record could not be unmarshalled" )
3838
39- // 10 KiB limit defined in https://github.com/ipfs/specs/pull/319
40- const MaxRecordSize int = 10 << ( 10 * 1 )
39+ // ErrDataMissing is returned when the record is missing the data field.
40+ var ErrDataMissing = errors . New ( "data field is missing from record" )
4141
42- // ErrRecordSize should be returned when an ipns record is
43- // invalid due to being too big
42+ // ErrRecordSize is returned when an IPNS Record is too long.
4443var ErrRecordSize = errors .New ("record exceeds allowed size limit" )
44+
45+ // MaxRecordSize is the IPNS Record [size limit].
46+ //
47+ // [size limit]: https://specs.ipfs.tech/ipns/ipns-record/#record-size-limit
48+ const MaxRecordSize int = 10 << (10 * 1 )
0 commit comments