EarnMorev1.0.0

validateCvvFromKey

validateCvvFromKey( pan: string, expiry: string, derivedKey: Buffer, cvv: string, keyId: string, ): boolean

Source: cvv.ts:149

Validates a 4-digit CVV using a pre-derived HMAC key. Uses constant-time comparison (timingSafeEqual) to prevent timing attacks.

Parameters

  • pan (string) — 16-digit PAN string
  • expiry (string) — "MM/YY" formatted expiry string
  • derivedKey (Buffer) — 32-byte key from deriveHmacKey()
  • cvv (string) — The 4-digit CVV to validate
  • keyId (string) — Key identifier — must match the keyId used during issuance. Default: DEFAULT_KEY_ID ("default")

Returns

  • boolean