diff --git a/CHANGELOG.md b/CHANGELOG.md index 50024760e..0dce5db8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ * nostr: update `FromBech32::from_bech32` method signature ([Yuki Kishimoto]) * nostr: update `NostrURI::from_nostr_uri` method signature ([Yuki Kishimoto]) * nostr: remove generics from parsing methods in `key` module ([Yuki Kishimoto]) +* bindings: remove redundant parsing methods from `EventId`, `PublicKey` and `SecretKey` ([Yuki Kishimoto]) ### Changed diff --git a/bindings/nostr-sdk-ffi/src/protocol/event/id.rs b/bindings/nostr-sdk-ffi/src/protocol/event/id.rs index d3659997b..bba4698ec 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/event/id.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/event/id.rs @@ -6,7 +6,7 @@ use std::ops::Deref; use std::sync::Arc; use nostr::nips::nip21::NostrURI; -use nostr::prelude::{FromBech32, ToBech32}; +use nostr::prelude::ToBech32; use uniffi::Object; use super::Kind; @@ -70,27 +70,6 @@ impl EventId { }) } - #[uniffi::constructor] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: nostr::EventId::from_hex(hex)?, - }) - } - - #[uniffi::constructor] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: nostr::EventId::from_bech32(bech32)?, - }) - } - - #[uniffi::constructor] - pub fn from_nostr_uri(uri: &str) -> Result { - Ok(Self { - inner: nostr::EventId::from_nostr_uri(uri)?, - }) - } - pub fn as_bytes(&self) -> Vec { self.inner.as_bytes().to_vec() } diff --git a/bindings/nostr-sdk-ffi/src/protocol/key/public_key.rs b/bindings/nostr-sdk-ffi/src/protocol/key/public_key.rs index 93c195186..4890b9ae9 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/key/public_key.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/key/public_key.rs @@ -4,7 +4,7 @@ use std::ops::Deref; -use nostr::nips::nip19::{FromBech32, ToBech32}; +use nostr::nips::nip19::ToBech32; use nostr::nips::nip21::NostrURI; use uniffi::Object; @@ -40,20 +40,6 @@ impl PublicKey { }) } - #[uniffi::constructor] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: nostr::PublicKey::from_hex(hex)?, - }) - } - - #[uniffi::constructor] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: nostr::PublicKey::from_bech32(bech32)?, - }) - } - #[uniffi::constructor] pub fn from_bytes(bytes: &[u8]) -> Result { Ok(Self { @@ -61,13 +47,6 @@ impl PublicKey { }) } - #[uniffi::constructor] - pub fn from_nostr_uri(uri: &str) -> Result { - Ok(Self { - inner: nostr::PublicKey::from_nostr_uri(uri)?, - }) - } - pub fn to_hex(&self) -> String { self.inner.to_string() } diff --git a/bindings/nostr-sdk-ffi/src/protocol/key/secret_key.rs b/bindings/nostr-sdk-ffi/src/protocol/key/secret_key.rs index 793d3be7c..0dc0985cc 100644 --- a/bindings/nostr-sdk-ffi/src/protocol/key/secret_key.rs +++ b/bindings/nostr-sdk-ffi/src/protocol/key/secret_key.rs @@ -4,7 +4,7 @@ use std::ops::Deref; -use nostr::nips::nip19::{FromBech32, ToBech32}; +use nostr::nips::nip19::ToBech32; use uniffi::Object; use crate::error::Result; @@ -40,20 +40,6 @@ impl SecretKey { }) } - #[uniffi::constructor] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: nostr::SecretKey::from_hex(hex)?, - }) - } - - #[uniffi::constructor] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: nostr::SecretKey::from_bech32(bech32)?, - }) - } - #[uniffi::constructor] pub fn from_bytes(bytes: &[u8]) -> Result { Ok(Self { diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart index 55f990b7a..dd05ce959 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/public_key.dart @@ -11,9 +11,6 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // Rust type: RustOpaqueMoi> abstract class PublicKey implements RustOpaqueInterface { - static PublicKey fromHex({required String publicKey}) => RustLib.instance.api - .crateApiProtocolKeyPublicKeyPublicKeyFromHex(publicKey: publicKey); - static PublicKey fromSlice({required List publicKey}) => RustLib.instance.api .crateApiProtocolKeyPublicKeyPublicKeyFromSlice(publicKey: publicKey); diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart index 72c9608c5..b6876dba6 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/api/protocol/key/secret_key.dart @@ -11,9 +11,6 @@ import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; // Rust type: RustOpaqueMoi> abstract class SecretKey implements RustOpaqueInterface { - static SecretKey fromHex({required String secretKey}) => RustLib.instance.api - .crateApiProtocolKeySecretKeySecretKeyFromHex(secretKey: secretKey); - static SecretKey fromSlice({required List secretKey}) => RustLib.instance.api .crateApiProtocolKeySecretKeySecretKeyFromSlice(secretKey: secretKey); diff --git a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart index 85ca37c2b..02fe5ae29 100644 --- a/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart +++ b/bindings/nostr-sdk-flutter/lib/src/rust/frb_generated.dart @@ -73,7 +73,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.6.0'; @override - int get rustContentHash => 440607370; + int get rustContentHash => 1878779762; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( @@ -134,9 +134,6 @@ abstract class RustLibApi extends BaseApi { SecretKey crateApiProtocolKeyKeysSecretKey({required Keys that}); - PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex( - {required String publicKey}); - PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice( {required List publicKey}); @@ -151,9 +148,6 @@ abstract class RustLibApi extends BaseApi { String crateApiProtocolKeyPublicKeyPublicKeyToNostrUri( {required PublicKey that}); - SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex( - {required String secretKey}); - SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice( {required List secretKey}); @@ -845,32 +839,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["that"], ); - @override - PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromHex( - {required String publicKey}) { - return handler.executeSync(SyncTask( - callFfi: () { - final serializer = SseSerializer(generalizedFrbRustBinding); - sse_encode_String(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 25)!; - }, - codec: SseCodec( - decodeSuccessData: - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey, - decodeErrorData: sse_decode_AnyhowException, - ), - constMeta: kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta, - argValues: [publicKey], - apiImpl: this, - )); - } - - TaskConstMeta get kCrateApiProtocolKeyPublicKeyPublicKeyFromHexConstMeta => - const TaskConstMeta( - debugName: "PublicKey_from_hex", - argNames: ["publicKey"], - ); - @override PublicKey crateApiProtocolKeyPublicKeyPublicKeyFromSlice( {required List publicKey}) { @@ -878,7 +846,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_list_prim_u_8_loose(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 25)!; }, codec: SseCodec( decodeSuccessData: @@ -904,7 +872,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_String(publicKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 26)!; }, codec: SseCodec( decodeSuccessData: @@ -931,7 +899,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 27)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -956,7 +924,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 29)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 28)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -982,7 +950,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_PublicKey( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 30)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 29)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -1000,32 +968,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["that"], ); - @override - SecretKey crateApiProtocolKeySecretKeySecretKeyFromHex( - {required String secretKey}) { - return handler.executeSync(SyncTask( - callFfi: () { - final serializer = SseSerializer(generalizedFrbRustBinding); - sse_encode_String(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 31)!; - }, - codec: SseCodec( - decodeSuccessData: - sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey, - decodeErrorData: sse_decode_AnyhowException, - ), - constMeta: kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta, - argValues: [secretKey], - apiImpl: this, - )); - } - - TaskConstMeta get kCrateApiProtocolKeySecretKeySecretKeyFromHexConstMeta => - const TaskConstMeta( - debugName: "SecretKey_from_hex", - argNames: ["secretKey"], - ); - @override SecretKey crateApiProtocolKeySecretKeySecretKeyFromSlice( {required List secretKey}) { @@ -1033,7 +975,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_list_prim_u_8_loose(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 30)!; }, codec: SseCodec( decodeSuccessData: @@ -1057,7 +999,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return handler.executeSync(SyncTask( callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 31)!; }, codec: SseCodec( decodeSuccessData: @@ -1083,7 +1025,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_String(secretKey, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 32)!; }, codec: SseCodec( decodeSuccessData: @@ -1110,7 +1052,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 33)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -1136,7 +1078,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_SecretKey( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 36)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 34)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -1162,7 +1104,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 37)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 35)!; }, codec: SseCodec( decodeSuccessData: sse_decode_list_String, @@ -1187,7 +1129,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 38)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 36)!; }, codec: SseCodec( decodeSuccessData: sse_decode_opt_String, @@ -1212,7 +1154,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 39)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 37)!; }, codec: SseCodec( decodeSuccessData: sse_decode_bool, @@ -1237,7 +1179,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 40)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 38)!; }, codec: SseCodec( decodeSuccessData: sse_decode_bool, @@ -1262,7 +1204,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 41)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 39)!; }, codec: SseCodec( decodeSuccessData: sse_decode_bool, @@ -1287,7 +1229,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 42)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 40)!; }, codec: SseCodec( decodeSuccessData: sse_decode_String, @@ -1311,7 +1253,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_list_String(tag, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 43)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 41)!; }, codec: SseCodec( decodeSuccessData: @@ -1337,7 +1279,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInner_Tag( that, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 44)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 42)!; }, codec: SseCodec( decodeSuccessData: sse_decode_list_String, @@ -1361,7 +1303,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 45, port: port_); + funcId: 43, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, diff --git a/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/public_key.rs b/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/public_key.rs index 414eb5200..464551b2b 100644 --- a/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/public_key.rs +++ b/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/public_key.rs @@ -26,12 +26,6 @@ impl _PublicKey { }) } - pub fn from_hex(public_key: &str) -> Result { - Ok(Self { - inner: PublicKey::from_hex(public_key)?, - }) - } - pub fn from_slice(public_key: &[u8]) -> Result { Ok(Self { inner: PublicKey::from_slice(public_key)?, diff --git a/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/secret_key.rs b/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/secret_key.rs index 27664b9f0..51422e5a6 100644 --- a/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/secret_key.rs +++ b/bindings/nostr-sdk-flutter/rust/src/api/protocol/key/secret_key.rs @@ -41,12 +41,6 @@ impl _SecretKey { }) } - pub fn from_hex(secret_key: &str) -> Result { - Ok(Self { - inner: SecretKey::from_hex(secret_key)?, - }) - } - pub fn from_slice(secret_key: &[u8]) -> Result { Ok(Self { inner: SecretKey::from_slice(secret_key)?, diff --git a/bindings/nostr-sdk-flutter/rust/src/frb_generated.rs b/bindings/nostr-sdk-flutter/rust/src/frb_generated.rs index 4a891ed06..aabbc55bd 100644 --- a/bindings/nostr-sdk-flutter/rust/src/frb_generated.rs +++ b/bindings/nostr-sdk-flutter/rust/src/frb_generated.rs @@ -43,7 +43,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueMoi, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.6.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 440607370; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1878779762; // Section: executor @@ -1145,40 +1145,6 @@ fn wire__crate__api__protocol__key__Keys_secret_key_impl( }, ) } -fn wire__crate__api__protocol__key__public_key__PublicKey_from_hex_impl( - ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, - rust_vec_len_: i32, - data_len_: i32, -) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( - flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "PublicKey_from_hex", - port: None, - mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, - }, - move || { - let message = unsafe { - flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( - ptr_, - rust_vec_len_, - data_len_, - ) - }; - let mut deserializer = - flutter_rust_bridge::for_generated::SseDeserializer::new(message); - let api_public_key = ::sse_decode(&mut deserializer); - deserializer.end(); - transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( - (move || { - let output_ok = crate::api::protocol::key::public_key::_PublicKey::from_hex( - &api_public_key, - )?; - Ok(output_ok) - })(), - ) - }, - ) -} fn wire__crate__api__protocol__key__public_key__PublicKey_from_slice_impl( ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, rust_vec_len_: i32, @@ -1395,40 +1361,6 @@ fn wire__crate__api__protocol__key__public_key__PublicKey_to_nostr_uri_impl( }, ) } -fn wire__crate__api__protocol__key__secret_key__SecretKey_from_hex_impl( - ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, - rust_vec_len_: i32, - data_len_: i32, -) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { - FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( - flutter_rust_bridge::for_generated::TaskInfo { - debug_name: "SecretKey_from_hex", - port: None, - mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, - }, - move || { - let message = unsafe { - flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( - ptr_, - rust_vec_len_, - data_len_, - ) - }; - let mut deserializer = - flutter_rust_bridge::for_generated::SseDeserializer::new(message); - let api_secret_key = ::sse_decode(&mut deserializer); - deserializer.end(); - transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>( - (move || { - let output_ok = crate::api::protocol::key::secret_key::_SecretKey::from_hex( - &api_secret_key, - )?; - Ok(output_ok) - })(), - ) - }, - ) -} fn wire__crate__api__protocol__key__secret_key__SecretKey_from_slice_impl( ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, rust_vec_len_: i32, @@ -2270,7 +2202,7 @@ fn pde_ffi_dispatcher_primary_impl( 1 => wire__crate__api__client__Client_add_relay_impl(port, ptr, rust_vec_len, data_len), 2 => wire__crate__api__client__Client_connect_impl(port, ptr, rust_vec_len, data_len), 4 => wire__crate__api__client__Client_send_event_impl(port, ptr, rust_vec_len, data_len), - 45 => wire__crate__api__init_app_impl(port, ptr, rust_vec_len, data_len), + 43 => wire__crate__api__init_app_impl(port, ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -2314,80 +2246,70 @@ fn pde_ffi_dispatcher_sync_impl( 22 => wire__crate__api__protocol__key__Keys_parse_impl(ptr, rust_vec_len, data_len), 23 => wire__crate__api__protocol__key__Keys_public_key_impl(ptr, rust_vec_len, data_len), 24 => wire__crate__api__protocol__key__Keys_secret_key_impl(ptr, rust_vec_len, data_len), - 25 => wire__crate__api__protocol__key__public_key__PublicKey_from_hex_impl( - ptr, - rust_vec_len, - data_len, - ), - 26 => wire__crate__api__protocol__key__public_key__PublicKey_from_slice_impl( - ptr, - rust_vec_len, - data_len, - ), - 27 => wire__crate__api__protocol__key__public_key__PublicKey_parse_impl( + 25 => wire__crate__api__protocol__key__public_key__PublicKey_from_slice_impl( ptr, rust_vec_len, data_len, ), - 28 => wire__crate__api__protocol__key__public_key__PublicKey_to_bech32_impl( + 26 => wire__crate__api__protocol__key__public_key__PublicKey_parse_impl( ptr, rust_vec_len, data_len, ), - 29 => wire__crate__api__protocol__key__public_key__PublicKey_to_hex_impl( + 27 => wire__crate__api__protocol__key__public_key__PublicKey_to_bech32_impl( ptr, rust_vec_len, data_len, ), - 30 => wire__crate__api__protocol__key__public_key__PublicKey_to_nostr_uri_impl( + 28 => wire__crate__api__protocol__key__public_key__PublicKey_to_hex_impl( ptr, rust_vec_len, data_len, ), - 31 => wire__crate__api__protocol__key__secret_key__SecretKey_from_hex_impl( + 29 => wire__crate__api__protocol__key__public_key__PublicKey_to_nostr_uri_impl( ptr, rust_vec_len, data_len, ), - 32 => wire__crate__api__protocol__key__secret_key__SecretKey_from_slice_impl( + 30 => wire__crate__api__protocol__key__secret_key__SecretKey_from_slice_impl( ptr, rust_vec_len, data_len, ), - 33 => wire__crate__api__protocol__key__secret_key__SecretKey_generate_impl( + 31 => wire__crate__api__protocol__key__secret_key__SecretKey_generate_impl( ptr, rust_vec_len, data_len, ), - 34 => wire__crate__api__protocol__key__secret_key__SecretKey_parse_impl( + 32 => wire__crate__api__protocol__key__secret_key__SecretKey_parse_impl( ptr, rust_vec_len, data_len, ), - 35 => wire__crate__api__protocol__key__secret_key__SecretKey_to_bech32_impl( + 33 => wire__crate__api__protocol__key__secret_key__SecretKey_to_bech32_impl( ptr, rust_vec_len, data_len, ), - 36 => wire__crate__api__protocol__key__secret_key__SecretKey_to_secret_hex_impl( + 34 => wire__crate__api__protocol__key__secret_key__SecretKey_to_secret_hex_impl( ptr, rust_vec_len, data_len, ), - 37 => wire__crate__api__protocol__event__tag__Tag_as_vec_impl(ptr, rust_vec_len, data_len), - 38 => wire__crate__api__protocol__event__tag__Tag_content_impl(ptr, rust_vec_len, data_len), - 39 => wire__crate__api__protocol__event__tag__Tag_is_protected_impl( + 35 => wire__crate__api__protocol__event__tag__Tag_as_vec_impl(ptr, rust_vec_len, data_len), + 36 => wire__crate__api__protocol__event__tag__Tag_content_impl(ptr, rust_vec_len, data_len), + 37 => wire__crate__api__protocol__event__tag__Tag_is_protected_impl( ptr, rust_vec_len, data_len, ), - 40 => { + 38 => { wire__crate__api__protocol__event__tag__Tag_is_reply_impl(ptr, rust_vec_len, data_len) } - 41 => wire__crate__api__protocol__event__tag__Tag_is_root_impl(ptr, rust_vec_len, data_len), - 42 => wire__crate__api__protocol__event__tag__Tag_kind_impl(ptr, rust_vec_len, data_len), - 43 => wire__crate__api__protocol__event__tag__Tag_parse_impl(ptr, rust_vec_len, data_len), - 44 => wire__crate__api__protocol__event__tag__Tag_to_vec_impl(ptr, rust_vec_len, data_len), + 39 => wire__crate__api__protocol__event__tag__Tag_is_root_impl(ptr, rust_vec_len, data_len), + 40 => wire__crate__api__protocol__event__tag__Tag_kind_impl(ptr, rust_vec_len, data_len), + 41 => wire__crate__api__protocol__event__tag__Tag_parse_impl(ptr, rust_vec_len, data_len), + 42 => wire__crate__api__protocol__event__tag__Tag_to_vec_impl(ptr, rust_vec_len, data_len), _ => unreachable!(), } } diff --git a/bindings/nostr-sdk-js/src/protocol/event/id.rs b/bindings/nostr-sdk-js/src/protocol/event/id.rs index c0a08a308..b798f015e 100644 --- a/bindings/nostr-sdk-js/src/protocol/event/id.rs +++ b/bindings/nostr-sdk-js/src/protocol/event/id.rs @@ -74,27 +74,6 @@ impl JsEventId { }) } - #[wasm_bindgen(js_name = fromHex)] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: EventId::from_hex(hex).map_err(into_err)?, - }) - } - - #[wasm_bindgen(js_name = fromBech32)] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: EventId::from_bech32(bech32).map_err(into_err)?, - }) - } - - #[wasm_bindgen(js_name = fromNostrUri)] - pub fn from_nostr_uri(uri: &str) -> Result { - Ok(Self { - inner: EventId::from_nostr_uri(uri).map_err(into_err)?, - }) - } - #[wasm_bindgen(js_name = asBytes)] pub fn as_bytes(&self) -> Vec { self.inner.as_bytes().to_vec() diff --git a/bindings/nostr-sdk-js/src/protocol/key/public_key.rs b/bindings/nostr-sdk-js/src/protocol/key/public_key.rs index 5f6f589df..0cf8548de 100644 --- a/bindings/nostr-sdk-js/src/protocol/key/public_key.rs +++ b/bindings/nostr-sdk-js/src/protocol/key/public_key.rs @@ -44,27 +44,6 @@ impl JsPublicKey { }) } - #[wasm_bindgen(js_name = fromHex)] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: PublicKey::from_hex(hex).map_err(into_err)?, - }) - } - - #[wasm_bindgen(js_name = fromBech32)] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: PublicKey::from_bech32(bech32).map_err(into_err)?, - }) - } - - #[wasm_bindgen(js_name = fromNostrUri)] - pub fn from_nostr_uri(uri: &str) -> Result { - Ok(Self { - inner: PublicKey::from_nostr_uri(uri).map_err(into_err)?, - }) - } - /// Get in hex format #[wasm_bindgen(js_name = toHex)] pub fn to_hex(&self) -> String { diff --git a/bindings/nostr-sdk-js/src/protocol/key/secret_key.rs b/bindings/nostr-sdk-js/src/protocol/key/secret_key.rs index 3d8367f63..a1d21357a 100644 --- a/bindings/nostr-sdk-js/src/protocol/key/secret_key.rs +++ b/bindings/nostr-sdk-js/src/protocol/key/secret_key.rs @@ -38,20 +38,6 @@ impl JsSecretKey { }) } - #[wasm_bindgen(js_name = fromHex)] - pub fn from_hex(hex: &str) -> Result { - Ok(Self { - inner: SecretKey::from_hex(hex).map_err(into_err)?, - }) - } - - #[wasm_bindgen(js_name = fromBech32)] - pub fn from_bech32(bech32: &str) -> Result { - Ok(Self { - inner: SecretKey::from_bech32(bech32).map_err(into_err)?, - }) - } - /// Generate random secret key pub fn generate() -> Self { Self {