sfs

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateInbox

func CreateInbox(accDid string) error

CreateInbox sets up a default inbox for the account

func DeriveWithKeyshares

func DeriveWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, coinType crypto.CoinType) (*types.AccountInfo, error)

The function retrieves the public keyshare and the associated encrypted keyshare from a vault based on a given accounts DID, then derives a new set of keyshares for the given coin type.

func GetAccountInfo

func GetAccountInfo(ctx context.Context, did string) (*types.AccountInfo, error)

The function generates a new DID and associated keyshares for a given coin type. It returns the DID and the associated account information.

func GetEncryptedKeyshare

func GetEncryptedKeyshare(did string, cred *servicetypes.WebauthnCredential) (*types.VaultKeyshare, error)

The function retrieves a keyshare from a vault based on a given key DID.

func GetPublicKeyshare

func GetPublicKeyshare(did string) (*types.VaultKeyshare, error)

The function retrieves the public keyshare from a vault based on a given accounts DID.

func GetUnclaimedKeyshares

func GetUnclaimedKeyshares(did string) (types.KeyShareCollection, error)

The function retrieves all unclaimed keyshares from a vault based on a given accounts DID.

func HasInbox

func HasInbox(accDid string) (bool, error)

HasInbox checks if the account has an inbox

func Init

func Init() error

The function "Init" is declared with the parameter "error" and its purpose is not specified as the code is incomplete.

func InsertEncryptedKeyshare

func InsertEncryptedKeyshare(ks *types.VaultKeyshare, cred *servicetypes.WebauthnCredential, coinType crypto.CoinType) error

The function inserts a keyshare into a table and returns an error if there is one.

func InsertPublicKeyshare

func InsertPublicKeyshare(ks *types.VaultKeyshare, coinType crypto.CoinType) error

The function inserts the public vault keyshare into a table and returns an error if there is one.

func InsertUnclaimedKeyshare

func InsertUnclaimedKeyshare(ks *types.VaultKeyshare, coinType crypto.CoinType, idx int) error

The function inserts a keyshare into a table and returns an error if there is one.

func LoadInbox

func LoadInbox(accDid string) (*types.Inbox, error)

LoadInbox loads the inbox for the account

func NewMailboxKey

func NewMailboxKey(secretKey []byte) (*mbKey, error)

func RandomUnclaimedWallet

func RandomUnclaimedWallet() (string, error)

RandomUnclaimedWallet returns a random unclaimed wallet from the store

func ReadInbox

func ReadInbox(accDid string) ([]*types.WalletMail, error)

ReadInbox reads the inbox for the account

func RetreiveCredential

func RetreiveCredential(tokenString string) (*servicetypes.WebauthnCredential, error)

RetreiveCredential returns the *servicetypes.WebauthnCredential from the JWT token string

func SignCosmosTxWithKeyshares

func SignCosmosTxWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, msgs ...sdk.Msg) ([]byte, error)

The function retrieves the public keyshare and the associated encrypted keyshare from a vault based on a given accounts DID, then signs a given message with all keyshares.

func SignWithKeyshares

func SignWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, msg []byte) ([]byte, error)

The function retrieves the public keyshare and the associated encrypted keyshare from a vault based on a given accounts DID, then signs a given message with all keyshares.

func StoreCredential

func StoreCredential(did string, cred *servicetypes.WebauthnCredential) (string, error)

StoreCredential stores the credential in the icefire redis store with a 1 hour expiry. The client is returned the JWT token string.

func VerifyWithPublicKeyshare

func VerifyWithPublicKeyshare(ctx context.Context, did string, sig []byte, msg []byte) (bool, error)

The function retrieves the public keyshare from a vault based on a given accounts DID and verifies a given signature.

func WriteInbox

func WriteInbox(toDid string, msg *types.WalletMail) error

WriteInbox writes the inbox to the database

Types

type ClaimAccountResponse

type ClaimAccountResponse struct {
	Alias       string                     `json:"alias"`
	UcwDid      string                     `json:"ucw_did"`
	CoinType    crypto.CoinType            `json:"coin_type"`
	Address     string                     `json:"address"`
	Account     *types.AccountInfo         `json:"account"`
	DIDDocument *identitytypes.DIDDocument `json:"did_document"`
	JWT         string                     `json:"jwt"`
}

func ClaimAccount

func ClaimAccount(ucwDid string, coinType crypto.CoinType, cred *servicetypes.WebauthnCredential, alias string) (*ClaimAccountResponse, error)

Resolve account takes a list of key shares and a coin type and returns an account.

type JWTClaims

type JWTClaims struct {
	Did        string `json:"did"`
	Credential []byte `json:"credential"`
	ExpiresAt  int64  `json:"expires_at"`
}

type UnlockAccountResponse

type UnlockAccountResponse struct {
	Did     string             `json:"ucw_did"`
	Account *types.AccountInfo `json:"account"`
	JWT     string             `json:"jwt"`
}

func UnlockAccount

UnlockAccount uses a credential to unlock an account and generate a time limited JWT, for use with the API.

Jump to

Keyboard shortcuts

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