Skip to content

Commit 9d98ec3

Browse files
committed
Expose signer methods for Client
1 parent 8ab40f0 commit 9d98ec3

File tree

5 files changed

+582
-170
lines changed

5 files changed

+582
-170
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* Expose `EventBuilder` ([Yuki Kishimoto])
4444
* Expose `Client::send_event_builder` ([Yuki Kishimoto])
4545
* Expose `Client::automatic_authentication` ([Yuki Kishimoto])
46+
* Expose signer methods for `Client` ([Yuki Kishimoto])
4647
* Add `SendEventOutput` ([Yuki Kishimoto])
4748

4849
### Fixed

lib/src/rust/api/client.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'client/output.dart';
99
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
1010
import 'protocol/event.dart';
1111
import 'protocol/event/builder.dart';
12+
import 'protocol/signer.dart';
1213

1314
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `from`
1415

@@ -37,6 +38,9 @@ abstract class Client implements RustOpaqueInterface {
3738
/// Connect to all added relays
3839
Future<void> connect();
3940

41+
/// Check if signer is configured
42+
Future<bool> hasSigner();
43+
4044
factory Client() => NostrSdk.instance.api.crateApiClientClientNew();
4145

4246
/// Send event
@@ -51,4 +55,15 @@ abstract class Client implements RustOpaqueInterface {
5155
///
5256
/// Return an error if the [`NostrSigner`] is not set.
5357
Future<SendEventOutput> sendEventBuilder({required EventBuilder builder});
58+
59+
/// Set nostr signer
60+
Future<void> setSigner({required NostrSigner signer});
61+
62+
/// Get current nostr signer
63+
///
64+
/// Rise error if it not set.
65+
Future<NostrSigner> signer();
66+
67+
/// Unset nostr signer
68+
Future<void> unsetSigner();
5469
}

0 commit comments

Comments
 (0)