base

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountV1

type AccountV1 struct {
	// Address is the address of the account.
	Address string `json:"address"`

	// CoinType is the coin type of the account.
	CoinType crypto.CoinType `json:"coin_type"`

	// Name is the name of the account.
	Name string `json:"name"`

	// Data is the marshalled keyshare
	Data []byte `json:"data"`

	// PublicKeyshare is the public key share of the account.
	PublicKeyshare *v1types.Keyshare `json:"public_keshare"`
}

func NewAccountV1

func NewAccountV1(name string, coin crypto.CoinType) (*AccountV1, v1types.KeyshareSet, error)

NewAccountV1 creates a new account with the given name and coin type.

func (*AccountV1) DID

func (a *AccountV1) DID() string

DID returns the DID of the account.

func (*AccountV1) DIDAlias

func (a *AccountV1) DIDAlias() string

DIDAlias returns the DID alias or name of the account.

func (*AccountV1) GetAccountData

func (a *AccountV1) GetAccountData() *crypto.AccountData

GetAccountData returns the proto representation of the account

func (*AccountV1) Marshal

func (a *AccountV1) Marshal() ([]byte, error)

Marshal returns the JSON encoding of the account.

func (*AccountV1) PublicKey

func (a *AccountV1) 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 (*AccountV1) Sign

func (a *AccountV1) Sign(pks *v1types.Keyshare, msg []byte) ([]byte, error)

Sign returns the signature of the message using the private keyshare.

func (*AccountV1) Unmarshal

func (a *AccountV1) Unmarshal(data []byte) error

Unmarshal parses the JSON-encoded data and stores the result in the account.

func (*AccountV1) Verify

func (a *AccountV1) Verify(msg, sig []byte) (bool, error)

Verify returns true if the signature is valid for the message and false otherwise.

type EncryptionKey

type EncryptionKey = *secp256k1.PubKey

Jump to

Keyboard shortcuts

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