Skip to content

Commit 1edfe9c

Browse files
committed
feat: add sample funcs + docs
1 parent 6639449 commit 1edfe9c

File tree

1 file changed

+35
-6
lines changed
  • infrastructure/eid-wallet/src/routes/(auth)/onboarding

1 file changed

+35
-6
lines changed

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");

0 commit comments

Comments
 (0)