---
name: "Authen::U2F::Tester::Role::Keystore"
section: "3pm"
platform: "linux"
package: "libauthen-u2f-tester-perl"
version: "0.03-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Authen::U2F::Tester::Role::Keystore"
---

# Authen::U2F::Tester::Role::Keystore(3pm)

U2F Tester Keystore Role.

## NAME

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

## VERSION

version 0.03

## 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;
```

## 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.

## 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\>

## 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.

## AUTHOR

Michael Schout \<mschout@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Michael Schout.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
