Skip to content

Commit

Permalink
flutter: regenerate dart files
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Nov 10, 2024
1 parent 46d9639 commit 6a4bf0b
Show file tree
Hide file tree
Showing 8 changed files with 3,035 additions and 2,148 deletions.
30 changes: 8 additions & 22 deletions bindings/nostr-sdk-flutter/lib/src/rust/api/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,14 @@ import '../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'protocol/event.dart';

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Client>>
abstract class Client implements RustOpaqueInterface {
Future<bool> addRelay({required String url});

Future<void> connect();


static Client default_() =>
RustLib.instance.api.crateApiClientClientDefault();


// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Client>>
abstract class Client implements RustOpaqueInterface {
Future<bool> addRelay({required String url });


Future<void> connect();


static Client default_()=>RustLib.instance.api.crateApiClientClientDefault();


Future<String> sendEvent({required Event event });




}


Future<String> sendEvent({required Event event});
}
85 changes: 30 additions & 55 deletions bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,47 @@ import '../../frb_generated.dart';
import 'key/public_key.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Event>>
abstract class Event implements RustOpaqueInterface {
Future<String> asJson();

Future<String> asPrettyJson();


/// Get event author (`pubkey` field)
Future<PublicKey> author();


// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Event>>
abstract class Event implements RustOpaqueInterface {
Future<String> asJson();
Future<String> content();

Future<BigInt> createdAt();

Future<String> asPrettyJson();
static Event fromJson({required String json}) =>
RustLib.instance.api.crateApiProtocolEventEventFromJson(json: json);

Future<String> id();

/// Get event author (`pubkey` field)
Future<PublicKey> author();
/// Returns `true` if the event has an expiration tag that is expired.
/// If an event has no expiration tag, then it will return `false`.
///
/// <https://github.com/nostr-protocol/nips/blob/master/40.md>
Future<bool> isExpired();

/// Check if it's a protected event
///
/// <https://github.com/nostr-protocol/nips/blob/master/70.md>
Future<bool> isProtected();

Future<String> content();
Future<int> kind();

Future<String> signature();

Future<BigInt> createdAt();
Future<List<List<String>>> tags();

/// Verify both `EventId` and `Signature`
Future<void> verify();

static Event fromJson({required String json })=>RustLib.instance.api.crateApiProtocolEventEventFromJson(json: json);
/// Verify if the `EventId` it's composed correctly
Future<bool> verifyId();


Future<String> id();


/// Returns `true` if the event has an expiration tag that is expired.
/// If an event has no expiration tag, then it will return `false`.
///
/// <https://github.com/nostr-protocol/nips/blob/master/40.md>
Future<bool> isExpired();


/// Check if it's a protected event
///
/// <https://github.com/nostr-protocol/nips/blob/master/70.md>
Future<bool> isProtected();


Future<int> kind();


Future<String> signature();


Future<List<List<String>>> tags();


/// Verify both `EventId` and `Signature`
Future<void> verify();


/// Verify if the `EventId` it's composed correctly
Future<bool> verifyId();


/// Verify only event `Signature`
Future<bool> verifySignature();




}


/// Verify only event `Signature`
Future<bool> verifySignature();
}
43 changes: 15 additions & 28 deletions bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,22 @@ import 'key/public_key.dart';
import 'key/secret_key.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Keys>>
abstract class Keys implements RustOpaqueInterface {
/// Generate random keys
///
/// This constructor use a random number generator that retrieves randomness from the operating system.
static Keys generate() =>
RustLib.instance.api.crateApiProtocolKeyKeysGenerate();


factory Keys({required SecretKey secretKey}) =>
RustLib.instance.api.crateApiProtocolKeyKeysNew(secretKey: secretKey);


/// Parse secret key from `hex` or `bech32`
static Keys parse({required String secretKey}) =>
RustLib.instance.api.crateApiProtocolKeyKeysParse(secretKey: secretKey);


// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_Keys>>
abstract class Keys implements RustOpaqueInterface {
/// Generate random keys
///
/// This constructor use a random number generator that retrieves randomness from the operating system.
static Keys generate()=>RustLib.instance.api.crateApiProtocolKeyKeysGenerate();
Future<PublicKey> publicKey();


factory Keys({required SecretKey secretKey })=>RustLib.instance.api.crateApiProtocolKeyKeysNew(secretKey: secretKey);


/// Parse secret key from `hex` or `bech32`
static Keys parse({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeyKeysParse(secretKey: secretKey);


Future<PublicKey> publicKey();


Future<SecretKey> secretKey();




}


Future<SecretKey> secretKey();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,25 @@
import '../../../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';


// 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`
// 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`
// These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `to_bytes`

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_PublicKey>>
abstract class PublicKey implements RustOpaqueInterface {
static PublicKey fromHex({required String publicKey}) => RustLib.instance.api
.crateApiProtocolKeyPublicKeyPublicKeyFromHex(publicKey: publicKey);




// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_PublicKey>>
abstract class PublicKey implements RustOpaqueInterface {
static PublicKey fromHex({required String publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyFromHex(publicKey: publicKey);


static PublicKey fromSlice({required List<int> publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyFromSlice(publicKey: publicKey);


/// Parse from `hex`, `bech32` or [NIP21](https://github.com/nostr-protocol/nips/blob/master/21.md) URI
static PublicKey parse({required String publicKey })=>RustLib.instance.api.crateApiProtocolKeyPublicKeyPublicKeyParse(publicKey: publicKey);


Future<String> toBech32();


Future<String> toHex();

static PublicKey fromSlice({required List<int> publicKey}) =>
RustLib.instance.api
.crateApiProtocolKeyPublicKeyPublicKeyFromSlice(publicKey: publicKey);

Future<String> toNostrUri();
/// Parse from `hex`, `bech32` or [NIP21](https://github.com/nostr-protocol/nips/blob/master/21.md) URI
static PublicKey parse({required String publicKey}) => RustLib.instance.api
.crateApiProtocolKeyPublicKeyPublicKeyParse(publicKey: publicKey);

Future<String> toBech32();

Future<String> toHex();


}


Future<String> toNostrUri();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,29 @@
import '../../../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';


// 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`, `from`
// 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`, `from`
// These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `to_secret_bytes`

// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_SecretKey>>
abstract class SecretKey implements RustOpaqueInterface {
static SecretKey fromHex({required String secretKey}) => RustLib.instance.api
.crateApiProtocolKeySecretKeySecretKeyFromHex(secretKey: secretKey);




// Rust type: RustOpaqueMoi<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<_SecretKey>>
abstract class SecretKey implements RustOpaqueInterface {
static SecretKey fromHex({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyFromHex(secretKey: secretKey);


static SecretKey fromSlice({required List<int> secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyFromSlice(secretKey: secretKey);


/// Generate random secret key
///
/// This constructor use a random number generator that retrieves randomness from the operating system.
static SecretKey generate()=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyGenerate();


/// Parse from `hex` or `bech32`
static SecretKey parse({required String secretKey })=>RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyParse(secretKey: secretKey);


Future<String> toBech32();

static SecretKey fromSlice({required List<int> secretKey}) =>
RustLib.instance.api
.crateApiProtocolKeySecretKeySecretKeyFromSlice(secretKey: secretKey);

Future<String> toSecretHex();
/// Generate random secret key
///
/// This constructor use a random number generator that retrieves randomness from the operating system.
static SecretKey generate() =>
RustLib.instance.api.crateApiProtocolKeySecretKeySecretKeyGenerate();

/// Parse from `hex` or `bech32`
static SecretKey parse({required String secretKey}) => RustLib.instance.api
.crateApiProtocolKeySecretKeySecretKeyParse(secretKey: secretKey);

Future<String> toBech32();


}


Future<String> toSecretHex();
}
Loading

0 comments on commit 6a4bf0b

Please sign in to comment.