notaryapi

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2015 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_BUY uint8 = iota
	TYPE_PAY_ENTRY
	TYPE_PAY_CHAIN
)

--------------------------------------------------------------- Three types of entries (transactions) for Entry Credit Block ---------------------------------------------------------------

View Source
const (
	ErrorBadMethod             = 0
	ErrorNotAcceptable         = 1
	ErrorMissingVersionSpec    = 2
	ErrorMalformedVersionSpec  = 3
	ErrorBadVersionSpec        = 4
	ErrorEmptyRequest          = 5
	ErrorBadElementSpec        = 6
	ErrorBadIdentifier         = 7
	ErrorBlockNotFound         = 8
	ErrorEntryNotFound         = 9
	ErrorInternal              = 10
	ErrorJSONMarshal           = 11
	ErrorXMLMarshal            = 12
	ErrorUnsupportedMarshal    = 13
	ErrorJSONUnmarshal         = 14
	ErrorXMLUnmarshal          = 15
	ErrorUnsupportedUnmarshal  = 16
	ErrorBadPOSTData           = 17
	ErrorTemplateError         = 18
	ErrorHTTPNewRequestFailure = 19
	ErrorHTTPDoRequestFailure  = 20
	ErrorHTMLMarshal           = 21
	ErrorVerifySignature       = 22
)
View Source
const DBlockVersion = 1
View Source
const HashSize = 32

Size of array used to store sha hashes. See ShaHash.

View Source
const (
	Separator = "/"
)

Variables

View Source
var M = struct{ Main, Alt gocoding.Marshaller }{
	json.NewMarshaller(),
	json.NewMarshaller(),
}

Functions

func AltBlockEncoder

func AltBlockEncoder(scratch [64]byte, r gocoding.Renderer, v reflect.Value)

func DecodeBinary

func DecodeBinary(bytes *string) ([]byte, error)

func DecodeStringToChainName

func DecodeStringToChainName(pathstr string) (name [][]byte)

To decode the binary name to a string to enable internal path search in db The algorithm is PathString = Hex(Name[0]) + ":" + Hex(Name[0]) + ":" + ... + Hex(Name[n])

func EncodeBinary

func EncodeBinary(bytes *[]byte) string

func EncodeChainNameToString

func EncodeChainNameToString(name [][]byte) (pathstr string)

To encode the binary name to a string to enable internal path search in db The algorithm is PathString = Hex(Name[0]) + ":" + Hex(Name[0]) + ":" + ... + Hex(Name[n])

func NewDecoding

func NewDecoding(decoding gocoding.Decoding) gocoding.Decoding

func NewJSONUnmarshaller

func NewJSONUnmarshaller() gocoding.Unmarshaller

func NewUnmarshaller

func NewUnmarshaller(decoding gocoding.Decoding) gocoding.Unmarshaller

func StartDynamic

func StartDynamic(path string, readEH func(err error)) error

func StartStatic

func StartStatic(path string) (err error)

func UnmarshalJSON

func UnmarshalJSON(reader gocoding.SliceableRuneReader, obj interface{}) error

func Verify

func Verify(publicKey *[ed25519.PublicKeySize]byte, message []byte, sig *[ed25519.SignatureSize]byte) bool

Verify returns true iff sig is a valid signature of message by publicKey.

func VerifySlice

func VerifySlice(p []byte, message []byte, s []byte) bool

Verify returns true iff sig is a valid signature of message by publicKey.

Types

type BinaryMarshallable

type BinaryMarshallable interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	MarshalledSize() uint64
}

type BuyCBEntry

type BuyCBEntry struct {
	CBEntry      //interface
	FactomTxHash *Hash
	// contains filtered or unexported fields
}

func NewBuyCBEntry

func NewBuyCBEntry(pubKey *Hash, factoidTxHash *Hash,
	credits int32) *BuyCBEntry

func (*BuyCBEntry) Credits

func (e *BuyCBEntry) Credits() int32

func (*BuyCBEntry) MarshalBinary

func (e *BuyCBEntry) MarshalBinary() (data []byte, err error)

func (*BuyCBEntry) MarshalledSize

func (e *BuyCBEntry) MarshalledSize() uint64

func (*BuyCBEntry) PublicKey

func (e *BuyCBEntry) PublicKey() *Hash

func (*BuyCBEntry) Type

func (e *BuyCBEntry) Type() byte

func (*BuyCBEntry) UnmarshalBinary

