authr

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Method = types.DIDMethod("authr")

Variables

This section is empty.

Functions

func FormatIdentifier

func FormatIdentifier(pub []byte) string

FormatIdentifier formats a public key into a DID

Types

type AuthData

type AuthData struct {
	// SecretKey is the secret key used to encrypt the data
	SecretKey []byte `json:"secret_key"`

	// Data is the encrypted data
	Data []byte `json:"data"`

	// Type is the type of data
	Type string `json:"type"`

	// Origin is the origin of the data
	Origin string `json:"origin"`
}

func NewCredentialAuthData

func NewCredentialAuthData(cred *types.Credential, origin string, key types.DIDSecretKey) (*AuthData, error)

NewCredentialAuthData creates a new credential auth data

func NewEmailAuthData

func NewEmailAuthData(email string, key types.DIDSecretKey) (*AuthData, error)

NewEmailAuthData creates a new email auth data

func (*AuthData) GetSecretKeyFromEmail

func (a *AuthData) GetSecretKeyFromEmail(email string) (types.DIDSecretKey, error)

GetSecretKey returns the secret key

func (*AuthData) Key

func (a *AuthData) Key() string

Key returns the key of the auth data

func (*AuthData) Marshal

func (a *AuthData) Marshal() ([]byte, error)

Marshal marshals the auth data

func (*AuthData) Unmarshal

func (a *AuthData) Unmarshal(bz []byte) error

Unmarshal unmarshals the auth data

type AuthSecretKey

type AuthSecretKey []byte

AuthSecretKey is a secret key for an Authenticator

func NewSecretKey

func NewSecretKey() (AuthSecretKey, error)

NewSecretKey creates a new secret key for an Authenticator

func (AuthSecretKey) AccumulatorKey

func (sk AuthSecretKey) AccumulatorKey() (*accumulator.SecretKey, error)

AccumulatorKey returns the accumulator key

func (AuthSecretKey) Bytes

func (sk AuthSecretKey) Bytes() []byte

Bytes returns the bytes of the secret key

func (AuthSecretKey) Decrypt

func (sk AuthSecretKey) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts a byte slice using AES-GCM

func (AuthSecretKey) Encrypt

func (sk AuthSecretKey) Encrypt(bz []byte) ([]byte, error)

Encrypt encrypts a byte slice using AES-GCM

type Authenticator

type Authenticator struct {
	Method types.DIDMethod
	ID     types.DIDIdentifier
	// contains filtered or unexported fields
}

Authenticator is a DID that can be used to authenticate a user

func NewAuthenticator

func NewAuthenticator(email string, cred *types.Credential, origin string) (*Authenticator, error)

NewAuthenticator creates a new Authenticator DID

func ResolveAuthenticator

func ResolveAuthenticator(didString string) (*Authenticator, error)

ResolveAuthenticator creates an Authenticator from a DID and an email.

func (*Authenticator) DID

func (a *Authenticator) DID() string

DID returns the DID string

func (*Authenticator) DIDSecretKey

func (a *Authenticator) DIDSecretKey(email string) (types.DIDSecretKey, error)

DIDSecretKey returns the DIDSecretKey for the authenticator

func (*Authenticator) DIDUrl

func (a *Authenticator) DIDUrl() types.DIDUrl

DIDUrl returns the DIDUrl

func (*Authenticator) ListCredentialDescriptors

func (a *Authenticator) ListCredentialDescriptors(origin string) ([]protocol.CredentialDescriptor, error)

ListCredentialDescriptors returns a list of credential descriptors for the authenticator

func (*Authenticator) LockResource

func (a *Authenticator) LockResource(resource types.DIDResource) ([]byte, error)

LockResource locks a resource to the authenticator

func (*Authenticator) UnlockResource

func (a *Authenticator) UnlockResource(resource types.DIDResource) ([]byte, error)

UnlockResource unlocks a resource from the authenticator

Jump to

Keyboard shortcuts

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