keyring

package
v0.0.0-...-a315113 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package keys provides common key management API.

The Keybase interface

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

NewLegacy

The NewLegacy constructor returns an on-disk implementation backed by LevelDB storage that has been the default implementation used by the SDK until v0.38.0. Due to security concerns, it is recommended to drop it in favor of the NewKeyring constructor as it will be removed in future releases.

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 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 use 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")
)
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")
)
View Source
var ErrPrivKeyExtr = errors.New("private key extraction works only for Local")

ErrPrivKeyExtr is used to output an error if extraction of a private key from Local item fails

Functions

func MarshalInfo

func MarshalInfo(i LegacyInfo) []byte

encoding info

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers concrete types and interfaces on the given codec.

func SignWithLedger

func SignWithLedger(k *Record, msg []byte) (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 string, 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

	// ImportPubKey imports ASCII armored public keys.
	ImportPubKey(uid string, armor string) error
}

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

type KeyOutput

type KeyOutput struct {
	Name     string `json:"name" yaml:"name"`
	Type     string `json:"type" yaml:"type"`
	Address  string `json:"address" yaml:"address"`
	PubKey   string `json:"pubkey" yaml:"pubkey"`
	Mnemonic string `json:"mnemonic,omitempty" yaml:"mnemonic"`
}

KeyOutput defines a structure wrapping around an Info object used for output functionality.

func MkAccKeyOutput

func MkAccKeyOutput(k *Record) (KeyOutput, error)

MkAccKeyOutput create a KeyOutput in with "acc" Bech32 prefixes. If the public key is a multisig public key, then the threshold and constituent public keys will be added.

func MkAccKeysOutput

func MkAccKeysOutput(records []*Record) ([]KeyOutput, error)

MkAccKeysOutput returns a slice of KeyOutput objects, each with the "acc" Bech32 prefixes, given a slice of Record objects. It returns an error if any call to MkKeyOutput fails.

func MkConsKeyOutput

func MkConsKeyOutput(k *Record) (KeyOutput, error)

MkConsKeyOutput create a KeyOutput in with "cons" Bech32 prefixes.

func MkValKeyOutput

func MkValKeyOutput(k *Record) (KeyOutput, error)

MkValKeyOutput create a KeyOutput in with "val" Bech32 prefixes.

func NewKeyOutput

func NewKeyOutput(name string, keyType KeyType, a sdk.Address, pk cryptotypes.PubKey) (KeyOutput, error)

NewKeyOutput creates a default KeyOutput instance without Mnemonic, Threshold and PubKeys

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 string, 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)
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.

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

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

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

NewLegacyMultiInfo creates a new legacyMultiInfo instance

type LegacyMultiInfo

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

func (i LegacyMultiInfo) GetAddress() sdk.AccAddress

GetAddress implements Info interface

func (LegacyMultiInfo) GetAlgo

func (i LegacyMultiInfo) GetAlgo() hd.PubKeyType

GetPath implements Info interface

func (LegacyMultiInfo) GetName

func (i LegacyMultiInfo) GetName() string

GetName implements Info interface

func (LegacyMultiInfo) GetPath

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

GetPath implements Info interface

func (LegacyMultiInfo) GetPubKey

func (i LegacyMultiInfo) GetPubKey() cryptotypes.PubKey

GetPubKey implements Info interface

func (LegacyMultiInfo) GetType

func (i LegacyMultiInfo) GetType() KeyType

GetType implements Info interface

func (LegacyMultiInfo) UnpackInterfaces

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

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

type Migrator

type Migrator interface {
	MigrateAll() (bool, 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
}

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

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

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

NewLedgerRecord creates a new Record with ledger item

func NewLocalRecord

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

NewLocalRecord creates a new Record with local key item

func NewMultiRecord

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

NewMultiRecord creates a new Record with multi item

func NewOfflineRecord

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

NewOfflineRecord creates a new Record with offline item

func (*Record) Descriptor

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

func (Record) GetAddress

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

GetAddress fetches an address of the record

func (*Record) GetItem

func (m *Record) GetItem() isRecord_Item

func (*Record) GetLedger

func (m *Record) GetLedger() *Record_Ledger

func (*Record) GetLocal

func (m *Record) GetLocal() *Record_Local

func (*Record) GetMulti

func (m *Record) GetMulti() *Record_Multi

func (*Record) GetOffline

func (m *Record) GetOffline() *Record_Offline

func (*Record) GetPubKey

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

GetPubKey fetches a public key of the record

func (Record) GetType

func (k Record) GetType() KeyType

GetType fetches type of the record

func (*Record) Marshal

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

func (*Record) MarshalTo

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

func (*Record) MarshalToSizedBuffer

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

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) Reset

func (m *Record) Reset()

func (*Record) Size

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

func (*Record) String

func (m *Record) String() string

func (*Record) Unmarshal

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

func (*Record) UnpackInterfaces

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

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*Record) XXX_DiscardUnknown

func (m *Record) XXX_DiscardUnknown()

func (*Record) XXX_Marshal

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

func (*Record) XXX_Merge

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

func (*Record) XXX_OneofWrappers

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

XXX_OneofWrappers is for the internal use of the proto package.

func (*Record) XXX_Size

func (m *Record) XXX_Size() int

func (*Record) XXX_Unmarshal

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

type Record_Ledger

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

Ledger item

func (*Record_Ledger) Descriptor

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

