NAME

PayProp::API::Public::Client::Role::Encrypt - Role to encapsulate value encryption.

SYNOPSIS

package Module::Requiring::Ecryption;
with qw/ PayProp::API::Public::Client::Role::Encrypt /;

...;

__PACKAGE__->meta->make_immutable;

my $Module = Module::Requiring::Ecryption->new( encryption_secret => 'meh' );
my $Promise = $Module
	->encrypt_hex_p('TO_ENCRYPT')
	->then(sub {
		my ( $encrypted_value ) = @_;
		...;
	})
	->wait
;

DESCRIPTION

Define methods to encrypt and decrypt tokens, and return Mojo::Promise.

encrypt_hex_p

Method to encrypt given value.

$self
	->encrypt_hex_p('TO_ENCRYPT')
	->then(sub {
		my ( $encrypted_value ) = @_;
		...;
	})
	->wait
;

Return:

C<Mojo::Promise> that resolved with encrypted value on success.

decrypt_hex_p

Method to decrypt given value.

$self
	->decrypt_hex_p('TO_DECRYPT')
	->then(sub {
		my ( $decrypted_value ) = @_;
		...;
	})
	->wait
;

Return:

C<Mojo::Promise> that resolved with decrypted value on success.