User enabled encryption for data 2/2
// Registration of email address and shipping address via web form
$emailAddress = '
[email protected]';
$shippingAddres = new Address(
street: 'Kerkstraat',
number: '123',
postalCode: '2000',
city: 'Antwerp',
countryCode: 'BE'
);
$userMeta = new UserMeta($user->getUserId(), $emailAddress, $shippingAddres);
$repository = new Repository();
// Keep records for transactions for a limited time
// Can be encrypted by a universal encryption key
$repository->storeTransactionMeta($userMeta);
// Keep records for longer time period, securely encrypting the data
// using the user's own encryption key
$repository->persistUserMeta($userMeta, $user);