Add NIP-46 bunker proxy support for remote signing#418
Open
greenart7c3 wants to merge 3 commits into
Open
Conversation
A new login mode that pairs Amber with a remote NIP-46 bunker. All signing, encryption and decryption requests are forwarded to the bunker silently — no approval prompts are ever shown — making Amber a fully transparent NIP-46 proxy. Works for the three ingestion paths: nostrsigner:// intents, the ContentProvider IPC, and inbound NIP-46 events on Amber's own relays.
MainPage is reused inside MainScreen's NavHost for the post-login "add another account" flow, so the bunkerProxyLogin route also has to be registered there. Without this, tapping the bunker proxy button while already logged in throws IllegalArgumentException because the post-login graph (startDestination=Applications) does not know the route.
… picker - After a successful bunker proxy login, navigate the NavHost to the Applications route (mirrors the existing nsec login flow). Without this the user was left on the bunker login screen. - Drop the inner Scaffold in BunkerProxyLoginScreen and accept a contentPadding parameter so the post-login MainScreen's top/bottom bars no longer cut off the screen content. - For both the inbound NIP-46 path (EventNotificationConsumer) and the nostrsigner:// intent path (IntentUtils.handleProxyIntent), only short-circuit "connect" / "get_public_key" silently when there is a single saved account. With multiple accounts, fall through to the existing connect approval UI so the user can pick which account to expose to the requesting app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for Amber to function as a NIP-46 bunker proxy, allowing users to connect to remote bunkers and forward all signing operations to them. This enables Amber to act as a local signer interface while delegating cryptographic operations to a remote bunker service.
Key Changes
New BunkerProxyLoginScreen UI: Added a new login flow with two tabs:
bunker://URI to connect to an existing bunkernostrconnect://URI to share with a bunker for pairingRemoteBunkerClient service: New service class that handles all NIP-46 communication with remote bunkers:
sign_event,sign_message,nip44_encrypt,nip04_encrypt,nip44_decrypt,nip04_decrypt,decrypt_zap_event,get_public_key,connectProxyResponseSubscription: New subscription manager for receiving NIP-46 responses from remote bunkers:
Account proxy support: Extended Account model to support proxy mode:
ProxyAccountMetadatato store remote bunker pubkey, relays, and connection detailsRemoteBunkerClientwhen in proxy modeIntent handling: Added
handleProxyIntent()in IntentUtils to short-circuit nostrsigner:// intents:EventNotificationConsumer integration: Added
forwardProxyRequest()to handle inbound NIP-46 requests:UI and navigation:
Persistence: Extended LocalPreferences to save/load proxy account metadata (remote pubkey, relays, bunker name, secret)
Notable Implementation Details
bunker://URIs (direct connection) andnostrconnect://URIs (user-initiated pairing)https://claude.ai/code/session_01U28mr2RosEzh1h45VD27Bn