mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-16 20:08:50 +00:00
chore: setup bunker
This commit is contained in:
@ -12,8 +12,14 @@ class LoginAccount {
|
|||||||
final AccountType type;
|
final AccountType type;
|
||||||
final String pubkey;
|
final String pubkey;
|
||||||
final String? privateKey;
|
final String? privateKey;
|
||||||
|
final List<String>? 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) {
|
static LoginAccount nip19(String key) {
|
||||||
final keyData = bech32ToHex(key);
|
final keyData = bech32ToHex(key);
|
||||||
@ -42,6 +48,19 @@ class LoginAccount {
|
|||||||
return LoginAccount._(type: AccountType.externalSigner, pubkey: key);
|
return LoginAccount._(type: AccountType.externalSigner, pubkey: key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LoginAccount bunker(
|
||||||
|
String privateKey,
|
||||||
|
String pubkey,
|
||||||
|
List<String> relays,
|
||||||
|
) {
|
||||||
|
return LoginAccount._(
|
||||||
|
type: AccountType.externalSigner,
|
||||||
|
pubkey: pubkey,
|
||||||
|
privateKey: privateKey,
|
||||||
|
signerRelays: relays,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static Map<String, dynamic> toJson(LoginAccount? acc) => {
|
static Map<String, dynamic> toJson(LoginAccount? acc) => {
|
||||||
"type": acc?.type.name,
|
"type": acc?.type.name,
|
||||||
"pubKey": acc?.pubkey,
|
"pubKey": acc?.pubkey,
|
||||||
|
@ -30,6 +30,14 @@ class _LoginInputPage extends State<LoginInputPage> {
|
|||||||
"Login",
|
"Login",
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
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);
|
final keyData = bech32ToHex(_controller.text);
|
||||||
if (keyData.isNotEmpty) {
|
if (keyData.isNotEmpty) {
|
||||||
loginData.value = LoginAccount.nip19(_controller.text);
|
loginData.value = LoginAccount.nip19(_controller.text);
|
||||||
|
Reference in New Issue
Block a user