From 88fbc7fe96f8543b90908fdbe76d5108fc8e9c21 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 19 Sep 2026 01:08:39 +0700 Subject: [PATCH 1/2] feat(swift-sdk): share a bounded login key with a browser over Bluetooth The wallet FFI identity-key row gains `total_budget` / `expires_at` (with presence flags) so callers can register the protocol 14 limited keys; a row carrying either becomes an `IdentityPublicKey::V1`, everything else stays V0. The parsed identity-update projection carries the same fields. The Swift `IdentityPubkey` model exposes `totalBudget` / `expiresAt`. SwiftExampleApp adds "Share Login Key with Browser" under an identity's keys: the phone advertises a BLE GATT service, shows a six-digit pairing code when a browser writes its request, registers an AUTHENTICATION / HIGH HASH160 key with the chosen budget and expiry (signed by the master key), and serves the login key encrypted with the Yappr key-exchange envelope. The phone never keeps the login key. The Kotlin JNI decoder passes no limits, so Android behaviour is unchanged. Co-Authored-By: Claude Fable 5.1 --- packages/swift-sdk/SwiftExampleApp/Info.plist | 6 + .../Services/BrowserLoginKeyProtocol.swift | 384 ++++++++++++++++++ .../Services/BrowserLoginPeripheral.swift | 215 ++++++++++ .../Views/IdentityDetailView.swift | 17 + .../Views/ShareLoginKeyView.swift | 356 ++++++++++++++++ .../BrowserLoginKeyProtocolTests.swift | 166 ++++++++ 6 files changed, 1144 insertions(+) create mode 100644 packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/BrowserLoginKeyProtocol.swift create mode 100644 packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/BrowserLoginPeripheral.swift create mode 100644 packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShareLoginKeyView.swift create mode 100644 packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/BrowserLoginKeyProtocolTests.swift diff --git a/packages/swift-sdk/SwiftExampleApp/Info.plist b/packages/swift-sdk/SwiftExampleApp/Info.plist index 0f71e153e0a..9093385615b 100644 --- a/packages/swift-sdk/SwiftExampleApp/Info.plist +++ b/packages/swift-sdk/SwiftExampleApp/Info.plist @@ -30,6 +30,12 @@ NSCameraUsageDescription The camera is used to scan Dash address QR codes. + + NSBluetoothAlwaysUsageDescription + Bluetooth is used to hand a nearby browser a time- and spend-limited login key for your identity. +