keystore

package
v0.0.0-...-89805ac Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptKey

func DecryptKey(serviceKey, encryptedKey []byte) ([]byte, error)

DecryptKey encrypts another key with the service key using xchacha20-poly1305

func EncryptKey

func EncryptKey(serviceKey, key []byte) ([]byte, error)

EncryptKey encrypts another key with the service key using xchacha20-poly1305

func GenerateServiceKey

func GenerateServiceKey(skPassword string) (key, salt string, err error)

GenerateServiceKey using argon2 for key derivation generate a service key and corresponding salt, base58 encoding both values.

Types

type GetKeyDetailsRequest

type GetKeyDetailsRequest struct {
	ID string
}

type GetKeyDetailsResponse

type GetKeyDetailsResponse struct {
	ID         string
	Type       crypto.KeyType
	Controller string
	CreatedAt  string
}

type GetKeyRequest

type GetKeyRequest struct {
	ID string
}

type GetKeyResponse

type GetKeyResponse struct {
	ID         string
	Type       crypto.KeyType
	Controller string
	CreatedAt  string
	Key        gocrypto.PrivateKey
}

type KeyDetails

type KeyDetails struct {
	ID         string         `json:"id"`
	Controller string         `json:"controller"`
	KeyType    crypto.KeyType `json:"keyType"`
	CreatedAt  string         `json:"createdAt"`
}

KeyDetails represents a common data model to get information about a key, without revealing the key itself

type Service

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

func (Service) Config

func (Service) GetKey

func (s Service) GetKey(request GetKeyRequest) (*GetKeyResponse, error)

func (Service) GetKeyDetails

func (s Service) GetKeyDetails(request GetKeyDetailsRequest) (*GetKeyDetailsResponse, error)

func (Service) Status

func (s Service) Status() framework.Status

func (Service) StoreKey

func (s Service) StoreKey(request StoreKeyRequest) error

func (Service) Type

func (s Service) Type() framework.Type

type ServiceKey

type ServiceKey struct {
	Base58Key  string
	Base58Salt string
}

type Storage

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

func NewKeyStoreStorage

func NewKeyStoreStorage(db storage.ServiceStorage, key ServiceKey) (*Storage, error)

func (*Storage) GetKey

func (kss *Storage) GetKey(id string) (*StoredKey, error)

func (*Storage) GetKeyDetails

func (kss *Storage) GetKeyDetails(id string) (*KeyDetails, error)

func (*Storage) StoreKey

func (kss *Storage) StoreKey(key StoredKey) error

type StoreKeyRequest

type StoreKeyRequest struct {
	ID               string
	Type             crypto.KeyType
	Controller       string
	PrivateKeyBase58 string
}

type StoredKey

type StoredKey struct {
	ID         string         `json:"id"`
	Controller string         `json:"controller"`
	KeyType    crypto.KeyType `json:"keyType"`
	Base58Key  string         `json:"key"`
	CreatedAt  string         `json:"createdAt"`
}

StoredKey represents a common data model to store data on all key types

Jump to

Keyboard shortcuts

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