Documentation
¶
Index ¶
Constants ¶
const PrimaryAccountName = "primary"
Variables ¶
var ControllerTypeSystem = schema.MustTypeSystem( schema.SpawnStruct("keyShare", []schema.StructField{ schema.SpawnStructField("bytes", "Bytes", false, false), schema.SpawnStructField("name", "String", false, false), schema.SpawnStructField("lastUsed", "Int", false, false), }, schema.SpawnStructRepresentationMap(nil), ), schema.SpawnBytes("Bytes"), schema.SpawnString("String"), schema.SpawnInt("Int"), )
Functions ¶
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 // DID returns the DID of the account DID() string // GetAuthInfo creates an AuthInfo for a transaction GetAuthInfo(gas sdk.Coins) (*txtypes.AuthInfo, error) ListKeyshares() ([]KeyShare, error) MapKeyshares(f func(KeyShare) error) error // Name returns the name of the account Name() string // PartyIDs returns the party IDs of the account PartyIDs() []crypto.PartyID // Nonce returns the nonce of the account Nonce() uint64 // IncrementNonce increments the nonce of the account IncrementNonce() // PubKey returns secp256k1 public key PubKey() *crypto.PubKey // Signs a message Sign(bz []byte) ([]byte, error) // Type returns the type of the account Type() string // VerificationMethod returns the verification method for the account VerificationMethod(controller string) *types.VerificationMethod // Verifies a signature Verify(bz []byte, sig []byte) (bool, error) // Lock locks the account Lock(c *crypto.WebauthnCredential, rootDir string) error // Unlock unlocks the account Unlock(c *crypto.WebauthnCredential, rootDir string) error }
Account is an interface for an account in the wallet
type Controller ¶
type Controller interface { // Address returns the controller's address Address() string // Get the controller's DID Did() string // Get the controller's DID document DidDocument() *types.DidDocument // Authorize the client to access the controller's account Authorize(cred *crypto.WebauthnCredential) error // CreateAccount creates a new account for the controller CreateAccount(name string, coinType crypto.CoinType) error // GetAccount returns the controller's account GetAccount(name string, coinType crypto.CoinType) (Account, error) // ListAccounts returns the controller's accounts ListAccounts(ct crypto.CoinType) ([]Account, error) // Sign signs a message with the controller's account Sign(name string, coinType crypto.CoinType, msg []byte) ([]byte, error) // Verify verifies a signature with the controller's account Verify(name string, coinType crypto.CoinType, msg []byte, sig []byte) (bool, error) }
func LoadController ¶
func LoadController(ctx context.Context, credential *crypto.WebauthnCredential, didDoc *types.DidDocument) (Controller, error)
LoadController loads a controller from the given DID document using the underlying IPFS store
func NewController ¶
func NewController(ctx context.Context, credential *crypto.WebauthnCredential) (Controller, error)
type FilterOptions ¶
! ||--------------------------------------------------------------------------------|| ! || Map & Slice Filtering || ! ||--------------------------------------------------------------------------------||
type KeyShare ¶
type KeyShare interface { string Bytes() []byte Config() *cmp.Config Did() string PartyID() crypto.PartyID PubKey() *crypto.PubKey Encrypt(credential *crypto.WebauthnCredential) error Decrypt(credential *crypto.WebauthnCredential) error IsEncrypted() bool }Base64()
KeyShare is a type that interacts with a cmp.Config file located on disk.
func LoadKeyshareFromStore ¶
LoadKeyshareFromStore loads a keyshare from a store. The value can be a base64 encoded string or a []byte.
type KeyShareParseResult ¶
type KeyShareParseResult struct {}
func ParseKeyShareDid ¶
func ParseKeyShareDid(name string) (*KeyShareParseResult, error)
ParseKeyShareDid parses a keyshare DID into its components. The DID format is: did:{coin_type}:{account_address}#ks-{account_name}-{keyshare_name}