From 787a84825752ffecab6a678fe6ccd27bec6db513 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 15 May 2025 11:12:12 +0100 Subject: [PATCH] chore: setup bunker --- lib/login.dart | 21 ++++++++++++++++++++- lib/pages/login_input.dart | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/login.dart b/lib/login.dart index ac11c5e..de11a2a 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -12,8 +12,14 @@ class LoginAccount { final AccountType type; final String pubkey; final String? privateKey; + final List? signerRelays; - LoginAccount._({required this.type, required this.pubkey, this.privateKey}); + LoginAccount._({ + required this.type, + required this.pubkey, + this.privateKey, + this.signerRelays, + }); static LoginAccount nip19(String key) { final keyData = bech32ToHex(key); @@ -42,6 +48,19 @@ class LoginAccount { return LoginAccount._(type: AccountType.externalSigner, pubkey: key); } + static LoginAccount bunker( + String privateKey, + String pubkey, + List relays, + ) { + return LoginAccount._( + type: AccountType.externalSigner, + pubkey: pubkey, + privateKey: privateKey, + signerRelays: relays, + ); + } + static Map toJson(LoginAccount? acc) => { "type": acc?.type.name, "pubKey": acc?.pubkey, diff --git a/lib/pages/login_input.dart b/lib/pages/login_input.dart index 6be6c5a..5aa934e 100644 --- a/lib/pages/login_input.dart +++ b/lib/pages/login_input.dart @@ -30,6 +30,14 @@ class _LoginInputPage extends State { "Login", onTap: () async { try { + if (_controller.text.startsWith("bunker://")) { + // not supported yet in ndk + setState(() { + _error = "Bunker login not supported yet"; + _controller.clear(); + }); + return; + } final keyData = bech32ToHex(_controller.text); if (keyData.isNotEmpty) { loginData.value = LoginAccount.nip19(_controller.text);