Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PrimaryAccountaddress string = "primary"
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface {
// Address returns the controller's address
Address() string
// Get the controller's DID
Did() string
// PrimaryIdentity returns the controller's DID document
PrimaryIdentity() *types.DidDocument
// BlockchainIdentities returns the controller's blockchain identities
BlockchainIdentities() []*types.DidDocument
// Createmodels.Account creates a new models.Account for the controller
CreateAccount(name string, coinType crypto.CoinType) (models.Account, error)
// GetAccount returns an account by Address or DID
GetAccount(id string) (models.Account, error)
// Listmodels.Accounts returns the controller's models.Accounts
ListAccounts() ([]models.Account, error)
// SendMail sends a message between two Controllers
SendMail(address string, to string, body string) error
// ReadMail reads the controller's inbox
ReadMail(address string) ([]*models.InboxMessage, error)
// Sign signs a message with the controller's models.Account
Sign(address string, msg []byte) ([]byte, error)
// Verify verifies a signature with the controller's models.Account
Verify(address string, msg []byte, sig []byte) (bool, error)
}
func LoadController ¶
func LoadController(doc *types.DidDocument) (Controller, error)
func NewController ¶
func NewController(options ...Option) (Controller, error)
type Option ¶
type Option func(*Options)
func WithBroadcastTx ¶ added in v0.6.9
func WithBroadcastTx() Option
func WithConfigHandlers ¶
func WithConfigHandlers(handlers ...mpc.OnConfigGenerated) Option
func WithIPFSDisabled ¶
func WithIPFSDisabled() Option
func WithUsername ¶ added in v0.6.9
func WithWebauthnCredential ¶
func WithWebauthnCredential(cred *crypto.WebauthnCredential) Option
type Options ¶
type Options struct {
// The controller's on config generated handler
OnConfigGenerated []mpc.OnConfigGenerated
// Credential to authorize the controller
WebauthnCredential *crypto.WebauthnCredential
// Disable IPFS
DisableIPFS bool
// Broadcast the transaction
BroadcastTx bool
// Username for the controller
Username string
}
type User ¶ added in v0.6.11
type User struct {
// DID of the user
Did string `json:"_id"`
// DID document of the primary identity
Username string `json:"username"`
// Map of the dids of the keyshares to the dids of the accounts
Accounts []string `json:"accounts"`
// DidDocument of the primary identity
PrimaryIdentity *types.DidDocument `json:"primaryIdentity"`
}
func NewUser ¶ added in v0.6.11
func NewUser(c Controller) *User
Click to show internal directories.
Click to hide internal directories.