Firefox-Marionette

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    these headers are added to any existing headers going to the
    metacpan.org site, but no other site. To clear site headers, see the
    delete_site_header method

 add_webauthn_authenticator

    accepts a hash of the following keys;

      * has_resident_key - boolean value to indicate if the authenticator
      will support client side discoverable credentials
      <https://www.w3.org/TR/webauthn-2/#client-side-discoverable-credential>

      * has_user_verification - boolean value to determine if the
      authenticator
      <https://www.w3.org/TR/webauthn-2/#virtual-authenticators> supports
      user verification
      <https://www.w3.org/TR/webauthn-2/#user-verification>.

      * is_user_consenting - boolean value to determine the result of all
      user consent <https://www.w3.org/TR/webauthn-2/#user-consent>

README  view on Meta::CPAN

        use Crypt::URandom();
    
        my $user_name = MIME::Base64::encode_base64( Crypt::URandom::urandom( 10 ), q[] ) . q[@example.com];
        my $firefox = Firefox::Marionette->new();
        $firefox->go('https://webauthn.io');
        $firefox->find_id('input-email')->type($user_name);
        $firefox->find_id('register-button')->click();
        $firefox->await(sub { sleep 1; $firefox->find_class('alert-success'); });
        $firefox->find_id('login-button')->click();
        $firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); });
        foreach my $credential ($firefox->webauthn_credentials()) {
            $firefox->delete_webauthn_credential($credential);

    # ... time passes ...

            $firefox->add_webauthn_credential(
                      id            => $credential->id(),
                      host          => $credential->host(),
                      user          => $credential->user(),
                      private_key   => $credential->private_key(),
                      is_resident   => $credential->is_resident(),

README  view on Meta::CPAN

    will remove the User-Agent
    <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent>,
    Accept
    <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept> and
    Accept-Encoding
    <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding>
    headers from all future requests to metacpan.org.

    This method returns itself to aid in chaining methods.

 delete_webauthn_all_credentials

    This method accepts an optional authenticator, in which case it will
    delete all credentials from this authenticator. If no parameter is
    supplied, the default authenticator will have all credentials deleted.

        my $firefox = Firefox::Marionette->new();
        my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
        $firefox->delete_webauthn_all_credentials($authenticator);
        $firefox->delete_webauthn_all_credentials();

 delete_webauthn_authenticator

    This method accepts an optional authenticator, in which case it will
    delete this authenticator from the current Firefox instance. If no
    parameter is supplied, the default authenticator will be deleted.

        my $firefox = Firefox::Marionette->new();
        my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
        $firefox->delete_webauthn_authenticator($authenticator);

README  view on Meta::CPAN


 delete_webauthn_credential

    This method accepts either a credential and an authenticator, in which
    case it will remove the credential from the supplied authenticator or

        use Firefox::Marionette();
    
        my $firefox = Firefox::Marionette->new();
        my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
        foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
            $firefox->delete_webauthn_credential($credential, $authenticator);
        }

    just a credential, in which case it will remove the credential from the
    default authenticator.

        use Firefox::Marionette();
    
        my $firefox = Firefox::Marionette->new();
        ...
        foreach my $credential ($firefox->webauthn_credentials()) {
            $firefox->delete_webauthn_credential($credential);
        }

    This method returns itself to aid in chaining methods.

 developer

    returns true if the current version of firefox is a developer edition
    <https://www.mozilla.org/en-US/firefox/developer/> (does the minor
    version number end with an 'b\d+'?) version.

README  view on Meta::CPAN

 uri

    returns the current URI of current top level browsing context for
    Desktop. It is equivalent to the javascript document.location.href

 webauthn_authenticator

    returns the default WebAuthn authenticator created when the new method
    was called.

 webauthn_credentials

    This method accepts an optional authenticator, in which case it will
    return all the credentials attached to this authenticator. If no
    parameter is supplied, credentials from the default authenticator will
    be returned.

        use Firefox::Marionette();
        use v5.10;
    
        my $firefox = Firefox::Marionette->new();
        foreach my $credential ($firefox->webauthn_credentials()) {
           say "Credential host is " . $credential->host();
        }
    
        # OR
    
        my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
        foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
           say "Credential host is " . $credential->host();
        }

 webauthn_set_user_verified

    This method accepts a boolean for the is_user_verified field and an
    optional authenticator (the default authenticator will be used
    otherwise). It sets the is_user_verified field to the supplied boolean
    value.

