credentials

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowCredential

type AllowCredential struct {
	Type       string                `json:"type"`
	ID         string                `json:"id"`
	Transports []CredentialTransport `json:"transports"`
}

type AllowCredentials

type AllowCredentials struct {
	Key      []AllowCredential `json:"key"`
	Webauthn []AllowCredential `json:"webauthn"`
}

type AsymmetricKeySigner

type AsymmetricKeySigner struct {
	*AsymmetricKeySignerConfig
}

func NewAsymmetricKeySigner

func NewAsymmetricKeySigner(config *AsymmetricKeySignerConfig) *AsymmetricKeySigner

func (*AsymmetricKeySigner) Sign

func (signer *AsymmetricKeySigner) Sign(challenge string, allowCredentials *AllowCredentials) (*KeyAssertion, error)

Sign signs the given challenge using the private key and the hashing algorithm specified in the Algorithm field. If the Algorithm field is not set or invalid, it defaults to SHA256.

type AsymmetricKeySignerConfig

type AsymmetricKeySignerConfig struct {
	PrivateKey  string
	CredId      string
	AppOrigin   string
	CrossOrigin *bool
	Algorithm   *crypto.Hash
}

type CredentialAssertion

type CredentialAssertion struct {
	CredId     string `json:"credId"`
	ClientData string `json:"clientData"`
	Signature  string `json:"signature"`
	Algorithm  string `json:"algorithm"`
}

type CredentialKind

type CredentialKind string
const (
	KeyCredential CredentialKind = "Key"
)

type CredentialTransport

type CredentialTransport string
const (
	USB      CredentialTransport = "usb"
	NFC      CredentialTransport = "nfc"
	BLE      CredentialTransport = "ble"
	Internal CredentialTransport = "internal"
)

type ICredentialSigner

type ICredentialSigner interface {
	Sign(challenge string, allowCredential *AllowCredentials) (*KeyAssertion, error)
}

For not it returns a KeyAssertion. But we can make it more generic afterward

type KeyAssertion

type KeyAssertion struct {
	Kind                CredentialKind      `json:"kind"`
	CredentialAssertion CredentialAssertion `json:"credentialAssertion"`
}

Jump to

Keyboard shortcuts

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