File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33[ ![ Latest Version] ( https://img.shields.io/packagist/v/maatify/crypto.svg?style=for-the-badge )] ( https://packagist.org/packages/maatify/crypto )
44[ ![ PHP Version] ( https://img.shields.io/packagist/php-v/maatify/crypto.svg?style=for-the-badge )] ( https://packagist.org/packages/maatify/crypto )
5- [ ![ License] ( https://img.shields.io/packagist/l/maatify /crypto.svg ?style=for-the-badge )] ( LICENSE )
5+ [ ![ License] ( https://img.shields.io/github/license/Maatify /crypto?style=for-the-badge )] ( LICENSE )
66
77![ PHPStan] ( https://img.shields.io/badge/PHPStan-Level%20Max-4E8CAE )
88
@@ -33,14 +33,25 @@ composer require maatify/crypto
3333
3434` ` ` php
3535use Maatify\C rypto\D X\C ryptoProvider;
36+ use Maatify\C rypto\R eversible\D TO\R eversibleCryptoMetadataDTO;
3637
3738$crypto = $container -> get(CryptoProvider::class);
3839
3940$service = $crypto -> context(" user:email:v1" );
4041
41- $cipher = $service -> encrypt(" hello world" );
42+ $encrypted = $service -> encrypt(" hello world" );
4243
43- $plain = $service -> decrypt($cipher );
44+ $metadata = new ReversibleCryptoMetadataDTO(
45+ $encrypted [' result' ]-> iv,
46+ $encrypted [' result' ]-> tag
47+ );
48+
49+ $plain = $service -> decrypt(
50+ $encrypted [' result' ]-> cipher,
51+ $encrypted [' key_id' ],
52+ $encrypted [' algorithm' ],
53+ $metadata
54+ );
4455` ` `
4556
4657---
You can’t perform that action at this time.
0 commit comments