controller

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DIDController

type DIDController interface {
	// Address
	Address() string

	// DID
	ID() string

	// DID Document
	Document() *types.DidDocument

	// This method is used to get the challenge response from the DID controller.
	BeginRegistration(aka string) ([]byte, error)

	// This is the method that will be called when the user clicks on the "Register" button.
	FinishRegistration(aka string, challengeResponse string) ([]byte, error)

	// This method is used to get the options for the assertion.
	BeginLogin(aka string) ([]byte, error)

	// This is the method that will be called when the user clicks the "Login" button on the login page.
	FinishLogin(aka string, challengeResponse string) ([]byte, error)

	// Creates a new account and returns the address of the account.
	CreateAccount(name string, coinType crypto.CoinType) (*types.VerificationMethod, error)

	// Gets an account by name
	GetAccount(name string) (wallet.Account, error)

	// Gets Cosmos account
	GetSonrAccount() (wallet.CosmosAccount, error)

	// Gets all accounts
	ListAccounts() ([]wallet.Account, error)

	// Sign a message with the primary account
	Sign(message []byte) ([]byte, error)

	// Verify a message with the primary account
	Verify(message []byte, signature []byte) (bool, error)
}

`DIDController` is a type that is both a `wallet.Wallet` and a `store.WalletStore`. @property GetChallengeResponse - This method is used to get the challenge response from the DID controller. @property RegisterAuthenticationCredential - This is the method that will be called when the user clicks on the "Register" button. @property GetAssertionOptions - This method is used to get the options for the assertion. @property AuthorizeCredential - This is the method that will be called when the user clicks the "Login" button on the login page.

func New

func New(account wallet.Account, opts ...stores.Option) (DIDController, error)

`New` creates a new DID controller instance

type DIDControllerImpl

type DIDControllerImpl struct {
	// contains filtered or unexported fields
}

`DIDControllerImpl` is a type that implements the `DIDController` interface. @property - `wallet.Wallet`: This is the interface that the DID controller implements. @property - `store.WalletStore`: This is the interface that the DID controller implements.

func (*DIDControllerImpl) Address

func (d *DIDControllerImpl) Address() string

Address returns the address of the DID controller.

func (*DIDControllerImpl) BeginLogin added in v0.3.1

func (d *DIDControllerImpl) BeginLogin(aka string) ([]byte, error)

This method is used to get the options for the assertion.

func (*DIDControllerImpl) BeginRegistration added in v0.3.1

func (d *DIDControllerImpl) BeginRegistration(aka string) ([]byte, error)

This method is used to get the challenge response from the DID controller.

func (*DIDControllerImpl) CreateAccount

func (w *DIDControllerImpl) CreateAccount(name string, coinType crypto.CoinType) (*types.VerificationMethod, error)

Creating a new account.

func (*DIDControllerImpl) Document

func (d *DIDControllerImpl) Document() *types.DidDocument

Document returns the DID document of the DID controller.

func (*DIDControllerImpl) FinishLogin added in v0.3.1

func (d *DIDControllerImpl) FinishLogin(aka string, challengResp string) ([]byte, error)

This is the method that will be called when the user clicks the "Login" button on the login page.

func (*DIDControllerImpl) FinishRegistration added in v0.3.1

func (d *DIDControllerImpl) FinishRegistration(aka string, challengResp string) ([]byte, error)

This is the method that will be called when the user clicks on the "Register" button.

func (*DIDControllerImpl) GetAccount

func (w *DIDControllerImpl) GetAccount(name string) (wallet.Account, error)

Returning the account.WalletAccount and error.

func (*DIDControllerImpl) GetSonrAccount added in v0.3.1

func (w *DIDControllerImpl) GetSonrAccount() (wallet.CosmosAccount, error)

Get Sonr account

func (*DIDControllerImpl) ID

func (d *DIDControllerImpl) ID() string

ID returns the DID of the DID controller.

func (*DIDControllerImpl) ListAccounts

func (w *DIDControllerImpl) ListAccounts() ([]wallet.Account, error)

ListAccounts returns the list of accounts.

func (*DIDControllerImpl) Sign added in v0.3.1

func (w *DIDControllerImpl) Sign(data []byte) ([]byte, error)

Sign signs the data with the given account.

func (*DIDControllerImpl) Verify added in v0.3.1

func (w *DIDControllerImpl) Verify(data, sig []byte) (bool, error)

Verify verifies the signature with the given account.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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