logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Authen::U2F::Tester::Role::Keystore - U2F Tester Keystore Role.

Author

       Michael Schout <mschout@cpan.org>

Bugs

       Please report any bugs or feature requests on the bugtracker website
       <https://github.com/mschout/perl-authen-u2f-tester/issues>

       When submitting a bug or request, please include a test-file or a patch to an existing test-file that
       illustrates the bug or desired feature.

Description

       This is a Moose::Role that Authen::U2F::Tester keystore's must consume.  All required methods must be
       implemented by the consuming Moose class.

Methods

exists($handle):bool
       Check if the given handle (in Base64 URL format) exists (or is valid) in the key store.

   get($handle):Crypt::PK::ECC
       Given the key handle (in Base64 URL format), return the private key (as a Crypt::PK::ECC object)
       associated with it in the key store.

   put($private_key):scalar
       Save the given keypair in the keystore, returning a unique key handle that uniquely identifies the
       keypair.  The returned handle should NOT be Base64 URL encoded.  $private_key is a raw private key
       string.

   remove($handle):void
       Remove the given key handle from the key store.

Name

       Authen::U2F::Tester::Role::Keystore - U2F Tester Keystore Role.

Source

       The development version is on github at <http://https://github.com/mschout/perl-authen-u2f-tester> and
       may be cloned from <git://https://github.com/mschout/perl-authen-u2f-tester.git>

Synopsis

        package Authen::U2F::Tester::Keystore::Example;

        use Moose;
        use namespace::autoclean;

        with 'Authen::U2F::Tester::Role::Keystore';

        sub exists {
            my ($self, $handle) = @_;
            ...
            # if handle is valid and exists in the keystore:
            return 1;

            # else
            return 0;
        }

        sub put {
            my ($self, $private_key) = @_;

            # somehow generate a unique handle
            return $handle;
        }

        sub get {
            my ($self, $handle) = @_;

            $handle = decode_base64url($handle);

            # fetch the Crypt::PK::ECC private key object associated with this handle.
            return $pkec;
        }

        __PACKAGE__->meta->make_immutable;

Version

       version 0.03

See Also