---
name: "File::KDBX::Key::ChallengeResponse"
section: "3pm"
platform: "linux"
package: "libfile-kdbx-perl"
version: "0.906-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/File::KDBX::Key::ChallengeResponse"
---

# File::KDBX::Key::ChallengeResponse(3pm)

A challenge-response key

## NAME

File::KDBX::Key::ChallengeResponse - A challenge-response key

## VERSION

version 0.906

## SYNOPSIS

```
    use File::KDBX::Key::ChallengeResponse;
    my $responder = sub {
        my $challenge = shift;
        ...;    # generate a response based on a secret of some sort
        return $response;
    };
    my $key = File::KDBX::Key::ChallengeResponse->new($responder);
```

## DESCRIPTION

A challenge-response key is kind of like multifactor authentication, except you don't really *authenticate* to a KDBX database because it's not a service. Specifically it would be the "what you have" component. It assumes there is some device that can store a key that is only known to the owner of a database. A challenge is made to the device and the response generated based on the key is used as the raw key.

Inherets methods and attributes from File::KDBX::Key.

This is a generic implementation where a responder subroutine is provided to provide the response. There is also File::KDBX::Key::YubiKey which is a subclass that allows YubiKeys to be responder devices.

## METHODS

### raw\_key

```
    $raw_key = $key->raw_key;
    $raw_key = $key->raw_key($challenge);
```

Get the raw key which is the response to a challenge. The response will be saved so that subsequent calls (with or without the challenge) can provide the response without challenging the responder again. Only one response is saved at a time; if you call this with a different challenge, the new response is saved over any previous response.

### challenge

```
    $response = $key->challenge($challenge, @options);
```

Issue a challenge and get a response, or throw if the responder failed to provide one.

## BUGS

Please report any bugs or feature requests on the bugtracker website \<https://github.com/chazmcgarvey/File-KDBX/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

Charles McGarvey \<ccm@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Charles McGarvey.

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