|
| 1 | +// This file is automatically generated, so please do not edit it. |
| 2 | +// Generated by `flutter_rust_bridge`@ 2.0.0. |
| 3 | + |
| 4 | +// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import |
| 5 | + |
| 6 | +import '../../frb_generated.dart'; |
| 7 | +import 'key.dart'; |
| 8 | +import 'key/public_key.dart'; |
| 9 | +import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; |
| 10 | +import 'package:freezed_annotation/freezed_annotation.dart' hide protected; |
| 11 | +part 'signer.freezed.dart'; |
| 12 | + |
| 13 | +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `deref`, `from`, `from`, `from` |
| 14 | + |
| 15 | +// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_NostrSigner>> |
| 16 | +abstract class NostrSigner implements RustOpaqueInterface { |
| 17 | + /// Get backend |
| 18 | + SignerBackend backend(); |
| 19 | + |
| 20 | + /// Get public key |
| 21 | + Future<PublicKey> getPublicKey(); |
| 22 | + |
| 23 | + /// Keys signer |
| 24 | + static NostrSigner keys({required Keys keys}) => |
| 25 | + NostrSdk.instance.api.crateApiProtocolSignerNostrSignerKeys(keys: keys); |
| 26 | + |
| 27 | + /// Decrypt |
| 28 | + Future<String> nip04Decrypt( |
| 29 | + {required PublicKey publicKey, required String encryptedContent}); |
| 30 | + |
| 31 | + /// Encrypt |
| 32 | + Future<String> nip04Encrypt( |
| 33 | + {required PublicKey publicKey, required String content}); |
| 34 | + |
| 35 | + /// Decrypt |
| 36 | + Future<String> nip44Decrypt( |
| 37 | + {required PublicKey publicKey, required String payload}); |
| 38 | + |
| 39 | + /// Encrypt |
| 40 | + Future<String> nip44Encrypt( |
| 41 | + {required PublicKey publicKey, required String content}); |
| 42 | +} |
| 43 | + |
| 44 | +@freezed |
| 45 | +sealed class SignerBackend with _$SignerBackend { |
| 46 | + const SignerBackend._(); |
| 47 | + |
| 48 | + /// Secret key |
| 49 | + const factory SignerBackend.keys() = SignerBackend_Keys; |
| 50 | + |
| 51 | + /// Browser extension (NIP07) |
| 52 | + /// |
| 53 | + /// <https://github.com/nostr-protocol/nips/blob/master/07.md> |
| 54 | + const factory SignerBackend.browserExtension() = |
| 55 | + SignerBackend_BrowserExtension; |
| 56 | + |
| 57 | + /// Nostr Connect (NIP46) |
| 58 | + /// |
| 59 | + /// <https://github.com/nostr-protocol/nips/blob/master/46.md> |
| 60 | + const factory SignerBackend.nostrConnect() = SignerBackend_NostrConnect; |
| 61 | + |
| 62 | + /// Custom |
| 63 | + const factory SignerBackend.custom( |
| 64 | + String field0, |
| 65 | + ) = SignerBackend_Custom; |
| 66 | +} |
0 commit comments