func (e *BuyCBEntry) UnmarshalBinary(data []byte) (err error)

type ByteArray

type ByteArray []byte

func NewByteArray

func NewByteArray(newHash []byte) (*ByteArray, error)

func (ByteArray) Bytes

func (ba ByteArray) Bytes() []byte

func (ByteArray) MarshalBinary

func (ba ByteArray) MarshalBinary() ([]byte, error)

func (ByteArray) MarshalledSize

func (ba ByteArray) MarshalledSize() uint64

func (ByteArray) SetBytes

func (ba ByteArray) SetBytes(newArray []byte) error

func (ByteArray) UnmarshalBinary

func (ba ByteArray) UnmarshalBinary(data []byte) (error, []byte)

type CBEntry

type CBEntry interface {
	Type() byte
	PublicKey() *Hash
	Credits() int32
	MarshalBinary() ([]byte, error)
	MarshalledSize() uint64
	UnmarshalBinary(data []byte) (err error)
}

type CBInfo

type CBInfo struct {
	CBHash     *Hash
	FBHash     *Hash
	FBBlockNum uint64
	ChainID    *Hash
}

func (*CBInfo) MarshalBinary

func (b *CBInfo) MarshalBinary() (data []byte, err error)

func (*CBInfo) MarshalledSize

func (b *CBInfo) MarshalledSize() uint64

func (*CBInfo) UnmarshalBinary

func (b *CBInfo) UnmarshalBinary(data []byte) (err error)

type CBlock

type CBlock struct {
	//Marshalized
	Header    *CBlockHeader
	CBEntries []CBEntry //Interface
	//Not Marshalized
	CBHash   *Hash
	Salt     *Hash
	Chain    *CChain
	IsSealed bool
}

func CreateCBlock

func CreateCBlock(chain *CChain, prev *CBlock, cap uint) (b *CBlock, err error)

func (*CBlock) AddCBEntry

func (b *CBlock) AddCBEntry(e CBEntry) (err error)

func (*CBlock) MarshalBinary

func (b *CBlock) MarshalBinary() (data []byte, err error)

func (*CBlock) MarshalledSize

func (b *CBlock) MarshalledSize() uint64

func (*CBlock) UnmarshalBinary

func (b *CBlock) UnmarshalBinary(data []byte) (err error)

type CBlockHeader

type CBlockHeader struct {
	BlockID       uint64
	PrevBlockHash *Hash
	TimeStamp     int64
	EntryCount    uint32
}

-----------------------

func NewCBlockHeader

func NewCBlockHeader(blockId uint64, prevHash *Hash, merkle *Hash) *CBlockHeader

func (*CBlockHeader) MarshalBinary

func (b *CBlockHeader) MarshalBinary() (data []byte, err error)

func (*CBlockHeader) MarshalledSize

func (b *CBlockHeader) MarshalledSize() uint64

func (*CBlockHeader) UnmarshalBinary

func (b *CBlockHeader) UnmarshalBinary(data []byte) (err error)

type CChain

type CChain struct {
	ChainID      *Hash
	Name         [][]byte
	Blocks       []*CBlock
	CurrentBlock *CBlock
	BlockMutex   sync.Mutex
	NextBlockID  uint64
}

func (*CChain) MarshalBinary

func (b *CChain) MarshalBinary() (data []byte, err error)

func (*CChain) MarshalledSize

func (b *CChain) MarshalledSize() uint64

func (*CChain) UnmarshalBinary

func (b *CChain) UnmarshalBinary(data []byte) (err error)

type DBEntry

type DBEntry struct {
	MerkleRoot *Hash // Different MR in EBlockHeader
	ChainID    *Hash
	// contains filtered or unexported fields
}

func NewDBEntry

func NewDBEntry(eb *EBlock) *DBEntry

func NewDBEntryFromCBlock

func NewDBEntryFromCBlock(cb *CBlock) *DBEntry

func (*DBEntry) EncodableFields

func (e *DBEntry) EncodableFields() map[string]reflect.Value

func (*DBEntry) GetBinaryTimeStamp

func (e *DBEntry) GetBinaryTimeStamp() []byte

func (*DBEntry) Hash

func (e *DBEntry) Hash() *Hash

func (*DBEntry) MarshalBinary

func (e *DBEntry) MarshalBinary() (data []byte, err error)

func (*DBEntry) MarshalledSize

func (e *DBEntry) MarshalledSize() (size uint64)

func (*DBEntry) RealTime

