Documentation ¶
Index ¶
- func DeserializeECDSASecp256k1Signature(sigBytes []byte) (*curves.EcdsaSignature, error)
- func GetEncryptionKeyFromSecp256k1(publicKey PubKey) ([]byte, error)
- func GetSecretFromSecp256k1(publicKey PubKey) (*accumulator.SecretKey, error)
- func RunIteratedProtocol(firstParty pv1.Iterator, secondParty pv1.Iterator) (error, error)
- func SerializeECDSASecp256k1Signature(sig *curves.EcdsaSignature) ([]byte, error)
- func StringListToZkElements(strs ...string) []accumulator.Element
- func StringToZkElement(str string) accumulator.Element
- type EncKeyshareSet
- func (kss *EncKeyshareSet) DecryptUserKeyshare(key crypto.EncryptionKey) (KeyshareSet, error)
- func (kss *EncKeyshareSet) FormatDID(ct crypto.CoinType) string
- func (kss *EncKeyshareSet) GetAccountData(ct crypto.CoinType) *crypto.AccountData
- func (kss *EncKeyshareSet) Marshal() ([]byte, error)
- func (kss *EncKeyshareSet) PublicKey() *secp256k1.PubKey
- func (kss *EncKeyshareSet) Unmarshal(bz []byte) error
- type Keyshare
- func (ks *Keyshare) FormatAddress(ct sonrcrypto.CoinType) (string, error)
- func (ks *Keyshare) FormatDID(ct sonrcrypto.CoinType) (string, error)
- func (ks *Keyshare) GetAliceDKGResult() (*dkg.AliceOutput, error)
- func (ks *Keyshare) GetBobDKGResult() (*dkg.BobOutput, error)
- func (ks *Keyshare) MarshalPrivate() ([]byte, error)
- func (ks *Keyshare) MarshalPublic() ([]byte, error)
- func (ks *Keyshare) PubKey() (*secp256k1.PubKey, error)
- func (ks *Keyshare) PublicPoint() (*curves.EcPoint, error)
- func (ks *Keyshare) UnmarshalPrivate(bz []byte) error
- func (ks *Keyshare) UnmarshalPublic(bz []byte) error
- func (ks *Keyshare) Verify(msg []byte, sigBz []byte) (bool, error)
- type KeyshareRole
- type KeyshareSet
- func (kss KeyshareSet) Alice() *Keyshare
- func (kss KeyshareSet) Bob() *Keyshare
- func (kss KeyshareSet) DKGAtIndex(i int) *protocol.Message
- func (kss KeyshareSet) EncryptUserKeyshare(c crypto.EncryptionKey) (*EncKeyshareSet, error)
- func (kss KeyshareSet) FormatAddress(ct crypto.CoinType) string
- func (kss KeyshareSet) FormatDID(ct crypto.CoinType) string
- func (wa KeyshareSet) GetAccountData(ct crypto.CoinType) *crypto.AccountData
- func (kss KeyshareSet) IsValid() error
- func (kss KeyshareSet) PublicKey() *secp256k1.PubKey
- func (kss KeyshareSet) Sign(msg []byte) ([]byte, error)
- func (kss KeyshareSet) Verify(msg []byte, sigBz []byte) (bool, error)
- type PubKey
- type Secp256k1PublicKey
- type ZKAccumulator
- type ZKEphemeralKey
- type ZKSet
- func (c ZKSet) AddElement(pk PubKey, elem string) error
- func (c ZKSet) Decrypt(key PubKey, ciphertext []byte) ([]byte, error)
- func (c ZKSet) Encrypt(key PubKey, bz []byte) ([]byte, error)
- func (s ZKSet) GetAccumulator() *ZKAccumulator
- func (c ZKSet) RemoveElement(pk PubKey, elem string) error
- func (s ZKSet) SetAccumulator(a *ZKAccumulator) error
- func (s ZKSet) String() string
- func (c ZKSet) ValidateMembership(spk PubKey, elem string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeserializeECDSASecp256k1Signature ¶
func DeserializeECDSASecp256k1Signature(sigBytes []byte) (*curves.EcdsaSignature, error)
func GetSecretFromSecp256k1 ¶
func GetSecretFromSecp256k1(publicKey PubKey) (*accumulator.SecretKey, error)
func RunIteratedProtocol ¶
For DKG bob starts first. For refresh and sign, Alice starts first.
func SerializeECDSASecp256k1Signature ¶
func SerializeECDSASecp256k1Signature(sig *curves.EcdsaSignature) ([]byte, error)
func StringListToZkElements ¶
func StringListToZkElements(strs ...string) []accumulator.Element
func StringToZkElement ¶
func StringToZkElement(str string) accumulator.Element
Types ¶
type EncKeyshareSet ¶
type EncKeyshareSet struct {}
func (*EncKeyshareSet) DecryptUserKeyshare ¶
func (kss *EncKeyshareSet) DecryptUserKeyshare(key crypto.EncryptionKey) (KeyshareSet, error)
func (*EncKeyshareSet) FormatDID ¶
func (kss *EncKeyshareSet) FormatDID(ct crypto.CoinType) string
FormatDID returns the DID of the account based on the coin type
func (*EncKeyshareSet) GetAccountData ¶
func (kss *EncKeyshareSet) GetAccountData(ct crypto.CoinType) *crypto.AccountData
GetAccountData returns the proto representation of the account
func (*EncKeyshareSet) Marshal ¶
func (kss *EncKeyshareSet) Marshal() ([]byte, error)
Marshal returns the JSON encoding of the EncKeyshareSet.
func (*EncKeyshareSet) PublicKey ¶
func (kss *EncKeyshareSet) PublicKey() *secp256k1.PubKey
The `PublicKey()` function is a method of the `KeyshareSet` type. It returns the public key corresponding to Alice's keyshare in the keyshare set. It does this by calling the `PubKey()` method of the `Keyshare` object corresponding to Alice's keyshare. If the keyshare set is not valid or if there is an error in retrieving the public key, it returns an error.
func (*EncKeyshareSet) Unmarshal ¶
func (kss *EncKeyshareSet) Unmarshal(bz []byte) error
Unmarshal parses the JSON-encoded data and stores the result in the EncKeyshareSet.
type Keyshare ¶
type Keyshare struct { protocol.Message `json:"output"` Role KeyshareRole `json:"role"` }Output *
func NewAliceKeyshare ¶
func NewBobKeyshare ¶
func (*Keyshare) FormatAddress ¶
func (ks *Keyshare) FormatAddress(ct sonrcrypto.CoinType) (string, error)
func (*Keyshare) GetAliceDKGResult ¶
func (ks *Keyshare) GetAliceDKGResult() (*dkg.AliceOutput, error)
func (*Keyshare) MarshalPrivate ¶
func (*Keyshare) MarshalPublic ¶
func (*Keyshare) PublicPoint ¶
PublicPoint returns the public key of the keyshare as a *curves.EcPoint
func (*Keyshare) UnmarshalPrivate ¶
func (*Keyshare) UnmarshalPublic ¶
type KeyshareRole ¶
type KeyshareRole string
const ( KeyshareRole = "alice" KeyshareRoleUser KeyshareRole = "bob" )KeyshareRolePublic
type KeyshareSet ¶
type KeyshareSet [2]*Keyshare
func EmptyKeyshareSet ¶
func EmptyKeyshareSet() KeyshareSet
The function returns an empty KeyshareSet.
func NewKSS ¶
func NewKSS(a *Keyshare, b *Keyshare) KeyshareSet
The function creates a new KeyshareSet object using the provided Alice and Bob DKG result messages.
func NewKeyshareSet ¶
func NewKeyshareSet(aliceDkgResultMsg *protocol.Message, bobDkgResultMsg *protocol.Message) KeyshareSet
The function creates a new KeyshareSet object using the provided Alice and Bob DKG result messages.
func (KeyshareSet) Alice ¶
func (kss KeyshareSet) Alice() *Keyshare
The `Alice()` function is a method of the `KeyshareSet` type. It returns the `Keyshare` object corresponding to Alice's keyshare in the keyshare set.
func (KeyshareSet) Bob ¶
func (kss KeyshareSet) Bob() *Keyshare
The `Bob()` function is a method of the `KeyshareSet` type. It returns the `Keyshare` object corresponding to Bob's keyshare in the keyshare set.
func (KeyshareSet) DKGAtIndex ¶
func (kss KeyshareSet) DKGAtIndex(i int) *protocol.Message
The `DKGAtIndex` function is a method of the `KeyshareSet` type. It takes an integer `i` as input and returns the DKG (Distributed Key Generation) result message at the specified index.
func (KeyshareSet) EncryptUserKeyshare ¶
func (kss KeyshareSet) EncryptUserKeyshare(c crypto.EncryptionKey) (*EncKeyshareSet, error)
func (KeyshareSet) FormatAddress ¶
func (kss KeyshareSet) FormatAddress(ct crypto.CoinType) string
FormatAddress returns the address of the account based on the coin type
func (KeyshareSet) FormatDID ¶
func (kss KeyshareSet) FormatDID(ct crypto.CoinType) string
FormatDID returns the DID of the account based on the coin type
func (KeyshareSet) GetAccountData ¶
func (wa KeyshareSet) GetAccountData(ct crypto.CoinType) *crypto.AccountData
GetAccountData returns the proto representation of the account
func (KeyshareSet) IsValid ¶
func (kss KeyshareSet) IsValid() error
The `IsValid()` function is a method of the `KeyshareSet` type. It checks if the `KeyshareSet` object is valid by performing the following checks:
func (KeyshareSet) PublicKey ¶
func (kss KeyshareSet) PublicKey() *secp256k1.PubKey
The `PublicKey()` function is a method of the `KeyshareSet` type. It returns the public key corresponding to Alice's keyshare in the keyshare set. It does this by calling the `PubKey()` method of the `Keyshare` object corresponding to Alice's keyshare. If the keyshare set is not valid or if there is an error in retrieving the public key, it returns an error.
type PubKey ¶
type PubKey = cryptotypes.PubKey
type Secp256k1PublicKey ¶
type ZKAccumulator ¶
type ZKAccumulator = accumulator.Accumulator
type ZKEphemeralKey ¶
type ZKEphemeralKey []byte
func GetEphemeralFromSecp256k1 ¶
func GetEphemeralFromSecp256k1(publicKey PubKey) (ZKEphemeralKey, error)
func (ZKEphemeralKey) String ¶
func (zk ZKEphemeralKey) String() string
type ZKSet ¶
type ZKSet string
func CreateZkSet ¶
CreateZkSet creates a new ZKSet from a public key and a list of initial ids
func (ZKSet) AddElement ¶
AddElement adds an element to the accumulator
func (ZKSet) GetAccumulator ¶
func (s ZKSet) GetAccumulator() *ZKAccumulator
GetAccumulator returns the accumulator for the ZKSet
func (ZKSet) RemoveElement ¶
RemoveElement removes an element from the accumulator
func (ZKSet) SetAccumulator ¶
func (s ZKSet) SetAccumulator(a *ZKAccumulator) error
SetAccumulator sets the accumulator for the ZKSet