Documentation ¶
Index ¶
- Constants
- func NewKeys() (*PublicKey, *SecretKey, error)
- func NewKeysFromReader(reader io.Reader) (*PublicKey, *SecretKey, error)
- type BitVector
- func (vector *BitVector) Append(bit byte)
- func (vector *BitVector) Bytes() []byte
- func (vector *BitVector) Delete(index int)
- func (vector *BitVector) Element(i int) byte
- func (vector *BitVector) Insert(bit byte, index int)
- func (vector *BitVector) Length() int
- func (vector *BitVector) Set(bit byte, index int)
- type Context
- type MinaTSchnorrHandler
- type NetworkType
- type Permutation
- type PublicKey
- func (pk PublicKey) GenerateAddress() string
- func (pk PublicKey) MarshalBinary() ([]byte, error)
- func (pk *PublicKey) ParseAddress(b58 string) error
- func (pk *PublicKey) SetPointPallas(pallas *curves.PointPallas)
- func (pk *PublicKey) UnmarshalBinary(input []byte) error
- func (pk *PublicKey) VerifyMessage(sig *Signature, message string) error
- func (pk *PublicKey) VerifyTransaction(sig *Signature, transaction *Transaction) error
- type SBox
- type SecretKey
- func (sk SecretKey) GetPublicKey() *PublicKey
- func (sk SecretKey) MarshalBinary() ([]byte, error)
- func (sk *SecretKey) SetFq(fq *fq.Fq)
- func (sk *SecretKey) SignMessage(message string) (*Signature, error)
- func (sk *SecretKey) SignTransaction(transaction *Transaction) (*Signature, error)
- func (sk *SecretKey) UnmarshalBinary(input []byte) error
- type Signature
- type Transaction
Constants ¶
const ( Cube = iota // x^3 Quint // x^5 Sept // x^7 Inverse // x^-1 )
const ( ThreeW = iota FiveW Three )
const ( TestNet = iota MainNet NullNet )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BitVector ¶
type BitVector struct {
// contains filtered or unexported fields
}
A BitVector is a variable sized vector of bits. It supports lookups, sets, appends, insertions, and deletions.
This class is not thread safe.
func NewBitVector ¶
NewBitVector creates and initializes a new bit vector with length elements, using data as its initial contents.
func (*BitVector) Bytes ¶
Bytes returns a slice of the contents of the bit vector. If the caller changes the returned slice, the contents of the bit vector may change.
func (*BitVector) Delete ¶
Delete removes the bit in the supplied index of the bit vector. All bits in positions greater than or equal to index before the call will be shifted down by one.
func (*BitVector) Element ¶
Element returns the bit in the ith index of the bit vector. Returned value is either 1 or 0.
func (*BitVector) Insert ¶
Insert inserts bit into the supplied index of the bit vector. All bits in positions greater than or equal to index before the call will be shifted up by one.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) Init ¶
func (ctx *Context) Init(pType Permutation, networkId NetworkType) *Context
type MinaTSchnorrHandler ¶
type MinaTSchnorrHandler struct{}
type Permutation ¶
type Permutation int
Permutation is the permute function to use
func (Permutation) Permute ¶
func (p Permutation) Permute(ctx *Context)
Permute executes the poseidon hash function
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is the verification key
func (PublicKey) GenerateAddress ¶
GenerateAddress converts the public key to an address
func (PublicKey) MarshalBinary ¶
func (*PublicKey) ParseAddress ¶
ParseAddress converts a given string into a public key returning an error on failure
func (*PublicKey) SetPointPallas ¶
func (pk *PublicKey) SetPointPallas(pallas *curves.PointPallas)
func (*PublicKey) UnmarshalBinary ¶
func (*PublicKey) VerifyMessage ¶
VerifyMessage checks if the claimed signature on a _string_ is valid. this is nonstandard; see above.
func (*PublicKey) VerifyTransaction ¶
func (pk *PublicKey) VerifyTransaction(sig *Signature, transaction *Transaction) error
VerifyTransaction checks if the signature is over the given transaction using this public key
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey is the signing key
func (SecretKey) GetPublicKey ¶
GetPublicKey returns the corresponding verification
func (SecretKey) MarshalBinary ¶
func (*SecretKey) SignMessage ¶
SignMessage signs a _string_. this is somewhat non-standard; we do it by just adding bytes to the roinput. See https://github.com/MinaProtocol/c-reference-signer/blob/master/crypto.c#L1020
func (*SecretKey) SignTransaction ¶
func (sk *SecretKey) SignTransaction(transaction *Transaction) (*Signature, error)
SignTransaction generates a signature over the specified txn and network id See https://github.com/MinaProtocol/c-reference-signer/blob/master/crypto.c#L1020
func (*SecretKey) UnmarshalBinary ¶
type Signature ¶
Signature is a Mina compatible signature either for payment or delegation
func (Signature) MarshalBinary ¶
func (*Signature) UnmarshalBinary ¶
type Transaction ¶
type Transaction struct {
Fee, FeeToken uint64
FeePayerPk *PublicKey
Nonce, ValidUntil uint32
Memo string
Tag [3]bool
SourcePk, ReceiverPk *PublicKey
TokenId, Amount uint64
Locked bool
NetworkId NetworkType
}
Transaction is a Mina transaction for payments or delegations
func (*Transaction) MarshalBinary ¶
func (txn *Transaction) MarshalBinary() ([]byte, error)
func (*Transaction) UnmarshalBinary ¶
func (txn *Transaction) UnmarshalBinary(input []byte) error
func (*Transaction) UnmarshalJSON ¶
func (txn *Transaction) UnmarshalJSON(input []byte) error