func (e *DBEntry) RealTime() time.Time

func (*DBEntry) SetHash

func (e *DBEntry) SetHash(binaryHash []byte)

func (*DBEntry) SetTimeStamp

func (e *DBEntry) SetTimeStamp(binaryTime []byte)

func (*DBEntry) ShaHash

func (e *DBEntry) ShaHash() *Hash

func (*DBEntry) StampTime

func (e *DBEntry) StampTime()

func (*DBEntry) TimeStamp

func (e *DBEntry) TimeStamp() int64

func (*DBEntry) UnmarshalBinary

func (e *DBEntry) UnmarshalBinary(data []byte) (err error)

type DBInfo

type DBInfo struct {

	// Serial hash for the directory block
	DBHash *Hash

	// BTCTxHash is the Tx hash returned from rpcclient.SendRawTransaction
	BTCTxHash *Hash // use string or *btcwire.ShaHash ???

	// BTCTxOffset is the index of the TX in this BTC block
	BTCTxOffset int

	// BTCBlockHeight is the height of the block where this TX is stored in BTC
	BTCBlockHeight int32

	//BTCBlockHash is the hash of the block where this TX is stored in BTC
	BTCBlockHash *Hash // use string or *btcwire.ShaHash ???

	// DBMerkleRoot is the merkle root of the Directory Block
	// and is written into BTC as OP_RETURN data
	DBMerkleRoot *Hash
}

func NewDBInfoFromDBlock

func NewDBInfoFromDBlock(b *DBlock) *DBInfo

func (*DBInfo) MarshalBinary

func (b *DBInfo) MarshalBinary() (data []byte, err error)

func (*DBInfo) MarshalledSize

func (b *DBInfo) MarshalledSize() uint64

func (*DBInfo) UnmarshalBinary

func (b *DBInfo) UnmarshalBinary(data []byte) (err error)

type DBlock

type DBlock struct {
	//Marshalized
	Header    *DBlockHeader
	DBEntries []*DBEntry
	Salt      *Hash

	//Not Marshalized
	Chain    *DChain
	IsSealed bool
	DBHash   *Hash
}

func CreateDBlock

func CreateDBlock(chain *DChain, prev *DBlock, cap uint) (b *DBlock, err error)

func (*DBlock) CalculateMerkleRoot

func (b *DBlock) CalculateMerkleRoot() *Hash

func (*DBlock) EncodableFields

func (b *DBlock) EncodableFields() map[string]reflect.Value

func (*DBlock) MarshalBinary

func (b *DBlock) MarshalBinary() (data []byte, err error)

func (*DBlock) MarshalledSize

func (b *DBlock) MarshalledSize() uint64

func (*DBlock) UnmarshalBinary

func (b *DBlock) UnmarshalBinary(data []byte) (err error)

type DBlockHeader

type DBlockHeader struct {
	BlockID       uint64
	PrevBlockHash *Hash
	MerkleRoot    *Hash
	Version       int32
	TimeStamp     int64
	BatchFlag     byte // 1: start of the batch
	EntryCount    uint32
}

func NewDBlockHeader

func NewDBlockHeader(blockId uint64, prevHash *Hash, version int32,
	count uint32) *DBlockHeader

func (*DBlockHeader) MarshalBinary

func (b *DBlockHeader) MarshalBinary() (data []byte, err error)

func (*DBlockHeader) MarshalledSize

func (b *DBlockHeader) MarshalledSize() uint64

func (*DBlockHeader) RealTime

func (b *DBlockHeader) RealTime() time.Time

func (*DBlockHeader) UnmarshalBinary

func (b *DBlockHeader) UnmarshalBinary(data []byte) (err error)

type DChain

type DChain struct {
	ChainID      *Hash
	Blocks       []*DBlock
	CurrentBlock *DBlock
	BlockMutex   sync.Mutex
	NextBlockID  uint64
}

func (*DChain) AddCBlockToDBEntry

func (dchain *DChain) AddCBlockToDBEntry(cb *CBlock) (err error)

Add DBEntry from an Entry Credit Block

func (*DChain) AddDBEntry

func (dchain *DChain) AddDBEntry(eb *EBlock) (err error)

Add DBEntry from an Entry Block

func (*DChain) AddFBlockToDBEntry

func (dchain *DChain) AddFBlockToDBEntry(dbEntry *DBEntry) (err error)

Add DBEntry from a Factoid Block

type DetachedPublicKey

