Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadSignature = errors.New("invalid signature") ErrNoSignature = errors.New("missing signature") ErrNoPubkey = errors.New("missing public key") )
var SignedHeadPrototype schema.TypedPrototype
SignedHeadPrototype represents the IPLD node prototype of SignedHead.
See: bindnode.Prototype.
Functions ¶
This section is empty.
Types ¶
type SignedHead ¶
func NewSignedHead ¶
func NewSignedHead(headCid cid.Cid, topic string, privKey ic.PrivKey) (*SignedHead, error)
func UnwrapSignedHead ¶
func UnwrapSignedHead(node ipld.Node) (*SignedHead, error)
UnwrapSignedHead unwraps the given node as a SignedHead.
Note that the node is reassigned to SignedHeadPrototype if its prototype is different. Therefore, it is recommended to load the node using the correct prototype function initially to avoid unnecessary node assignment.
func (SignedHead) Encode ¶
func (s SignedHead) Encode() ([]byte, error)
func (SignedHead) ToNode ¶
func (s SignedHead) ToNode() (n ipld.Node, err error)
ToNode converts this SignedHead to its representation as an IPLD typed node.
See: bindnode.Wrap.
func (SignedHead) Validate ¶
func (s SignedHead) Validate() (peer.ID, error)
Validate checks the signature on the SignedHead and returns the peer ID of the signer.
Even though the signature is valid with the included public key, the caller will need to check if the signer's ID is allowed to sign this message.