Skip to content

VerifyMac

Source: src/AWS/PaymentCryptography/VerifyMac.ts

Runtime binding for payment-cryptography:VerifyMac — verifies a Message Authentication Code against hex-encoded message data under a Key. A mismatched MAC fails with the typed VerificationFailedException. Provide VerifyMacHttp on the Function to satisfy this service.

// init
const verifyMac = yield* PaymentCryptography.VerifyMac(macKey);
// runtime — MessageData and Mac are hex-encoded
yield* verifyMac({
MessageData: "31323334353637383930313233343536",
Mac: mac,
VerificationAttributes: { Algorithm: "HMAC" },
});