type DetachedPublicKey [ed25519.PublicKeySize]byte

type DetachedSignature

type DetachedSignature [ed25519.SignatureSize]byte

func (*DetachedSignature) String

func (ds *DetachedSignature) String() string

type EBEntry

type EBEntry struct {
	ChainID *[]byte // not marshalllized
	// contains filtered or unexported fields
}

func NewEBEntry

func NewEBEntry(h *Hash, id *[]byte) *EBEntry

func (*EBEntry) EncodableFields

func (e *EBEntry) EncodableFields() map[string]reflect.Value

func (*EBEntry) GetBinaryTimeStamp

func (e *EBEntry) GetBinaryTimeStamp() []byte

func (*EBEntry) Hash

func (e *EBEntry) Hash() *Hash

func (*EBEntry) MarshalBinary

func (e *EBEntry) MarshalBinary() ([]byte, error)

func (*EBEntry) MarshalledSize

func (e *EBEntry) MarshalledSize() uint64

func (*EBEntry) RealTime

func (e *EBEntry) RealTime() time.Time

func (*EBEntry) SetHash

func (e *EBEntry) SetHash(binaryHash []byte)

func (*EBEntry) SetIntTimeStamp

func (e *EBEntry) SetIntTimeStamp(ts int64)

func (*EBEntry) SetTimeStamp

func (e *EBEntry) SetTimeStamp(binaryTime []byte)

func (*EBEntry) ShaHash

func (e *EBEntry) ShaHash() *Hash

func (*EBEntry) StampTime

func (e *EBEntry) StampTime()

func (*EBEntry) TimeStamp

func (e *EBEntry) TimeStamp() int64

func (*EBEntry) UnmarshalBinary

func (e *EBEntry) UnmarshalBinary(data []byte) (err error)

type EBInfo

type EBInfo struct {
	EBHash     *Hash
	MerkleRoot *Hash
	DBHash     *Hash
	DBBlockNum uint64
	ChainID    *Hash
}

func (*EBInfo) MarshalBinary

func (b *EBInfo) MarshalBinary() (data []byte, err error)

func (*EBInfo) MarshalledSize

func (b *EBInfo) MarshalledSize() (size uint64)

func (*EBInfo) UnmarshalBinary

func (b *EBInfo) UnmarshalBinary(data []byte) (err error)

type EBlock

type EBlock struct {
	//Marshalized
	Header    *EBlockHeader
	EBEntries []*EBEntry

	//Not Marshalized
	EBHash     *Hash
	MerkleRoot *Hash
	Salt       *Hash
	Chain      *EChain
	IsSealed   bool
}

func CreateBlock

func CreateBlock(chain *EChain, prev *EBlock, capacity uint) (b *EBlock, err error)

func (*EBlock) AddEBEntry

func (b *EBlock) AddEBEntry(e *Entry) (err error)

func (*EBlock) MarshalBinary

func (b *EBlock) MarshalBinary() (data []byte, err error)

func (*EBlock) MarshalledSize

func (b *EBlock) MarshalledSize() (size uint64)

func (*EBlock) UnmarshalBinary

func (b *EBlock) UnmarshalBinary(data []byte) (err error)

type EBlockHeader

type EBlockHeader struct {
	BlockID       uint64
	PrevBlockHash *Hash
	TimeStamp     int64
}

func NewEBlockHeader

func NewEBlockHeader(blockId uint64, prevHash *Hash, merkle *Hash) *EBlockHeader

func (*EBlockHeader) MarshalBinary

func (b *EBlockHeader) MarshalBinary() (data []byte, err error)

func (*EBlockHeader) MarshalledSize

func (b *EBlockHeader) MarshalledSize() uint64

func (*EBlockHeader) RealTime

func (e *EBlockHeader) RealTime() time.Time

func (*EBlockHeader) UnmarshalBinary

func (b *EBlockHeader) UnmarshalBinary(data []byte) (err error)

type ECBalance

type ECBalance struct {
	PublicKey *Hash
	Credits   int32
}

type EChain

type EChain struct {
	//Marshalized
	ChainID    *Hash
	Name       [][]byte
	FirstEntry *Entry

	//Not Marshalized
	Blocks       []*EBlock
	CurrentBlock *EBlock
	BlockMutex   sync.Mutex
	NextBlockID  uint64
}

func (*EChain) EncodableFields

func (b *EChain) EncodableFields() map[string]reflect.Value

For Json marshaling

