package webauthn
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
type EnableParams struct {
EnableUI bool `json:"enableUI,omitempty"`
}
func Enable () *EnableParams {
return &EnableParams {}
}
func (p EnableParams ) WithEnableUI (enableUI bool ) *EnableParams {
p .EnableUI = enableUI
return &p
}
func (p *EnableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandEnable , p , nil )
}
type DisableParams struct {}
func Disable () *DisableParams {
return &DisableParams {}
}
func (p *DisableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandDisable , nil , nil )
}
type AddVirtualAuthenticatorParams struct {
Options *VirtualAuthenticatorOptions `json:"options"`
}
func AddVirtualAuthenticator (options *VirtualAuthenticatorOptions ) *AddVirtualAuthenticatorParams {
return &AddVirtualAuthenticatorParams {
Options : options ,
}
}
type AddVirtualAuthenticatorReturns struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId,omitempty"`
}
func (p *AddVirtualAuthenticatorParams ) Do (ctx context .Context ) (authenticatorID AuthenticatorID , err error ) {
var res AddVirtualAuthenticatorReturns
err = cdp .Execute (ctx , CommandAddVirtualAuthenticator , p , &res )
if err != nil {
return "" , err
}
return res .AuthenticatorID , nil
}
type SetResponseOverrideBitsParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
IsBogusSignature bool `json:"isBogusSignature,omitempty"`
IsBadUV bool `json:"isBadUV,omitempty"`
IsBadUP bool `json:"isBadUP,omitempty"`
}
func SetResponseOverrideBits (authenticatorID AuthenticatorID ) *SetResponseOverrideBitsParams {
return &SetResponseOverrideBitsParams {
AuthenticatorID : authenticatorID ,
}
}
func (p SetResponseOverrideBitsParams ) WithIsBogusSignature (isBogusSignature bool ) *SetResponseOverrideBitsParams {
p .IsBogusSignature = isBogusSignature
return &p
}
func (p SetResponseOverrideBitsParams ) WithIsBadUV (isBadUV bool ) *SetResponseOverrideBitsParams {
p .IsBadUV = isBadUV
return &p
}
func (p SetResponseOverrideBitsParams ) WithIsBadUP (isBadUP bool ) *SetResponseOverrideBitsParams {
p .IsBadUP = isBadUP
return &p
}
func (p *SetResponseOverrideBitsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetResponseOverrideBits , p , nil )
}
type RemoveVirtualAuthenticatorParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
}
func RemoveVirtualAuthenticator (authenticatorID AuthenticatorID ) *RemoveVirtualAuthenticatorParams {
return &RemoveVirtualAuthenticatorParams {
AuthenticatorID : authenticatorID ,
}
}
func (p *RemoveVirtualAuthenticatorParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandRemoveVirtualAuthenticator , p , nil )
}
type AddCredentialParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
Credential *Credential `json:"credential"`
}
func AddCredential (authenticatorID AuthenticatorID , credential *Credential ) *AddCredentialParams {
return &AddCredentialParams {
AuthenticatorID : authenticatorID ,
Credential : credential ,
}
}
func (p *AddCredentialParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandAddCredential , p , nil )
}
type GetCredentialParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
CredentialID string `json:"credentialId"`
}
func GetCredential (authenticatorID AuthenticatorID , credentialID string ) *GetCredentialParams {
return &GetCredentialParams {
AuthenticatorID : authenticatorID ,
CredentialID : credentialID ,
}
}
type GetCredentialReturns struct {
Credential *Credential `json:"credential,omitempty"`
}
func (p *GetCredentialParams ) Do (ctx context .Context ) (credential *Credential , err error ) {
var res GetCredentialReturns
err = cdp .Execute (ctx , CommandGetCredential , p , &res )
if err != nil {
return nil , err
}
return res .Credential , nil
}
type GetCredentialsParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
}
func GetCredentials (authenticatorID AuthenticatorID ) *GetCredentialsParams {
return &GetCredentialsParams {
AuthenticatorID : authenticatorID ,
}
}
type GetCredentialsReturns struct {
Credentials []*Credential `json:"credentials,omitempty"`
}
func (p *GetCredentialsParams ) Do (ctx context .Context ) (credentials []*Credential , err error ) {
var res GetCredentialsReturns
err = cdp .Execute (ctx , CommandGetCredentials , p , &res )
if err != nil {
return nil , err
}
return res .Credentials , nil
}
type RemoveCredentialParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
CredentialID string `json:"credentialId"`
}
func RemoveCredential (authenticatorID AuthenticatorID , credentialID string ) *RemoveCredentialParams {
return &RemoveCredentialParams {
AuthenticatorID : authenticatorID ,
CredentialID : credentialID ,
}
}
func (p *RemoveCredentialParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandRemoveCredential , p , nil )
}
type ClearCredentialsParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
}
func ClearCredentials (authenticatorID AuthenticatorID ) *ClearCredentialsParams {
return &ClearCredentialsParams {
AuthenticatorID : authenticatorID ,
}
}
func (p *ClearCredentialsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandClearCredentials , p , nil )
}
type SetUserVerifiedParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
IsUserVerified bool `json:"isUserVerified"`
}
func SetUserVerified (authenticatorID AuthenticatorID , isUserVerified bool ) *SetUserVerifiedParams {
return &SetUserVerifiedParams {
AuthenticatorID : authenticatorID ,
IsUserVerified : isUserVerified ,
}
}
func (p *SetUserVerifiedParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetUserVerified , p , nil )
}
type SetAutomaticPresenceSimulationParams struct {
AuthenticatorID AuthenticatorID `json:"authenticatorId"`
Enabled bool `json:"enabled"`
}
func SetAutomaticPresenceSimulation (authenticatorID AuthenticatorID , enabled bool ) *SetAutomaticPresenceSimulationParams {
return &SetAutomaticPresenceSimulationParams {
AuthenticatorID : authenticatorID ,
Enabled : enabled ,
}
}
func (p *SetAutomaticPresenceSimulationParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetAutomaticPresenceSimulation , p , nil )
}
const (
CommandEnable = "WebAuthn.enable"
CommandDisable = "WebAuthn.disable"
CommandAddVirtualAuthenticator = "WebAuthn.addVirtualAuthenticator"
CommandSetResponseOverrideBits = "WebAuthn.setResponseOverrideBits"
CommandRemoveVirtualAuthenticator = "WebAuthn.removeVirtualAuthenticator"
CommandAddCredential = "WebAuthn.addCredential"
CommandGetCredential = "WebAuthn.getCredential"
CommandGetCredentials = "WebAuthn.getCredentials"
CommandRemoveCredential = "WebAuthn.removeCredential"
CommandClearCredentials = "WebAuthn.clearCredentials"
CommandSetUserVerified = "WebAuthn.setUserVerified"
CommandSetAutomaticPresenceSimulation = "WebAuthn.setAutomaticPresenceSimulation"
)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .