add Touch ID wallet unlock via Swift biometric helper + Bun spawn

This commit is contained in:
2026-05-18 03:57:00 +08:00
parent d0648d62ef
commit b130e92294
9 changed files with 152 additions and 7 deletions
+23
View File
@@ -27,6 +27,7 @@ import {
getBinaryDir,
MoneroWalletManager,
} from './lib/monero'
import { canPromptTouchID, promptTouchID } from './lib/biometric'
const env = getENV()
@@ -133,6 +134,14 @@ type TxEntry = {
type RPC = {
bun: RPCSchema<{
requests: {
biometricCanAuth: {
params: {}
response: boolean
}
biometricAuth: {
params: { reason: string }
response: boolean
}
getSecret: {
params: {
service: string
@@ -357,6 +366,20 @@ const rpc = BrowserView.defineRPC<RPC>({
maxRequestTime: 120000,
handlers: {
requests: {
biometricCanAuth: async () => {
try {
return canPromptTouchID()
} catch {
return false
}
},
biometricAuth: async ({ reason }) => {
try {
return promptTouchID(reason)
} catch {
return false
}
},
getSecret: async ({ name, service }) => {
return await Bun.secrets.get({ name, service })
},