Skip to content

Commit e67dbf2

Browse files
authored
feat: add packages (#235)
* feat: add packages * feat: add sample funcs + docs
1 parent 3e74892 commit e67dbf2

File tree

6 files changed

+66
-6
lines changed

6 files changed

+66
-6
lines changed

infrastructure/eid-wallet/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"license": "MIT",
2121
"dependencies": {
22+
"@auvo/tauri-plugin-crypto-hw-api": "^0.1.0",
2223
"@hugeicons/core-free-icons": "^1.0.13",
2324
"@hugeicons/svelte": "^1.0.2",
2425
"@ngneat/falso": "^7.3.0",

infrastructure/eid-wallet/src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ thiserror = { version = "2.0.11" }
3232
[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies]
3333
tauri-plugin-barcode-scanner = "2"
3434
tauri-plugin-biometric = "2.2.0"
35+
tauri-plugin-crypto-hw = "0.1.0"
3536

infrastructure/eid-wallet/src-tauri/gen/android/.idea/AndroidProjectSystem.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infrastructure/eid-wallet/src-tauri/gen/android/.idea/deviceManager.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
<script lang="ts">
22
import { goto } from "$app/navigation";
3-
import { Hero } from "$lib/fragments";
4-
import { ButtonAction, Drawer } from "$lib/ui";
5-
import { getContext, onMount } from "svelte";
6-
import { GlobalState } from "$lib/global";
7-
import axios from "axios";
8-
import { v4 as uuidv4 } from "uuid";
93
import {
104
PUBLIC_PROVISIONER_URL,
115
PUBLIC_REGISTRY_URL,
126
} from "$env/static/public";
7+
import { Hero } from "$lib/fragments";
8+
import { GlobalState } from "$lib/global";
9+
import { ButtonAction, Drawer } from "$lib/ui";
1310
import { capitalize } from "$lib/utils";
11+
import {
12+
generate, getPublicKey,
13+
// signPayload, verifySignature
14+
} from "@auvo/tauri-plugin-crypto-hw-api"
1415
import * as falso from "@ngneat/falso";
16+
import axios from "axios";
17+
import { getContext, onMount } from "svelte";
1518
import { Shadow } from "svelte-loading-spinners";
19+
import { v4 as uuidv4 } from "uuid";
1620
1721
let isPaneOpen = $state(false);
1822
let preVerified = $state(false);
@@ -41,6 +45,31 @@
4145
return randomLetters() + randomDigits();
4246
}
4347
48+
// IMO, call this function early, check if hardware even supports the app
49+
// docs: https://github.com/auvoid/tauri-plugin-crypto-hw/blob/48d0b9db7083f9819766e7b3bfd19e39de9a77f3/examples/tauri-app/src/App.svelte#L13
50+
async function generateApplicationKeyPair() {
51+
let res: string | undefined
52+
try {
53+
res = await generate("default")
54+
console.log(res)
55+
} catch (e) {
56+
// Put hardware crypto missing error here
57+
console.log(e)
58+
}
59+
return res
60+
}
61+
62+
async function getApplicationPublicKey() {
63+
let res: string | undefined
64+
try {
65+
res = await getPublicKey("default")
66+
console.log(res)
67+
} catch (e) {
68+
console.log(e)
69+
}
70+
return res // check getPublicKey doc comments (multibase hex format)
71+
}
72+
4473
const handleNext = async () => {
4574
//handle next functionlity
4675
goto("/verify");

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)