-
Notifications
You must be signed in to change notification settings - Fork 4
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: updated signature method according to the up-to-date implementation #175
base: main
Are you sure you want to change the base?
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. |
@@ -41,7 +41,7 @@ which Pando subscribes. | |||
#### Prerequisite | |||
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() |
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.
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()
}
No description provided.