-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(IT Wallet): [SIW-692] Add PIN auth during presentation (#5255)
## Short description This PR adds the PIN authentication while presenting claims. This happens in two flows: 1. While issuing a credential, when presenting attributes required to obtain the credential; 2. While presenting a credential. ## List of changes proposed in this pull request - Introduces a `itwSagaUtils.ts` which contains any generator function util which is used across sagas and adds a `verifyPin` utility; - Replace existing pin authentications with `verifyPin`; - Adds `verifyPin` during the credential issuing flow and during presentation flows; ## How to test 1. Obtain a PID. PIN should be asked when storing the PID; 2. Obtain a credential. PIN should be asked when presenting claims required to obtain the credential and when storing the credential; 3. Present your PID (scan QR code from the RP demo). PIN should be asked when confirming the presentation; 4. Present your credential (long press on the credential). PIN should be asked when confirming the presentation. --------- Co-authored-by: Mario Perrotta <[email protected]>
- Loading branch information
1 parent
cdc668b
commit 0fe3716
Showing
5 changed files
with
53 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CommonActions } from "@react-navigation/native"; | ||
import { isActionOf } from "typesafe-actions"; | ||
import { put, take } from "typed-redux-saga/macro"; | ||
import NavigationService from "../../../navigation/NavigationService"; | ||
import { | ||
identificationRequest, | ||
identificationSuccess | ||
} from "../../../store/actions/identification"; | ||
import I18n from "../../../i18n"; | ||
|
||
/** | ||
* Generator function that handles the PIN verification. | ||
* Throws an error if the identification fails. | ||
*/ | ||
export function* verifyPin() { | ||
yield* put( | ||
identificationRequest(false, true, undefined, { | ||
label: I18n.t("global.buttons.cancel"), | ||
onCancel: () => | ||
NavigationService.dispatchNavigationAction(CommonActions.goBack()) | ||
}) | ||
); | ||
|
||
const res = yield* take(identificationSuccess); | ||
|
||
if (!isActionOf(identificationSuccess, res)) { | ||
throw new Error(); // TODO: needs to be mapped to an ITW error type in the future (SIW-713) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters