head

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadSignature = errors.New("invalid signature")
	ErrNoSignature  = errors.New("missing signature")
	ErrNoPubkey     = errors.New("missing public key")
)
View Source
var SignedHeadPrototype schema.TypedPrototype

SignedHeadPrototype represents the IPLD node prototype of SignedHead.

See: bindnode.Prototype.

Functions

This section is empty.

Types

type SignedHead

type SignedHead struct {
	Head   ipld.Link
	Topic  *string
	Pubkey []byte
	Sig    []byte
}

func Decode

func Decode(SignedHeadReader io.Reader) (*SignedHead, error)

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) Sign

func (s *SignedHead) Sign(privKey ic.PrivKey) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL