-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add records validator #5
Conversation
fa7e587
to
2314664
Compare
README.md
Outdated
|
||
The `validate` function aims to verify if an IPNS record is valid. First the record is unmarshalled, then the public key is obtained and finally the record is validated (signature and validity are verified). | ||
|
||
The `select` function is responsible for deciding which ipns record is the best (newer) between two records. Both records are unmarshalled and their sequece numbers are compared. If the first record provided is the newer, the operation result will be `0`, otherwise the operation result will be `1`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
"Both records are unmarshalled and their sequence
numbers are compared."
test/index.spec.js
Outdated
}) | ||
}) | ||
|
||
it('should use validator.select to select the newer record returning 0 if it is the first parameter', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'should use validator.select to select the first record because it is newer'?
test/index.spec.js
Outdated
}) | ||
}) | ||
|
||
it('should use validator.select to select the newer record returning 1 if it is the second parameter', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same logic as above.
ipns
should offer a validator capable of validate records, as well select which one is the best record between two of them (using the sequence number).This is particularly useful for validating libp2p records transparently, providing this validator.
Note:
go-ipns
also provides this feature here