webauthn

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCredential        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCredential          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCredential = fmt.Errorf("proto: unexpected end of group")
)

Functions

func GetCredentialDescriptorsForDIDDocument

func GetCredentialDescriptorsForDIDDocument(didDoc *idtypes.DIDDocument) ([]protocol.CredentialDescriptor, error)

GetCredentialDescriptorsForDIDDocument returns a list of credential descriptors for a DID document

Types

type Authenticator

type Authenticator struct {
	// aaguid is the AAGUID of the authenticator. An AAGUID is defined as an array
	// containing the globally unique identifier of the authenticator model being
	// sought.
	Aaguid []byte `protobuf:"bytes,1,opt,name=aaguid,proto3" json:"aaguid,omitempty"`
	// sign_count is the SignCount -Upon a new login operation, the Relying Party
	// compares the stored signature counter value with the new signCount value
	// returned in the assertion’s authenticator data.
	SignCount uint32 `protobuf:"varint,2,opt,name=sign_count,json=signCount,proto3" json:"sign_count,omitempty"`
	// attachment is a signal that the authenticator may be cloned, i.e. at
	// least two copies of the credential private key may exist and are being used
	// in parallel.
	Attachment string `protobuf:"bytes,3,opt,name=attachment,proto3" json:"attachment,omitempty"`
}

Authenticator is a message type that contains certificate information about a WebAuthn authenticator.

func (*Authenticator) Descriptor

func (*Authenticator) Descriptor() ([]byte, []int)

func (*Authenticator) GetAaguid

func (m *Authenticator) GetAaguid() []byte

func (*Authenticator) GetAttachment

func (m *Authenticator) GetAttachment() string

func (*Authenticator) GetSignCount

func (m *Authenticator) GetSignCount() uint32

func (*Authenticator) Marshal

func (m *Authenticator) Marshal() (dAtA []byte, err error)

func (*Authenticator) MarshalTo

func (m *Authenticator) MarshalTo(dAtA []byte) (int, error)

func (*Authenticator) MarshalToSizedBuffer

func (m *Authenticator) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Authenticator) ProtoMessage

func (*Authenticator) ProtoMessage()

func (*Authenticator) Reset

func (m *Authenticator) Reset()

func (*Authenticator) Size

func (m *Authenticator) Size() (n int)

func (*Authenticator) String

func (m *Authenticator) String() string

func (*Authenticator) Unmarshal

func (m *Authenticator) Unmarshal(dAtA []byte) error

func (*Authenticator) XXX_DiscardUnknown

func (m *Authenticator) XXX_DiscardUnknown()

func (*Authenticator) XXX_Marshal

func (m *Authenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Authenticator) XXX_Merge

func (m *Authenticator) XXX_Merge(src proto.Message)

func (*Authenticator) XXX_Size

func (m *Authenticator) XXX_Size() int

func (*Authenticator) XXX_Unmarshal

func (m *Authenticator) XXX_Unmarshal(b []byte) error

type Credential

type Credential struct {
	// id is a probabilistically-unique byte sequence identifying a public key
	// credential source and its authentication assertions.
	Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// public_key is the public key portion of a Relying Party-specific credential
	// key pair, generated by an authenticator and returned to a Relying Party at
	// registration time.
	PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// attestation_type is the attestation format used (if any) by the
	// authenticator when creating the credential.
	AttestationType string `protobuf:"bytes,3,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"`
	// transport is the transports used by the authenticator when creating the
	// credential.
	Transport []string `protobuf:"bytes,4,rep,name=transport,proto3" json:"transport,omitempty"`
	// Authenticator is the Authenticator information for a given certificate.
	Authenticator *Authenticator `protobuf:"bytes,5,opt,name=authenticator,proto3" json:"authenticator,omitempty"`
	// controller is the DID Controller of the credential.
	Controller string `protobuf:"bytes,6,opt,name=controller,proto3" json:"controller,omitempty"`
}

Credential is a message type that contains all needed information about a WebAuthn credential for storage.

func CredentialFromDIDString

