@synonymdev/react-native-pubky 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -11
- package/android/build.gradle +3 -2
- package/android/src/main/java/com/pubky/PubkyModule.kt +19 -19
- package/android/src/main/java/uniffi/{mobile/mobile.kt → pubkymobile/pubkymobile.kt} +72 -87
- package/android/src/main/jniLibs/arm64-v8a/{libmobile.so → libpubkymobile.so} +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86/{libmobile.so → libpubkymobile.so} +0 -0
- package/android/src/main/jniLibs/x86_64/{libmobile.so → libpubkymobile.so} +0 -0
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/Info.plist +8 -8
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/Headers/mobileFFI.h +0 -6
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/Headers/module.modulemap +2 -2
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +188 -0
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/libmobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64-simulator/Headers/mobileFFI.h +0 -6
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64-simulator/Headers/module.modulemap +2 -2
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +188 -0
- package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64-simulator/libmobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +0 -1
- package/ios/{mobile.swift → pubkymobile.swift} +11 -22
- package/package.json +9 -8
- package/react-native-pubky.podspec +2 -2
- package/android/src/main/java/com/pubky/pubky.iml +0 -11
- package/android/src/main/jniLibs/armeabi-v7a/libmobile.so +0 -0
package/README.md
CHANGED
@@ -8,20 +8,19 @@ React Native implementation of [pubky](https://github.com/pubky/pubky)
|
|
8
8
|
npm install @synonymdev/react-native-pubky
|
9
9
|
```
|
10
10
|
|
11
|
-
##
|
11
|
+
## Implementation Status
|
12
|
+
### Implemented Methods
|
13
|
+
- [x] [auth](#auth): Authentication functionality.
|
14
|
+
### Methods to be Implemented
|
15
|
+
- [ ] parseAuthUrl: Method to decode an authUrl.
|
16
|
+
- [ ] publish: Functionality to publish content.
|
17
|
+
- [ ] resolve: Functionality to resolve content.
|
18
|
+
- [ ] signIn: Functionality to sign in.
|
19
|
+
- [ ] signUp: Functionality to sign up.
|
12
20
|
|
13
|
-
1. Clone & npm install:
|
14
|
-
```sh
|
15
|
-
git clone git@github.com:pubky/react-native-pubky.git && cd react-native-pubky && npm i
|
16
|
-
```
|
17
|
-
2. Delete the `rust/pubky` directory to prevent a memory error (This step will be removed once pubky is public).
|
18
|
-
3. Yarn add it to your project:
|
19
|
-
```sh
|
20
|
-
yarn add path/to/react-native-pubky
|
21
|
-
```
|
22
21
|
|
23
22
|
## Usage
|
24
|
-
|
23
|
+
### <a name="auth"></a>Auth
|
25
24
|
```js
|
26
25
|
import { auth } from '@synonymdev/react-native-pubky';
|
27
26
|
|
@@ -33,6 +32,18 @@ if (authRes.isErr()) {
|
|
33
32
|
console.log(authRes.value);
|
34
33
|
```
|
35
34
|
|
35
|
+
## Local Installation
|
36
|
+
|
37
|
+
1. Clone & npm install:
|
38
|
+
```sh
|
39
|
+
git clone git@github.com:pubky/react-native-pubky.git && cd react-native-pubky && npm i
|
40
|
+
```
|
41
|
+
2. Delete the `rust/pubky` directory to prevent a memory error (This step will be removed once pubky is public).
|
42
|
+
3. Yarn add it to your project:
|
43
|
+
```sh
|
44
|
+
yarn add path/to/react-native-pubky
|
45
|
+
```
|
46
|
+
|
36
47
|
## Update Bindings
|
37
48
|
|
38
49
|
After making changes to any of the Rust files, the bindings will need to be updated. To do this, run the following command:
|
package/android/build.gradle
CHANGED
@@ -8,7 +8,7 @@ buildscript {
|
|
8
8
|
}
|
9
9
|
|
10
10
|
dependencies {
|
11
|
-
classpath "com.android.tools.build:gradle:7.2.
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.2"
|
12
12
|
// noinspection DifferentKotlinGradleVersion
|
13
13
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
14
14
|
}
|
@@ -95,7 +95,8 @@ dependencies {
|
|
95
95
|
//noinspection GradleDynamicVersion
|
96
96
|
implementation "com.facebook.react:react-native:+"
|
97
97
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
98
|
+
// Uniffi
|
98
99
|
implementation("net.java.dev.jna:jna:5.7.0@aar")
|
99
|
-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.
|
100
|
+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
100
101
|
}
|
101
102
|
|
@@ -9,7 +9,7 @@ import kotlinx.coroutines.CoroutineScope
|
|
9
9
|
import kotlinx.coroutines.Dispatchers
|
10
10
|
import kotlinx.coroutines.launch
|
11
11
|
import kotlinx.coroutines.withContext
|
12
|
-
import uniffi.
|
12
|
+
import uniffi.pubkymobile.auth
|
13
13
|
|
14
14
|
class PubkyModule(reactContext: ReactApplicationContext) :
|
15
15
|
ReactContextBaseJavaModule(reactContext) {
|
@@ -18,24 +18,24 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
18
18
|
return NAME
|
19
19
|
}
|
20
20
|
|
21
|
-
@ReactMethod
|
22
|
-
fun auth(url: String, secretKey: String, promise: Promise) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
21
|
+
@ReactMethod
|
22
|
+
fun auth(url: String, secretKey: String, promise: Promise) {
|
23
|
+
CoroutineScope(Dispatchers.IO).launch {
|
24
|
+
try {
|
25
|
+
val result = auth(url, secretKey)
|
26
|
+
val array = Arguments.createArray().apply {
|
27
|
+
result.forEach { pushString(it) }
|
28
|
+
}
|
29
|
+
withContext(Dispatchers.Main) {
|
30
|
+
promise.resolve(array)
|
31
|
+
}
|
32
|
+
} catch (e: Exception) {
|
33
|
+
withContext(Dispatchers.Main) {
|
34
|
+
promise.reject("Error", e.message)
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
39
|
|
40
40
|
companion object {
|
41
41
|
const val NAME = "Pubky"
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
@file:Suppress("NAME_SHADOWING")
|
5
5
|
|
6
|
-
package uniffi.
|
6
|
+
package uniffi.pubkymobile;
|
7
7
|
|
8
8
|
// Common helper code.
|
9
9
|
//
|
@@ -48,7 +48,7 @@ open class RustBuffer : Structure() {
|
|
48
48
|
|
49
49
|
companion object {
|
50
50
|
internal fun alloc(size: Int = 0) = rustCall() { status ->
|
51
|
-
_UniFFILib.INSTANCE.
|
51
|
+
_UniFFILib.INSTANCE.ffi_pubkymobile_rustbuffer_alloc(size, status)
|
52
52
|
}.also {
|
53
53
|
if(it.data == null) {
|
54
54
|
throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
|
@@ -64,7 +64,7 @@ open class RustBuffer : Structure() {
|
|
64
64
|
}
|
65
65
|
|
66
66
|
internal fun free(buf: RustBuffer.ByValue) = rustCall() { status ->
|
67
|
-
_UniFFILib.INSTANCE.
|
67
|
+
_UniFFILib.INSTANCE.ffi_pubkymobile_rustbuffer_free(buf, status)
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
@@ -361,7 +361,7 @@ private fun findLibraryName(componentName: String): String {
|
|
361
361
|
if (libOverride != null) {
|
362
362
|
return libOverride
|
363
363
|
}
|
364
|
-
return "
|
364
|
+
return "pubkymobile"
|
365
365
|
}
|
366
366
|
|
367
367
|
private inline fun <reified Lib : Library> loadIndirect(
|
@@ -376,7 +376,7 @@ private inline fun <reified Lib : Library> loadIndirect(
|
|
376
376
|
internal interface _UniFFILib : Library {
|
377
377
|
companion object {
|
378
378
|
internal val INSTANCE: _UniFFILib by lazy {
|
379
|
-
loadIndirect<_UniFFILib>(componentName = "
|
379
|
+
loadIndirect<_UniFFILib>(componentName = "pubkymobile")
|
380
380
|
.also { lib: _UniFFILib ->
|
381
381
|
uniffiCheckContractApiVersion(lib)
|
382
382
|
uniffiCheckApiChecksums(lib)
|
@@ -385,129 +385,125 @@ internal interface _UniFFILib : Library {
|
|
385
385
|
}
|
386
386
|
}
|
387
387
|
|
388
|
-
fun
|
388
|
+
fun uniffi_pubkymobile_fn_func_auth(`url`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,
|
389
389
|
): Pointer
|
390
|
-
fun
|
390
|
+
fun ffi_pubkymobile_rustbuffer_alloc(`size`: Int,_uniffi_out_err: RustCallStatus,
|
391
391
|
): RustBuffer.ByValue
|
392
|
-
fun
|
392
|
+
fun ffi_pubkymobile_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,_uniffi_out_err: RustCallStatus,
|
393
393
|
): RustBuffer.ByValue
|
394
|
-
fun
|
395
|
-
): RustBuffer.ByValue
|
396
|
-
fun ffi_mobile_rustbuffer_free(`buf`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
394
|
+
fun ffi_pubkymobile_rustbuffer_free(`buf`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
397
395
|
): Unit
|
398
|
-
fun
|
396
|
+
fun ffi_pubkymobile_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Int,_uniffi_out_err: RustCallStatus,
|
399
397
|
): RustBuffer.ByValue
|
400
|
-
fun
|
398
|
+
fun ffi_pubkymobile_rust_future_continuation_callback_set(`callback`: UniFffiRustFutureContinuationCallbackType,
|
401
399
|
): Unit
|
402
|
-
fun
|
400
|
+
fun ffi_pubkymobile_rust_future_poll_u8(`handle`: Pointer,`uniffiCallback`: USize,
|
403
401
|
): Unit
|
404
|
-
fun
|
402
|
+
fun ffi_pubkymobile_rust_future_cancel_u8(`handle`: Pointer,
|
405
403
|
): Unit
|
406
|
-
fun
|
404
|
+
fun ffi_pubkymobile_rust_future_free_u8(`handle`: Pointer,
|
407
405
|
): Unit
|
408
|
-
fun
|
406
|
+
fun ffi_pubkymobile_rust_future_complete_u8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
409
407
|
): Byte
|
410
|
-
fun
|
408
|
+
fun ffi_pubkymobile_rust_future_poll_i8(`handle`: Pointer,`uniffiCallback`: USize,
|
411
409
|
): Unit
|
412
|
-
fun
|
410
|
+
fun ffi_pubkymobile_rust_future_cancel_i8(`handle`: Pointer,
|
413
411
|
): Unit
|
414
|
-
fun
|
412
|
+
fun ffi_pubkymobile_rust_future_free_i8(`handle`: Pointer,
|
415
413
|
): Unit
|
416
|
-
fun
|
414
|
+
fun ffi_pubkymobile_rust_future_complete_i8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
417
415
|
): Byte
|
418
|
-
fun
|
416
|
+
fun ffi_pubkymobile_rust_future_poll_u16(`handle`: Pointer,`uniffiCallback`: USize,
|
419
417
|
): Unit
|
420
|
-
fun
|
418
|
+
fun ffi_pubkymobile_rust_future_cancel_u16(`handle`: Pointer,
|
421
419
|
): Unit
|
422
|
-
fun
|
420
|
+
fun ffi_pubkymobile_rust_future_free_u16(`handle`: Pointer,
|
423
421
|
): Unit
|
424
|
-
fun
|
422
|
+
fun ffi_pubkymobile_rust_future_complete_u16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
425
423
|
): Short
|
426
|
-
fun
|
424
|
+
fun ffi_pubkymobile_rust_future_poll_i16(`handle`: Pointer,`uniffiCallback`: USize,
|
427
425
|
): Unit
|
428
|
-
fun
|
426
|
+
fun ffi_pubkymobile_rust_future_cancel_i16(`handle`: Pointer,
|
429
427
|
): Unit
|
430
|
-
fun
|
428
|
+
fun ffi_pubkymobile_rust_future_free_i16(`handle`: Pointer,
|
431
429
|
): Unit
|
432
|
-
fun
|
430
|
+
fun ffi_pubkymobile_rust_future_complete_i16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
433
431
|
): Short
|
434
|
-
fun
|
432
|
+
fun ffi_pubkymobile_rust_future_poll_u32(`handle`: Pointer,`uniffiCallback`: USize,
|
435
433
|
): Unit
|
436
|
-
fun
|
434
|
+
fun ffi_pubkymobile_rust_future_cancel_u32(`handle`: Pointer,
|
437
435
|
): Unit
|
438
|
-
fun
|
436
|
+
fun ffi_pubkymobile_rust_future_free_u32(`handle`: Pointer,
|
439
437
|
): Unit
|
440
|
-
fun
|
438
|
+
fun ffi_pubkymobile_rust_future_complete_u32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
441
439
|
): Int
|
442
|
-
fun
|
440
|
+
fun ffi_pubkymobile_rust_future_poll_i32(`handle`: Pointer,`uniffiCallback`: USize,
|
443
441
|
): Unit
|
444
|
-
fun
|
442
|
+
fun ffi_pubkymobile_rust_future_cancel_i32(`handle`: Pointer,
|
445
443
|
): Unit
|
446
|
-
fun
|
444
|
+
fun ffi_pubkymobile_rust_future_free_i32(`handle`: Pointer,
|
447
445
|
): Unit
|
448
|
-
fun
|
446
|
+
fun ffi_pubkymobile_rust_future_complete_i32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
449
447
|
): Int
|
450
|
-
fun
|
448
|
+
fun ffi_pubkymobile_rust_future_poll_u64(`handle`: Pointer,`uniffiCallback`: USize,
|
451
449
|
): Unit
|
452
|
-
fun
|
450
|
+
fun ffi_pubkymobile_rust_future_cancel_u64(`handle`: Pointer,
|
453
451
|
): Unit
|
454
|
-
fun
|
452
|
+
fun ffi_pubkymobile_rust_future_free_u64(`handle`: Pointer,
|
455
453
|
): Unit
|
456
|
-
fun
|
454
|
+
fun ffi_pubkymobile_rust_future_complete_u64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
457
455
|
): Long
|
458
|
-
fun
|
456
|
+
fun ffi_pubkymobile_rust_future_poll_i64(`handle`: Pointer,`uniffiCallback`: USize,
|
459
457
|
): Unit
|
460
|
-
fun
|
458
|
+
fun ffi_pubkymobile_rust_future_cancel_i64(`handle`: Pointer,
|
461
459
|
): Unit
|
462
|
-
fun
|
460
|
+
fun ffi_pubkymobile_rust_future_free_i64(`handle`: Pointer,
|
463
461
|
): Unit
|
464
|
-
fun
|
462
|
+
fun ffi_pubkymobile_rust_future_complete_i64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
465
463
|
): Long
|
466
|
-
fun
|
464
|
+
fun ffi_pubkymobile_rust_future_poll_f32(`handle`: Pointer,`uniffiCallback`: USize,
|
467
465
|
): Unit
|
468
|
-
fun
|
466
|
+
fun ffi_pubkymobile_rust_future_cancel_f32(`handle`: Pointer,
|
469
467
|
): Unit
|
470
|
-
fun
|
468
|
+
fun ffi_pubkymobile_rust_future_free_f32(`handle`: Pointer,
|
471
469
|
): Unit
|
472
|
-
fun
|
470
|
+
fun ffi_pubkymobile_rust_future_complete_f32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
473
471
|
): Float
|
474
|
-
fun
|
472
|
+
fun ffi_pubkymobile_rust_future_poll_f64(`handle`: Pointer,`uniffiCallback`: USize,
|
475
473
|
): Unit
|
476
|
-
fun
|
474
|
+
fun ffi_pubkymobile_rust_future_cancel_f64(`handle`: Pointer,
|
477
475
|
): Unit
|
478
|
-
fun
|
476
|
+
fun ffi_pubkymobile_rust_future_free_f64(`handle`: Pointer,
|
479
477
|
): Unit
|
480
|
-
fun
|
478
|
+
fun ffi_pubkymobile_rust_future_complete_f64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
481
479
|
): Double
|
482
|
-
fun
|
480
|
+
fun ffi_pubkymobile_rust_future_poll_pointer(`handle`: Pointer,`uniffiCallback`: USize,
|
483
481
|
): Unit
|
484
|
-
fun
|
482
|
+
fun ffi_pubkymobile_rust_future_cancel_pointer(`handle`: Pointer,
|
485
483
|
): Unit
|
486
|
-
fun
|
484
|
+
fun ffi_pubkymobile_rust_future_free_pointer(`handle`: Pointer,
|
487
485
|
): Unit
|
488
|
-
fun
|
486
|
+
fun ffi_pubkymobile_rust_future_complete_pointer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
489
487
|
): Pointer
|
490
|
-
fun
|
488
|
+
fun ffi_pubkymobile_rust_future_poll_rust_buffer(`handle`: Pointer,`uniffiCallback`: USize,
|
491
489
|
): Unit
|
492
|
-
fun
|
490
|
+
fun ffi_pubkymobile_rust_future_cancel_rust_buffer(`handle`: Pointer,
|
493
491
|
): Unit
|
494
|
-
fun
|
492
|
+
fun ffi_pubkymobile_rust_future_free_rust_buffer(`handle`: Pointer,
|
495
493
|
): Unit
|
496
|
-
fun
|
494
|
+
fun ffi_pubkymobile_rust_future_complete_rust_buffer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
497
495
|
): RustBuffer.ByValue
|
498
|
-
fun
|
496
|
+
fun ffi_pubkymobile_rust_future_poll_void(`handle`: Pointer,`uniffiCallback`: USize,
|
499
497
|
): Unit
|
500
|
-
fun
|
498
|
+
fun ffi_pubkymobile_rust_future_cancel_void(`handle`: Pointer,
|
501
499
|
): Unit
|
502
|
-
fun
|
500
|
+
fun ffi_pubkymobile_rust_future_free_void(`handle`: Pointer,
|
503
501
|
): Unit
|
504
|
-
fun
|
502
|
+
fun ffi_pubkymobile_rust_future_complete_void(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
505
503
|
): Unit
|
506
|
-
fun
|
507
|
-
): Short
|
508
|
-
fun uniffi_mobile_checksum_func_myexample(
|
504
|
+
fun uniffi_pubkymobile_checksum_func_auth(
|
509
505
|
): Short
|
510
|
-
fun
|
506
|
+
fun ffi_pubkymobile_uniffi_contract_version(
|
511
507
|
): Int
|
512
508
|
|
513
509
|
}
|
@@ -516,7 +512,7 @@ private fun uniffiCheckContractApiVersion(lib: _UniFFILib) {
|
|
516
512
|
// Get the bindings contract version from our ComponentInterface
|
517
513
|
val bindings_contract_version = 24
|
518
514
|
// Get the scaffolding contract version by calling the into the dylib
|
519
|
-
val scaffolding_contract_version = lib.
|
515
|
+
val scaffolding_contract_version = lib.ffi_pubkymobile_uniffi_contract_version()
|
520
516
|
if (bindings_contract_version != scaffolding_contract_version) {
|
521
517
|
throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
522
518
|
}
|
@@ -524,10 +520,7 @@ private fun uniffiCheckContractApiVersion(lib: _UniFFILib) {
|
|
524
520
|
|
525
521
|
@Suppress("UNUSED_PARAMETER")
|
526
522
|
private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
527
|
-
if (lib.
|
528
|
-
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
529
|
-
}
|
530
|
-
if (lib.uniffi_mobile_checksum_func_myexample() != 65225.toShort()) {
|
523
|
+
if (lib.uniffi_pubkymobile_checksum_func_auth() != 46918.toShort()) {
|
531
524
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
532
525
|
}
|
533
526
|
}
|
@@ -547,7 +540,7 @@ internal object uniffiRustFutureContinuationCallback: UniFffiRustFutureContinuat
|
|
547
540
|
}
|
548
541
|
|
549
542
|
internal fun register(lib: _UniFFILib) {
|
550
|
-
lib.
|
543
|
+
lib.ffi_pubkymobile_rust_future_continuation_callback_set(this)
|
551
544
|
}
|
552
545
|
}
|
553
546
|
|
@@ -667,10 +660,10 @@ public object FfiConverterSequenceString: FfiConverterRustBuffer<List<String>> {
|
|
667
660
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
668
661
|
suspend fun `auth`(`url`: String, `secretKey`: String) : List<String> {
|
669
662
|
return uniffiRustCallAsync(
|
670
|
-
_UniFFILib.INSTANCE.
|
671
|
-
{ future, continuation -> _UniFFILib.INSTANCE.
|
672
|
-
{ future, continuation -> _UniFFILib.INSTANCE.
|
673
|
-
{ future -> _UniFFILib.INSTANCE.
|
663
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_auth(FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),),
|
664
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
665
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
666
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
674
667
|
// lift function
|
675
668
|
{ FfiConverterSequenceString.lift(it) },
|
676
669
|
// Error FFI converter
|
@@ -678,11 +671,3 @@ suspend fun `auth`(`url`: String, `secretKey`: String) : List<String> {
|
|
678
671
|
)
|
679
672
|
}
|
680
673
|
|
681
|
-
fun `myexample`(): List<String> {
|
682
|
-
return FfiConverterSequenceString.lift(
|
683
|
-
rustCall() { _status ->
|
684
|
-
_UniFFILib.INSTANCE.uniffi_mobile_fn_func_myexample(_status)
|
685
|
-
})
|
686
|
-
}
|
687
|
-
|
688
|
-
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -6,37 +6,37 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>BinaryPath</key>
|
9
|
-
<string>
|
9
|
+
<string>libpubkymobile.a</string>
|
10
10
|
<key>HeadersPath</key>
|
11
11
|
<string>Headers</string>
|
12
12
|
<key>LibraryIdentifier</key>
|
13
|
-
<string>ios-arm64</string>
|
13
|
+
<string>ios-arm64-simulator</string>
|
14
14
|
<key>LibraryPath</key>
|
15
|
-
<string>
|
15
|
+
<string>libpubkymobile.a</string>
|
16
16
|
<key>SupportedArchitectures</key>
|
17
17
|
<array>
|
18
18
|
<string>arm64</string>
|
19
19
|
</array>
|
20
20
|
<key>SupportedPlatform</key>
|
21
21
|
<string>ios</string>
|
22
|
+
<key>SupportedPlatformVariant</key>
|
23
|
+
<string>simulator</string>
|
22
24
|
</dict>
|
23
25
|
<dict>
|
24
26
|
<key>BinaryPath</key>
|
25
|
-
<string>
|
27
|
+
<string>libpubkymobile.a</string>
|
26
28
|
<key>HeadersPath</key>
|
27
29
|
<string>Headers</string>
|
28
30
|
<key>LibraryIdentifier</key>
|
29
|
-
<string>ios-arm64
|
31
|
+
<string>ios-arm64</string>
|
30
32
|
<key>LibraryPath</key>
|
31
|
-
<string>
|
33
|
+
<string>libpubkymobile.a</string>
|
32
34
|
<key>SupportedArchitectures</key>
|
33
35
|
<array>
|
34
36
|
<string>arm64</string>
|
35
37
|
</array>
|
36
38
|
<key>SupportedPlatform</key>
|
37
39
|
<string>ios</string>
|
38
|
-
<key>SupportedPlatformVariant</key>
|
39
|
-
<string>simulator</string>
|
40
40
|
</dict>
|
41
41
|
</array>
|
42
42
|
<key>CFBundlePackageType</key>
|
package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/Headers/mobileFFI.h
RENAMED
@@ -64,9 +64,6 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
64
64
|
|
65
65
|
// Scaffolding functions
|
66
66
|
void* _Nonnull uniffi_mobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
67
|
-
);
|
68
|
-
RustBuffer uniffi_mobile_fn_func_myexample(RustCallStatus *_Nonnull out_status
|
69
|
-
|
70
67
|
);
|
71
68
|
RustBuffer ffi_mobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
72
69
|
);
|
@@ -184,9 +181,6 @@ void ffi_mobile_rust_future_complete_void(void* _Nonnull handle, RustCallStatus
|
|
184
181
|
);
|
185
182
|
uint16_t uniffi_mobile_checksum_func_auth(void
|
186
183
|
|
187
|
-
);
|
188
|
-
uint16_t uniffi_mobile_checksum_func_myexample(void
|
189
|
-
|
190
184
|
);
|
191
185
|
uint32_t ffi_mobile_uniffi_contract_version(void
|
192
186
|
|
@@ -0,0 +1,188 @@
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi` crate.
|
2
|
+
// Trust me, you don't want to mess with it!
|
3
|
+
|
4
|
+
#pragma once
|
5
|
+
|
6
|
+
#include <stdbool.h>
|
7
|
+
#include <stddef.h>
|
8
|
+
#include <stdint.h>
|
9
|
+
|
10
|
+
// The following structs are used to implement the lowest level
|
11
|
+
// of the FFI, and thus useful to multiple uniffied crates.
|
12
|
+
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
|
13
|
+
#ifdef UNIFFI_SHARED_H
|
14
|
+
// We also try to prevent mixing versions of shared uniffi header structs.
|
15
|
+
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
|
16
|
+
#ifndef UNIFFI_SHARED_HEADER_V4
|
17
|
+
#error Combining helper code from multiple versions of uniffi is not supported
|
18
|
+
#endif // ndef UNIFFI_SHARED_HEADER_V4
|
19
|
+
#else
|
20
|
+
#define UNIFFI_SHARED_H
|
21
|
+
#define UNIFFI_SHARED_HEADER_V4
|
22
|
+
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
23
|
+
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
|
24
|
+
|
25
|
+
typedef struct RustBuffer
|
26
|
+
{
|
27
|
+
int32_t capacity;
|
28
|
+
int32_t len;
|
29
|
+
uint8_t *_Nullable data;
|
30
|
+
} RustBuffer;
|
31
|
+
|
32
|
+
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
|
33
|
+
|
34
|
+
// Task defined in Rust that Swift executes
|
35
|
+
typedef void (*UniFfiRustTaskCallback)(const void * _Nullable, int8_t);
|
36
|
+
|
37
|
+
// Callback to execute Rust tasks using a Swift Task
|
38
|
+
//
|
39
|
+
// Args:
|
40
|
+
// executor: ForeignExecutor lowered into a size_t value
|
41
|
+
// delay: Delay in MS
|
42
|
+
// task: UniFfiRustTaskCallback to call
|
43
|
+
// task_data: data to pass the task callback
|
44
|
+
typedef int8_t (*UniFfiForeignExecutorCallback)(size_t, uint32_t, UniFfiRustTaskCallback _Nullable, const void * _Nullable);
|
45
|
+
|
46
|
+
typedef struct ForeignBytes
|
47
|
+
{
|
48
|
+
int32_t len;
|
49
|
+
const uint8_t *_Nullable data;
|
50
|
+
} ForeignBytes;
|
51
|
+
|
52
|
+
// Error definitions
|
53
|
+
typedef struct RustCallStatus {
|
54
|
+
int8_t code;
|
55
|
+
RustBuffer errorBuf;
|
56
|
+
} RustCallStatus;
|
57
|
+
|
58
|
+
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
59
|
+
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
|
60
|
+
#endif // def UNIFFI_SHARED_H
|
61
|
+
|
62
|
+
// Continuation callback for UniFFI Futures
|
63
|
+
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
64
|
+
|
65
|
+
// Scaffolding functions
|
66
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
67
|
+
);
|
68
|
+
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
69
|
+
);
|
70
|
+
RustBuffer ffi_pubkymobile_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
|
71
|
+
);
|
72
|
+
void ffi_pubkymobile_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
|
73
|
+
);
|
74
|
+
RustBuffer ffi_pubkymobile_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
76
|
+
void ffi_pubkymobile_rust_future_continuation_callback_set(UniFfiRustFutureContinuation _Nonnull callback
|
77
|
+
);
|
78
|
+
void ffi_pubkymobile_rust_future_poll_u8(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
79
|
+
);
|
80
|
+
void ffi_pubkymobile_rust_future_cancel_u8(void* _Nonnull handle
|
81
|
+
);
|
82
|
+
void ffi_pubkymobile_rust_future_free_u8(void* _Nonnull handle
|
83
|
+
);
|
84
|
+
uint8_t ffi_pubkymobile_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
85
|
+
);
|
86
|
+
void ffi_pubkymobile_rust_future_poll_i8(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
87
|
+
);
|
88
|
+
void ffi_pubkymobile_rust_future_cancel_i8(void* _Nonnull handle
|
89
|
+
);
|
90
|
+
void ffi_pubkymobile_rust_future_free_i8(void* _Nonnull handle
|
91
|
+
);
|
92
|
+
int8_t ffi_pubkymobile_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
93
|
+
);
|
94
|
+
void ffi_pubkymobile_rust_future_poll_u16(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
95
|
+
);
|
96
|
+
void ffi_pubkymobile_rust_future_cancel_u16(void* _Nonnull handle
|
97
|
+
);
|
98
|
+
void ffi_pubkymobile_rust_future_free_u16(void* _Nonnull handle
|
99
|
+
);
|
100
|
+
uint16_t ffi_pubkymobile_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
101
|
+
);
|
102
|
+
void ffi_pubkymobile_rust_future_poll_i16(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
103
|
+
);
|
104
|
+
void ffi_pubkymobile_rust_future_cancel_i16(void* _Nonnull handle
|
105
|
+
);
|
106
|
+
void ffi_pubkymobile_rust_future_free_i16(void* _Nonnull handle
|
107
|
+
);
|
108
|
+
int16_t ffi_pubkymobile_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
109
|
+
);
|
110
|
+
void ffi_pubkymobile_rust_future_poll_u32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
111
|
+
);
|
112
|
+
void ffi_pubkymobile_rust_future_cancel_u32(void* _Nonnull handle
|
113
|
+
);
|
114
|
+
void ffi_pubkymobile_rust_future_free_u32(void* _Nonnull handle
|
115
|
+
);
|
116
|
+
uint32_t ffi_pubkymobile_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
117
|
+
);
|
118
|
+
void ffi_pubkymobile_rust_future_poll_i32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
119
|
+
);
|
120
|
+
void ffi_pubkymobile_rust_future_cancel_i32(void* _Nonnull handle
|
121
|
+
);
|
122
|
+
void ffi_pubkymobile_rust_future_free_i32(void* _Nonnull handle
|
123
|
+
);
|
124
|
+
int32_t ffi_pubkymobile_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
125
|
+
);
|
126
|
+
void ffi_pubkymobile_rust_future_poll_u64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
127
|
+
);
|
128
|
+
void ffi_pubkymobile_rust_future_cancel_u64(void* _Nonnull handle
|
129
|
+
);
|
130
|
+
void ffi_pubkymobile_rust_future_free_u64(void* _Nonnull handle
|
131
|
+
);
|
132
|
+
uint64_t ffi_pubkymobile_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
133
|
+
);
|
134
|
+
void ffi_pubkymobile_rust_future_poll_i64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
135
|
+
);
|
136
|
+
void ffi_pubkymobile_rust_future_cancel_i64(void* _Nonnull handle
|
137
|
+
);
|
138
|
+
void ffi_pubkymobile_rust_future_free_i64(void* _Nonnull handle
|
139
|
+
);
|
140
|
+
int64_t ffi_pubkymobile_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
141
|
+
);
|
142
|
+
void ffi_pubkymobile_rust_future_poll_f32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
143
|
+
);
|
144
|
+
void ffi_pubkymobile_rust_future_cancel_f32(void* _Nonnull handle
|
145
|
+
);
|
146
|
+
void ffi_pubkymobile_rust_future_free_f32(void* _Nonnull handle
|
147
|
+
);
|
148
|
+
float ffi_pubkymobile_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
149
|
+
);
|
150
|
+
void ffi_pubkymobile_rust_future_poll_f64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
151
|
+
);
|
152
|
+
void ffi_pubkymobile_rust_future_cancel_f64(void* _Nonnull handle
|
153
|
+
);
|
154
|
+
void ffi_pubkymobile_rust_future_free_f64(void* _Nonnull handle
|
155
|
+
);
|
156
|
+
double ffi_pubkymobile_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
157
|
+
);
|
158
|
+
void ffi_pubkymobile_rust_future_poll_pointer(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
159
|
+
);
|
160
|
+
void ffi_pubkymobile_rust_future_cancel_pointer(void* _Nonnull handle
|
161
|
+
);
|
162
|
+
void ffi_pubkymobile_rust_future_free_pointer(void* _Nonnull handle
|
163
|
+
);
|
164
|
+
void*_Nonnull ffi_pubkymobile_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
165
|
+
);
|
166
|
+
void ffi_pubkymobile_rust_future_poll_rust_buffer(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
167
|
+
);
|
168
|
+
void ffi_pubkymobile_rust_future_cancel_rust_buffer(void* _Nonnull handle
|
169
|
+
);
|
170
|
+
void ffi_pubkymobile_rust_future_free_rust_buffer(void* _Nonnull handle
|
171
|
+
);
|
172
|
+
RustBuffer ffi_pubkymobile_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
173
|
+
);
|
174
|
+
void ffi_pubkymobile_rust_future_poll_void(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
175
|
+
);
|
176
|
+
void ffi_pubkymobile_rust_future_cancel_void(void* _Nonnull handle
|
177
|
+
);
|
178
|
+
void ffi_pubkymobile_rust_future_free_void(void* _Nonnull handle
|
179
|
+
);
|
180
|
+
void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
181
|
+
);
|
182
|
+
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
183
|
+
|
184
|
+
);
|
185
|
+
uint32_t ffi_pubkymobile_uniffi_contract_version(void
|
186
|
+
|
187
|
+
);
|
188
|
+
|
Binary file
|
@@ -64,9 +64,6 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
64
64
|
|
65
65
|
// Scaffolding functions
|
66
66
|
void* _Nonnull uniffi_mobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
67
|
-
);
|
68
|
-
RustBuffer uniffi_mobile_fn_func_myexample(RustCallStatus *_Nonnull out_status
|
69
|
-
|
70
67
|
);
|
71
68
|
RustBuffer ffi_mobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
72
69
|
);
|
@@ -184,9 +181,6 @@ void ffi_mobile_rust_future_complete_void(void* _Nonnull handle, RustCallStatus
|
|
184
181
|
);
|
185
182
|
uint16_t uniffi_mobile_checksum_func_auth(void
|
186
183
|
|
187
|
-
);
|
188
|
-
uint16_t uniffi_mobile_checksum_func_myexample(void
|
189
|
-
|
190
184
|
);
|
191
185
|
uint32_t ffi_mobile_uniffi_contract_version(void
|
192
186
|
|
@@ -0,0 +1,188 @@
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi` crate.
|
2
|
+
// Trust me, you don't want to mess with it!
|
3
|
+
|
4
|
+
#pragma once
|
5
|
+
|
6
|
+
#include <stdbool.h>
|
7
|
+
#include <stddef.h>
|
8
|
+
#include <stdint.h>
|
9
|
+
|
10
|
+
// The following structs are used to implement the lowest level
|
11
|
+
// of the FFI, and thus useful to multiple uniffied crates.
|
12
|
+
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
|
13
|
+
#ifdef UNIFFI_SHARED_H
|
14
|
+
// We also try to prevent mixing versions of shared uniffi header structs.
|
15
|
+
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
|
16
|
+
#ifndef UNIFFI_SHARED_HEADER_V4
|
17
|
+
#error Combining helper code from multiple versions of uniffi is not supported
|
18
|
+
#endif // ndef UNIFFI_SHARED_HEADER_V4
|
19
|
+
#else
|
20
|
+
#define UNIFFI_SHARED_H
|
21
|
+
#define UNIFFI_SHARED_HEADER_V4
|
22
|
+
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
23
|
+
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
|
24
|
+
|
25
|
+
typedef struct RustBuffer
|
26
|
+
{
|
27
|
+
int32_t capacity;
|
28
|
+
int32_t len;
|
29
|
+
uint8_t *_Nullable data;
|
30
|
+
} RustBuffer;
|
31
|
+
|
32
|
+
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
|
33
|
+
|
34
|
+
// Task defined in Rust that Swift executes
|
35
|
+
typedef void (*UniFfiRustTaskCallback)(const void * _Nullable, int8_t);
|
36
|
+
|
37
|
+
// Callback to execute Rust tasks using a Swift Task
|
38
|
+
//
|
39
|
+
// Args:
|
40
|
+
// executor: ForeignExecutor lowered into a size_t value
|
41
|
+
// delay: Delay in MS
|
42
|
+
// task: UniFfiRustTaskCallback to call
|
43
|
+
// task_data: data to pass the task callback
|
44
|
+
typedef int8_t (*UniFfiForeignExecutorCallback)(size_t, uint32_t, UniFfiRustTaskCallback _Nullable, const void * _Nullable);
|
45
|
+
|
46
|
+
typedef struct ForeignBytes
|
47
|
+
{
|
48
|
+
int32_t len;
|
49
|
+
const uint8_t *_Nullable data;
|
50
|
+
} ForeignBytes;
|
51
|
+
|
52
|
+
// Error definitions
|
53
|
+
typedef struct RustCallStatus {
|
54
|
+
int8_t code;
|
55
|
+
RustBuffer errorBuf;
|
56
|
+
} RustCallStatus;
|
57
|
+
|
58
|
+
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
|
59
|
+
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
|
60
|
+
#endif // def UNIFFI_SHARED_H
|
61
|
+
|
62
|
+
// Continuation callback for UniFFI Futures
|
63
|
+
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
64
|
+
|
65
|
+
// Scaffolding functions
|
66
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
67
|
+
);
|
68
|
+
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
69
|
+
);
|
70
|
+
RustBuffer ffi_pubkymobile_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
|
71
|
+
);
|
72
|
+
void ffi_pubkymobile_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
|
73
|
+
);
|
74
|
+
RustBuffer ffi_pubkymobile_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
76
|
+
void ffi_pubkymobile_rust_future_continuation_callback_set(UniFfiRustFutureContinuation _Nonnull callback
|
77
|
+
);
|
78
|
+
void ffi_pubkymobile_rust_future_poll_u8(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
79
|
+
);
|
80
|
+
void ffi_pubkymobile_rust_future_cancel_u8(void* _Nonnull handle
|
81
|
+
);
|
82
|
+
void ffi_pubkymobile_rust_future_free_u8(void* _Nonnull handle
|
83
|
+
);
|
84
|
+
uint8_t ffi_pubkymobile_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
85
|
+
);
|
86
|
+
void ffi_pubkymobile_rust_future_poll_i8(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
87
|
+
);
|
88
|
+
void ffi_pubkymobile_rust_future_cancel_i8(void* _Nonnull handle
|
89
|
+
);
|
90
|
+
void ffi_pubkymobile_rust_future_free_i8(void* _Nonnull handle
|
91
|
+
);
|
92
|
+
int8_t ffi_pubkymobile_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
93
|
+
);
|
94
|
+
void ffi_pubkymobile_rust_future_poll_u16(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
95
|
+
);
|
96
|
+
void ffi_pubkymobile_rust_future_cancel_u16(void* _Nonnull handle
|
97
|
+
);
|
98
|
+
void ffi_pubkymobile_rust_future_free_u16(void* _Nonnull handle
|
99
|
+
);
|
100
|
+
uint16_t ffi_pubkymobile_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
101
|
+
);
|
102
|
+
void ffi_pubkymobile_rust_future_poll_i16(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
103
|
+
);
|
104
|
+
void ffi_pubkymobile_rust_future_cancel_i16(void* _Nonnull handle
|
105
|
+
);
|
106
|
+
void ffi_pubkymobile_rust_future_free_i16(void* _Nonnull handle
|
107
|
+
);
|
108
|
+
int16_t ffi_pubkymobile_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
109
|
+
);
|
110
|
+
void ffi_pubkymobile_rust_future_poll_u32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
111
|
+
);
|
112
|
+
void ffi_pubkymobile_rust_future_cancel_u32(void* _Nonnull handle
|
113
|
+
);
|
114
|
+
void ffi_pubkymobile_rust_future_free_u32(void* _Nonnull handle
|
115
|
+
);
|
116
|
+
uint32_t ffi_pubkymobile_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
117
|
+
);
|
118
|
+
void ffi_pubkymobile_rust_future_poll_i32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
119
|
+
);
|
120
|
+
void ffi_pubkymobile_rust_future_cancel_i32(void* _Nonnull handle
|
121
|
+
);
|
122
|
+
void ffi_pubkymobile_rust_future_free_i32(void* _Nonnull handle
|
123
|
+
);
|
124
|
+
int32_t ffi_pubkymobile_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
125
|
+
);
|
126
|
+
void ffi_pubkymobile_rust_future_poll_u64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
127
|
+
);
|
128
|
+
void ffi_pubkymobile_rust_future_cancel_u64(void* _Nonnull handle
|
129
|
+
);
|
130
|
+
void ffi_pubkymobile_rust_future_free_u64(void* _Nonnull handle
|
131
|
+
);
|
132
|
+
uint64_t ffi_pubkymobile_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
133
|
+
);
|
134
|
+
void ffi_pubkymobile_rust_future_poll_i64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
135
|
+
);
|
136
|
+
void ffi_pubkymobile_rust_future_cancel_i64(void* _Nonnull handle
|
137
|
+
);
|
138
|
+
void ffi_pubkymobile_rust_future_free_i64(void* _Nonnull handle
|
139
|
+
);
|
140
|
+
int64_t ffi_pubkymobile_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
141
|
+
);
|
142
|
+
void ffi_pubkymobile_rust_future_poll_f32(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
143
|
+
);
|
144
|
+
void ffi_pubkymobile_rust_future_cancel_f32(void* _Nonnull handle
|
145
|
+
);
|
146
|
+
void ffi_pubkymobile_rust_future_free_f32(void* _Nonnull handle
|
147
|
+
);
|
148
|
+
float ffi_pubkymobile_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
149
|
+
);
|
150
|
+
void ffi_pubkymobile_rust_future_poll_f64(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
151
|
+
);
|
152
|
+
void ffi_pubkymobile_rust_future_cancel_f64(void* _Nonnull handle
|
153
|
+
);
|
154
|
+
void ffi_pubkymobile_rust_future_free_f64(void* _Nonnull handle
|
155
|
+
);
|
156
|
+
double ffi_pubkymobile_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
157
|
+
);
|
158
|
+
void ffi_pubkymobile_rust_future_poll_pointer(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
159
|
+
);
|
160
|
+
void ffi_pubkymobile_rust_future_cancel_pointer(void* _Nonnull handle
|
161
|
+
);
|
162
|
+
void ffi_pubkymobile_rust_future_free_pointer(void* _Nonnull handle
|
163
|
+
);
|
164
|
+
void*_Nonnull ffi_pubkymobile_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
165
|
+
);
|
166
|
+
void ffi_pubkymobile_rust_future_poll_rust_buffer(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
167
|
+
);
|
168
|
+
void ffi_pubkymobile_rust_future_cancel_rust_buffer(void* _Nonnull handle
|
169
|
+
);
|
170
|
+
void ffi_pubkymobile_rust_future_free_rust_buffer(void* _Nonnull handle
|
171
|
+
);
|
172
|
+
RustBuffer ffi_pubkymobile_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
173
|
+
);
|
174
|
+
void ffi_pubkymobile_rust_future_poll_void(void* _Nonnull handle, void* _Nonnull uniffi_callback
|
175
|
+
);
|
176
|
+
void ffi_pubkymobile_rust_future_cancel_void(void* _Nonnull handle
|
177
|
+
);
|
178
|
+
void ffi_pubkymobile_rust_future_free_void(void* _Nonnull handle
|
179
|
+
);
|
180
|
+
void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
|
181
|
+
);
|
182
|
+
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
183
|
+
|
184
|
+
);
|
185
|
+
uint32_t ffi_pubkymobile_uniffi_contract_version(void
|
186
|
+
|
187
|
+
);
|
188
|
+
|
Binary file
|
Binary file
|
package/ios/Pubky.mm
CHANGED
@@ -5,8 +5,8 @@ import Foundation
|
|
5
5
|
// Depending on the consumer's build setup, the low-level FFI code
|
6
6
|
// might be in a separate module, or it might be compiled inline into
|
7
7
|
// this module. This is a bit of light hackery to work with both.
|
8
|
-
#if canImport(
|
9
|
-
import
|
8
|
+
#if canImport(pubkymobileFFI)
|
9
|
+
import pubkymobileFFI
|
10
10
|
#endif
|
11
11
|
|
12
12
|
fileprivate extension RustBuffer {
|
@@ -19,13 +19,13 @@ fileprivate extension RustBuffer {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
|
22
|
-
try! rustCall {
|
22
|
+
try! rustCall { ffi_pubkymobile_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
|
23
23
|
}
|
24
24
|
|
25
25
|
// Frees the buffer in place.
|
26
26
|
// The buffer must not be used after this is called.
|
27
27
|
func deallocate() {
|
28
|
-
try! rustCall {
|
28
|
+
try! rustCall { ffi_pubkymobile_rustbuffer_free(self, $0) }
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
@@ -416,20 +416,20 @@ fileprivate class ContinuationHolder {
|
|
416
416
|
}
|
417
417
|
|
418
418
|
fileprivate func uniffiInitContinuationCallback() {
|
419
|
-
|
419
|
+
ffi_pubkymobile_rust_future_continuation_callback_set(uniffiFutureContinuationCallback)
|
420
420
|
}
|
421
421
|
|
422
422
|
public func auth(url: String, secretKey: String) async -> [String] {
|
423
423
|
return try! await uniffiRustCallAsync(
|
424
424
|
rustFutureFunc: {
|
425
|
-
|
425
|
+
uniffi_pubkymobile_fn_func_auth(
|
426
426
|
FfiConverterString.lower(url),
|
427
427
|
FfiConverterString.lower(secretKey)
|
428
428
|
)
|
429
429
|
},
|
430
|
-
pollFunc:
|
431
|
-
completeFunc:
|
432
|
-
freeFunc:
|
430
|
+
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
431
|
+
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
432
|
+
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
433
433
|
liftFunc: FfiConverterSequenceString.lift,
|
434
434
|
errorHandler: nil
|
435
435
|
|
@@ -438,14 +438,6 @@ public func auth(url: String, secretKey: String) async -> [String] {
|
|
438
438
|
|
439
439
|
|
440
440
|
|
441
|
-
public func myexample() -> [String] {
|
442
|
-
return try! FfiConverterSequenceString.lift(
|
443
|
-
try! rustCall() {
|
444
|
-
uniffi_mobile_fn_func_myexample($0)
|
445
|
-
}
|
446
|
-
)
|
447
|
-
}
|
448
|
-
|
449
441
|
private enum InitializationResult {
|
450
442
|
case ok
|
451
443
|
case contractVersionMismatch
|
@@ -457,14 +449,11 @@ private var initializationResult: InitializationResult {
|
|
457
449
|
// Get the bindings contract version from our ComponentInterface
|
458
450
|
let bindings_contract_version = 24
|
459
451
|
// Get the scaffolding contract version by calling the into the dylib
|
460
|
-
let scaffolding_contract_version =
|
452
|
+
let scaffolding_contract_version = ffi_pubkymobile_uniffi_contract_version()
|
461
453
|
if bindings_contract_version != scaffolding_contract_version {
|
462
454
|
return InitializationResult.contractVersionMismatch
|
463
455
|
}
|
464
|
-
if (
|
465
|
-
return InitializationResult.apiChecksumMismatch
|
466
|
-
}
|
467
|
-
if (uniffi_mobile_checksum_func_myexample() != 65225) {
|
456
|
+
if (uniffi_pubkymobile_checksum_func_auth() != 46918) {
|
468
457
|
return InitializationResult.apiChecksumMismatch
|
469
458
|
}
|
470
459
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@synonymdev/react-native-pubky",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.1",
|
4
4
|
"description": "React Native Implementation of Pubky",
|
5
5
|
"source": "./src/index.tsx",
|
6
6
|
"main": "./lib/commonjs/index.js",
|
@@ -37,18 +37,19 @@
|
|
37
37
|
"!**/.*"
|
38
38
|
],
|
39
39
|
"scripts": {
|
40
|
-
"example": "yarn workspace react-native-pubky-example",
|
41
40
|
"test": "jest",
|
42
41
|
"typecheck": "tsc",
|
43
42
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
44
43
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
45
44
|
"prepare": "bob build",
|
46
45
|
"release": "release-it",
|
47
|
-
"
|
48
|
-
"
|
46
|
+
"example:ios": "cd example && cd ios && rm -rf Pods && cd ../ && npm i && bundle install && npm run build:ios && npm run ios",
|
47
|
+
"example:android": "cd example && npm i && npm run build:android && npm run android",
|
48
|
+
"reinstall": "yarn install && npm run clean && npm run prepare",
|
49
|
+
"cargo-build": "cd rust && cargo build && cd pubky && cargo build && cd pubky && cargo build && cd ../ && cd pubky-common && cargo build && cd ../ && cd pubky-homeserver && cargo build && cd ../../../",
|
49
50
|
"update-bindings:ios": "npm run cargo-build && node setup-ios-bindings.js && npm run reinstall",
|
50
51
|
"update-bindings:android": "npm run cargo-build && node setup-android-bindings.js && npm run reinstall",
|
51
|
-
"update-bindings": "npm run cargo-build && npm run update-bindings:ios && npm run update-bindings:android"
|
52
|
+
"update-bindings": "npm run reinstall && npm run cargo-build && npm run update-bindings:ios && npm run update-bindings:android"
|
52
53
|
},
|
53
54
|
"keywords": [
|
54
55
|
"pubky",
|
@@ -58,7 +59,7 @@
|
|
58
59
|
],
|
59
60
|
"repository": {
|
60
61
|
"type": "git",
|
61
|
-
"url": "git+https://
|
62
|
+
"url": "git+https://github.com/pubky/react-native-pubky.git"
|
62
63
|
},
|
63
64
|
"author": "coreyphillips <corey@synonym.to> (https://github.com/coreyphillips)",
|
64
65
|
"license": "MIT",
|
@@ -88,7 +89,7 @@
|
|
88
89
|
"jest": "^29.7.0",
|
89
90
|
"prettier": "^3.0.3",
|
90
91
|
"react": "18.3.1",
|
91
|
-
"react-native": "0.75.
|
92
|
+
"react-native": "0.75.3",
|
92
93
|
"react-native-builder-bob": "^0.30.2",
|
93
94
|
"release-it": "^15.0.0",
|
94
95
|
"turbo": "^1.10.7",
|
@@ -193,6 +194,6 @@
|
|
193
194
|
"create-react-native-library": {
|
194
195
|
"type": "module-legacy",
|
195
196
|
"languages": "kotlin-swift",
|
196
|
-
"version": "0.41.
|
197
|
+
"version": "0.41.2"
|
197
198
|
}
|
198
199
|
}
|
@@ -15,11 +15,11 @@ Pod::Spec.new do |s|
|
|
15
15
|
|
16
16
|
s.platforms = { :ios => min_ios_version_supported }
|
17
17
|
s.ios.deployment_target = min_ios_version_supported
|
18
|
-
s.source = { :git => "https://github.com/
|
18
|
+
s.source = { :git => "https://github.com/pubky/react-native-pubky.git", :tag => "#{s.version}" }
|
19
19
|
|
20
20
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
21
21
|
s.ios.source_files = "ios/**/*.{h,m,mm,swift}"
|
22
|
-
s.ios.vendored_frameworks = "ios/Frameworks/
|
22
|
+
s.ios.vendored_frameworks = "ios/Frameworks/PubkyMobile.xcframework"
|
23
23
|
|
24
24
|
s.pod_target_xcconfig = {
|
25
25
|
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "x86_64"
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
-
<exclude-output />
|
5
|
-
<content url="file://$MODULE_DIR$">
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" packagePrefix="com.pubky" />
|
7
|
-
</content>
|
8
|
-
<orderEntry type="inheritedJdk" />
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
-
</component>
|
11
|
-
</module>
|
Binary file
|