Skip to content

Commit 65d6d5f

Browse files
authored
fix(biometrics): IOS keyhandling, timed keys on android (#323)
* IOS: Fixes handling of existing encryption keys when performing crypto options. * Add methods to delete the keys on IOS/Android. * Android: Add ability to configure time based keys on android, which allows crypto operations without triggering bio prompt if bio prompt has been complete X seconds previously. * Android: make the didBiometricDatabaseChange operation have no side effects and support custom key name.
1 parent eee7ed3 commit 65d6d5f

File tree

9 files changed

+427
-215
lines changed

9 files changed

+427
-215
lines changed

apps/demo/src/plugin-demos/biometrics.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222

2323
<Button text="verify with encryption" tap="{{ doVerifyFingerprintWithEncrypt }}" class="btn btn-primary" />
2424
<Button text="verify with decryption" tap="{{ doVerifyFingerprintWithDecrypt }}" class="btn btn-primary" />
25+
<Button text="delete Key" tap="{{ doDeleteKey }}" class="btn btn-primary" />
26+
2527
<TextField text="{{ encryptedPassword }}" ></TextField>
2628
<TextField text="{{ IV }}"></TextField>
2729
<TextField text="{{ decryptedPassword }}"></TextField>
28-
30+
<TextField text="{{ androidKeyTimeout }}" ></TextField>
31+
2932
</StackLayout>
3033
</ScrollView>
3134
</TabViewItem.view>
3235
</TabViewItem>
3336
<TabViewItem title="About">
3437
<TabViewItem.view>
3538
<StackLayout class="tab-content">
36-
<Image margin="10" src="~/res/telerik-logo.png" />
3739
<Label text="Biometrics plugin demo" class="title"/>
3840
<Label text="The Biometrics plugin allows you to use the fingerprint / face scanner of your mobile device." textWrap="true"/>
3941
<Label text=" "/>

packages/biometrics/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ biometricAuth.available().then((avail) => {
108108

109109
### Normal operation
110110

111-
If you do not pass any of the options (pinFallback / keyName) to the verify method then the plugin will create a secure key, call the authorization methods to trigger face/fingerprint and then attempt to use the key to encrypt some text. The idea being that the key will not be accessable unless the user has successfully authenticated.
111+
If you do not pass any of the options (pinFallback / keyName) to the verify method then the plugin will create a secure key, call the authorization methods to trigger face/fingerprint and then attempt to use the key to encrypt some text. The idea being that the key will not be accessible unless the user has successfully authenticated.
112112

113113
This however is not foolproof and the most secure method is to pass the `secret` and `Keyname`options to encrypt/decrypt text.
114114

packages/biometrics/common.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ export interface AndroidOptions {
8181
* Retrieved from the result of an encryption.
8282
*/
8383
iv?: string;
84+
85+
/**
86+
* The period in seconds for which operations on the key are valid without triggering a biometric prompt.
87+
*/
88+
validityDuration?: number;
8489
}
8590

8691
export interface BiometricIDAvailableResult {
@@ -117,9 +122,17 @@ export interface BiometricApi {
117122
verifyBiometric(options: VerifyBiometricOptions): Promise<BiometricResult>;
118123

119124
/**
120-
* Note will not do anyting on android if using pin fallback.
125+
* Note will not do anything on android if using pin fallback.
121126
*/
122127
close(): void;
128+
129+
/**
130+
*
131+
* When using encryption backed biometrics keys are generated, this allow you to remove the key.
132+
*
133+
* @param keyName Optional keyName to delete, if not supplied will delete the default key.
134+
*/
135+
deleteKey(keyName?: string): void;
123136
}
124137

125138
export interface BiometricResult {

0 commit comments

Comments
 (0)