Skip to content

VerifyPinData

Source: src/AWS/PaymentCryptography/VerifyPinData.ts

Runtime binding for payment-cryptography:VerifyPinData — verifies an encrypted PIN block against PIN verification data (e.g. a Visa PVV) using a PIN verification Key (PVK) and the PIN encryption Key (PEK) the block is encrypted under. A mismatch fails with the typed VerificationFailedException. Provide VerifyPinDataHttp on the Function to satisfy this service.

// init
const verifyPin = yield* PaymentCryptography.VerifyPinData(pvk, pek);
// runtime
const outcome = yield* verifyPin({
VerificationAttributes: {
VisaPin: { PinVerificationKeyIndex: 1, VerificationValue: pvv },
},
EncryptedPinBlock: encryptedPinBlock,
PrimaryAccountNumber: "9123456789012345",
PinBlockFormat: "ISO_FORMAT_0",
}).pipe(
Effect.map(() => "valid"),
Effect.catchTag("VerificationFailedException", () =>
Effect.succeed("invalid"),
),
);