Skip to content

Add pattern validation for hashedPhoneNumber#188

Merged
bigludo7 merged 1 commit intocamaraproject:mainfrom
ravindrapalaskar17:Add-pattern-validation-for-hashedPhoneNumber
May 21, 2025
Merged

Add pattern validation for hashedPhoneNumber#188
bigludo7 merged 1 commit intocamaraproject:mainfrom
ravindrapalaskar17:Add-pattern-validation-for-hashedPhoneNumber

Conversation

@ravindrapalaskar17
Copy link
Contributor

@ravindrapalaskar17 ravindrapalaskar17 commented Apr 21, 2025

What type of PR is this?

Add one of the following kinds:

  • enhancement/feature

What this PR does / why we need it:

This PR introduces pattern validation for the hashedPhoneNumber parameter.

Previously, pattern validation was only applied to the phoneNumber field, ensuring it followed the E.164 format (i.e., starting with the country code and prefixed with +). However, when a user provides a hashedPhoneNumber, we cannot reverse it to verify the presence of the + prefix due to the nature of hashing.

To address this, we now enforce a pattern validation specifically for hashedPhoneNumber. The validation checks that the hash:

  • Is exactly 64 characters long,
  • Contains only valid hexadecimal characters (i.e., a-f, A-F, 0-9).

This approach ensures that the input format for hashedPhoneNumber remains consistent and secure, without relying on characteristics of the unhashed value.

Which issue(s) this PR fixes:

Fixes #189

Special notes for reviewers:

No functional change.

Changelog input

Add pattern validation for hashedPhoneNumber

@bigludo7
Copy link
Collaborator

Works for me - But we have first to merge #191 to set back the version to wip.

@maxl2287
Copy link
Contributor

maxl2287 commented May 8, 2025

@bigludo7 #191 is now approved, I guess this can be merged 🚀

Copy link
Contributor

@maxl2287 maxl2287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigludo7 bigludo7 merged commit 7ef0e90 into camaraproject:main May 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pattern validation for hashedPhoneNumber in Number Verification API

4 participants