namesys: more comments
License: MIT Signed-off-by: Dirk McCormick <dirkmdev@gmail.com>
Dirk McCormick committed
Jan 31, 2018 at 10:08 UTC
84fe5827b9bd15fb73e382f49aa76504210d776c
1 file changed
+6
-3
namesys/validator.go
+6
-3
@@ -41,12 +41,15 @@ var ErrKeyFormat = errors.New("record key could not be parsed into peer ID")
41
// from the peer store
42
var ErrPublicKeyNotFound = errors.New("public key not found in peer store")
43
44
-// NewIpnsRecordValidator returns a ValidChecker for IPNS records
44
+// NewIpnsRecordValidator returns a ValidChecker for IPNS records.
45
// The validator function will get a public key from the KeyBook
46
-// to verify the record's signature
46
+// to verify the record's signature. Note that the public key must
47
+// already have been fetched from the network and put into the KeyBook
48
+// by the caller.
49
func NewIpnsRecordValidator(kbook pstore.KeyBook) *record.ValidChecker {
50
// ValidateIpnsRecord implements ValidatorFunc and verifies that the
49
- // given 'val' is an IpnsEntry and that that entry is valid.
51
+ // given record's value is an IpnsEntry, that the entry has been correctly
52
+ // signed, and that the entry has not expired
53
ValidateIpnsRecord := func(r *record.ValidationRecord) error {
54
if r.Namespace != "ipns" {
55
return ErrInvalidPath