func (*Record_Ledger) GetPath

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

func (*Record_Ledger) Marshal

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

func (*Record_Ledger) MarshalTo

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

func (*Record_Ledger) MarshalToSizedBuffer

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

func (*Record_Ledger) ProtoMessage

func (*Record_Ledger) ProtoMessage()

func (*Record_Ledger) Reset

func (m *Record_Ledger) Reset()

func (*Record_Ledger) Size

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

func (*Record_Ledger) String

func (m *Record_Ledger) String() string

func (*Record_Ledger) Unmarshal

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

func (*Record_Ledger) XXX_DiscardUnknown

func (m *Record_Ledger) XXX_DiscardUnknown()

func (*Record_Ledger) XXX_Marshal

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

func (*Record_Ledger) XXX_Merge

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

func (*Record_Ledger) XXX_Size

func (m *Record_Ledger) XXX_Size() int

func (*Record_Ledger) XXX_Unmarshal

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

type Record_Ledger_

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

func (*Record_Ledger_) MarshalTo

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

func (*Record_Ledger_) MarshalToSizedBuffer

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

func (*Record_Ledger_) Size

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

type Record_Local

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

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

func (*Record_Local) Descriptor

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

func (*Record_Local) Marshal

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

func (*Record_Local) MarshalTo

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

func (*Record_Local) MarshalToSizedBuffer

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

func (*Record_Local) ProtoMessage

func (*Record_Local) ProtoMessage()

func (*Record_Local) Reset

func (m *Record_Local) Reset()

func (*Record_Local) Size

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

func (*Record_Local) String

func (m *Record_Local) String() string

func (*Record_Local) Unmarshal

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

func (*Record_Local) XXX_DiscardUnknown

func (m *Record_Local) XXX_DiscardUnknown()

func (*Record_Local) XXX_Marshal

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

func (*Record_Local) XXX_Merge

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

func (*Record_Local) XXX_Size

func (m *Record_Local) XXX_Size() int

func (*Record_Local) XXX_Unmarshal

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

type Record_Local_

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

func (*Record_Local_) MarshalTo

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

func (*Record_Local_) MarshalToSizedBuffer

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

func (*Record_Local_) Size

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

type Record_Multi

type Record_Multi struct {
}

Multi item

func (*Record_Multi) Descriptor

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

func (*Record_Multi) Marshal

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

func (*Record_Multi) MarshalTo

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

func (*Record_Multi) MarshalToSizedBuffer

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

func (*Record_Multi) ProtoMessage

func (*Record_Multi) ProtoMessage()

func (*Record_Multi) Reset

func (m *Record_Multi) Reset()

func (*Record_Multi) Size

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

func (*Record_Multi) String

func (m *Record_Multi) String() string

func (*Record_Multi) Unmarshal

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

func (*Record_Multi) XXX_DiscardUnknown

func (m *Record_Multi) XXX_DiscardUnknown()

func (*Record_Multi) XXX_Marshal

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

func (*Record_Multi) XXX_Merge

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

func (*Record_Multi) XXX_Size

func (m *Record_Multi) XXX_Size() int

func (*Record_Multi) XXX_Unmarshal

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

type Record_Multi_

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

func (*Record_Multi_) MarshalTo

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

func (*Record_Multi_) MarshalToSizedBuffer

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

func (*Record_Multi_) Size

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

type Record_Offline

type Record_Offline struct {
}

Offline item

func (*Record_Offline) Descriptor

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

func (*Record_Offline) Marshal

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

func (*Record_Offline) MarshalTo

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

func (*Record_Offline) MarshalToSizedBuffer

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

func (*Record_Offline) ProtoMessage

func (*Record_Offline) ProtoMessage()

func (*Record_Offline) Reset

func (m *Record_Offline) Reset()

func (*Record_Offline) Size

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

func (*Record_Offline) String

func (m *Record_Offline) String() string

func (*Record_Offline) Unmarshal

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

func (*Record_Offline) XXX_DiscardUnknown

func (m *Record_Offline) XXX_DiscardUnknown()

func (*Record_Offline) XXX_Marshal

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

func (*Record_Offline) XXX_Merge

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

func (*Record_Offline) XXX_Size

func (m *Record_Offline) XXX_Size() int

func (*Record_Offline) XXX_Unmarshal

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

type Record_Offline_

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

func (*Record_Offline_) MarshalTo

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

func (*Record_Offline_) MarshalToSizedBuffer

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

func (*Record_Offline_) Size

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) ([]byte, types.PubKey, error)

	// SignByAddress sign byte messages with a user key providing the address.
	SignByAddress(address sdk.Address, msg []byte) ([]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

func (sal SigningAlgoList) String() string

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

type UnsafeExporter

type UnsafeExporter interface {
	// UnsafeExportPrivKeyHex returns a private key in unarmored hex format
	UnsafeExportPrivKeyHex(uid string) (string, error)
}

UnsafeExporter is implemented by key stores that support unsafe export of private keys' material.

type UnsafeKeyring

type UnsafeKeyring interface {
	Keyring
	UnsafeExporter
}

UnsafeKeyring exposes unsafe operations such as unsafe unarmored export in addition to those that are made available by the Keyring interface.

func NewUnsafe

func NewUnsafe(kr Keyring) UnsafeKeyring

NewUnsafe returns a new keyring that provides support for unsafe operations.

Jump to

Keyboard shortcuts

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