123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- // Package webauthn provides the Chrome DevTools Protocol
- // commands, types, and events for the WebAuthn domain.
- //
- // This domain allows configuring virtual authenticators to test the WebAuthn
- // API.
- //
- // Generated by the cdproto-gen command.
- package webauthn
- // Code generated by cdproto-gen. DO NOT EDIT.
- import (
- "context"
- "github.com/chromedp/cdproto/cdp"
- )
- // EnableParams enable the WebAuthn domain and start intercepting credential
- // storage and retrieval with a virtual authenticator.
- type EnableParams struct {
- EnableUI bool `json:"enableUI,omitempty"` // Whether to enable the WebAuthn user interface. Enabling the UI is recommended for debugging and demo purposes, as it is closer to the real experience. Disabling the UI is recommended for automated testing. Supported at the embedder's discretion if UI is available. Defaults to false.
- }
- // Enable enable the WebAuthn domain and start intercepting credential
- // storage and retrieval with a virtual authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-enable
- //
- // parameters:
- func Enable() *EnableParams {
- return &EnableParams{}
- }
- // WithEnableUI whether to enable the WebAuthn user interface. Enabling the
- // UI is recommended for debugging and demo purposes, as it is closer to the
- // real experience. Disabling the UI is recommended for automated testing.
- // Supported at the embedder's discretion if UI is available. Defaults to false.
- func (p EnableParams) WithEnableUI(enableUI bool) *EnableParams {
- p.EnableUI = enableUI
- return &p
- }
- // Do executes WebAuthn.enable against the provided context.
- func (p *EnableParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandEnable, p, nil)
- }
- // DisableParams disable the WebAuthn domain.
- type DisableParams struct{}
- // Disable disable the WebAuthn domain.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-disable
- func Disable() *DisableParams {
- return &DisableParams{}
- }
- // Do executes WebAuthn.disable against the provided context.
- func (p *DisableParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandDisable, nil, nil)
- }
- // AddVirtualAuthenticatorParams creates and adds a virtual authenticator.
- type AddVirtualAuthenticatorParams struct {
- Options *VirtualAuthenticatorOptions `json:"options"`
- }
- // AddVirtualAuthenticator creates and adds a virtual authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-addVirtualAuthenticator
- //
- // parameters:
- //
- // options
- func AddVirtualAuthenticator(options *VirtualAuthenticatorOptions) *AddVirtualAuthenticatorParams {
- return &AddVirtualAuthenticatorParams{
- Options: options,
- }
- }
- // AddVirtualAuthenticatorReturns return values.
- type AddVirtualAuthenticatorReturns struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId,omitempty"`
- }
- // Do executes WebAuthn.addVirtualAuthenticator against the provided context.
- //
- // returns:
- //
- // authenticatorID
- func (p *AddVirtualAuthenticatorParams) Do(ctx context.Context) (authenticatorID AuthenticatorID, err error) {
- // execute
- var res AddVirtualAuthenticatorReturns
- err = cdp.Execute(ctx, CommandAddVirtualAuthenticator, p, &res)
- if err != nil {
- return "", err
- }
- return res.AuthenticatorID, nil
- }
- // SetResponseOverrideBitsParams resets parameters isBogusSignature, isBadUV,
- // isBadUP to false if they are not present.
- type SetResponseOverrideBitsParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- IsBogusSignature bool `json:"isBogusSignature,omitempty"` // If isBogusSignature is set, overrides the signature in the authenticator response to be zero. Defaults to false.
- IsBadUV bool `json:"isBadUV,omitempty"` // If isBadUV is set, overrides the UV bit in the flags in the authenticator response to be zero. Defaults to false.
- IsBadUP bool `json:"isBadUP,omitempty"` // If isBadUP is set, overrides the UP bit in the flags in the authenticator response to be zero. Defaults to false.
- }
- // SetResponseOverrideBits resets parameters isBogusSignature, isBadUV,
- // isBadUP to false if they are not present.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-setResponseOverrideBits
- //
- // parameters:
- //
- // authenticatorID
- func SetResponseOverrideBits(authenticatorID AuthenticatorID) *SetResponseOverrideBitsParams {
- return &SetResponseOverrideBitsParams{
- AuthenticatorID: authenticatorID,
- }
- }
- // WithIsBogusSignature if isBogusSignature is set, overrides the signature
- // in the authenticator response to be zero. Defaults to false.
- func (p SetResponseOverrideBitsParams) WithIsBogusSignature(isBogusSignature bool) *SetResponseOverrideBitsParams {
- p.IsBogusSignature = isBogusSignature
- return &p
- }
- // WithIsBadUV if isBadUV is set, overrides the UV bit in the flags in the
- // authenticator response to be zero. Defaults to false.
- func (p SetResponseOverrideBitsParams) WithIsBadUV(isBadUV bool) *SetResponseOverrideBitsParams {
- p.IsBadUV = isBadUV
- return &p
- }
- // WithIsBadUP if isBadUP is set, overrides the UP bit in the flags in the
- // authenticator response to be zero. Defaults to false.
- func (p SetResponseOverrideBitsParams) WithIsBadUP(isBadUP bool) *SetResponseOverrideBitsParams {
- p.IsBadUP = isBadUP
- return &p
- }
- // Do executes WebAuthn.setResponseOverrideBits against the provided context.
- func (p *SetResponseOverrideBitsParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSetResponseOverrideBits, p, nil)
- }
- // RemoveVirtualAuthenticatorParams removes the given authenticator.
- type RemoveVirtualAuthenticatorParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- }
- // RemoveVirtualAuthenticator removes the given authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-removeVirtualAuthenticator
- //
- // parameters:
- //
- // authenticatorID
- func RemoveVirtualAuthenticator(authenticatorID AuthenticatorID) *RemoveVirtualAuthenticatorParams {
- return &RemoveVirtualAuthenticatorParams{
- AuthenticatorID: authenticatorID,
- }
- }
- // Do executes WebAuthn.removeVirtualAuthenticator against the provided context.
- func (p *RemoveVirtualAuthenticatorParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandRemoveVirtualAuthenticator, p, nil)
- }
- // AddCredentialParams adds the credential to the specified authenticator.
- type AddCredentialParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- Credential *Credential `json:"credential"`
- }
- // AddCredential adds the credential to the specified authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-addCredential
- //
- // parameters:
- //
- // authenticatorID
- // credential
- func AddCredential(authenticatorID AuthenticatorID, credential *Credential) *AddCredentialParams {
- return &AddCredentialParams{
- AuthenticatorID: authenticatorID,
- Credential: credential,
- }
- }
- // Do executes WebAuthn.addCredential against the provided context.
- func (p *AddCredentialParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandAddCredential, p, nil)
- }
- // GetCredentialParams returns a single credential stored in the given
- // virtual authenticator that matches the credential ID.
- type GetCredentialParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- CredentialID string `json:"credentialId"`
- }
- // GetCredential returns a single credential stored in the given virtual
- // authenticator that matches the credential ID.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-getCredential
- //
- // parameters:
- //
- // authenticatorID
- // credentialID
- func GetCredential(authenticatorID AuthenticatorID, credentialID string) *GetCredentialParams {
- return &GetCredentialParams{
- AuthenticatorID: authenticatorID,
- CredentialID: credentialID,
- }
- }
- // GetCredentialReturns return values.
- type GetCredentialReturns struct {
- Credential *Credential `json:"credential,omitempty"`
- }
- // Do executes WebAuthn.getCredential against the provided context.
- //
- // returns:
- //
- // credential
- func (p *GetCredentialParams) Do(ctx context.Context) (credential *Credential, err error) {
- // execute
- var res GetCredentialReturns
- err = cdp.Execute(ctx, CommandGetCredential, p, &res)
- if err != nil {
- return nil, err
- }
- return res.Credential, nil
- }
- // GetCredentialsParams returns all the credentials stored in the given
- // virtual authenticator.
- type GetCredentialsParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- }
- // GetCredentials returns all the credentials stored in the given virtual
- // authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-getCredentials
- //
- // parameters:
- //
- // authenticatorID
- func GetCredentials(authenticatorID AuthenticatorID) *GetCredentialsParams {
- return &GetCredentialsParams{
- AuthenticatorID: authenticatorID,
- }
- }
- // GetCredentialsReturns return values.
- type GetCredentialsReturns struct {
- Credentials []*Credential `json:"credentials,omitempty"`
- }
- // Do executes WebAuthn.getCredentials against the provided context.
- //
- // returns:
- //
- // credentials
- func (p *GetCredentialsParams) Do(ctx context.Context) (credentials []*Credential, err error) {
- // execute
- var res GetCredentialsReturns
- err = cdp.Execute(ctx, CommandGetCredentials, p, &res)
- if err != nil {
- return nil, err
- }
- return res.Credentials, nil
- }
- // RemoveCredentialParams removes a credential from the authenticator.
- type RemoveCredentialParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- CredentialID string `json:"credentialId"`
- }
- // RemoveCredential removes a credential from the authenticator.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-removeCredential
- //
- // parameters:
- //
- // authenticatorID
- // credentialID
- func RemoveCredential(authenticatorID AuthenticatorID, credentialID string) *RemoveCredentialParams {
- return &RemoveCredentialParams{
- AuthenticatorID: authenticatorID,
- CredentialID: credentialID,
- }
- }
- // Do executes WebAuthn.removeCredential against the provided context.
- func (p *RemoveCredentialParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandRemoveCredential, p, nil)
- }
- // ClearCredentialsParams clears all the credentials from the specified
- // device.
- type ClearCredentialsParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- }
- // ClearCredentials clears all the credentials from the specified device.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-clearCredentials
- //
- // parameters:
- //
- // authenticatorID
- func ClearCredentials(authenticatorID AuthenticatorID) *ClearCredentialsParams {
- return &ClearCredentialsParams{
- AuthenticatorID: authenticatorID,
- }
- }
- // Do executes WebAuthn.clearCredentials against the provided context.
- func (p *ClearCredentialsParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandClearCredentials, p, nil)
- }
- // SetUserVerifiedParams sets whether User Verification succeeds or fails for
- // an authenticator. The default is true.
- type SetUserVerifiedParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- IsUserVerified bool `json:"isUserVerified"`
- }
- // SetUserVerified sets whether User Verification succeeds or fails for an
- // authenticator. The default is true.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-setUserVerified
- //
- // parameters:
- //
- // authenticatorID
- // isUserVerified
- func SetUserVerified(authenticatorID AuthenticatorID, isUserVerified bool) *SetUserVerifiedParams {
- return &SetUserVerifiedParams{
- AuthenticatorID: authenticatorID,
- IsUserVerified: isUserVerified,
- }
- }
- // Do executes WebAuthn.setUserVerified against the provided context.
- func (p *SetUserVerifiedParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSetUserVerified, p, nil)
- }
- // SetAutomaticPresenceSimulationParams sets whether tests of user presence
- // will succeed immediately (if true) or fail to resolve (if false) for an
- // authenticator. The default is true.
- type SetAutomaticPresenceSimulationParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- Enabled bool `json:"enabled"`
- }
- // SetAutomaticPresenceSimulation sets whether tests of user presence will
- // succeed immediately (if true) or fail to resolve (if false) for an
- // authenticator. The default is true.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-setAutomaticPresenceSimulation
- //
- // parameters:
- //
- // authenticatorID
- // enabled
- func SetAutomaticPresenceSimulation(authenticatorID AuthenticatorID, enabled bool) *SetAutomaticPresenceSimulationParams {
- return &SetAutomaticPresenceSimulationParams{
- AuthenticatorID: authenticatorID,
- Enabled: enabled,
- }
- }
- // Do executes WebAuthn.setAutomaticPresenceSimulation against the provided context.
- func (p *SetAutomaticPresenceSimulationParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSetAutomaticPresenceSimulation, p, nil)
- }
- // SetCredentialPropertiesParams allows setting credential properties.
- // https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties.
- type SetCredentialPropertiesParams struct {
- AuthenticatorID AuthenticatorID `json:"authenticatorId"`
- CredentialID string `json:"credentialId"`
- BackupEligibility bool `json:"backupEligibility,omitempty"`
- BackupState bool `json:"backupState,omitempty"`
- }
- // SetCredentialProperties allows setting credential properties.
- // https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn#method-setCredentialProperties
- //
- // parameters:
- //
- // authenticatorID
- // credentialID
- func SetCredentialProperties(authenticatorID AuthenticatorID, credentialID string) *SetCredentialPropertiesParams {
- return &SetCredentialPropertiesParams{
- AuthenticatorID: authenticatorID,
- CredentialID: credentialID,
- }
- }
- // WithBackupEligibility [no description].
- func (p SetCredentialPropertiesParams) WithBackupEligibility(backupEligibility bool) *SetCredentialPropertiesParams {
- p.BackupEligibility = backupEligibility
- return &p
- }
- // WithBackupState [no description].
- func (p SetCredentialPropertiesParams) WithBackupState(backupState bool) *SetCredentialPropertiesParams {
- p.BackupState = backupState
- return &p
- }
- // Do executes WebAuthn.setCredentialProperties against the provided context.
- func (p *SetCredentialPropertiesParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSetCredentialProperties, p, nil)
- }
- // Command names.
- 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"
- CommandSetCredentialProperties = "WebAuthn.setCredentialProperties"
- )
|