Skip to content
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

refactor: [SIW-1176] Change decoded assertion format on iOS #17

Merged
merged 9 commits into from
Jun 5, 2024

Conversation

LazyAfternoons
Copy link
Contributor

@LazyAfternoons LazyAfternoons commented Jun 4, 2024

Short description

This PR is a followup to #10 which changes the decoded assertion format to reflect what we expect in our actual backed which requires an authenticatorData and signature as base64 strings. Currently it returns the whole decoded assertion as a base64 string. This change reduces the complexity of the verification downstream.

List of Changes

  • Changes the native method decodeAssertion implementation which now returns an object containing authenticatorData and signature as base64 encoded strings;
  • Updates the javascript part of the native bridge to reflect the aforementioned change with the proper return type;
  • Updates the backend verification function to reflect the aforementioned change;
  • Wraps the example app functions in try-catch to prevent unhandled rejected promises in case of error;
  • Updates the documentation.

How Has This Been Tested?

  • Set value in .env file under example app and backend
  • Start metro with cd example && yarn start
  • Start backend with cd backend && yarn start
  • Using a supported iOS device open Xcode and start the example app
  • Try sequentially every button
  • Last CTA Verify Assertion should return a value like this {result: {signCount: 1}}

backend/src/index.ts Fixed Show fixed Hide fixed
backend/src/index.ts Dismissed Show dismissed Hide dismissed
@LazyAfternoons LazyAfternoons changed the title refactor: [SIW-1176] Change decoded attestation format refactor: [SIW-1176] Change decoded assertion format Jun 4, 2024
@LazyAfternoons LazyAfternoons changed the title refactor: [SIW-1176] Change decoded assertion format refactor: [SIW-1176] Change decoded assertion format on iOS Jun 4, 2024
@LazyAfternoons LazyAfternoons marked this pull request as ready for review June 4, 2024 15:23
src/index.tsx Outdated Show resolved Hide resolved
const nonce = await getChallengeFromServer();
setChallenge(nonce);
const res = await getAttestation(nonce, hardwareKeyTag);
setAssertion(res);
Copy link
Contributor

Choose a reason for hiding this comment

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

it should be setAttestation

Copy link
Contributor Author

@LazyAfternoons LazyAfternoons Jun 5, 2024

Choose a reason for hiding this comment

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

Nice catch, thank you! Fixed in e554377

LazyAfternoons and others added 2 commits June 5, 2024 12:04
@LazyAfternoons LazyAfternoons merged commit 360aa2a into main Jun 5, 2024
9 checks passed
@LazyAfternoons LazyAfternoons deleted the SIW-1176-attestation-decode-format branch June 5, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants