Skip to content

Commit 67e7f9b

Browse files
Update biometric.mdx
Solving some formatting issues.
1 parent 0c4d6f8 commit 67e7f9b

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/content/docs/plugin/biometric.mdx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ In the `src-tauri/Info.ios.plist` file, add the following snippet:
8989
<?xml version="1.0" encoding="UTF-8"?>
9090
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
9191
<plist version="1.0">
92-
<dict>
93-
<key>NSFaceIDUsageDescription</key>
94-
<string>Authenticate with biometric</string>
95-
</dict>
92+
<dict>
93+
<key>NSFaceIDUsageDescription</key>
94+
<string>Authenticate with biometric</string>
95+
</dict>
9696
</plist>
9797
```
9898

@@ -227,35 +227,39 @@ import { biometricCipher } from '@tauri-apps/plugin-biometric';
227227
// Encrypts data
228228
const encryptOptions = {
229229
// ... other options
230-
dataToEncrypt: getOriginalData()
230+
dataToEncrypt: getOriginalData(),
231231
};
232232

233233
try {
234-
const encrypted = await biometricCipher('Passwordless authentication', encryptOptions);
234+
const encrypted = await biometricCipher(
235+
'Passwordless authentication',
236+
encryptOptions
237+
);
235238
console.log(
236239
'Hooray! Successfully encrypted data! We can now store it to decrypt later, when needed'
237240
);
238241
} catch (err) {
239242
console.log('Oh no! Authentication failed because ' + err.message);
240243
}
241244

242-
243245
// Decrypts data back to the original
244246
const decryptOptions = {
245247
// ... other options
246248
dataToDecrypt: encrypted.data,
247249
};
248250

249251
try {
250-
const original = await biometricCipher('Passwordless authentication', decryptOptions);
252+
const original = await biometricCipher(
253+
'Passwordless authentication',
254+
decryptOptions
255+
);
251256
console.log(
252257
'Hooray! Successfully decrypted data after the user authenticated with their biometric method.'
253258
);
254259
const valid = originalData() == dataToDecrypt.data;
255260
} catch (err) {
256261
console.log('Oh no! Authentication failed because ' + err.message);
257262
}
258-
259263
```
260264

261265
</TabItem>
@@ -269,7 +273,7 @@ fn bio_cipher(app_handle: tauri::AppHandle, original_data: Option<String>) {
269273

270274
let encrypt_options = AuthOptions {
271275
// ... other options
272-
data_to_encrypt: original_data.unwrap()
276+
data_to_encrypt: original_data.unwrap()
273277
};
274278

275279
// if the encryption was successful, the function returns Result::Ok(CipherResult)
@@ -285,7 +289,7 @@ fn bio_cipher(app_handle: tauri::AppHandle, original_data: Option<String>) {
285289

286290
let decrypt_options = AuthOptions {
287291
// ... other options
288-
data_to_decrypt: encrypted.data
292+
data_to_decrypt: encrypted.data
289293
};
290294

291295
// if the encryption was successful, the function returns Result::Ok(CipherResult)

0 commit comments

Comments
 (0)