func (*EChain) GenerateIDFromName

func (b *EChain) GenerateIDFromName() (chainID *Hash, err error)

To generate a chain id (hash) from a binary array name The algorithm is chainID = Sha(Sha(Name[0]) + Sha(Name[1] + ... + Sha(Name[n])

func (*EChain) MarshalBinary

func (b *EChain) MarshalBinary() (data []byte, err error)

func (*EChain) MarshalledSize

func (b *EChain) MarshalledSize() uint64

func (*EChain) UnmarshalBinary

func (b *EChain) UnmarshalBinary(data []byte) (err error)

type Entry

type Entry struct {
	ChainID Hash
	ExtIDs  [][]byte
	Data    []byte
}

func (*Entry) MarshalBinary

func (e *Entry) MarshalBinary() ([]byte, error)

func (*Entry) MarshalledSize

func (e *Entry) MarshalledSize() uint64

func (*Entry) UnmarshalBinary

func (e *Entry) UnmarshalBinary(data []byte) (err error)

type EntryInfo

type EntryInfo struct {
	EntryHash  *Hash
	EBHash     *Hash
	EBBlockNum uint64
}

func (*EntryInfo) MarshalBinary

func (e *EntryInfo) MarshalBinary() (data []byte, err error)

func (*EntryInfo) MarshalledSize

func (e *EntryInfo) MarshalledSize() uint64

func (*EntryInfo) UnmarshalBinary

func (e *EntryInfo) UnmarshalBinary(data []byte) (err error)

type EntryInfoBranch

type EntryInfoBranch struct {
	EntryHash *Hash
	EntryInfo *EntryInfo
	EBInfo    *EBInfo
	DBInfo    *DBInfo
}

type Error

type Error struct {
	APICode     uint
	HTTPCode    int
	Name        string
	Description string
	SupportURL  string
	Message     string
}

func CreateError

func CreateError(code uint, message string) *Error

func Marshal

func Marshal(resource interface{}, accept string, writer io.Writer, alt bool) (r *Error)

func (*Error) Error

func (r *Error) Error() string

type Hash

type Hash struct {
	Bytes []byte `json:"bytes"`
}

func BuildMerkleTreeStore

func BuildMerkleTreeStore(hashes []*Hash) (merkles []*Hash)

func CreateHash

func CreateHash(entities ...BinaryMarshallable) (h *Hash, err error)

func HexToHash

func HexToHash(hexStr string) (h *Hash, err error)

func NewHash

func NewHash() *Hash

func NewShaHash

func NewShaHash(newHash []byte) (*Hash, error)

NewShaHash returns a new ShaHash from a byte slice. An error is returned if the number of bytes passed in is not HashSize.

func Sha

func Sha(p []byte) (h *Hash)

func (*Hash) BTCString

func (h *Hash) BTCString() string

String returns the ShaHash in the standard bitcoin big-endian form.

func (*Hash) ByteString

func (h *Hash) ByteString() string

func (*Hash) Decoding

func (*Hash) Encoding

func (h *Hash) Encoding(m gocoding.Marshaller, t reflect.Type) gocoding.Encoder

func (*Hash) GetBytes

func (h *Hash) GetBytes() []byte

func (*Hash) IsSameAs

func (a *Hash) IsSameAs(b *Hash) bool

Compare two Hashes

func (*Hash) MarshalBinary

func (h *Hash) MarshalBinary() ([]byte, error)

func (*Hash) MarshalledSize

func (h *Hash) MarshalledSize() uint64

func (*Hash) SetBytes

func (hash *Hash) SetBytes(newHash []byte) error

SetBytes sets the bytes which represent the hash. An error is returned if the number of bytes passed in is not HashSize.

func (*Hash) String

func (h *Hash) String() string

func (*Hash) UnmarshalBinary

func (h *Hash) UnmarshalBinary(p []byte) error

type HashF

type HashF [HashSize]byte

Fixed sixe hash used for map, where byte slice wont work

func (*HashF) From

func (h *HashF) From(hash *Hash)

func (HashF) Hash

func (h HashF) Hash() Hash

type PayChainCBEntry

type PayChainCBEntry struct {
	CBEntry          //interface
	EntryHash        *Hash
	ChainIDHash      *Hash
	EntryChainIDHash *Hash //Hash(EntryHash+ChainIDHash)
	// contains filtered or unexported fields
}

func NewPayChainCBEntry

func NewPayChainCBEntry(pubKey *Hash, entryHash *Hash, credits int32,
	chainIDHash *Hash, entryChainIDHash *Hash) *PayChainCBEntry

func (*PayChainCBEntry) Credits

func (e *PayChainCBEntry) Credits() int32

func (*PayChainCBEntry) MarshalBinary

func (e *PayChainCBEntry) MarshalBinary() (data []byte, err error)

func (*PayChainCBEntry) MarshalledSize

func (e *PayChainCBEntry) MarshalledSize() uint64

func (*PayChainCBEntry) PublicKey

func (e *PayChainCBEntry) PublicKey() *Hash

func (*PayChainCBEntry) Type

func (e *PayChainCBEntry) Type() byte

func (*PayChainCBEntry) UnmarshalBinary

func (e *PayChainCBEntry) UnmarshalBinary(data []byte) (err error)

type PayEntryCBEntry

type PayEntryCBEntry struct {
	CBEntry   //interface
	EntryHash *Hash
	TimeStamp int64
	// contains filtered or unexported fields
}

func NewPayEntryCBEntry

func NewPayEntryCBEntry(pubKey *Hash, entryHash *Hash, credits int32,
	timeStamp int64) *PayEntryCBEntry

func (*PayEntryCBEntry) Credits

func (e *PayEntryCBEntry) Credits() int32

func (*PayEntryCBEntry) MarshalBinary

func (e *PayEntryCBEntry) MarshalBinary() (data []byte, err error)

func (*PayEntryCBEntry) MarshalledSize

func (e *PayEntryCBEntry) MarshalledSize() uint64

func (*PayEntryCBEntry) PublicKey

func (e *PayEntryCBEntry) PublicKey() *Hash

func (*PayEntryCBEntry) Type

func (e *PayEntryCBEntry) Type() byte

func (*PayEntryCBEntry) UnmarshalBinary

func (e *PayEntryCBEntry) UnmarshalBinary(data []byte) (err error)

type PrivateKey

type PrivateKey struct {
	Key *[ed25519.PrivateKeySize]byte
	Pub PublicKey
}

PrivateKey contains Public/Private key pair

func (*PrivateKey) AllocateNew

func (pk *PrivateKey) AllocateNew()

func (*PrivateKey) GenerateKey

func (pk *PrivateKey) GenerateKey() (err error)

Generate creates new PrivateKey / PublciKey pair or returns error

func (PrivateKey) MarshalSign

func (pk PrivateKey) MarshalSign(msg BinaryMarshallable) (sig Signature)

Sign signs msg with PrivateKey and return Signature

func (PrivateKey) Public

func (pk PrivateKey) Public() []byte

func (PrivateKey) Sign

func (pk PrivateKey) Sign(msg []byte) (sig Signature)

Sign signs msg with PrivateKey and return Signature

type PublicKey

type PublicKey struct {
	Key *[ed25519.PublicKeySize]byte
}

PublicKey contains only Public part of Public/Private key pair

func PubKeyFromString

func PubKeyFromString(instr string) (pk PublicKey)

func (PublicKey) String

func (pk PublicKey) String() string

func (PublicKey) Verify

func (k PublicKey) Verify(msg []byte, sig *[ed25519.SignatureSize]byte) bool

type Signature

type Signature struct {
	Pub PublicKey
	Sig *[ed25519.SignatureSize]byte
}

Signature has signed data and its corresponsing PublicKey

func UnmarshalBinarySignature

func UnmarshalBinarySignature(data []byte) (sig Signature)

func (*Signature) DetachSig

func (sig *Signature) DetachSig() *DetachedSignature

func (Signature) Key

func (sig Signature) Key() []byte

func (Signature) Verify

func (sig Signature) Verify(msg []byte) bool

Verify returns true iff sig is a valid signature of msg by PublicKey.

type Signer

type Signer interface {
	Sign(msg []byte) Signature
}

Signer object can Sign msg

type SimpleData

type SimpleData struct {
	Data []byte
}

func (*SimpleData) MarshalBinary

func (d *SimpleData) MarshalBinary() ([]byte, error)

func (*SimpleData) MarshalledSize

func (d *SimpleData) MarshalledSize() uint64

func (*SimpleData) UnmarshalBinary

func (d *SimpleData) UnmarshalBinary([]byte) error

type Verifyer

type Verifyer interface {
	Verify(msg []byte) bool
}

Verifyer objects can Verify signed messages

Jump to

Keyboard shortcuts

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