The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

METHODS

encrypt_hex_p

Method to encrypt given value.

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

Returns 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
        ;

Returns Mojo::Promise that resolved with decrypted value on success.

AUTHOR

Yanga Kandeni <yangak@cpan.org>

Valters Skrupskis <malishew@cpan.org>

COPYRIGHT

Copyright 2023- PayProp

LICENSE

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

If you would like to contribute documentation or file a bug report then please raise an issue / pull request:

https://github.com/Humanstate/api-client-public-module