services

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BucketAdi              = []byte("adi")
	BucketMnemonic         = []byte("mnemonic")
	BucketKeyCounter       = []byte("keycounter")
	BucketTransactionCache = []byte("TransactionCache")
)
View Source
var ErrNotEnoughData = errors.BadRequest.With("not enough data")
View Source
var ErrOverflow = errors.BadRequest.With("overflow")

Functions

func LabelForLiteIdentity

func LabelForLiteIdentity(label string) (string, bool)

LabelForLiteIdentity returns the label of the LiteIdentity if label is a valid LiteIdentity account URL. Otherwise, LabelForLiteIdentity returns the original value.

func LabelForLiteTokenAccount

func LabelForLiteTokenAccount(label string) (string, bool)

LabelForLiteTokenAccount returns the identity of the token account if label is a valid token account URL. Otherwise, LabelForLiteTokenAccount returns the original value.

func LabelIsLite

func LabelIsLite(label string) bool

func LabelIsValid

func LabelIsValid(label string) error

func RestoreAccounts

func RestoreAccounts(wallet db.DB) (out string, err error)

func SanitizedCopy added in v0.6.3

func SanitizedCopy(dst, src db.DB) error

Types

type AccountService

type AccountService struct {
	Vaults WalletManager
}

func (*AccountService) AdiList

func (*AccountService) ListAccounts

func (*AccountService) RegisterADI

func (*AccountService) RegisterBook

func (m *AccountService) RegisterBook(ctx context.Context, req *api.RegisterBookRequest) (_ *api.RegisterBookResponse, err error)

func (*AccountService) RegisterTokenAccount

func (*AccountService) UnregisterBook

func (m *AccountService) UnregisterBook(ctx context.Context, req *api.UnregisterBookRequest) (_ *api.UnregisterBookResponse, err error)

type GeneralService

type GeneralService struct {
	MaxTTL time.Duration
	Keys   KeyStore
}

func (*GeneralService) Decode

func (*GeneralService) Encode

func (*GeneralService) GenerateMnemonic

func (*GeneralService) RefreshToken added in v0.6.0

func (*GeneralService) Version

type Key

type Key struct {
	api.Key
	Hash []byte
	// contains filtered or unexported fields
}

func (*Key) GetPrivateKey

func (k *Key) GetPrivateKey() ([]byte, bool)

func (*Key) GetPublicKey

func (k *Key) GetPublicKey() ([]byte, bool)

func (*Key) GetPublicKeyHash

func (k *Key) GetPublicKeyHash() ([]byte, bool)

func (*Key) GetType

func (k *Key) GetType() protocol.SignatureType

func (*Key) InitializeFromSeed

func (k *Key) InitializeFromSeed(seed []byte, signatureType protocol.SignatureType, hdPath string) error

func (*Key) NativeAddress

func (k *Key) NativeAddress() (address string, err error)

func (*Key) PublicKeyHash

func (k *Key) PublicKeyHash() []byte

func (*Key) String

func (k *Key) String() string

type KeyService

type KeyService struct {
	Vaults WalletManager
}

func (*KeyService) FindSigner

func (*KeyService) GenerateAddress

func (*KeyService) ImportKey

func (*KeyService) KeyAssign

func (*KeyService) KeyList

func (*KeyService) KeyRemove

func (*KeyService) KeyRename

func (*KeyService) ResolveKey

func (*KeyService) RestoreKeyCounters added in v0.6.0

type KeyStore added in v0.6.0

type KeyStore interface {
	GetKey(v Vault, token []byte) (*memguard.Enclave, error)
	PutKey(v Vault, token []byte, ttl time.Duration, key *memguard.Enclave) (*time.Time, error)
	PutPassphrase(v Vault, token []byte, ttl time.Duration, passphrase *memguard.Enclave) (*time.Time, error)
	DeleteKey(v Vault, token []byte) error
	RefreshToken(oldToken, newToken []byte, ttl time.Duration) (*time.Time, error)
}

type LedgerManager

type LedgerManager interface {
	Wallets() ([]*api.LedgerWalletInfo, error)
	Derive(id *url.URL, path bip44.Derivation, pin, display bool, labels ...string) (address.Address, error)
	Sign(id *url.URL, path bip44.Derivation, txn *protocol.Transaction, sig protocol.Signature) (protocol.Signature, error)
}

type LedgerService

type LedgerService struct {
	Vaults WalletManager
	Ledger LedgerManager
}

func (*LedgerService) LedgerGenerateKey

func (s *LedgerService) LedgerGenerateKey(_ context.Context, req *api.GenerateLedgerKeyRequest) (*api.Key, error)

func (*LedgerService) LedgerQueryWallets

func (s *LedgerService) LedgerQueryWallets(_ context.Context) (*api.LedgerWalletResponse, error)

type SigningService

type SigningService struct {
	Vaults WalletManager
	Ledger LedgerManager
}

func (*SigningService) ResetLastUsedOn

func (*SigningService) Sign

func (s *SigningService) Sign(_ context.Context, req *api.SignRequest) (_ *api.SignResponse, err error)

func (*SigningService) SignMessage

func (s *SigningService) SignMessage(_ context.Context, req *api.SignMessageRequest) (_ *api.SignResponse, err error)

func (*SigningService) SignTransaction

func (s *SigningService) SignTransaction(_ context.Context, req *api.SignTransactionRequest) (_ *api.SignResponse, err error)

type TokenKeyStore added in v0.6.0

type TokenKeyStore struct {
	// contains filtered or unexported fields
}