README.md  view on Meta::CPAN

    my $uuid = UUID::uuid();
    $firefox->add_site_header( 'metacpan.org', 'Track-my-automated-tests' => $uuid );
    $firefox->go('https://metacpan.org/');

these headers are added to any existing headers going to the metacpan.org site, but no other site.  To clear site headers, see the [delete\_site\_header](#delete_site_header) method

## add\_webauthn\_authenticator

accepts a hash of the following keys;

- has\_resident\_key - boolean value to indicate if the authenticator will support [client side discoverable credentials](https://www.w3.org/TR/webauthn-2/#client-side-discoverable-credential)
- has\_user\_verification - boolean value to determine if the [authenticator](https://www.w3.org/TR/webauthn-2/#virtual-authenticators) supports [user verification](https://www.w3.org/TR/webauthn-2/#user-verification).
- is\_user\_consenting - boolean value to determine the result of all [user consent](https://www.w3.org/TR/webauthn-2/#user-consent) [authorization gestures](https://www.w3.org/TR/webauthn-2/#authorization-gesture), and by extension, any [test of use...
- is\_user\_verified - boolean value to determine the result of [User Verification](https://www.w3.org/TR/webauthn-2/#user-verification) performed on the [Virtual Authenticator](https://www.w3.org/TR/webauthn-2/#virtual-authenticators). If set to tru...
- protocol - the [protocol](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator#protocol) spoken by the authenticator.  This may be [CTAP1\_U2F](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator#CTAP1_U2F), [CTAP...
- transport - the [transport](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator#transport) simulated by the authenticator.  This may be [BLE](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator#BLE), [HYBRID](htt...

It returns the newly created [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator).

    use Firefox::Marionette();
    use Crypt::URandom();

README.md  view on Meta::CPAN

    use Crypt::URandom();

    my $user_name = MIME::Base64::encode_base64( Crypt::URandom::urandom( 10 ), q[] ) . q[@example.com];
    my $firefox = Firefox::Marionette->new();
    $firefox->go('https://webauthn.io');
    $firefox->find_id('input-email')->type($user_name);
    $firefox->find_id('register-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('alert-success'); });
    $firefox->find_id('login-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); });
    foreach my $credential ($firefox->webauthn_credentials()) {
        $firefox->delete_webauthn_credential($credential);

\# ... time passes ...

        $firefox->add_webauthn_credential(
                  id            => $credential->id(),
                  host          => $credential->host(),
                  user          => $credential->user(),
                  private_key   => $credential->private_key(),
                  is_resident   => $credential->is_resident(),

README.md  view on Meta::CPAN


    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    $firefox->delete_header( 'metacpan.org', 'User-Agent', 'Accept', 'Accept-Encoding' );

will remove the [User-Agent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent), [Accept](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) and [Accept-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Hea...

This method returns [itself](https://metacpan.org/pod/Firefox::Marionette) to aid in chaining methods.

## delete\_webauthn\_all\_credentials

This method accepts an optional [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator), in which case it will delete all [credentials](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Credential) from this authe...

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    $firefox->delete_webauthn_all_credentials($authenticator);
    $firefox->delete_webauthn_all_credentials();

## delete\_webauthn\_authenticator

This method accepts an optional [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator), in which case it will delete this authenticator from the current Firefox instance.  If no parameter is supplied, the default authe...

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    $firefox->delete_webauthn_authenticator($authenticator);
    $firefox->delete_webauthn_authenticator();

## delete\_webauthn\_credential

This method accepts either a [credential](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Credential) and an [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator), in which case it will remove the credential f...

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
        $firefox->delete_webauthn_credential($credential, $authenticator);
    }

just a [credential](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Credential), in which case it will remove the credential from the default authenticator.

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    ...
    foreach my $credential ($firefox->webauthn_credentials()) {
        $firefox->delete_webauthn_credential($credential);
    }

This method returns [itself](https://metacpan.org/pod/Firefox::Marionette) to aid in chaining methods.

## developer

returns true if the [current version](#browser_version) of firefox is a [developer edition](https://www.mozilla.org/en-US/firefox/developer/) (does the minor version number end with an 'b\\d+'?) version.

## dismiss\_alert

README.md  view on Meta::CPAN

    $firefox->uninstall($extension_id); # not recommended to uninstall this extension IRL.

## uri

returns the current [URI](https://metacpan.org/pod/URI) of current top level browsing context for Desktop.  It is equivalent to the javascript `document.location.href`

## webauthn\_authenticator

returns the default [WebAuthn authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator) created when the [new](#new) method was called.

## webauthn\_credentials

This method accepts an optional [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator), in which case it will return all the [credentials](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Credential) attached to...

    use Firefox::Marionette();
    use v5.10;

    my $firefox = Firefox::Marionette->new();
    foreach my $credential ($firefox->webauthn_credentials()) {
       say "Credential host is " . $credential->host();
    }

    # OR

    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
       say "Credential host is " . $credential->host();
    }

## webauthn\_set\_user\_verified

This method accepts a boolean for the [is\_user\_verified](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authenticator#is_user_verified) field and an optional [authenticator](https://metacpan.org/pod/Firefox::Marionette::WebAuthn::Authentic...

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();

lib/Firefox/Marionette.pm  view on Meta::CPAN

    my $authenticator;
    if ( $parameters{authenticator} ) {
        $authenticator = $parameters{authenticator};
    }
    else {
        $authenticator = $self->webauthn_authenticator();
    }
    return $authenticator;
}

sub webauthn_credentials {
    my ( $self, $parameter_authenticator ) = @_;
    my $authenticator = $self->_get_webauthn_authenticator(
        authenticator => $parameter_authenticator );
    my $message_id = $self->_new_message_id();
    $self->_send_request(
        [
            _COMMAND(),
            $message_id,
            $self->_command('WebAuthn:GetCredentials'),
            {

lib/Firefox/Marionette.pm  view on Meta::CPAN

    if ( $credential->{userHandle} eq q[] ) {
        $credential->{userHandle} = undef;
    }
    else {
        $credential->{userHandle} =
          MIME::Base64::decode_base64url( $credential->{userHandle} );
    }
    return $credential;
}

sub delete_webauthn_all_credentials {
    my ( $self, $parameter_authenticator ) = @_;
    my $authenticator = $self->_get_webauthn_authenticator(
        authenticator => $parameter_authenticator );
    my $message_id = $self->_new_message_id();
    $self->_send_request(
        [
            _COMMAND(),
            $message_id,
            $self->_command('WebAuthn:RemoveAllCredentials'),
            {

lib/Firefox/Marionette.pm  view on Meta::CPAN

    $firefox->go('https://metacpan.org/');

these headers are added to any existing headers going to the metacpan.org site, but no other site.  To clear site headers, see the L<delete_site_header|/delete_site_header> method

=head2 add_webauthn_authenticator

accepts a hash of the following keys;

=over 4

=item * has_resident_key - boolean value to indicate if the authenticator will support L<client side discoverable credentials|https://www.w3.org/TR/webauthn-2/#client-side-discoverable-credential>

=item * has_user_verification - boolean value to determine if the L<authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators> supports L<user verification|https://www.w3.org/TR/webauthn-2/#user-verification>.

=item * is_user_consenting - boolean value to determine the result of all L<user consent|https://www.w3.org/TR/webauthn-2/#user-consent> L<authorization gestures|https://www.w3.org/TR/webauthn-2/#authorization-gesture>, and by extension, any L<test o...

=item * is_user_verified - boolean value to determine the result of L<User Verification|https://www.w3.org/TR/webauthn-2/#user-verification> performed on the L<Virtual Authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators>. If set to...

=item * protocol - the L<protocol|Firefox::Marionette::WebAuthn::Authenticator#protocol> spoken by the authenticator.  This may be L<CTAP1_U2F|Firefox::Marionette::WebAuthn::Authenticator#CTAP1_U2F>, L<CTAP2|Firefox::Marionette::WebAuthn::Authenticat...

=item * transport - the L<transport|Firefox::Marionette::WebAuthn::Authenticator#transport> simulated by the authenticator.  This may be L<BLE|Firefox::Marionette::WebAuthn::Authenticator#BLE>, L<HYBRID|Firefox::Marionette::WebAuthn::Authenticator#HY...

lib/Firefox/Marionette.pm  view on Meta::CPAN

    use Crypt::URandom();

    my $user_name = MIME::Base64::encode_base64( Crypt::URandom::urandom( 10 ), q[] ) . q[@example.com];
    my $firefox = Firefox::Marionette->new();
    $firefox->go('https://webauthn.io');
    $firefox->find_id('input-email')->type($user_name);
    $firefox->find_id('register-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('alert-success'); });
    $firefox->find_id('login-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); });
    foreach my $credential ($firefox->webauthn_credentials()) {
        $firefox->delete_webauthn_credential($credential);

# ... time passes ...

        $firefox->add_webauthn_credential(
                  id            => $credential->id(),
                  host          => $credential->host(),
                  user          => $credential->user(),
                  private_key   => $credential->private_key(),
                  is_resident   => $credential->is_resident(),

lib/Firefox/Marionette.pm  view on Meta::CPAN


    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    $firefox->delete_header( 'metacpan.org', 'User-Agent', 'Accept', 'Accept-Encoding' );

will remove the L<User-Agent|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent>, L<Accept|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept> and L<Accept-Encoding|https://developer.mozilla.org/en-US/docs/Web/HTTP/Hea...

This method returns L<itself|Firefox::Marionette> to aid in chaining methods.

=head2 delete_webauthn_all_credentials

This method accepts an optional L<authenticator|Firefox::Marionette::WebAuthn::Authenticator>, in which case it will delete all L<credentials|Firefox::Marionette::WebAuthn::Credential> from this authenticator.  If no parameter is supplied, the defaul...

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    $firefox->delete_webauthn_all_credentials($authenticator);
    $firefox->delete_webauthn_all_credentials();

=head2 delete_webauthn_authenticator

This method accepts an optional L<authenticator|Firefox::Marionette::WebAuthn::Authenticator>, in which case it will delete this authenticator from the current Firefox instance.  If no parameter is supplied, the default authenticator will be deleted.

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    $firefox->delete_webauthn_authenticator($authenticator);
    $firefox->delete_webauthn_authenticator();

=head2 delete_webauthn_credential

This method accepts either a L<credential|Firefox::Marionette::WebAuthn::Credential> and an L<authenticator|Firefox::Marionette::WebAuthn::Authenticator>, in which case it will remove the credential from the supplied authenticator or

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
        $firefox->delete_webauthn_credential($credential, $authenticator);
    }

just a L<credential|Firefox::Marionette::WebAuthn::Credential>, in which case it will remove the credential from the default authenticator.

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();
    ...
    foreach my $credential ($firefox->webauthn_credentials()) {
        $firefox->delete_webauthn_credential($credential);
    }

This method returns L<itself|Firefox::Marionette> to aid in chaining methods.

=head2 developer

returns true if the L<current version|/browser_version> of firefox is a L<developer edition|https://www.mozilla.org/en-US/firefox/developer/> (does the minor version number end with an 'b\d+'?) version.

=head2 dismiss_alert

lib/Firefox/Marionette.pm  view on Meta::CPAN

    $firefox->uninstall($extension_id); # not recommended to uninstall this extension IRL.

=head2 uri

returns the current L<URI|URI> of current top level browsing context for Desktop.  It is equivalent to the javascript C<document.location.href>

=head2 webauthn_authenticator

returns the default L<WebAuthn authenticator|Firefox::Marionette::WebAuthn::Authenticator> created when the L<new|/new> method was called.

=head2 webauthn_credentials

This method accepts an optional L<authenticator|Firefox::Marionette::WebAuthn::Authenticator>, in which case it will return all the L<credentials|Firefox::Marionette::WebAuthn::Credential> attached to this authenticator.  If no parameter is supplied,...

    use Firefox::Marionette();
    use v5.10;

    my $firefox = Firefox::Marionette->new();
    foreach my $credential ($firefox->webauthn_credentials()) {
       say "Credential host is " . $credential->host();
    }

    # OR

    my $authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::INTERNAL(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2() );
    foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
       say "Credential host is " . $credential->host();
    }

=head2 webauthn_set_user_verified

This method accepts a boolean for the L<is_user_verified|Firefox::Marionette::WebAuthn::Authenticator#is_user_verified> field and an optional L<authenticator|Firefox::Marionette::WebAuthn::Authenticator> (the default authenticator will be used otherw...

    use Firefox::Marionette();

    my $firefox = Firefox::Marionette->new();

lib/Firefox/Marionette/WebAuthn/Authenticator.pm  view on Meta::CPAN

return 'usb', the L<transport|/transport> code for a L<Universal Serial Bus|https://en.wikipedia.org/wiki/USB> transport.

=head1 SUBROUTINES/METHODS

=head2 new

accepts a hash as a parameter.  Allowed keys are below;

=over 4

=item * has_resident_key - boolean value to indicate if the L<authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators> will support L<client side discoverable credentials|https://www.w3.org/TR/webauthn-2/#client-side-discoverable-crede...

=item * has_user_verification - boolean value to determine if the L<authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators> supports L<user verification|https://www.w3.org/TR/webauthn-2/#user-verification>.

=item * id - the id of the authenticator.

=item * is_user_consenting - boolean value to determine the result of all L<user consent|https://www.w3.org/TR/webauthn-2/#user-consent> L<authorization gestures|https://www.w3.org/TR/webauthn-2/#authorization-gesture>, and by extension, any L<test o...

=item * is_user_verified - boolean value to determine the result of L<User Verification|https://www.w3.org/TR/webauthn-2/#user-verification> performed on the L<Virtual Authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators>. If set to...

=item * protocol - the L<protocol|/protocol> spoken by the authenticator.  This may be L<CTAP1_U2F|/CTAP1_U2F>, L<CTAP2|/CTAP2> or L<CTAP2_1|/CTAP2_1>.

=item * transport - the L<transport|/transport> simulated by the authenticator.  This may be L<BLE|/BLE>, L<HYBRID|/HYBRID>, L<INTERNAL|/INTERNAL>, L<NFC|/NFC>, L<SMART_CARD|/SMART_CARD> or L<USB|/USB>.

=back

This method returns a new L<webauthn virtual authenticator|Firefox::Marionette::WebAuthn::Authenticator> object.

=head2 has_resident_key

This method returns a boolean value to indicate if the L<authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators> will support L<client side discoverable credentials|https://www.w3.org/TR/webauthn-2/#client-side-discoverable-credential...

=head2 has_user_verification

This method returns a boolean value to determine if the L<authenticator|https://www.w3.org/TR/webauthn-2/#virtual-authenticators> supports L<user verification|https://www.w3.org/TR/webauthn-2/#user-verification>.

=head2 is_user_consenting

This method returns a boolean value to determine the result of all L<user consent|https://www.w3.org/TR/webauthn-2/#user-consent> L<authorization gestures|https://www.w3.org/TR/webauthn-2/#authorization-gesture>, and by extension, any L<test of user ...

=head2 is_user_verified

lib/Firefox/Marionette/WebAuthn/Credential.pm  view on Meta::CPAN

    use Crypt::URandom();

    my $user_name = MIME::Base64::encode_base64( Crypt::URandom::urandom( 10 ), q[] ) . q[@example.com];
    my $firefox = Firefox::Marionette->new();
    $firefox->go('https://webauthn.io');
    $firefox->find_id('input-email')->type($user_name);
    $firefox->find_id('register-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('alert-success'); });
    $firefox->find_id('login-button')->click();
    $firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); });
    foreach my $credential ($firefox->webauthn_credentials()) {
        $firefox->delete_webauthn_credential($credential);

# ... time passes ...

        $firefox->add_webauthn_credential(
                  id            => $credential->id(),
                  host          => $credential->host(),
                  user          => $credential->user(),
                  private_key   => $credential->private_key(),
                  is_resident   => $credential->is_resident(),

t/04-proxy.t  view on Meta::CPAN

			debug => $debug,
			visible => $visible,
			profile => $profile,
			host  => "$sshd_listen:22",
			via   => "$jumpd_listen:22",
			trust => $ca->cert(),
			proxy => "https://$squid_listen:" . $squid->port()
					);
		ok($firefox, "Created a firefox object going through ssh and web proxies");
		if (!$ENV{FIREFOX_NO_PROXY_AUTH}) {
			ok($firefox->add_login(host => "moz-proxy://$squid_listen:" . $squid->port(), user => $squid_username, password => $squid_password, realm => $squid_realm), "Added proxy credentials");
		}
		if (!$ENV{FIREFOX_NO_WEB_AUTH}) {
			ok($firefox->add_login(host => "https://$nginx_listen:" . $nginx->port(), user => $nginx_username, password => $nginx_password, realm => $nginx_realm), "Added web server credentials");
		}
		eval {
			if ($ENV{FIREFOX_NO_WEB_AUTH}) {
				ok($firefox->go("https://$nginx_listen:" . $nginx->port()), "Retrieved webpage (no web server auth)");
			} else {
				ok($firefox->go("https://$nginx_listen:" . $nginx->port())->accept_alert()->await(sub { $firefox->loaded() }), "Retrieved webpage");
			}
		} or do {
			chomp $@;
			diag("Did not load webpage:$@");

t/04-webauthn.t  view on Meta::CPAN

		ok($result, "Loading https://$host_name:$@");
		ok($firefox->find_id('input-email')->type($user_name), "Entering $user_name for username");
		ok($firefox->find_id('register-button')->click(), "Registering authentication for $host_name");;
		$firefox->await(sub { sleep 1; $firefox->find_class('alert-success'); });
		ok($firefox->find_id('login-button')->click(), "Clicking login button for $host_name");
		ok($firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); }), "Successfully authenticated to $host_name");
		my $authenticator = $firefox->webauthn_authenticator();
		ok($authenticator, "Successfully retrieved WebAuthn Authenticator:" . $authenticator->id());
		my $sign_count_after_one_login;
		my $count = 0;
		foreach my $credential ($firefox->webauthn_credentials()) {
			ok($credential->id(), "Credential id is " . $credential->id());
			ok($credential->host() eq $host_name, "Hostname is $host_name:" . $credential->host());
			ok($credential->user(), "Username is " . $credential->user());
			$sign_count_after_one_login = $credential->sign_count();
			ok($credential->sign_count() >= 1, "Sign Count is >= 1:" . $credential->sign_count());
			$firefox->delete_webauthn_credential($credential);
			$firefox->add_webauthn_credential(
					id => $credential->id(), 
					host => $credential->host(),
					user => $credential->user(),

t/04-webauthn.t  view on Meta::CPAN

					sign_count => $credential->sign_count(),
							);
		}
		ok($firefox->go('about:blank'), "Loading about:blank");
		ok($firefox->clear_cache(Firefox::Marionette::Cache::CLEAR_COOKIES()), "Deleting all cookies");
		ok($firefox->go('https://' . $host_name), "Loading https://$host_name");
		ok($firefox->find_id('input-email')->type($user_name), "Entering $user_name for username");
		ok($firefox->find_id('login-button')->click(), "Clicking login button for $host_name");
		ok($firefox->await(sub { sleep 1; $firefox->find_class('hero confetti'); }), "Successfully authenticated to $host_name");
		$count = 0;
		foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
			ok($credential->id(), "Credential id is " . $credential->id());
			ok($credential->host() eq $host_name, "Hostname is $host_name:" . $credential->host());
			ok($credential->user(), "Username is " . $credential->user());
			ok($credential->sign_count() == ($sign_count_after_one_login * 2), "Sign Count is == ($sign_count_after_one_login * 2):" . $credential->sign_count());
		}
		ok($firefox->delete_webauthn_all_credentials($authenticator), "Deleted all Webauthn credentials");
		$host_name = 'webauthn.bin.coffee';
		ok($firefox->go("https://$host_name"), "Loaded https://$host_name");
		ok($firefox->find_id('createButton')->click(), "Clicked 'Create Credential'");
		ok($firefox->find_id('getButton')->click(), "Clicked 'Get Assertion'");
		foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
			ok($credential->id(), "Credential id is " . $credential->id());
			ok($credential->host() eq $host_name, "Hostname is " . $credential->host());
			ok($credential->user(), "Username is " . $credential->user());
			ok($credential->sign_count(), "Sign Count is " . $credential->sign_count());
		}
		$authenticator = $firefox->add_webauthn_authenticator( transport => Firefox::Marionette::WebAuthn::Authenticator::HYBRID(), protocol => Firefox::Marionette::WebAuthn::Authenticator::CTAP2(), has_resident_key => 1 );
		ok($authenticator, "Successfully added CTAP2/Hybrid WebAuthn Authenticator:" . $authenticator->id());
		ok($authenticator->transport() eq 'hybrid', "Correct transport of 'hybrid' is returned:" . $authenticator->transport());
		ok($authenticator->protocol() eq 'ctap2', "Correct protocol of 'ctap2' is returned:" . $authenticator->protocol());
		ok($authenticator->has_resident_key() == 1, "Correct value for has_resident_key is returned:" . $authenticator->has_resident_key());

t/04-webauthn.t  view on Meta::CPAN

		my $credential = Firefox::Marionette::WebAuthn::Credential->new( host => 'example.org', is_resident => 1 );
		ok($credential, "Webauthn credential created");
		ok(!$credential->id(), "Credential id does not exist yet");
		ok($credential->host(), "Hostname is " . $credential->host());
		ok($credential->is_resident() == 1, "is_resident is 1:" . $credential->is_resident());
		my $cred_id = 'rDFWHBYyRzQGhu92NBf6P6QOhGlsvjtxZB8b8GBWhwg';
		$host_name = 'example.net';
		eval {
			$credential = $firefox->add_webauthn_credential( authenticator => $authenticator, id => $cred_id, host => $host_name, is_resident => 0);
		};
		foreach my $credential ($firefox->webauthn_credentials($authenticator)) {
			ok($credential->id() eq $cred_id, "Credential id is '$cred_id':" . $credential->id());
			ok($credential->host() eq $host_name, "Hostname is '$host_name':" . $credential->host());
			ok(!$credential->user(), "Username is empty");
			ok($credential->is_resident() == 0, "is_resident is 0:" . $credential->is_resident());
			ok($credential->sign_count() == 0, "Sign Count is 0:" . $credential->sign_count());
			$firefox->delete_webauthn_credential($credential, $authenticator);
		}
		eval {
			$credential = $firefox->add_webauthn_credential( private_key => { name => 'RSA-PSS', size => 1024 }, host => $host_name, user => $user_name);
			ok($credential->id(), "Credential id is " . $credential->id());



( run in 0.274 second using v1.01-cache-2.11-cpan-4d50c553e7e )