Documentation ¶
Index ¶
- Constants
- func IsMnemonicValid(mnemonic string) bool
- func MiraclToHerumiPK(pk string) string
- func Sha3Sum256(data string) string
- type BLS0ChainScheme
- func (b0 *BLS0ChainScheme) Add(signature, msg string) (string, error)
- func (b0 *BLS0ChainScheme) GenerateKeys() (*Wallet, error)
- func (b0 *BLS0ChainScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
- func (b0 *BLS0ChainScheme) GetID() string
- func (b0 *BLS0ChainScheme) GetMnemonic() string
- func (b0 *BLS0ChainScheme) GetPrivateKey() string
- func (b0 *BLS0ChainScheme) GetPrivateKeyAsByteArray() ([]byte, error)
- func (b0 *BLS0ChainScheme) GetPublicKey() string
- func (b0 *BLS0ChainScheme) RecoverKeys(mnemonic string) (*Wallet, error)
- func (b0 *BLS0ChainScheme) SetID(id string) error
- func (b0 *BLS0ChainScheme) SetPrivateKey(privateKey string) error
- func (b0 *BLS0ChainScheme) SetPublicKey(publicKey string) error
- func (b0 *BLS0ChainScheme) Sign(hash string) (string, error)
- func (b0 *BLS0ChainScheme) SplitKeys(numSplits int) (*Wallet, error)
- func (b0 *BLS0ChainScheme) Verify(signature, msg string) (bool, error)
- type BLS0ChainThresholdScheme
- type ED255190chainScheme
- func (ed *ED255190chainScheme) Add(signature, msg string) (string, error)
- func (ed *ED255190chainScheme) GenerateKeys() (*Wallet, error)
- func (ed *ED255190chainScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
- func (ed *ED255190chainScheme) GetID() string
- func (b0 *ED255190chainScheme) GetMnemonic() string
- func (ed *ED255190chainScheme) GetPrivateKey() string
- func (ed *ED255190chainScheme) GetPrivateKeyAsByteArray() ([]byte, error)
- func (ed *ED255190chainScheme) GetPublicKey() string
- func (ed *ED255190chainScheme) RecoverKeys(mnemonic string) (*Wallet, error)
- func (ed *ED255190chainScheme) SetID(id string) error
- func (ed *ED255190chainScheme) SetPrivateKey(privateKey string) error
- func (ed *ED255190chainScheme) SetPublicKey(publicKey string) error
- func (ed *ED255190chainScheme) Sign(hash string) (string, error)
- func (b0 *ED255190chainScheme) SplitKeys(numSplits int) (*Wallet, error)
- func (ed *ED255190chainScheme) Verify(signature, msg string) (bool, error)
- type KeyPair
- type MiraclScheme
- func (b0 *MiraclScheme) Add(signature, msg string) (string, error)
- func (b0 *MiraclScheme) GenerateKeys() (*Wallet, error)
- func (b0 *MiraclScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
- func (b0 *MiraclScheme) GetMnemonic() string
- func (b0 *MiraclScheme) GetPrivateKey() string
- func (b0 *MiraclScheme) GetPrivateKeyAsByteArray() ([]byte, error)
- func (b0 *MiraclScheme) GetPublicKey() string
- func (b0 *MiraclScheme) RecoverKeys(mnemonic string) (*Wallet, error)
- func (b0 *MiraclScheme) SetPrivateKey(privateKey string) error
- func (b0 *MiraclScheme) SetPublicKey(publicKey string) error
- func (b0 *MiraclScheme) Sign(hash string) (string, error)
- func (b0 *MiraclScheme) SplitKeys(numSplits int) (*Wallet, error)
- func (b0 *MiraclScheme) Verify(signature, msg string) (bool, error)
- type MiraclThresholdScheme
- type SignatureScheme
- type SplitSignatureScheme
- type ThresholdSignatureScheme
- type Wallet
Constants ¶
const CryptoVersion = "1.0"
Variables ¶
This section is empty.
Functions ¶
func IsMnemonicValid ¶
func MiraclToHerumiPK ¶
This is an example of the same MIRACL public key serialized with ToString(). pk ([1bdfed3a85690775ee35c61678957aaba7b1a1899438829f1dc94248d87ed368,18a02c6bd223ae0dfda1d2f9a3c81726ab436ce5e9d17c531ff0a385a13a0b49],[039ac7dfc3364e851ebd2631ea6f1685609fc66d50223cc696cb59ff2fee47ac,17f6dfafec19bfa87bf791a4d694f43fec227ae6f5a867490e30328cac05eaff])
func Sha3Sum256 ¶
Types ¶
type BLS0ChainScheme ¶
type BLS0ChainScheme struct { PublicKey string `json:"public_key"` PrivateKey string `json:"private_key"` Mnemonic string `json:"mnemonic"` Ids string `json:"threshold_scheme_id"` // contains filtered or unexported fields }
BLS0ChainScheme - a signature scheme for BLS0Chain Signature
func NewBLS0ChainScheme ¶
func NewBLS0ChainScheme() *BLS0ChainScheme
NewBLS0ChainScheme - create a BLS0ChainScheme object
func (*BLS0ChainScheme) GenerateKeys ¶
func (b0 *BLS0ChainScheme) GenerateKeys() (*Wallet, error)
GenerateKeys - implement interface
func (*BLS0ChainScheme) GenerateKeysWithEth ¶
func (b0 *BLS0ChainScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
func (*BLS0ChainScheme) GetID ¶ added in v1.3.1
func (b0 *BLS0ChainScheme) GetID() string
GetID gets ID in hex string format
func (*BLS0ChainScheme) GetMnemonic ¶ added in v1.3.1
func (b0 *BLS0ChainScheme) GetMnemonic() string
func (*BLS0ChainScheme) GetPrivateKey ¶
func (b0 *BLS0ChainScheme) GetPrivateKey() string
func (*BLS0ChainScheme) GetPrivateKeyAsByteArray ¶
func (b0 *BLS0ChainScheme) GetPrivateKeyAsByteArray() ([]byte, error)
GetPrivateKeyAsByteArray - converts private key into byte array
func (*BLS0ChainScheme) GetPublicKey ¶
func (b0 *BLS0ChainScheme) GetPublicKey() string
GetPublicKey - implement interface
func (*BLS0ChainScheme) RecoverKeys ¶
func (b0 *BLS0ChainScheme) RecoverKeys(mnemonic string) (*Wallet, error)
func (*BLS0ChainScheme) SetID ¶ added in v1.3.1
func (b0 *BLS0ChainScheme) SetID(id string) error
SetID sets ID in HexString format
func (*BLS0ChainScheme) SetPrivateKey ¶
func (b0 *BLS0ChainScheme) SetPrivateKey(privateKey string) error
SetPrivateKey - implement interface
func (*BLS0ChainScheme) SetPublicKey ¶
func (b0 *BLS0ChainScheme) SetPublicKey(publicKey string) error
SetPublicKey - implement interface
func (*BLS0ChainScheme) Sign ¶
func (b0 *BLS0ChainScheme) Sign(hash string) (string, error)
Sign - implement interface
type BLS0ChainThresholdScheme ¶
type BLS0ChainThresholdScheme struct { BLS0ChainScheme Ids string `json:"threshold_scheme_id"` // contains filtered or unexported fields }
BLS0ChainThresholdScheme - a scheme that can create threshold signature shares for BLS0Chain signature scheme
func NewBLS0ChainThresholdScheme ¶
func NewBLS0ChainThresholdScheme() *BLS0ChainThresholdScheme
NewBLS0ChainThresholdScheme - create a new instance
func (*BLS0ChainThresholdScheme) GetID ¶
func (tss *BLS0ChainThresholdScheme) GetID() string
GetID gets ID in hex string format
func (*BLS0ChainThresholdScheme) SetID ¶
func (tss *BLS0ChainThresholdScheme) SetID(id string) error
SetID sets ID in HexString format
type ED255190chainScheme ¶
type ED255190chainScheme struct {
// contains filtered or unexported fields
}
ED255190chainScheme - a signature scheme based on ED25519
func NewED255190chainScheme ¶
func NewED255190chainScheme() *ED255190chainScheme
NewED255190chainScheme - create a ED255190chainScheme object
func (*ED255190chainScheme) Add ¶
func (ed *ED255190chainScheme) Add(signature, msg string) (string, error)
func (*ED255190chainScheme) GenerateKeys ¶
func (ed *ED255190chainScheme) GenerateKeys() (*Wallet, error)
GenerateKeys - implement interface
func (*ED255190chainScheme) GenerateKeysWithEth ¶
func (ed *ED255190chainScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
GenerateKeysWithEth - not implemented
func (*ED255190chainScheme) GetID ¶ added in v1.3.1
func (ed *ED255190chainScheme) GetID() string
GetID gets ID in hex string format
func (*ED255190chainScheme) GetMnemonic ¶ added in v1.3.1
func (b0 *ED255190chainScheme) GetMnemonic() string
func (*ED255190chainScheme) GetPrivateKey ¶
func (ed *ED255190chainScheme) GetPrivateKey() string
GetPrivateKey - implement interface
func (*ED255190chainScheme) GetPrivateKeyAsByteArray ¶ added in v1.3.1
func (ed *ED255190chainScheme) GetPrivateKeyAsByteArray() ([]byte, error)
GetPrivateKeyAsByteArray - converts private key into byte array
func (*ED255190chainScheme) GetPublicKey ¶
func (ed *ED255190chainScheme) GetPublicKey() string
GetPublicKey - implement interface
func (*ED255190chainScheme) RecoverKeys ¶
func (ed *ED255190chainScheme) RecoverKeys(mnemonic string) (*Wallet, error)
func (*ED255190chainScheme) SetID ¶ added in v1.3.1
func (ed *ED255190chainScheme) SetID(id string) error
SetID sets ID in HexString format
func (*ED255190chainScheme) SetPrivateKey ¶
func (ed *ED255190chainScheme) SetPrivateKey(privateKey string) error
func (*ED255190chainScheme) SetPublicKey ¶
func (ed *ED255190chainScheme) SetPublicKey(publicKey string) error
type MiraclScheme ¶ added in v1.3.1
type MiraclScheme struct { PublicKey string `json:"public_key"` PrivateKey string `json:"private_key"` Mnemonic string `json:"mnemonic"` }
MiraclScheme - a signature scheme for BLS0Chain Signature
func NewMiraclScheme ¶ added in v1.3.1
func NewMiraclScheme() *MiraclScheme
NewMiraclScheme - create a MiraclScheme object
func (*MiraclScheme) Add ¶ added in v1.3.1
func (b0 *MiraclScheme) Add(signature, msg string) (string, error)
func (*MiraclScheme) GenerateKeys ¶ added in v1.3.1
func (b0 *MiraclScheme) GenerateKeys() (*Wallet, error)
GenerateKeys generate fresh keys
func (*MiraclScheme) GenerateKeysWithEth ¶ added in v1.3.1
func (b0 *MiraclScheme) GenerateKeysWithEth(mnemonic, password string) (*Wallet, error)
GenerateKeysWithEth generate fresh keys based on eth wallet
func (*MiraclScheme) GetMnemonic ¶ added in v1.3.1
func (b0 *MiraclScheme) GetMnemonic() string
func (*MiraclScheme) GetPrivateKey ¶ added in v1.3.1
func (b0 *MiraclScheme) GetPrivateKey() string
func (*MiraclScheme) GetPrivateKeyAsByteArray ¶ added in v1.3.1
func (b0 *MiraclScheme) GetPrivateKeyAsByteArray() ([]byte, error)
GetPrivateKeyAsByteArray - converts private key into byte array
func (*MiraclScheme) GetPublicKey ¶ added in v1.3.1
func (b0 *MiraclScheme) GetPublicKey() string
GetPublicKey - implement interface
func (*MiraclScheme) RecoverKeys ¶ added in v1.3.1
func (b0 *MiraclScheme) RecoverKeys(mnemonic string) (*Wallet, error)
RecoverKeys recovery keys from mnemonic
func (*MiraclScheme) SetPrivateKey ¶ added in v1.3.1
func (b0 *MiraclScheme) SetPrivateKey(privateKey string) error
SetPrivateKey set private key to sign
func (*MiraclScheme) SetPublicKey ¶ added in v1.3.1
func (b0 *MiraclScheme) SetPublicKey(publicKey string) error
SetPublicKey - implement interface
func (*MiraclScheme) Sign ¶ added in v1.3.1
func (b0 *MiraclScheme) Sign(hash string) (string, error)
Sign sign message
type MiraclThresholdScheme ¶ added in v1.3.1
type MiraclThresholdScheme struct { MiraclScheme Ids string `json:"threshold_scheme_id"` // contains filtered or unexported fields }
MiraclThresholdScheme - a scheme that can create threshold signature shares for BLS0Chain signature scheme
func NewMiraclThresholdScheme ¶ added in v1.3.1
func NewMiraclThresholdScheme() *MiraclThresholdScheme
NewMiraclThresholdScheme - create a new instance
func (*MiraclThresholdScheme) GetID ¶ added in v1.3.1
func (mts *MiraclThresholdScheme) GetID() string
GetID gets ID in hex string format
func (*MiraclThresholdScheme) SetID ¶ added in v1.3.1
func (mts *MiraclThresholdScheme) SetID(id string) error
SetID sets ID in HexString format
type SignatureScheme ¶
type SignatureScheme interface { // Generate fresh keys GenerateKeys() (*Wallet, error) // Generate fresh keys based on eth wallet GenerateKeysWithEth(mnemonic, password string) (*Wallet, error) // Generate keys from mnemonic for recovery RecoverKeys(mnemonic string) (*Wallet, error) GetMnemonic() string // Signing - Set private key to sign SetPrivateKey(privateKey string) error Sign(hash string) (string, error) // Signature verification - Set public key to verify SetPublicKey(publicKey string) error GetPublicKey() string GetPrivateKey() string Verify(signature string, msg string) (bool, error) // Combine signature for schemes BLS Add(signature, msg string) (string, error) SplitKeys(numSplits int) (*Wallet, error) GetPrivateKeyAsByteArray() ([]byte, error) }
SignatureScheme - an encryption scheme for signing and verifying messages
func NewSignatureScheme ¶
func NewSignatureScheme(sigScheme string) SignatureScheme
NewSignatureScheme creates an instance for using signature functions
type SplitSignatureScheme ¶
type SplitSignatureScheme interface { SignatureScheme SplitKeys(numSplits int) (*Wallet, error) }
SplitSignatureScheme splits the primary key into number of parts.
type ThresholdSignatureScheme ¶
type ThresholdSignatureScheme interface { SignatureScheme SetID(id string) error GetID() string }
func GenerateThresholdKeyShares ¶ added in v1.3.1
func GenerateThresholdKeyShares(t, n int, originalKey SignatureScheme) ([]ThresholdSignatureScheme, error)
GenerateThresholdKeyShares given a signature scheme will generate threshold sig keys
func UnmarshalThresholdSignatureSchemes ¶ added in v1.3.1
func UnmarshalThresholdSignatureSchemes(sigScheme string, obj interface{}) ([]ThresholdSignatureScheme, error)
UnmarshalThresholdSignatureSchemes unmarshal ThresholdSignatureScheme from json string