Documentation
¶
Index ¶
- func CreateDefaultInboxMap(id string) (map[string]interface{}, error)
- func FormatBlockchainAddressAsDID(addr string) string
- func GetPubKeyFromCmpConfigBytes(bytes []byte) (*crypto.PubKey, error)
- func ParseCredentialDID(did string) (*crypto.WebauthnCredential, error)
- type Account
- type Credential
- func LoadCredential(vm *types.VerificationMethod) (Credential, error)
- func LoadJSONCredential(bz []byte) (Credential, error)
- func NewCredential(cred *crypto.WebauthnCredential, controller string) Credential
- func ValidateWebauthnCredential(credential *crypto.WebauthnCredential, controller string) (Credential, error)
- type Inbox
- type InboxMessage
- type KeyShare
- type KeyShareParseResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDefaultInboxMap ¶
func FormatBlockchainAddressAsDID ¶
FormatBlockchainAddressAsDID formats a blockchain address as a DID.
func GetPubKeyFromCmpConfigBytes ¶
GetPubKeyFromCmpConfigBytes loads KeyShare from a cmp.Config buffer.
func ParseCredentialDID ¶
func ParseCredentialDID(did string) (*crypto.WebauthnCredential, error)
Parse a DID into a WebauthnCredential struct
Types ¶
type Account ¶
type Account interface {
// Address returns the address of the account based on the coin type
Address() string
// CoinType returns the coin type of the account
CoinType() crypto.CoinType
// CreateInboxMail creates a new inbox mail
CreateInboxMessage(to string, body string) (*InboxMessage, error)
// DeriveAccount returns a new account with the same keyshares but a new coin type
DeriveAccount(ct crypto.CoinType, idx int, name string) (Account, error)
// DID returns the DID of the account
Did() string
// Get the controller's DID document
DidDocument() *types.DidDocument
// GetAuthInfo creates an AuthInfo for a transaction
GetAuthInfo(gas sdk.Coins) (*txtypes.AuthInfo, error)
ListKeyShares() []string
MapKeyShare(f func(ks KeyShare) KeyShare)
// Name returns the name of the account
Name() string
// PubKey returns secp256k1 public key
PubKey() *crypto.PubKey
// Signs a message
Sign(bz []byte) ([]byte, error)
// ToProto returns the proto representation of the account
ToProto() *v1.Account
// Type returns the type of the account
Type() string
// Verifies a signature
Verify(bz []byte, sig []byte) (bool, error)
// Lock locks the account
Lock(c Credential) error
// Unlock unlocks the account
Unlock(c Credential) error
}
Account is an interface for an account in the wallet
type Credential ¶
type Credential interface {
// Controller returns the credential's controller
Controller() string
// Get the credential's DID
Did() string
// Convert the credential to a DID VerificationMethod
ToVerificationMethod() *types.VerificationMethod
// Encrypt is used to encrypt a message for the credential
Encrypt(msg []byte) ([]byte, error)
// Decrypt is used to decrypt a message for the credential
Decrypt(msg []byte) ([]byte, error)
// Marshal is used to marshal the credential to JSON
Marshal() ([]byte, error)
}
func LoadCredential ¶
func LoadCredential(vm *types.VerificationMethod) (Credential, error)
func LoadJSONCredential ¶
func LoadJSONCredential(bz []byte) (Credential, error)
func NewCredential ¶
func NewCredential(cred *crypto.WebauthnCredential, controller string) Credential
func ValidateWebauthnCredential ¶
func ValidateWebauthnCredential(credential *crypto.WebauthnCredential, controller string) (Credential, error)
type Inbox ¶
type Inbox struct {
// The inbox id
Id string `json:"_id,omitempty"`
// The inbox messages
Messages []*InboxMessage `json:"messages,omitempty"`
}
func NewInboxFromMap ¶
func (*Inbox) AddMessageToMap ¶
func (inbox *Inbox) AddMessageToMap(msg *InboxMessage) (map[string]interface{}, error)
type InboxMessage ¶
type InboxMessage struct {
// The message id
Id string `json:"id,omitempty"`
// The message type
Type string `json:"type,omitempty"`
// The message content
Content string `json:"content,omitempty"`
// The message sender
Sender string `json:"sender,omitempty"`
// The message receiver
Receiver string `json:"receiver,omitempty"`
// CoinType Name is for the blockchain network name
CoinType string `json:"coinType,omitempty"`
}
func (*InboxMessage) InboxMessageToMap ¶
func (im *InboxMessage) InboxMessageToMap() (map[string]interface{}, error)
type KeyShare ¶
type KeyShare interface {
AccountName() string
Bytes() []byte
CoinType() crypto.CoinType
Config() *cmp.Config
DeriveBip44(ct crypto.CoinType, idx int, name string) (KeyShare, error)
Did() string
PartyID() crypto.PartyID
PubKey() *crypto.PubKey
IsEncrypted() bool
Encrypt(credential Credential) error
Decrypt(credential Credential) error
}
KeyShare is a type that interacts with a cmp.Config file located on disk.
type KeyShareParseResult ¶
type KeyShareParseResult struct {
}
func ParseAccountDID ¶
func ParseAccountDID(name string) (*KeyShareParseResult, error)
ParseAccountDID parses an account DID into its components.
func ParseKeyShareDID ¶
func ParseKeyShareDID(name string) (*KeyShareParseResult, error)
ParseKeyShareDID parses a keyshare DID into its components.
Click to show internal directories.
Click to hide internal directories.