Skip to content

Conversation

@sugarforever
Copy link
Collaborator

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2022

Codecov Report

Merging #175 (9588b1c) into main (c04d787) will not change coverage.
The diff coverage is n/a.

@@           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
sssion previously approved these changes Aug 22, 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()
Copy link
Collaborator

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()
}

@sssion sssion self-requested a review August 25, 2022 07:58
@sssion sssion dismissed their stale review August 25, 2022 07:59

something is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants