controller

package
v0.6.25 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ChallengeLength = 32

ChallengeLength - Length of bytes to generate for a challenge.¡¡

Variables

View Source
var PrimaryAccountaddress string = "primary"

Functions

func CreateChallenge added in v0.6.24

func CreateChallenge() (challenge protocol.URLEncodedBase64, err error)

CreateChallenge creates a new challenge that should be signed and returned by the authenticator. The spec recommends using at least 16 bytes with 100 bits of entropy. We use 32 bytes.

Types

type Controller

type Controller interface {
	// The `Address()` function is a method of the `didController` struct that returns the address of the
	// primary account associated with the controller. It takes a pointer to the `didController` struct as
	// its receiver and returns a string representing the address of the primary account.
	Address() string

	// The `Did()` function is a method of the `didController` struct that returns the DID (Decentralized
	// Identifier) associated with the controller's primary account. It takes a pointer to the
	// `didController` struct as its receiver and returns a string representing the DID.
	Did() string

	// PrimaryIdentity returns the controller's DID document
	PrimaryIdentity() *types.DidDocument

	// PrimaryTxHash returns the controller's primary identity transaction hash
	PrimaryTxHash() string

	// 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)

The function loads a controller with a primary account and a list of blockchain accounts from a given DID document.

func NewController

func NewController(options ...Option) (Controller, error)

type Option

type Option func(*Options)

func WithBroadcastTx

func WithBroadcastTx(brdcastChan chan *local.BroadcastTxResponse) Option

func WithConfigHandlers

func WithConfigHandlers(handlers ...mpc.OnConfigGenerated) Option

func WithIPFSDisabled

func WithIPFSDisabled() Option

func WithUsername

func WithUsername(username string) Option

func WithWebauthnCredential

func WithWebauthnCredential(cred *servicetypes.WebauthnCredential) Option

type Options

type Options struct {
	// The controller's on config generated handler
	OnConfigGenerated []mpc.OnConfigGenerated

	// Credential to authorize the controller
	WebauthnCredential *servicetypes.WebauthnCredential

	// Disable IPFS
	DisableIPFS bool

	// Broadcast the transaction
	BroadcastTx bool

	// Username for the controller
	Username string
	// contains filtered or unexported fields
}

type WalletClaims

type WalletClaims interface {
	GetClaimableWallet() *types.ClaimableWallet
	IssueChallenge() (protocol.URLEncodedBase64, error)
	Assign(cred *srvtypes.WebauthnCredential, alias string) (Controller, error)
	Address() string
}

func LoadClaimableWallet

func LoadClaimableWallet(cw *types.ClaimableWallet) WalletClaims

The function returns a WalletClaims interface that contains the claimable wallet and its creator.

func NewWalletClaims

func NewWalletClaims(creator string, kss []models.KeyShare) (WalletClaims, error)

The function creates a new wallet claim with a given creator and key shares.

Jump to

Keyboard shortcuts

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