Documentation
¶
Index ¶
- func CreateInbox(accDid string) error
- func DeriveWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, ...) (*types.AccountInfo, error)
- func GetAccountInfo(ctx context.Context, did string) (*types.AccountInfo, error)
- func GetEncryptedKeyshare(did string, cred *servicetypes.WebauthnCredential) (*types.VaultKeyshare, error)
- func GetPublicKeyshare(did string) (*types.VaultKeyshare, error)
- func GetUnclaimedKeyshares(did string) (types.KeyShareCollection, error)
- func HasInbox(accDid string) (bool, error)
- func Init() error
- func InsertEncryptedKeyshare(ks *types.VaultKeyshare, cred *servicetypes.WebauthnCredential, ...) error
- func InsertPublicKeyshare(ks *types.VaultKeyshare, coinType crypto.CoinType) error
- func InsertUnclaimedKeyshare(ks *types.VaultKeyshare, coinType crypto.CoinType, idx int) error
- func LoadInbox(accDid string) (*types.Inbox, error)
- func NewMailboxKey(secretKey []byte) (*mbKey, error)
- func RandomUnclaimedWallet() (string, error)
- func ReadInbox(accDid string) ([]*types.WalletMail, error)
- func RetreiveCredential(tokenString string) (*servicetypes.WebauthnCredential, error)
- func SignCosmosTxWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, ...) ([]byte, error)
- func SignWithKeyshares(ctx context.Context, did string, cred *servicetypes.WebauthnCredential, ...) ([]byte, error)
- func StoreCredential(did string, cred *servicetypes.WebauthnCredential) (string, error)
- func VerifyWithPublicKeyshare(ctx context.Context, did string, sig []byte, msg []byte) (bool, error)
- func WriteInbox(toDid string, msg *types.WalletMail) error
- type ClaimAccountResponse
- type JWTClaims
- type UnlockAccountResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateInbox ¶
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 ¶
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 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 ¶
The function inserts a keyshare into a table and returns an error if there is one.
func NewMailboxKey ¶
func RandomUnclaimedWallet ¶
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 UnlockAccountResponse ¶
type UnlockAccountResponse struct {
Did string `json:"ucw_did"`
Account *types.AccountInfo `json:"account"`
JWT string `json:"jwt"`
}
func UnlockAccount ¶
func UnlockAccount(did string, cred *servicetypes.WebauthnCredential) (*UnlockAccountResponse, error)
UnlockAccount uses a credential to unlock an account and generate a time limited JWT, for use with the API.