keyring

package
v0.50.10 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 31 Imported by: 3,620

Documentation

Overview

Package keyring provides common key management API.

The Keyring interface

The Keyring interface defines the methods that a type needs to implement to be used as key storage backend. This package provides a few implementations out-of-the-box.

NewInMemory

The NewInMemory constructor returns an implementation backed by an in-memory, goroutine-safe map that has historically been used for testing purposes or on-the-fly key generation as the generated keys are discarded when the process terminates or the type instance is garbage collected.

New

The New constructor returns an implementation backed by a keyring library (https://github.com/99designs/keyring), whose aim is to provide a common abstraction and uniform interface between secret stores available for Windows, macOS, and most GNU/Linux distributions as well as operating system-agnostic encrypted file-based backends.

The backends:

os	The instance returned by this constructor uses the operating system's default
	credentials store to handle keys storage operations securely. It should be noted
	that the keyring may be kept unlocked for the whole duration of the user
	session.
file	This backend more closely resembles the previous keyring storage used prior to
	v0.38.1. It stores the keyring encrypted within the app's configuration directory.
	This keyring will request a password each time it is accessed, which may occur
	multiple times in a single command resulting in repeated password prompts.
kwallet	This backend uses KDE Wallet Manager as a credentials management application:
	https://github.com/KDE/kwallet
pass	This backend uses the pass command line utility to store and retrieve keys:
	https://www.passwordstore.org/
test	This backend stores keys insecurely to disk. It does not prompt for a password to
	be unlocked and it should be used only for testing purposes.
memory	Same instance as returned by NewInMemory. This backend uses a transient storage. Keys
	are discarded when the process terminates or the type instance is garbage collected.

Index

Examples

Constants

View Source
const (
	BackendFile    = "file"
	BackendOS      = "os"
	BackendKWallet = "kwallet"
	BackendPass    = "pass"
	BackendTest    = "test"
	BackendMemory  = "memory"
)

Backend options for Keyring

View Source
const (
	// DefaultBIP39Passphrase used for deriving seed from mnemonic
	DefaultBIP39Passphrase = ""
)

Variables

View Source
var (
	// ErrUnsupportedSigningAlgo is raised when the caller tries to use a
	// different signing scheme than secp256k1.
	ErrUnsupportedSigningAlgo = errors.New("unsupported signing algo")
	// ErrUnsupportedLanguage is raised when the caller tries to use a
	// different language than english for creating a mnemonic sentence.
	ErrUnsupportedLanguage = errors.New("unsupported language: only english is supported")
	// ErrUnknownBacked is raised when the keyring backend is unknown
	ErrUnknownBacked = errors.New("unknown keyring backend")
	// ErrOverwriteKey is raised when a key cannot be overwritten
	ErrOverwriteKey = errors.New("cannot overwrite key")
	// ErrKeyAlreadyExists is raised when creating a key that already exists
	ErrKeyAlreadyExists = errors.Newf("key already exists")
	// ErrInvalidSignMode is raised when trying to sign with an invaled method
	ErrInvalidSignMode = errors.New("invalid sign mode, expected LEGACY_AMINO_JSON or TEXTUAL")
	// ErrMaxPassPhraseAttempts is raised when the maxPassphraseEntryAttempts is reached
	ErrMaxPassPhraseAttempts = errors.New("too many failed passphrase attempts")
	// ErrUnableToSerialize is raised when codec fails to serialize
	ErrUnableToSerialize = errors.New("unable to serialize record")
	// ErrOfflineSign is raised when trying to sign offline record.
	ErrOfflineSign = errors.New("cannot sign with offline keys")
	// ErrDuplicatedAddress is raised when creating a key with the same address as a key that already exists.
	ErrDuplicatedAddress = errors.New("duplicated address created")
	// ErrLedgerGenerateKey is raised when a ledger can't generate a key
	ErrLedgerGenerateKey = errors.New("failed to generate ledger key")
	// ErrNotLedgerObj is raised when record.GetLedger() returns nil.
	ErrNotLedgerObj = errors.New("not a ledger object")
	// ErrLedgerInvalidSignature is raised when ledger generates an invalid signature.
	ErrLedgerInvalidSignature = errors.New("Ledger generated an invalid signature. Perhaps you have multiple ledgers and need to try another one")
	// ErrLegacyToRecord is raised when cannot be converted to a Record
	ErrLegacyToRecord = errors.New("unable to convert LegacyInfo to Record")
	// ErrUnknownLegacyType is raised when a LegacyInfo type is unknown.
	ErrUnknownLegacyType = errors.New("unknown LegacyInfo type")
)
View Source
var (
	// ErrPrivKeyExtr is used to output an error if extraction of a private key from Local item fails.
	ErrPrivKeyExtr = errors.New("private key extraction works only for Local")
	// ErrPrivKeyNotAvailable is used when a Record_Local.PrivKey is nil.
	ErrPrivKeyNotAvailable = errors.New("private key is not available")
	// ErrCastAny is used to output an error if cast from types.Any fails.
	ErrCastAny = errors.New("unable to cast to cryptotypes")
)
View Source
var (
	ErrInvalidLengthRecord        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRecord          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRecord = fmt.Errorf("proto: unexpected end of group")
)

Functions

func MarshalInfo added in v0.46.0

func MarshalInfo(i LegacyInfo) []byte

encoding info

func NewAutoCLIKeyring added in v0.50.0

func NewAutoCLIKeyring(kr Keyring) (autoCLIKeyring, error)

NewAutoCLIKeyring wraps the SDK keyring and make it compatible with the AutoCLI keyring interfaces.

func RegisterLegacyAminoCodec added in v0.40.0

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers concrete types and interfaces on the given codec.

func SignWithLedger

func SignWithLedger(k *Record, msg []byte, signMode signing.SignMode) (sig []byte, pub types.PubKey, err error)

SignWithLedger signs a binary message with the ledger device referenced by an Info object and returns the signed bytes and the public key. It returns an error if the device could not be queried or it returned an error.

Types

type DeriveKeyFunc

type DeriveKeyFunc func(mnemonic, bip39Passphrase, hdPath string, algo hd.PubKeyType) ([]byte, error)

DeriveKeyFunc defines the function to derive a new key from a seed and hd path

type Exporter

type Exporter interface {
	// Export public key
	ExportPubKeyArmor(uid string) (string, error)
	ExportPubKeyArmorByAddress(address sdk.Address) (string, error)

	// ExportPrivKeyArmor returns a private key in ASCII armored format.
	// It returns an error if the key does not exist or a wrong encryption passphrase is supplied.
	ExportPrivKeyArmor(uid, encryptPassphrase string) (armor string, err error)
	ExportPrivKeyArmorByAddress(address sdk.Address, encryptPassphrase string) (armor string, err error)
}

Exporter is implemented by key stores that support export of public and private keys.

type Importer

type Importer interface {
	// ImportPrivKey imports ASCII armored passphrase-encrypted private keys.
	ImportPrivKey(uid, armor, passphrase string) error
	// ImportPrivKeyHex imports hex encoded keys.
	ImportPrivKeyHex(uid, privKey, algoStr string) error
	// ImportPubKey imports ASCII armored public keys.
	ImportPubKey(uid, armor string) error
}

Importer is implemented by key stores that support import of public and private keys.

type KeyType

type KeyType uint

KeyType reflects a human-readable type for key listing.

const (
	TypeLocal   KeyType = 0
	TypeLedger  KeyType = 1
	TypeOffline KeyType = 2
	TypeMulti   KeyType = 3
)

Info KeyTypes

func (KeyType) String

func (kt KeyType) String() string

String implements the stringer interface for KeyType.

type Keyring

type Keyring interface {
	// Get the backend type used in the keyring config: "file", "os", "kwallet", "pass", "test", "memory".
	Backend() string
	// List all keys.
	List() ([]*Record, error)

	// Supported signing algorithms for Keyring and Ledger respectively.
	SupportedAlgorithms() (SigningAlgoList, SigningAlgoList)

	// Key and KeyByAddress return keys by uid and address respectively.
	Key(uid string) (*Record, error)
	KeyByAddress(address sdk.Address) (*Record, error)

	// Delete and DeleteByAddress remove keys from the keyring.
	Delete(uid string) error
	DeleteByAddress(address sdk.Address) error

	// Rename an existing key from the Keyring
	Rename(from, to string) error

	// NewMnemonic generates a new mnemonic, derives a hierarchical deterministic key from it, and
	// persists the key to storage. Returns the generated mnemonic and the key Info.
	// It returns an error if it fails to generate a key for the given algo type, or if
	// another key is already stored under the same name or address.
	//
	// A passphrase set to the empty string will set the passphrase to the DefaultBIP39Passphrase value.
	NewMnemonic(uid string, language Language, hdPath, bip39Passphrase string, algo SignatureAlgo) (*Record, string, error)

	// NewAccount converts a mnemonic to a private key and BIP-39 HD Path and persists it.
	// It fails if there is an existing key Info with the same address.
	NewAccount(uid, mnemonic, bip39Passphrase, hdPath string, algo SignatureAlgo) (*Record, error)

	// SaveLedgerKey retrieves a public key reference from a Ledger device and persists it.
	SaveLedgerKey(uid string, algo SignatureAlgo, hrp string, coinType, account, index uint32) (*Record, error)

	// SaveOfflineKey stores a public key and returns the persisted Info structure.
	SaveOfflineKey(uid string, pubkey types.PubKey) (*Record, error)

	// SaveMultisig stores and returns a new multsig (offline) key reference.
	SaveMultisig(uid string, pubkey types.PubKey) (*Record, error)

	Signer

	Importer
	Exporter

	Migrator
}

Keyring exposes operations over a backend supported by github.com/99designs/keyring.

func New

func New(
	appName, backend, rootDir string, userInput io.Reader, cdc codec.Codec, opts ...Option,
) (Keyring, error)

New creates a new instance of a keyring. Keyring options can be applied when generating the new instance. Available backends are "os", "file", "kwallet", "memory", "pass", "test".

Example
// Select the encryption and storage for your cryptostore
cdc := getCodec()
cstore := NewInMemory(cdc)

sec := hd.Secp256k1

// Add keys and see they return in alphabetical order
bob, _, err := cstore.NewMnemonic("Bob", English, sdk.FullFundraiserPath, DefaultBIP39Passphrase, sec)
if err != nil {
	// this should never happen
	fmt.Println(err)
} else {
	// return info here just like in List
	fmt.Println(bob.Name)
}
_, _, _ = cstore.NewMnemonic("Alice", English, sdk.FullFundraiserPath, DefaultBIP39Passphrase, sec)
_, _, _ = cstore.NewMnemonic("Carl", English, sdk.FullFundraiserPath, DefaultBIP39Passphrase, sec)
records, _ := cstore.List()
for _, k := range records {
	fmt.Println(k.Name)
}

// We need to use passphrase to generate a signature
tx := []byte("deadbeef")
sig, pub, err := cstore.Sign("Bob", tx, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
if err != nil {
	fmt.Println("don't accept real passphrase")
}

// and we can validate the signature with publicly available info
bRecord, _ := cstore.Key("Bob")
key, _ := bRecord.GetPubKey()
bobKey, _ := bob.GetPubKey()
if !key.Equals(bobKey) {
	fmt.Println("Get and Create return different keys")
}

if pub.Equals(key) {
	fmt.Println("signed by Bob")
}
if !pub.VerifySignature(tx, sig) {
	fmt.Println("invalid signature")
}
Output:

Bob
Alice
Bob
Carl
signed by Bob

func NewInMemory

func NewInMemory(cdc codec.Codec, opts ...Option) Keyring

NewInMemory creates a transient keyring useful for testing purposes and on-the-fly key generation. Keybase options can be applied when generating this new Keybase.

func NewInMemoryWithKeyring added in v0.46.0

func NewInMemoryWithKeyring(kr keyring.Keyring, cdc codec.Codec, opts ...Option) Keyring

NewInMemoryWithKeyring returns an in memory keyring using the specified keyring.Keyring as the backing keyring.

type Language

type Language int

Language is a language to create the BIP 39 mnemonic in. Currently, only english is supported though. Find a list of all supported languages in the BIP 39 spec (word lists).

const (
	// English is the default language to create a mnemonic.
	// It is the only supported language by this package.
	English Language = iota + 1
	// Japanese is currently not supported.
	Japanese
	// Korean is currently not supported.
	Korean
	// Spanish is currently not supported.
	Spanish
	// ChineseSimplified is currently not supported.
	ChineseSimplified
	// ChineseTraditional is currently not supported.
	ChineseTraditional
	// French is currently not supported.
	French
	// Italian is currently not supported.
	Italian
)

type LegacyInfo deprecated added in v0.46.0

type LegacyInfo interface {
	// Human-readable type for key listing
	GetType() KeyType
	// Name of the key
	GetName() string
	// Public key
	GetPubKey() cryptotypes.PubKey
	// Address
	GetAddress() sdk.AccAddress
	// Bip44 Path
	GetPath() (*hd.BIP44Params, error)
	// Algo
	GetAlgo() hd.PubKeyType
}

Deprecated: LegacyInfo is the publicly exposed information about a keypair

func NewLegacyMultiInfo added in v0.46.0

func NewLegacyMultiInfo(name string, pub cryptotypes.PubKey) (LegacyInfo, error)

NewLegacyMultiInfo creates a new legacyMultiInfo instance

type LegacyMultiInfo added in v0.46.0

type LegacyMultiInfo struct {
	Name      string               `json:"name"`
	PubKey    cryptotypes.PubKey   `json:"pubkey"`
	Threshold uint                 `json:"threshold"`
	PubKeys   []multisigPubKeyInfo `json:"pubkeys"`
}

multiInfo is the public information about a multisig key

func (LegacyMultiInfo) GetAddress added in v0.46.0

func (i LegacyMultiInfo) GetAddress() sdk.AccAddress

GetAddress implements Info interface

func (LegacyMultiInfo) GetAlgo added in v0.46.0

func (i LegacyMultiInfo) GetAlgo() hd.PubKeyType

GetPath implements Info interface

func (LegacyMultiInfo) GetName added in v0.46.0

func (i LegacyMultiInfo) GetName() string

GetName implements Info interface

func (LegacyMultiInfo) GetPath added in v0.46.0

func (i LegacyMultiInfo) GetPath() (*hd.BIP44Params, error)

GetPath implements Info interface

func (LegacyMultiInfo) GetPubKey added in v0.46.0

func (i LegacyMultiInfo) GetPubKey() cryptotypes.PubKey

GetPubKey implements Info interface

func (LegacyMultiInfo) GetType added in v0.46.0

func (i LegacyMultiInfo) GetType() KeyType

GetType implements Info interface

func (LegacyMultiInfo) UnpackInterfaces added in v0.46.0

func (i LegacyMultiInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

type Migrator added in v0.46.0

type Migrator interface {
	MigrateAll() ([]*Record, error)
}

Migrator is implemented by key stores and enables migration of keys from amino to proto

type Option

type Option func(options *Options)

Option overrides keyring configuration options.

type Options

type Options struct {
	// supported signing algorithms for keyring
	SupportedAlgos SigningAlgoList
	// supported signing algorithms for Ledger
	SupportedAlgosLedger SigningAlgoList
	// define Ledger Derivation function
	LedgerDerivation func() (ledger.SECP256K1, error)
	// define Ledger key generation function
	LedgerCreateKey func([]byte) types.PubKey
	// define Ledger app name
	LedgerAppName string
	// indicate whether Ledger should skip DER Conversion on signature,
	// depending on which format (DER or BER) the Ledger app returns signatures
	LedgerSigSkipDERConv bool
}

Options define the options of the Keyring.

type PrivKeyGenFunc

type PrivKeyGenFunc func(bz []byte, algo hd.PubKeyType) (cryptotypes.PrivKey, error)

PrivKeyGenFunc defines the function to convert derived key bytes to a tendermint private key

type Record added in v0.46.0

type Record struct {
	// name represents a name of Record
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// pub_key represents a public key in any format
	PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"`
	// Record contains one of the following items
	//
	// Types that are valid to be assigned to Item:
	//	*Record_Local_
	//	*Record_Ledger_
	//	*Record_Multi_
	//	*Record_Offline_
	Item isRecord_Item `protobuf_oneof:"item"`
}

Record is used for representing a key in the keyring.

func NewLedgerRecord added in v0.46.0

func NewLedgerRecord(name string, pk cryptotypes.PubKey, path *hd.BIP44Params) (*Record, error)

NewLedgerRecord creates a new Record with ledger item

func NewLocalRecord added in v0.46.0

func NewLocalRecord(name string, priv cryptotypes.PrivKey, pk cryptotypes.PubKey) (*Record, error)

NewLocalRecord creates a new Record with local key item

func NewMultiRecord added in v0.46.0

func NewMultiRecord(name string, pk cryptotypes.PubKey) (*Record, error)

NewMultiRecord creates a new Record with multi item

func NewOfflineRecord added in v0.46.0

func NewOfflineRecord(name string, pk cryptotypes.PubKey) (*Record, error)

NewOfflineRecord creates a new Record with offline item

func (*Record) Descriptor added in v0.46.0

func (*Record) Descriptor() ([]byte, []int)

func (Record) GetAddress added in v0.46.0

func (k Record) GetAddress() (types.AccAddress, error)

GetAddress fetches an address of the record

func (*Record) GetItem added in v0.46.0

func (m *Record) GetItem() isRecord_Item

func (*Record) GetLedger added in v0.46.0

func (m *Record) GetLedger() *Record_Ledger

func (*Record) GetLocal added in v0.46.0

func (m *Record) GetLocal() *Record_Local

func (*Record) GetMulti added in v0.46.0

func (m *Record) GetMulti() *Record_Multi

func (*Record) GetOffline added in v0.46.0

func (m *Record) GetOffline() *Record_Offline

func (*Record) GetPubKey added in v0.46.0

func (k *Record) GetPubKey() (cryptotypes.PubKey, error)

GetPubKey fetches a public key of the record

func (Record) GetType added in v0.46.0

func (k Record) GetType() KeyType

GetType fetches type of the record

func (*Record) Marshal added in v0.46.0

func (m *Record) Marshal() (dAtA []byte, err error)

func (*Record) MarshalTo added in v0.46.0

func (m *Record) MarshalTo(dAtA []byte) (int, error)

func (*Record) MarshalToSizedBuffer added in v0.46.0

func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record) ProtoMessage added in v0.46.0

func (*Record) ProtoMessage()

func (*Record) Reset added in v0.46.0

func (m *Record) Reset()

func (*Record) Size added in v0.46.0

func (m *Record) Size() (n int)

func (*Record) String added in v0.46.0

func (m *Record) String() string

func (*Record) Unmarshal added in v0.46.0

func (m *Record) Unmarshal(dAtA []byte) error

func (*Record) UnpackInterfaces added in v0.46.0

func (k *Record) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*Record) XXX_DiscardUnknown added in v0.46.0

func (m *Record) XXX_DiscardUnknown()

func (*Record) XXX_Marshal added in v0.46.0

func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record) XXX_Merge added in v0.46.0

