feat: updated signature method according to the up-to-date implementation#175
Open
sugarforever wants to merge 4 commits intomainfrom
Open
feat: updated signature method according to the up-to-date implementation#175sugarforever wants to merge 4 commits intomainfrom
sugarforever wants to merge 4 commits intomainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #175 +/- ##
=======================================
Coverage 54.00% 54.00%
=======================================
Files 36 36
Lines 2087 2087
=======================================
Hits 1127 1127
Misses 843 843
Partials 117 117 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
sssion
previously approved these changes
Aug 22, 2022
sssion
reviewed
Aug 25, 2022
| Pando accepts IPLD data from metadata providers with the following required IPLD children nodes: | ||
| 1. `Provider String` - provider's peer ID | ||
| 2. `Signature Bytes` - signature of the IPLD data: sign( bytes(PreviousID) . bytes(Payload) . bytes(Provider)) ) | ||
| 2. `Signature Bytes` - signature of the IPLD data: dagjson.Encode( ipld.Node{PreviousID, Provider, Payload} ).Bytes() |
Collaborator
There was a problem hiding this comment.
sig, err := SignWithPrivky(signKey, meta)
if err != nil {
return nil, err
}
// Add signature
meta.Signature = sig
Signature Bytes is bytes from envelop's Marshal(). The envelop will use metaSignatureRecord, PrivateKey and bytes from IPLD node(dagjson.Encode)
// Signs metadata using libp2p envelope
func SignWithPrivky(privkey crypto.PrivKey, meta *Metadata) ([]byte, error) {
metaID, err := signMetadata(meta)
if err != nil {
return nil, err
}
envelope, err := record.Seal(&metaSignatureRecord{metaID: metaID}, privkey)
if err != nil {
return nil, err
}
return envelope.Marshal()
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.