feat(Device): B2PDE-1770 implement new method setBiometricsAuthenticationStatus#226
feat(Device): B2PDE-1770 implement new method setBiometricsAuthenticationStatus#226
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new API for toggling biometric authentication status between the web and native layers.
- Adds a new
SET_BIOMETRICS_AUTHENTICATION_STATUSmessage type in the post-message interface - Implements
setBiometricsAuthenticationStatus(enable: boolean)indevice.tswith accompanying unit tests - Updates package exports and user documentation (README and
index.ts)
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/post-message.ts | Register new SET_BIOMETRICS_AUTHENTICATION_STATUS response type |
| src/device.ts | Implement setBiometricsAuthenticationStatus function and JSDoc |
| src/tests/device-test.ts | Add unit tests for the new method |
| index.ts | Export setBiometricsAuthenticationStatus from the public API |
| README.md | Document setBiometricsAuthenticationStatus API and error cases |
Comments suppressed due to low confidence (2)
src/tests/device-test.ts:563
- Add an assertion to verify that
msg.payload.enablematches the expected value in the error test, ensuring the correct data is sent.
expect(msg.type).toBe('SET_BIOMETRICS_AUTHENTICATION_STATUS');
README.md:1802
- [nitpick] Consider adding a
404error case for unsupported bridge implementations, mirroring the documentation of similar methods.
- `400`: enable parameter is missing
88372db to
0c453da
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/device.ts
Outdated
| postMessageToNativeApp({ | ||
| type: 'SET_BIOMETRICS_AUTHENTICATION_STATUS', | ||
| payload: { | ||
| enable: enable, |
There was a problem hiding this comment.
According to the spec this should be:
| enable: enable, | |
| newStatus: enable, |
There was a problem hiding this comment.
Yes, I think "newStatus" has the wrong semantic once the parameter has been changed to a boolean. What do you all think?
There was a problem hiding this comment.
instead of a single parameter, consider accepting an object: {enable: boolean}
This makes the code easier to understand (the object acts as named parameters):
setBiometricsAuthenticationStatus({enable: true})
instead of:
setBiometricsAuthenticationStatus(true)
and it is easier to extend, adding new properties
54b8c42 to
502d3a5
Compare
B2PDE-1770
closes #225