feat(mobile): add biometric plugin (#829)

* chore: update deps, make mobile script paths relative

* feat(biometric): setup plugin folder

* feat: implement iOS

* add api

* android

* fix plugin name

* also check empty info.plist entry

* add example

* fix android

* supress

* lint

* better explanation

* add partners & contributed by

* change ext

* license headers

* update vite

* add covector setup

* tauri/dox removed

* add example

* docs

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Lucas Nogueira
2023-12-19 11:16:13 -03:00
committed by GitHub
parent fe79adb5c7
commit 8df28a9875
48 changed files with 1503 additions and 29 deletions
+1
View File
@@ -11,6 +11,7 @@
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.12",
"@tauri-apps/plugin-barcode-scanner": "2.0.0-alpha.3",
"@tauri-apps/plugin-biometric": "1.0.0",
"@tauri-apps/plugin-cli": "2.0.0-alpha.4",
"@tauri-apps/plugin-clipboard-manager": "2.0.0-alpha.4",
"@tauri-apps/plugin-dialog": "2.0.0-alpha.4",
+1
View File
@@ -48,6 +48,7 @@ tauri-plugin-updater = { path = "../../../plugins/updater", version = "2.0.0-alp
[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
tauri-plugin-barcode-scanner = { path = "../../../plugins/barcode-scanner/", version = "2.0.0-alpha.3" }
tauri-plugin-nfc = { path = "../../../plugins/nfc", version = "1.0.0" }
tauri-plugin-biometric = { path = "../../../plugins/biometric/", version = "1.0.0" }
[target."cfg(target_os = \"windows\")".dependencies]
window-shadows = "0.2"
+1
View File
@@ -15,6 +15,7 @@
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/../../../../../plugins/barcode-scanner/android" />
<option value="$PROJECT_DIR$/../../../../../plugins/biometric/android" />
<option value="$PROJECT_DIR$/../../../../../plugins/clipboard-manager/android" />
<option value="$PROJECT_DIR$/../../../../../plugins/dialog/android" />
<option value="$PROJECT_DIR$/../../../../../plugins/nfc/android" />
+1
View File
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
@@ -44,5 +44,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSFaceIDUsageDescription</key>
<string>Biometric Test</string>
</dict>
</plist>
+1
View File
@@ -48,6 +48,7 @@ pub fn run() {
{
app.handle().plugin(tauri_plugin_barcode_scanner::init())?;
app.handle().plugin(tauri_plugin_nfc::init())?;
app.handle().plugin(tauri_plugin_biometric::init())?;
}
let mut window_builder = WindowBuilder::new(app, "main", WindowUrl::default());
+6
View File
@@ -17,6 +17,7 @@
import Clipboard from "./views/Clipboard.svelte";
import WebRTC from "./views/WebRTC.svelte";
import Scanner from "./views/Scanner.svelte";
import Biometric from "./views/Biometric.svelte";
import { onMount } from "svelte";
import { ask } from "@tauri-apps/plugin-dialog";
@@ -113,6 +114,11 @@
component: Nfc,
icon: "i-ph-nfc",
},
isMobile && {
label: "Biometric",
component: Biometric,
icon: "i-ph-scan",
},
];
let selected = views[0];
+30
View File
@@ -0,0 +1,30 @@
<script>
import { authenticate } from "@tauri-apps/plugin-biometric";
export let onMessage;
let allowDeviceCredential = true;
function auth() {
authenticate("Tauri API wants to show it is awesome :)", {
allowDeviceCredential,
cancelTitle: "Cancel request",
fallbackTitle: "Trying the fallback option",
title: "Tauri API Auth",
subtitle: "Please authenticate :)",
confirmationRequired: false,
maxAttemps: 1,
})
.then(onMessage)
.catch(onMessage);
}
</script>
<div>
<input
type="checkbox"
id="dllowDeviceCredential"
bind:checked={allowDeviceCredential}
/>
<label for="allowDeviceCredentiale">Allow device credential</label>
</div>
<button class="btn" id="cli-matches" on:click={auth}> Authenticate </button>