Documentation ¶
Index ¶
- Constants
- type KeyState
- type MultiSig
- type Sig
- type SigEd25519
- func (s *SigEd25519) Equal(sig Sig) bool
- func (s *SigEd25519) Marshal() (data []byte)
- func (s *SigEd25519) PublicKey() []byte
- func (s *SigEd25519) Sign(msg []byte)
- func (s *SigEd25519) Signature() []byte
- func (s *SigEd25519) Type() int
- func (s *SigEd25519) Unmarshal(data []byte) []byte
- func (s *SigEd25519) Verify(_ *MultiSig, _ int, msgHash [32]byte) bool
- type SigGroup
- type SigSpec
- type Signature
Constants ¶
const ( SEd25519 = 1 Secdsa = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyState ¶
KeyState Required to provide the signatures for managing chains within an ADI A KeyState always has at
type MultiSig ¶
type MultiSig struct {
// contains filtered or unexported fields
}
MultiSig A slice of Sig structs where each Sig signs a message. It gives the m signatures of a possible n specified by the MultiSigSpec
func (*MultiSig) AddSig ¶
AddSig Add a Sig to a MultiSig. panics if the signature doesn't match the message Hash
func (*MultiSig) Check ¶
func (s *MultiSig) Check()
Check Throws a panic if anything is wrong about the MultiSig. Mostly that the signatures given have no duplicates.
type Sig ¶
type Sig interface { Type() int // Returns the type implementing the interface Signature() []byte // Returns the signature Marshal() []byte // Marshals the object implementing Sig into a slice PublicKey() []byte // Returns the public key Unmarshal(data []byte) []byte // Sets object implementing Sig to state defined by byte slice Verify(ms *MultiSig, idx int, msgHash [32]byte) bool // Validates message. True if message is validated by signature Equal(sig Sig) bool // Returns true if two signatures are equal }
type SigEd25519 ¶
type SigEd25519 struct {
// contains filtered or unexported fields
}
func (*SigEd25519) Equal ¶
func (s *SigEd25519) Equal(sig Sig) bool
Equal compare two Sig instances and return true if they are the same
func (*SigEd25519) Marshal ¶
func (s *SigEd25519) Marshal() (data []byte)
Marshal Marshals the Signature
func (*SigEd25519) PublicKey ¶
func (s *SigEd25519) PublicKey() []byte
PublicKey Returns public key for the signature. We can in many cases eliminate the public key from the signature, but for now we will include it.
func (*SigEd25519) Sign ¶
func (s *SigEd25519) Sign(msg []byte)
Sign Signs the given message, and populates the signature in the Sig
func (*SigEd25519) Signature ¶
func (s *SigEd25519) Signature() []byte
Signature Returns the bytes holding the signature
func (*SigEd25519) Type ¶
func (s *SigEd25519) Type() int
Type Returns the type for an Ed25519 signature
func (*SigEd25519) Unmarshal ¶
func (s *SigEd25519) Unmarshal(data []byte) []byte
Unmarshal UnMarshals the data stream into a SigEd25519 Note that the type byte is assumed to be present, and a panic is thrown if the the byte isn't present, or the data stream is not sufficent to hold the Ed25519 signature
type SigGroup ¶
type SigGroup struct {
SigSpecs []SigSpec // The SigSpec of a hash if not a MAST SigSpec
}
SigGroup Defines a set of SigSpecs. The priorities of the SigSpecs is indicated by their position in the SigSpecs slice, where a lower index indicates a higher priority.
SigGroups are persisted as a slice of hashes. On load, the SigSpecs are loaded for not MAST SigSpecs. For MAST SigSpecs, transactions must provide a SigSpec that validates against the hash in the SigGroup
func (*SigGroup) AddSigSpec ¶
AddSigSpec Adds or replaces a SigSpec authorized by the SigSpec at index auth, and placed at the index dest. Note that the destination cannot leave a nil entry in the SigSpecs slice.
type SigSpec ¶
type SigSpec struct { PublicKeys [][32]byte // Candidate Signatures. Must be exactly equal to n // contains filtered or unexported fields }
SigSpec Defines the public keys that can be used in a multiSignature
func (*SigSpec) Check ¶
func (s *SigSpec) Check()
Check Panics if m of n and list of public keys are not consistent. As a side effect, Check sorts the Public Keys