Documentation ¶
Index ¶
- Constants
- func FormatIdentifier(pub []byte) string
- type AuthData
- type AuthSecretKey
- type Authenticator
- func (a *Authenticator) DID() string
- func (a *Authenticator) DIDSecretKey(email string) (types.DIDSecretKey, error)
- func (a *Authenticator) DIDUrl() types.DIDUrl
- func (a *Authenticator) ListCredentialDescriptors(origin string) ([]protocol.CredentialDescriptor, error)
- func (a *Authenticator) LockResource(resource types.DIDResource) ([]byte, error)
- func (a *Authenticator) UnlockResource(resource types.DIDResource) ([]byte, error)
Constants ¶
const Method = types.DIDMethod("authr")
Variables ¶
This section is empty.
Functions ¶
func FormatIdentifier ¶
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
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
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) 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