mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-18 15:14:20 +01:00
feat: republish homeserver
Adds republishHomeserver method. Upgrades bindings. Updates README.md.
This commit is contained in:
@@ -4,22 +4,6 @@
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>libpubkycore.a</string>
|
||||
<key>HeadersPath</key>
|
||||
<string>Headers</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libpubkycore.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>libpubkycore.a</string>
|
||||
@@ -38,6 +22,22 @@
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>libpubkycore.a</string>
|
||||
<key>HeadersPath</key>
|
||||
<string>Headers</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>libpubkycore.a</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
|
||||
@@ -96,6 +96,8 @@ RustBuffer uniffi_pubkycore_fn_func_put(RustBuffer url, RustBuffer content, Rust
|
||||
);
|
||||
void uniffi_pubkycore_fn_func_remove_event_listener(RustCallStatus *_Nonnull out_status
|
||||
|
||||
);
|
||||
RustBuffer uniffi_pubkycore_fn_func_republish_homeserver(RustBuffer secret_key, RustBuffer homeserver, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
RustBuffer uniffi_pubkycore_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
@@ -268,6 +270,9 @@ uint16_t uniffi_pubkycore_checksum_func_put(void
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_remove_event_listener(void
|
||||
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_republish_homeserver(void
|
||||
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_resolve(void
|
||||
|
||||
|
||||
Binary file not shown.
@@ -96,6 +96,8 @@ RustBuffer uniffi_pubkycore_fn_func_put(RustBuffer url, RustBuffer content, Rust
|
||||
);
|
||||
void uniffi_pubkycore_fn_func_remove_event_listener(RustCallStatus *_Nonnull out_status
|
||||
|
||||
);
|
||||
RustBuffer uniffi_pubkycore_fn_func_republish_homeserver(RustBuffer secret_key, RustBuffer homeserver, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
RustBuffer uniffi_pubkycore_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
@@ -268,6 +270,9 @@ uint16_t uniffi_pubkycore_checksum_func_put(void
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_remove_event_listener(void
|
||||
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_republish_homeserver(void
|
||||
|
||||
);
|
||||
uint16_t uniffi_pubkycore_checksum_func_resolve(void
|
||||
|
||||
|
||||
Binary file not shown.
@@ -47,6 +47,11 @@ RCT_EXTERN_METHOD(signUp:(NSString *)secretKey
|
||||
withResolver:(RCTPromiseResolveBlock)resolve
|
||||
withRejecter:(RCTPromiseRejectBlock)reject)
|
||||
|
||||
RCT_EXTERN_METHOD(republishHomeserver:(NSString *)secretKey
|
||||
homeserver:(NSString *)homeserver
|
||||
withResolver:(RCTPromiseResolveBlock)resolve
|
||||
withRejecter:(RCTPromiseRejectBlock)reject)
|
||||
|
||||
RCT_EXTERN_METHOD(signIn:(NSString *)secretKey
|
||||
withResolver:(RCTPromiseResolveBlock)resolve
|
||||
withRejecter:(RCTPromiseRejectBlock)reject)
|
||||
|
||||
@@ -111,6 +111,18 @@ class Pubky: RCTEventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
@objc(republishHomeserver:homeserver:withResolver:withRejecter:)
|
||||
func republishHomeserver(_ secretKey: String, homeserver: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
||||
Task {
|
||||
do {
|
||||
let result = try await react_native_pubky.republishHomeserver(secretKey: secretKey, homeserver: homeserver)
|
||||
resolve(result)
|
||||
} catch {
|
||||
reject("republishHomeserver Error", "Failed to republish homeserver", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc(signIn:withResolver:withRejecter:)
|
||||
func signIn(_ secretKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
||||
Task {
|
||||
|
||||
@@ -766,6 +766,16 @@ public func removeEventListener() {
|
||||
|
||||
|
||||
|
||||
public func republishHomeserver(secretKey: String, homeserver: String) -> [String] {
|
||||
return try! FfiConverterSequenceString.lift(
|
||||
try! rustCall() {
|
||||
uniffi_pubkycore_fn_func_republish_homeserver(
|
||||
FfiConverterString.lower(secretKey),
|
||||
FfiConverterString.lower(homeserver),$0)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
public func resolve(publicKey: String) -> [String] {
|
||||
return try! FfiConverterSequenceString.lift(
|
||||
try! rustCall() {
|
||||
@@ -897,6 +907,9 @@ private var initializationResult: InitializationResult {
|
||||
if (uniffi_pubkycore_checksum_func_remove_event_listener() != 23534) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_pubkycore_checksum_func_republish_homeserver() != 63919) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_pubkycore_checksum_func_resolve() != 34317) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user