func (m *Record) XXX_Merge(src proto.Message)

func (*Record) XXX_OneofWrappers added in v0.46.0

func (*Record) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Record) XXX_Size added in v0.46.0

func (m *Record) XXX_Size() int

func (*Record) XXX_Unmarshal added in v0.46.0

func (m *Record) XXX_Unmarshal(b []byte) error

type Record_Ledger added in v0.46.0

type Record_Ledger struct {
	Path *hd.BIP44Params `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
}

Ledger item

func (*Record_Ledger) Descriptor added in v0.46.0

func (*Record_Ledger) Descriptor() ([]byte, []int)

func (*Record_Ledger) GetPath added in v0.46.0

func (rl *Record_Ledger) GetPath() *hd.BIP44Params

func (*Record_Ledger) Marshal added in v0.46.0

func (m *Record_Ledger) Marshal() (dAtA []byte, err error)

func (*Record_Ledger) MarshalTo added in v0.46.0

func (m *Record_Ledger) MarshalTo(dAtA []byte) (int, error)

func (*Record_Ledger) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Ledger) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Ledger) ProtoMessage added in v0.46.0

func (*Record_Ledger) ProtoMessage()

func (*Record_Ledger) Reset added in v0.46.0

func (m *Record_Ledger) Reset()

func (*Record_Ledger) Size added in v0.46.0

func (m *Record_Ledger) Size() (n int)

func (*Record_Ledger) String added in v0.46.0

func (m *Record_Ledger) String() string

func (*Record_Ledger) Unmarshal added in v0.46.0

func (m *Record_Ledger) Unmarshal(dAtA []byte) error

func (*Record_Ledger) XXX_DiscardUnknown added in v0.46.0

func (m *Record_Ledger) XXX_DiscardUnknown()

func (*Record_Ledger) XXX_Marshal added in v0.46.0

func (m *Record_Ledger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record_Ledger) XXX_Merge added in v0.46.0

func (m *Record_Ledger) XXX_Merge(src proto.Message)

func (*Record_Ledger) XXX_Size added in v0.46.0

func (m *Record_Ledger) XXX_Size() int

func (*Record_Ledger) XXX_Unmarshal added in v0.46.0

func (m *Record_Ledger) XXX_Unmarshal(b []byte) error

type Record_Ledger_ added in v0.46.0

type Record_Ledger_ struct {
	Ledger *Record_Ledger `protobuf:"bytes,4,opt,name=ledger,proto3,oneof" json:"ledger,omitempty"`
}

func (*Record_Ledger_) MarshalTo added in v0.46.0

func (m *Record_Ledger_) MarshalTo(dAtA []byte) (int, error)

func (*Record_Ledger_) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Ledger_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Ledger_) Size added in v0.46.0

func (m *Record_Ledger_) Size() (n int)

type Record_Local added in v0.46.0

type Record_Local struct {
	PrivKey *types.Any `protobuf:"bytes,1,opt,name=priv_key,json=privKey,proto3" json:"priv_key,omitempty"`
}

Item is a keyring item stored in a keyring backend. Local item

func (*Record_Local) Descriptor added in v0.46.0

func (*Record_Local) Descriptor() ([]byte, []int)

func (*Record_Local) Marshal added in v0.46.0

func (m *Record_Local) Marshal() (dAtA []byte, err error)

func (*Record_Local) MarshalTo added in v0.46.0

func (m *Record_Local) MarshalTo(dAtA []byte) (int, error)

func (*Record_Local) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Local) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Local) ProtoMessage added in v0.46.0

func (*Record_Local) ProtoMessage()

func (*Record_Local) Reset added in v0.46.0

func (m *Record_Local) Reset()

func (*Record_Local) Size added in v0.46.0

func (m *Record_Local) Size() (n int)

func (*Record_Local) String added in v0.46.0

func (m *Record_Local) String() string

func (*Record_Local) Unmarshal added in v0.46.0

func (m *Record_Local) Unmarshal(dAtA []byte) error

func (*Record_Local) XXX_DiscardUnknown added in v0.46.0

func (m *Record_Local) XXX_DiscardUnknown()

func (*Record_Local) XXX_Marshal added in v0.46.0

func (m *Record_Local) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record_Local) XXX_Merge added in v0.46.0

func (m *Record_Local) XXX_Merge(src proto.Message)

func (*Record_Local) XXX_Size added in v0.46.0

func (m *Record_Local) XXX_Size() int

func (*Record_Local) XXX_Unmarshal added in v0.46.0

func (m *Record_Local) XXX_Unmarshal(b []byte) error

type Record_Local_ added in v0.46.0

type Record_Local_ struct {
	Local *Record_Local `protobuf:"bytes,3,opt,name=local,proto3,oneof" json:"local,omitempty"`
}

func (*Record_Local_) MarshalTo added in v0.46.0

func (m *Record_Local_) MarshalTo(dAtA []byte) (int, error)

func (*Record_Local_) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Local_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Local_) Size added in v0.46.0

func (m *Record_Local_) Size() (n int)

type Record_Multi added in v0.46.0

type Record_Multi struct {
}

Multi item

func (*Record_Multi) Descriptor added in v0.46.0

func (*Record_Multi) Descriptor() ([]byte, []int)

func (*Record_Multi) Marshal added in v0.46.0

func (m *Record_Multi) Marshal() (dAtA []byte, err error)

func (*Record_Multi) MarshalTo added in v0.46.0

func (m *Record_Multi) MarshalTo(dAtA []byte) (int, error)

func (*Record_Multi) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Multi) ProtoMessage added in v0.46.0

func (*Record_Multi) ProtoMessage()

func (*Record_Multi) Reset added in v0.46.0

func (m *Record_Multi) Reset()

func (*Record_Multi) Size added in v0.46.0

func (m *Record_Multi) Size() (n int)

func (*Record_Multi) String added in v0.46.0

func (m *Record_Multi) String() string

func (*Record_Multi) Unmarshal added in v0.46.0

func (m *Record_Multi) Unmarshal(dAtA []byte) error

func (*Record_Multi) XXX_DiscardUnknown added in v0.46.0

func (m *Record_Multi) XXX_DiscardUnknown()

func (*Record_Multi) XXX_Marshal added in v0.46.0

func (m *Record_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record_Multi) XXX_Merge added in v0.46.0

func (m *Record_Multi) XXX_Merge(src proto.Message)

func (*Record_Multi) XXX_Size added in v0.46.0

func (m *Record_Multi) XXX_Size() int

func (*Record_Multi) XXX_Unmarshal added in v0.46.0

func (m *Record_Multi) XXX_Unmarshal(b []byte) error

type Record_Multi_ added in v0.46.0

type Record_Multi_ struct {
	Multi *Record_Multi `protobuf:"bytes,5,opt,name=multi,proto3,oneof" json:"multi,omitempty"`
}

func (*Record_Multi_) MarshalTo added in v0.46.0

func (m *Record_Multi_) MarshalTo(dAtA []byte) (int, error)

func (*Record_Multi_) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Multi_) Size added in v0.46.0

func (m *Record_Multi_) Size() (n int)

type Record_Offline added in v0.46.0

type Record_Offline struct {
}

Offline item

func (*Record_Offline) Descriptor added in v0.46.0

func (*Record_Offline) Descriptor() ([]byte, []int)

func (*Record_Offline) Marshal added in v0.46.0

func (m *Record_Offline) Marshal() (dAtA []byte, err error)

func (*Record_Offline) MarshalTo added in v0.46.0

func (m *Record_Offline) MarshalTo(dAtA []byte) (int, error)

func (*Record_Offline) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Offline) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Offline) ProtoMessage added in v0.46.0

func (*Record_Offline) ProtoMessage()

func (*Record_Offline) Reset added in v0.46.0

func (m *Record_Offline) Reset()

func (*Record_Offline) Size added in v0.46.0

func (m *Record_Offline) Size() (n int)

func (*Record_Offline) String added in v0.46.0

func (m *Record_Offline) String() string

func (*Record_Offline) Unmarshal added in v0.46.0

func (m *Record_Offline) Unmarshal(dAtA []byte) error

func (*Record_Offline) XXX_DiscardUnknown added in v0.46.0

func (m *Record_Offline) XXX_DiscardUnknown()

func (*Record_Offline) XXX_Marshal added in v0.46.0

func (m *Record_Offline) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record_Offline) XXX_Merge added in v0.46.0

func (m *Record_Offline) XXX_Merge(src proto.Message)

func (*Record_Offline) XXX_Size added in v0.46.0

func (m *Record_Offline) XXX_Size() int

func (*Record_Offline) XXX_Unmarshal added in v0.46.0

func (m *Record_Offline) XXX_Unmarshal(b []byte) error

type Record_Offline_ added in v0.46.0

type Record_Offline_ struct {
	Offline *Record_Offline `protobuf:"bytes,6,opt,name=offline,proto3,oneof" json:"offline,omitempty"`
}

func (*Record_Offline_) MarshalTo added in v0.46.0

func (m *Record_Offline_) MarshalTo(dAtA []byte) (int, error)

func (*Record_Offline_) MarshalToSizedBuffer added in v0.46.0

func (m *Record_Offline_) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record_Offline_) Size added in v0.46.0

func (m *Record_Offline_) Size() (n int)

type SignatureAlgo

type SignatureAlgo interface {
	Name() hd.PubKeyType
	Derive() hd.DeriveFn
	Generate() hd.GenerateFn
}

SignatureAlgo defines the interface for a keyring supported algorithm.

func NewSigningAlgoFromString

func NewSigningAlgoFromString(str string, algoList SigningAlgoList) (SignatureAlgo, error)

NewSigningAlgoFromString creates a supported SignatureAlgo.

type Signer

type Signer interface {
	// Sign sign byte messages with a user key.
	Sign(uid string, msg []byte, signMode signing.SignMode) ([]byte, types.PubKey, error)

	// SignByAddress sign byte messages with a user key providing the address.
	SignByAddress(address sdk.Address, msg []byte, signMode signing.SignMode) ([]byte, types.PubKey, error)
}

Signer is implemented by key stores that want to provide signing capabilities.

type SigningAlgoList

type SigningAlgoList []SignatureAlgo

SigningAlgoList is a slice of signature algorithms

func (SigningAlgoList) Contains

func (sal SigningAlgoList) Contains(algo SignatureAlgo) bool

Contains returns true if the SigningAlgoList the given SignatureAlgo.

func (SigningAlgoList) String added in v0.40.0

func (sal SigningAlgoList) String() string

String returns a comma separated string of the signature algorithm names in the list.

Jump to

Keyboard shortcuts

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