mirror of
https://github.com/temetro/temetro.git
synced 2026-08-28 19:37:33 +00:00
feat: QR pairing for wallet import (backend + website)
- Backend: nullable wallet_number on wallet_share_requests (migration 0029); createPairingRequest + POST /api/patients/wallet/pair; applyShareResponse binds the authenticated wallet on QR (pairing) requests - Frontend: Import dialog gains a "Show QR" mode rendering a temetro-pair QR (react-qr-code) the patient scans; requestWalletPairing helper; i18n keys Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -186,6 +186,11 @@
|
||||
"importApp": {
|
||||
"title": "Import from a patient app",
|
||||
"description": "Enter the patient's wallet number. They'll get a request on their phone to approve sharing their record with this clinic.",
|
||||
"tabNumber": "By number",
|
||||
"tabQr": "Show QR",
|
||||
"qrHint": "Generate a QR code, then have the patient scan it in their wallet app to share their record.",
|
||||
"qrCaption": "Scan this in the patient app",
|
||||
"generateQr": "Show QR code",
|
||||
"walletLabel": "Patient wallet number",
|
||||
"walletPlaceholder": "tmw_…",
|
||||
"tempLabel": "Share temporarily",
|
||||
|
||||
@@ -213,6 +213,21 @@ export async function requestWalletShare(input: {
|
||||
});
|
||||
}
|
||||
|
||||
// Create a QR pairing request (no wallet number — the patient scans a QR that
|
||||
// carries this clinic's relay URL + the request). Returns the request plus the
|
||||
// ephemeral public key the device seals to.
|
||||
export type WalletPairing = WalletShareRequest & { ephemeralPubKey: string };
|
||||
|
||||
export async function requestWalletPairing(input: {
|
||||
mode: WalletShareMode;
|
||||
durationHours?: number;
|
||||
}): Promise<WalletPairing> {
|
||||
return apiFetch<WalletPairing>("/api/patients/wallet/pair", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
// Poll a request until the patient approves/denies on their device.
|
||||
export async function pollWalletShare(
|
||||
id: string,
|
||||
|
||||
Reference in New Issue
Block a user