account

package
v0.3.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UCANVersion is the current version of the UCAN spec
	UCANVersion = "0.7.0"
	// UCANVersionKey is the key used in version headers for the UCAN spec
	UCANVersionKey = "ucv"
	// PrfKey denotes "Proofs" in a UCAN. Stored in JWT Claims
	PrfKey = "prf"
	// FctKey denotes "Facts" in a UCAN. Stored in JWT Claims
	FctKey = "fct"
	// AttKey denotes "Attenuations" in a UCAN. Stored in JWT Claims
	AttKey = "att"
	// CapKey indicates a resource Capability. Used in an attenuation
	CapKey = "cap"
)

Variables

View Source
var ErrInvalidToken = errors.New("invalid access token")

ErrInvalidToken indicates an access token is invalid

Functions

This section is empty.

Types

type WalletAccount

type WalletAccount interface {
	// The account configuration
	AccountConfig() *v1.AccountConfig

	// Bip32Derive derives a new account from a BIP32 path
	Bip32Derive(accName string, idx uint32, addrPrefix string, network string) (WalletAccount, error)

	// Bytes returns the bytes of the account
	Bytes() []byte

	// Equals returns true if the account is equal to the other account
	Equals(other cryptotypes.LedgerPrivKey) bool

	// GetSignerData returns the signer data for the account
	GetSignerData() authsigning.SignerData

	// Info returns the account information
	Info() *v1.AccountInfo

	// IsPrimary returns true if the account is the primary account
	IsPrimary() bool

	// ListConfigs returns the list of all the configurations that are needed to
	// sign a transaction.
	ListConfigs() ([]*cmp.Config, error)

	// NewOriginToken creates a new UCAN token
	NewOriginToken(audienceDID string, att ucan.Attenuations, fct []ucan.Fact, notBefore, expires time.Time) (*ucan.Token, error)

	// NewAttenuatedToken creates a new UCAN token from the parent token
	NewAttenuatedToken(parent *ucan.Token, audienceDID string, att ucan.Attenuations, fct []ucan.Fact, notBefore, expires time.Time) (*ucan.Token, error)

	// PubKey returns secp256k1 public key
	PubKey() common.SNRPubKey

	// Signs a message
	Sign(bz []byte) ([]byte, error)

	// Signs a transaction
	SignTxAux(msgs ...sdk.Msg) (txtypes.AuxSignerData, error)

	// Type returns the type of the account
	Type() string

	// Verifies a signature
	Verify(bz []byte, sig []byte) (bool, error)
}

`WalletAccount` is an interface that defines the methods that a wallet account must implement. @property AccountConfig - The account configuration @property Bip32Derive - This is a method that derives a new account from a BIP32 path. @property GetAssertionMethod - returns the verification method for the account. @property {bool} IsPrimary - returns true if the account is the primary account @property ListConfigs - This is a list of all the configurations that are needed to sign a transaction. @property Sign - This is the function that signs a transaction. @property Verify - Verifies a signature

func NewAccount

func NewAccount(accName string, addrPrefix string, networkName string) (WalletAccount, error)

It creates a new account with the given name, address prefix, and network name

func NewAccountFromConfig

func NewAccountFromConfig(accConf *v1.AccountConfig) (WalletAccount, error)

> This function creates a new wallet account from the given account configuration

Directories

Path Synopsis
internal
mpc

Jump to

Keyboard shortcuts

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