func CredentialFromDIDString(did string) (*Credential, error)

CredentialFromDIDString converts a DID string into a Credential

func (*Credential) DID

func (c *Credential) DID() string

func (*Credential) Decrypt

func (c *Credential) Decrypt(data []byte) ([]byte, error)

Decrypt is used to decrypt a message for the credential

func (*Credential) Descriptor

func (*Credential) Descriptor() ([]byte, []int)

func (*Credential) Deserialize

func (c *Credential) Deserialize(data []byte) error

Deserialize the credential from JSON

func (*Credential) Encrypt

func (c *Credential) Encrypt(data []byte) ([]byte, error)

Encrypt is used to encrypt a message for the credential

func (*Credential) GetAttestationType

func (m *Credential) GetAttestationType() string

func (*Credential) GetAuthenticator

func (m *Credential) GetAuthenticator() *Authenticator

func (*Credential) GetController

func (m *Credential) GetController() string

func (*Credential) GetDescriptor

func (vm *Credential) GetDescriptor() protocol.CredentialDescriptor

ToCredentialDescriptor converts a VerificationMethod to a CredentialDescriptor if the VerificationMethod uses the `did:webauthn` method

func (*Credential) GetId

func (m *Credential) GetId() []byte

func (*Credential) GetPublicKey

func (m *Credential) GetPublicKey() []byte

func (*Credential) GetTransport

func (m *Credential) GetTransport() []string

func (*Credential) Marshal

func (m *Credential) Marshal() (dAtA []byte, err error)

func (*Credential) MarshalTo

func (m *Credential) MarshalTo(dAtA []byte) (int, error)

func (*Credential) MarshalToSizedBuffer

func (m *Credential) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Credential) ProtoMessage

func (*Credential) ProtoMessage()

func (*Credential) PubKey

func (c *Credential) PubKey() *crypto.PubKey

PublicKeyMultibase returns the public key in multibase format

func (*Credential) Reset

func (m *Credential) Reset()

func (*Credential) Serialize

func (c *Credential) Serialize() ([]byte, error)

Serialize the credential to JSON

func (*Credential) ShortID

func (c *Credential) ShortID() string

ShortID returns the first 8 characters of the base58 encoded credential id

func (*Credential) Size

func (m *Credential) Size() (n int)

func (*Credential) String

func (m *Credential) String() string

func (*Credential) ToVerificationMethod

func (c *Credential) ToVerificationMethod() *idtypes.VerificationMethod

ToVerificationMethod converts the credential to a DID VerificationMethod

func (*Credential) Unmarshal

func (m *Credential) Unmarshal(dAtA []byte) error

func (*Credential) XXX_DiscardUnknown

func (m *Credential) XXX_DiscardUnknown()

func (*Credential) XXX_Marshal

func (m *Credential) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Credential) XXX_Merge

func (m *Credential) XXX_Merge(src proto.Message)

func (*Credential) XXX_Size

func (m *Credential) XXX_Size() int

func (*Credential) XXX_Unmarshal

func (m *Credential) XXX_Unmarshal(b []byte) error

type PublicKeyCredentialRequestOptions

type PublicKeyCredentialRequestOptions struct {
	Challenge          protocol.URLEncodedBase64            `json:"challenge"`
	Timeout            int                                  `json:"timeout,omitempty"`
	RelyingPartyID     string                               `json:"rpId,omitempty"`
	AllowedCredentials []protocol.CredentialDescriptor      `json:"allowCredentials,omitempty"`
	UserVerification   protocol.UserVerificationRequirement `json:"userVerification,omitempty"`
	Extensions         protocol.AuthenticationExtensions    `json:"extensions,omitempty"`
	Attestion          string                               `json:"attestation,omitempty"`
	AttestionFormats   []string                             `json:"attestationFormats,omitempty"`
}

PublicKeyCredentialRequestOptions is a struct that contains the options for a PublicKeyCredentialRequest This is a modified version of the struct from the webauthn package to allow for the Attestation field

Jump to

Keyboard shortcuts

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