Actions Status MetaCPAN Release

NAME

UID2::Client::XS - Unified ID 2.0 Client for Perl (binding to the UID2 C++ library)

SYNOPSIS

use UID2::Client::XS;

my $client = UID2::Client::XS->new({
    endpoint => '...',
    auth_key => '...',
    secret_key => '...',
});
my $result = $client->refresh();
die $result->{reason} unless $result->{is_success};
my $decrypted = $client->decrypt($uid2_token);
if ($result->{is_success}) {
    say $result->{uid};
}

DESCRIPTION

This module provides an interface to Unified ID 2.0 API.

CONSTRUCTOR METHODS

new

my $client = UID2::Client::XS->new(\%options);

Creates and returns a new UID2 client with a hashref of options.

Valid options are:

new_euid

my $client = UID2::Client::XS->new_euid(\%options);

Calls new() with EUID identity_scope.

METHODS

refresh

my $result = $client->refresh();

Fetch the latest keys and returns a hashref containing the response. The hashref will have the following keys:

refresh_json

my $result = $client->refresh_json($json);

Updates keys with the JSON string and returns a hashref containing the response. The hashref will have same keys of refresh.

decrypt

my $result = $client->decrypt($token);
# or
my $result = $client->decrypt($token, $timestamp);

Decrypts an advertising token and returns a hashref containing the response. The hashref will have the following keys:

encrypt_data

my $result = $client->encrypt_data($data, \%request);

Encrypts arbitrary data with a hashref of requests.

Valid options are:

One of advertising_token or site_id must be passed.

Returns a hashref containing the response. The hashref will have the following keys:

decrypt_data

my $result = $client->decrypt_data($encrypted_data);

Decrypts data encrypted with encrypt_data(). Returns a hashref containing the response. The hashref will have the following keys:

SEE ALSO

https://github.com/IABTechLab/uid2-client-cpp11

AUTHOR

Jiro Nishiguchi jiro@cpan.org