func (*TokenKeyStore) DeleteKey added in v0.6.0

func (s *TokenKeyStore) DeleteKey(v Vault, token []byte) error

func (*TokenKeyStore) GetKey added in v0.6.0

func (s *TokenKeyStore) GetKey(v Vault, token []byte) (*memguard.Enclave, error)

func (*TokenKeyStore) PutKey added in v0.6.0

func (s *TokenKeyStore) PutKey(v Vault, token []byte, ttl time.Duration, key *memguard.Enclave) (*time.Time, error)

func (*TokenKeyStore) PutPassphrase added in v0.6.0

func (s *TokenKeyStore) PutPassphrase(v Vault, token []byte, ttl time.Duration, passphrase *memguard.Enclave) (*time.Time, error)

func (*TokenKeyStore) RefreshToken added in v0.6.0

func (s *TokenKeyStore) RefreshToken(oldToken, newToken []byte, ttl time.Duration) (*time.Time, error)

type TransactionService

type TransactionService struct {
	Vaults WalletManager
}

func (*TransactionService) AddMemoToTransaction

func (*TransactionService) AddSendTokensOutput

func (*TransactionService) CreateEnvelope

func (*TransactionService) CreateTransaction

func (*TransactionService) DeleteTransaction

func (*TransactionService) GetTransaction

func (*TransactionService) ListTransactions

func (*TransactionService) WriteDataTransaction

func (m *TransactionService) WriteDataTransaction(_ context.Context, req *api.WriteDataRequest) (*api.TransactionResponse, error)

type Vault added in v0.6.0

type Vault interface {
	Info() *api.VaultInfo
	Status(token []byte) (*api.VaultStatus, error)
	Open(token []byte) (*model.Model, error)
	OpenRaw(token []byte) (*model.Model, error)
	Create(token []byte) (*model.Model, error)
	With(token []byte, fn func(*model.Model) error) error
	Close() error
}

type VaultService

type VaultService struct {
	MaxTTL time.Duration
	Keys   KeyStore
	Vaults WalletManager
}

func (*VaultService) AdoptVault

func (m *VaultService) AdoptVault(ctx context.Context, req *api.AdoptVaultRequest) (_ *api.AdoptVaultResponse, err error)

func (*VaultService) ConvertWallet

func (*VaultService) CopyVaultSanitized added in v0.6.3

func (*VaultService) CreateVault

func (m *VaultService) CreateVault(ctx context.Context, req *api.CreateVaultRequest) (_ *api.CreateVaultResponse, err error)

func (*VaultService) CreateWallet

func (*VaultService) EncryptVault

func (*VaultService) ExportVault

func (*VaultService) ImportMnemonic

func (*VaultService) ImportVault

func (*VaultService) ListVaults

func (*VaultService) LockVault

func (*VaultService) OpenVault

func (*VaultService) Set1PasswordRef

func (*VaultService) Status

func (*VaultService) UnlockVault

type VaultWithKeys added in v0.6.0

type VaultWithKeys struct {
	*vault.Vault
	Keys KeyStore
	// contains filtered or unexported fields
}

func (*VaultWithKeys) Create added in v0.6.0

func (v *VaultWithKeys) Create(token []byte) (*model.Model, error)

func (*VaultWithKeys) Open added in v0.6.0

func (v *VaultWithKeys) Open(token []byte) (*model.Model, error)

func (*VaultWithKeys) OpenRaw added in v0.6.0

func (v *VaultWithKeys) OpenRaw(token []byte) (*model.Model, error)

func (*VaultWithKeys) Status added in v0.6.0

func (v *VaultWithKeys) Status(token []byte) (*api.VaultStatus, error)

func (*VaultWithKeys) Unwrap added in v0.6.0

func (v *VaultWithKeys) Unwrap() *vault.Vault

func (*VaultWithKeys) With added in v0.6.0

func (v *VaultWithKeys) With(token []byte, fn func(*model.Model) error) error

type Wallet added in v0.6.0

type Wallet interface {
	Directory() string
	Index() Vault
	Vault(name string) Vault
	Each(fn func(Vault) error) error
}

type WalletManager

type WalletManager interface {
	UseMemDB() bool
	Each(fn func(Wallet) error) error
	Wallet(walletDir string) Wallet
}

type WalletManagerWithKeys added in v0.6.0

type WalletManagerWithKeys struct {
	InMemory bool
	Keys     KeyStore
	// contains filtered or unexported fields
}

func (*WalletManagerWithKeys) Each added in v0.6.0

func (m *WalletManagerWithKeys) Each(fn func(Wallet) error) error

func (*WalletManagerWithKeys) UseMemDB added in v0.6.0

func (m *WalletManagerWithKeys) UseMemDB() bool

func (*WalletManagerWithKeys) Wallet added in v0.6.0

func (m *WalletManagerWithKeys) Wallet(walletDir string) Wallet

type WalletWithKeys added in v0.6.0

type WalletWithKeys struct {
	*vault.Wallet
	Keys KeyStore
}

func (*WalletWithKeys) Directory added in v0.6.0

func (w *WalletWithKeys) Directory() string

func (*WalletWithKeys) Each added in v0.6.0

func (w *WalletWithKeys) Each(fn func(Vault) error) error

func (*WalletWithKeys) Index added in v0.6.0

func (w *WalletWithKeys) Index() Vault

func (*WalletWithKeys) Vault added in v0.6.0

func (w *WalletWithKeys) Vault(name string) Vault

Jump to

Keyboard shortcuts

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