9 our @ISA = qw(Exporter);
11 # Items to export into callers namespace by default. Note: do not export
12 # names by default without a very good reason. Use EXPORT_OK instead.
13 # Do not simply export all your public functions/methods/constants.
15 # This allows declaration use PVE::U2F::XS ':all';
16 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
18 our %EXPORT_TAGS = ( 'all' => [] );
20 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25 XSLoader
::load
('PVE::U2F', $VERSION);
36 if (my $lib = new_impl
()) {
37 return bless { ctx
=> $lib }, $class;
44 done_impl
($self->{ctx
});
50 qw(memory json base64 crypto origin challenge signature format)
55 die "u2fs: $errcodes[-$rc-1] error\n" if $rc < 0 && $rc >= -8;
56 die "u2fs: unknown error\n";
59 #### Context initialization
61 sub origin
($) { return $_[0]->{origin
}; }
63 my ($self, $origin) = @_;
64 checkrc
(set_origin_impl
($self->{ctx
}, $origin));
65 return $self->{origin
} = $origin;
68 sub appid
($) { return $_[0]->{appid
}; }
70 my ($self, $appid) = @_;
71 checkrc
(set_appid_impl
($self->{ctx
}, $appid));
72 return $self->{appid
} = $appid;
75 sub challenge
($) { return $_[0]->{challenge
}; }
76 sub set_challenge
($$) {
77 my ($self, $challenge) = @_;
78 checkrc
(set_challenge_impl
($self->{ctx
}, $challenge));
79 return $self->{challenge
} = $challenge;
82 sub keyHandle
($) { return $_[0]->{keyHandle
}; }
83 sub set_keyHandle
($$) {
84 my ($self, $keyHandle) = @_;
85 checkrc
(set_keyHandle_impl
($self->{ctx
}, $keyHandle));
86 return $self->{keyHandle
} = $keyHandle;
89 sub publicKey
($) { return $_[0]->{publicKey
}; }
90 sub set_publicKey
($$) {
91 my ($self, $publicKey) = @_;
92 checkrc
(set_publicKey_impl
($self->{ctx
}, $publicKey));
93 return $self->{publicKey
} = $publicKey;
98 sub registration_challenge
($) {
100 checkrc
(registration_challenge_impl
($self->{ctx
}, my $challenge));
104 sub registration_verify
($$) {
105 my ($self, $response) = @_;
106 checkrc
(registration_verify_impl
($self->{ctx
}, $response, my $kh, my $pk));
112 sub auth_challenge
($) {
114 checkrc
(auth_challenge_impl
($self->{ctx
}, my $challenge));
118 sub auth_verify
($$) {
119 my ($self, $response) = @_;
120 checkrc
(auth_verify_impl
($self->{ctx
}, $response,
125 return wantarray ?
($counter, $presence) : 1;
133 PVE::U2F - Perl bindings for libu2f-server
141 Perl bindings for libu2f-server
153 Proxmox Server Solutions GmbH <support@proxmox.com>