I got the code like this in request codeParameter:"{####}" and I want to store it in database decrypted.
const { plaintext, messageHeader } = await decrypt(
keyring,
b64.toByteArray(codeParameter),
);
console.log(plaintext, messageHeader);
That's the request
{
version: '1',
region: 'eu-west-1',
userPoolId: 'xxxxxxx',
userName: 'xxxxxxxx',
callerContext: {
awsSdkVersion: 'aws-sdk-unknown-unknown',
clientId: 'xxxxxxxx'
},
triggerSource: 'CustomMessage_SignUp',
request: {
userAttributes: {
sub: 'xxxxxxx',
'cognito:email_alias': 'xxxxxxx',
email_verified: 'false',
'cognito:user_status': 'UNCONFIRMED',
email: 'xxxxxxx'
},
codeParameter: '{####}',
linkParameter: '{##Click Here##}',
usernameParameter: null
},
response: { smsMessage: null, emailMessage: null, emailSubject: null }
}
From what can I see it's named code on AWS DOC and not codeParameter..
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-email-sender.html