@synonymdev/react-native-pubky 0.1.0 → 0.2.0
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 +34 -11
- package/android/build.gradle +3 -2
- package/android/src/main/java/com/pubky/PubkyModule.kt +32 -18
- package/android/src/main/java/uniffi/{mobile/mobile.kt → pubkymobile/pubkymobile.kt} +77 -77
- 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 +193 -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 +193 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libmobile.a +0 -0
- package/ios/Frameworks/{Mobile.xcframework/ios-arm64-simulator/libmobile.a → PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a} +0 -0
- package/ios/Pubky.mm +3 -0
- package/ios/Pubky.swift +22 -11
- package/ios/{mobile.swift → pubkymobile.swift} +15 -14
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +11 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +11 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +10 -8
- package/react-native-pubky.podspec +2 -2
- package/src/index.tsx +26 -0
- 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
|
+
- [x] [parseAuthUrl](#parseAuthUrl): Method to decode an authUrl.
|
15
|
+
### Methods to be Implemented
|
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
|
|
@@ -32,6 +31,30 @@ if (authRes.isErr()) {
|
|
32
31
|
}
|
33
32
|
console.log(authRes.value);
|
34
33
|
```
|
34
|
+
### <a name="parseAuthUrl"></a>parseAuthUrl
|
35
|
+
```js
|
36
|
+
import { parseAuthUrl } from '@synonymdev/react-native-pubky';
|
37
|
+
|
38
|
+
const pubkyAuthUrl = 'pubkyauth:///?relay=https://demo.httprelay.io/link&capabilities=/pub/pubky.app:rw,/pub/example.com/nested:rw&secret=FyzJ3gJ1W7boyFZC1Do9fYrRmDNgCLNRwEu_gaBgPUA';
|
39
|
+
const parseRes = await parseAuthUrl(pubkyAuthUrl);
|
40
|
+
if (parseRes.isErr()) {
|
41
|
+
console.log(parseRes.error.message);
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
console.log(parseRes.value);
|
45
|
+
```
|
46
|
+
|
47
|
+
## Local Installation
|
48
|
+
|
49
|
+
1. Clone & npm install:
|
50
|
+
```sh
|
51
|
+
git clone git@github.com:pubky/react-native-pubky.git && cd react-native-pubky && npm i
|
52
|
+
```
|
53
|
+
2. Delete the `rust/pubky` directory to prevent a memory error (This step will be removed once pubky is public).
|
54
|
+
3. Yarn add it to your project:
|
55
|
+
```sh
|
56
|
+
yarn add path/to/react-native-pubky
|
57
|
+
```
|
35
58
|
|
36
59
|
## Update Bindings
|
37
60
|
|
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,8 @@ 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
|
+
import uniffi.pubkymobile.parseAuthUrl
|
13
14
|
|
14
15
|
class PubkyModule(reactContext: ReactApplicationContext) :
|
15
16
|
ReactContextBaseJavaModule(reactContext) {
|
@@ -18,24 +19,37 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
18
19
|
return NAME
|
19
20
|
}
|
20
21
|
|
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
|
-
|
22
|
+
@ReactMethod
|
23
|
+
fun auth(url: String, secretKey: String, promise: Promise) {
|
24
|
+
CoroutineScope(Dispatchers.IO).launch {
|
25
|
+
try {
|
26
|
+
val result = auth(url, secretKey)
|
27
|
+
val array = Arguments.createArray().apply {
|
28
|
+
result.forEach { pushString(it) }
|
29
|
+
}
|
30
|
+
withContext(Dispatchers.Main) {
|
31
|
+
promise.resolve(array)
|
32
|
+
}
|
33
|
+
} catch (e: Exception) {
|
34
|
+
withContext(Dispatchers.Main) {
|
35
|
+
promise.reject("Error", e.message)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
@ReactMethod
|
42
|
+
fun parseAuthUrl(url: String, promise: Promise) {
|
43
|
+
try {
|
44
|
+
val result = parseAuthUrl(url)
|
45
|
+
val array = Arguments.createArray().apply {
|
46
|
+
result.forEach { pushString(it) }
|
47
|
+
}
|
48
|
+
promise.resolve(array)
|
49
|
+
} catch (e: Exception) {
|
50
|
+
promise.reject("Error", e.message)
|
37
51
|
}
|
38
|
-
}
|
52
|
+
}
|
39
53
|
|
40
54
|
companion object {
|
41
55
|
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,129 @@ 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 uniffi_pubkymobile_fn_func_parse_auth_url(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
391
391
|
): RustBuffer.ByValue
|
392
|
-
fun
|
392
|
+
fun ffi_pubkymobile_rustbuffer_alloc(`size`: Int,_uniffi_out_err: RustCallStatus,
|
393
393
|
): RustBuffer.ByValue
|
394
|
-
fun
|
394
|
+
fun ffi_pubkymobile_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,_uniffi_out_err: RustCallStatus,
|
395
395
|
): RustBuffer.ByValue
|
396
|
-
fun
|
396
|
+
fun ffi_pubkymobile_rustbuffer_free(`buf`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
397
397
|
): Unit
|
398
|
-
fun
|
398
|
+
fun ffi_pubkymobile_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Int,_uniffi_out_err: RustCallStatus,
|
399
399
|
): RustBuffer.ByValue
|
400
|
-
fun
|
400
|
+
fun ffi_pubkymobile_rust_future_continuation_callback_set(`callback`: UniFffiRustFutureContinuationCallbackType,
|
401
401
|
): Unit
|
402
|
-
fun
|
402
|
+
fun ffi_pubkymobile_rust_future_poll_u8(`handle`: Pointer,`uniffiCallback`: USize,
|
403
403
|
): Unit
|
404
|
-
fun
|
404
|
+
fun ffi_pubkymobile_rust_future_cancel_u8(`handle`: Pointer,
|
405
405
|
): Unit
|
406
|
-
fun
|
406
|
+
fun ffi_pubkymobile_rust_future_free_u8(`handle`: Pointer,
|
407
407
|
): Unit
|
408
|
-
fun
|
408
|
+
fun ffi_pubkymobile_rust_future_complete_u8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
409
409
|
): Byte
|
410
|
-
fun
|
410
|
+
fun ffi_pubkymobile_rust_future_poll_i8(`handle`: Pointer,`uniffiCallback`: USize,
|
411
411
|
): Unit
|
412
|
-
fun
|
412
|
+
fun ffi_pubkymobile_rust_future_cancel_i8(`handle`: Pointer,
|
413
413
|
): Unit
|
414
|
-
fun
|
414
|
+
fun ffi_pubkymobile_rust_future_free_i8(`handle`: Pointer,
|
415
415
|
): Unit
|
416
|
-
fun
|
416
|
+
fun ffi_pubkymobile_rust_future_complete_i8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
417
417
|
): Byte
|
418
|
-
fun
|
418
|
+
fun ffi_pubkymobile_rust_future_poll_u16(`handle`: Pointer,`uniffiCallback`: USize,
|
419
419
|
): Unit
|
420
|
-
fun
|
420
|
+
fun ffi_pubkymobile_rust_future_cancel_u16(`handle`: Pointer,
|
421
421
|
): Unit
|
422
|
-
fun
|
422
|
+
fun ffi_pubkymobile_rust_future_free_u16(`handle`: Pointer,
|
423
423
|
): Unit
|
424
|
-
fun
|
424
|
+
fun ffi_pubkymobile_rust_future_complete_u16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
425
425
|
): Short
|
426
|
-
fun
|
426
|
+
fun ffi_pubkymobile_rust_future_poll_i16(`handle`: Pointer,`uniffiCallback`: USize,
|
427
427
|
): Unit
|
428
|
-
fun
|
428
|
+
fun ffi_pubkymobile_rust_future_cancel_i16(`handle`: Pointer,
|
429
429
|
): Unit
|
430
|
-
fun
|
430
|
+
fun ffi_pubkymobile_rust_future_free_i16(`handle`: Pointer,
|
431
431
|
): Unit
|
432
|
-
fun
|
432
|
+
fun ffi_pubkymobile_rust_future_complete_i16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
433
433
|
): Short
|
434
|
-
fun
|
434
|
+
fun ffi_pubkymobile_rust_future_poll_u32(`handle`: Pointer,`uniffiCallback`: USize,
|
435
435
|
): Unit
|
436
|
-
fun
|
436
|
+
fun ffi_pubkymobile_rust_future_cancel_u32(`handle`: Pointer,
|
437
437
|
): Unit
|
438
|
-
fun
|
438
|
+
fun ffi_pubkymobile_rust_future_free_u32(`handle`: Pointer,
|
439
439
|
): Unit
|
440
|
-
fun
|
440
|
+
fun ffi_pubkymobile_rust_future_complete_u32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
441
441
|
): Int
|
442
|
-
fun
|
442
|
+
fun ffi_pubkymobile_rust_future_poll_i32(`handle`: Pointer,`uniffiCallback`: USize,
|
443
443
|
): Unit
|
444
|
-
fun
|
444
|
+
fun ffi_pubkymobile_rust_future_cancel_i32(`handle`: Pointer,
|
445
445
|
): Unit
|
446
|
-
fun
|
446
|
+
fun ffi_pubkymobile_rust_future_free_i32(`handle`: Pointer,
|
447
447
|
): Unit
|
448
|
-
fun
|
448
|
+
fun ffi_pubkymobile_rust_future_complete_i32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
449
449
|
): Int
|
450
|
-
fun
|
450
|
+
fun ffi_pubkymobile_rust_future_poll_u64(`handle`: Pointer,`uniffiCallback`: USize,
|
451
451
|
): Unit
|
452
|
-
fun
|
452
|
+
fun ffi_pubkymobile_rust_future_cancel_u64(`handle`: Pointer,
|
453
453
|
): Unit
|
454
|
-
fun
|
454
|
+
fun ffi_pubkymobile_rust_future_free_u64(`handle`: Pointer,
|
455
455
|
): Unit
|
456
|
-
fun
|
456
|
+
fun ffi_pubkymobile_rust_future_complete_u64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
457
457
|
): Long
|
458
|
-
fun
|
458
|
+
fun ffi_pubkymobile_rust_future_poll_i64(`handle`: Pointer,`uniffiCallback`: USize,
|
459
459
|
): Unit
|
460
|
-
fun
|
460
|
+
fun ffi_pubkymobile_rust_future_cancel_i64(`handle`: Pointer,
|
461
461
|
): Unit
|
462
|
-
fun
|
462
|
+
fun ffi_pubkymobile_rust_future_free_i64(`handle`: Pointer,
|
463
463
|
): Unit
|
464
|
-
fun
|
464
|
+
fun ffi_pubkymobile_rust_future_complete_i64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
465
465
|
): Long
|
466
|
-
fun
|
466
|
+
fun ffi_pubkymobile_rust_future_poll_f32(`handle`: Pointer,`uniffiCallback`: USize,
|
467
467
|
): Unit
|
468
|
-
fun
|
468
|
+
fun ffi_pubkymobile_rust_future_cancel_f32(`handle`: Pointer,
|
469
469
|
): Unit
|
470
|
-
fun
|
470
|
+
fun ffi_pubkymobile_rust_future_free_f32(`handle`: Pointer,
|
471
471
|
): Unit
|
472
|
-
fun
|
472
|
+
fun ffi_pubkymobile_rust_future_complete_f32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
473
473
|
): Float
|
474
|
-
fun
|
474
|
+
fun ffi_pubkymobile_rust_future_poll_f64(`handle`: Pointer,`uniffiCallback`: USize,
|
475
475
|
): Unit
|
476
|
-
fun
|
476
|
+
fun ffi_pubkymobile_rust_future_cancel_f64(`handle`: Pointer,
|
477
477
|
): Unit
|
478
|
-
fun
|
478
|
+
fun ffi_pubkymobile_rust_future_free_f64(`handle`: Pointer,
|
479
479
|
): Unit
|
480
|
-
fun
|
480
|
+
fun ffi_pubkymobile_rust_future_complete_f64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
481
481
|
): Double
|
482
|
-
fun
|
482
|
+
fun ffi_pubkymobile_rust_future_poll_pointer(`handle`: Pointer,`uniffiCallback`: USize,
|
483
483
|
): Unit
|
484
|
-
fun
|
484
|
+
fun ffi_pubkymobile_rust_future_cancel_pointer(`handle`: Pointer,
|
485
485
|
): Unit
|
486
|
-
fun
|
486
|
+
fun ffi_pubkymobile_rust_future_free_pointer(`handle`: Pointer,
|
487
487
|
): Unit
|
488
|
-
fun
|
488
|
+
fun ffi_pubkymobile_rust_future_complete_pointer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
489
489
|
): Pointer
|
490
|
-
fun
|
490
|
+
fun ffi_pubkymobile_rust_future_poll_rust_buffer(`handle`: Pointer,`uniffiCallback`: USize,
|
491
491
|
): Unit
|
492
|
-
fun
|
492
|
+
fun ffi_pubkymobile_rust_future_cancel_rust_buffer(`handle`: Pointer,
|
493
493
|
): Unit
|
494
|
-
fun
|
494
|
+
fun ffi_pubkymobile_rust_future_free_rust_buffer(`handle`: Pointer,
|
495
495
|
): Unit
|
496
|
-
fun
|
496
|
+
fun ffi_pubkymobile_rust_future_complete_rust_buffer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
497
497
|
): RustBuffer.ByValue
|
498
|
-
fun
|
498
|
+
fun ffi_pubkymobile_rust_future_poll_void(`handle`: Pointer,`uniffiCallback`: USize,
|
499
499
|
): Unit
|
500
|
-
fun
|
500
|
+
fun ffi_pubkymobile_rust_future_cancel_void(`handle`: Pointer,
|
501
501
|
): Unit
|
502
|
-
fun
|
502
|
+
fun ffi_pubkymobile_rust_future_free_void(`handle`: Pointer,
|
503
503
|
): Unit
|
504
|
-
fun
|
504
|
+
fun ffi_pubkymobile_rust_future_complete_void(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
505
505
|
): Unit
|
506
|
-
fun
|
506
|
+
fun uniffi_pubkymobile_checksum_func_auth(
|
507
507
|
): Short
|
508
|
-
fun
|
508
|
+
fun uniffi_pubkymobile_checksum_func_parse_auth_url(
|
509
509
|
): Short
|
510
|
-
fun
|
510
|
+
fun ffi_pubkymobile_uniffi_contract_version(
|
511
511
|
): Int
|
512
512
|
|
513
513
|
}
|
@@ -516,7 +516,7 @@ private fun uniffiCheckContractApiVersion(lib: _UniFFILib) {
|
|
516
516
|
// Get the bindings contract version from our ComponentInterface
|
517
517
|
val bindings_contract_version = 24
|
518
518
|
// Get the scaffolding contract version by calling the into the dylib
|
519
|
-
val scaffolding_contract_version = lib.
|
519
|
+
val scaffolding_contract_version = lib.ffi_pubkymobile_uniffi_contract_version()
|
520
520
|
if (bindings_contract_version != scaffolding_contract_version) {
|
521
521
|
throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
522
522
|
}
|
@@ -524,10 +524,10 @@ private fun uniffiCheckContractApiVersion(lib: _UniFFILib) {
|
|
524
524
|
|
525
525
|
@Suppress("UNUSED_PARAMETER")
|
526
526
|
private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
527
|
-
if (lib.
|
527
|
+
if (lib.uniffi_pubkymobile_checksum_func_auth() != 46918.toShort()) {
|
528
528
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
529
529
|
}
|
530
|
-
if (lib.
|
530
|
+
if (lib.uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088.toShort()) {
|
531
531
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
532
532
|
}
|
533
533
|
}
|
@@ -547,7 +547,7 @@ internal object uniffiRustFutureContinuationCallback: UniFffiRustFutureContinuat
|
|
547
547
|
}
|
548
548
|
|
549
549
|
internal fun register(lib: _UniFFILib) {
|
550
|
-
lib.
|
550
|
+
lib.ffi_pubkymobile_rust_future_continuation_callback_set(this)
|
551
551
|
}
|
552
552
|
}
|
553
553
|
|
@@ -667,10 +667,10 @@ public object FfiConverterSequenceString: FfiConverterRustBuffer<List<String>> {
|
|
667
667
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
668
668
|
suspend fun `auth`(`url`: String, `secretKey`: String) : List<String> {
|
669
669
|
return uniffiRustCallAsync(
|
670
|
-
_UniFFILib.INSTANCE.
|
671
|
-
{ future, continuation -> _UniFFILib.INSTANCE.
|
672
|
-
{ future, continuation -> _UniFFILib.INSTANCE.
|
673
|
-
{ future -> _UniFFILib.INSTANCE.
|
670
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_auth(FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),),
|
671
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
672
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
673
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
674
674
|
// lift function
|
675
675
|
{ FfiConverterSequenceString.lift(it) },
|
676
676
|
// Error FFI converter
|
@@ -678,10 +678,10 @@ suspend fun `auth`(`url`: String, `secretKey`: String) : List<String> {
|
|
678
678
|
)
|
679
679
|
}
|
680
680
|
|
681
|
-
fun `
|
681
|
+
fun `parseAuthUrl`(`url`: String): List<String> {
|
682
682
|
return FfiConverterSequenceString.lift(
|
683
683
|
rustCall() { _status ->
|
684
|
-
_UniFFILib.INSTANCE.
|
684
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_parse_auth_url(FfiConverterString.lower(`url`),_status)
|
685
685
|
})
|
686
686
|
}
|
687
687
|
|
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
|
|