-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Add hashSha256 method for SHA-256 hashing #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
feat: Add hashSha256 method for SHA-256 hashing #1116
Conversation
src/roktManager.ts
Outdated
| */ | ||
| public async hashSha256(attribute: string | number | boolean | undefined | null): Promise<string> { | ||
| if (attribute === undefined || attribute === null) { | ||
| throw new Error('Value cannot be null or undefined'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- i worry this will cause more harm than good in crashing the current loop/thread. our typical pattern would be to log an error or warning.
- I would also make the argument that there's nothing wrong with passing a null or undefined into this particular method. The method is able to act on the value passed in - it should just respond with the attribute (which is either null or undefined).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback about logging pattern. Updated the code:
- For
null/undefinedinputs: Returns the value as-is with a logger.warning - For hash failures: Returns undefined with a logger.error
| } | ||
|
|
||
| /** | ||
| * Hashes an attribute using SHA-256 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the acceptance criteria is to embed the wSDK hashAttributes on line 255 for advertisers since they don't have the Rokt kit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
|



Background
hashSha256method and related helpers to provide SHA-256 hashing functionality for advertisers using the mParticle Web SDK without requiring the Rokt Kit dependency.What Has Changed
hashSha256methodScreenshots/Video
Checklist
Additional Notes
Reference Issue (For employees only. Ignore if you are an outside contributor)