@synonymdev/react-native-pubky 0.3.0 → 0.5.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 +71 -5
- package/android/src/main/java/com/pubky/PubkyModule.kt +140 -0
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +187 -0
- package/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86_64/libpubkymobile.so +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +35 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +35 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +32 -0
- package/ios/Pubky.swift +84 -0
- package/ios/pubkymobile.swift +196 -0
- package/lib/commonjs/index.js +84 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +77 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +24 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +24 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +115 -2
package/README.md
CHANGED
@@ -12,11 +12,16 @@ npm install @synonymdev/react-native-pubky
|
|
12
12
|
### Implemented Methods
|
13
13
|
- [x] [auth](#auth): Authentication functionality.
|
14
14
|
- [x] [parseAuthUrl](#parseAuthUrl): Method to decode an authUrl.
|
15
|
+
- [x] [publish](#publish): Functionality to publish content.
|
16
|
+
- [x] [resolve](#resolve): Functionality to resolve content.
|
17
|
+
- [x] [publishHttps](#publishHttps): Publish HTTPS records.
|
18
|
+
- [x] [resolveHttps](#resolveHttps): Resolve HTTPS records.
|
15
19
|
### Methods to be Implemented
|
16
|
-
- [ ]
|
17
|
-
- [ ]
|
18
|
-
- [ ]
|
19
|
-
- [ ]
|
20
|
+
- [ ] signIn: Sign-in to a homeserver.
|
21
|
+
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
|
22
|
+
- [ ] signOut: Sign-out from a homeserver.
|
23
|
+
- [ ] put: Upload a small payload to a given path.
|
24
|
+
- [ ] get: Download a small payload from a given path relative to a pubky author.
|
20
25
|
|
21
26
|
|
22
27
|
## Usage
|
@@ -24,7 +29,10 @@ npm install @synonymdev/react-native-pubky
|
|
24
29
|
```js
|
25
30
|
import { auth } from '@synonymdev/react-native-pubky';
|
26
31
|
|
27
|
-
const authRes = await auth(
|
32
|
+
const authRes = await auth(
|
33
|
+
'pubkyauth:///?caps=/pub/pubky.app/:rw,/pub/foo.bar/file:r&secret=U55XnoH6vsMCpx1pxHtt8fReVg4Brvu9C0gUBuw-Jkw&relay=http://167.86.102.121:4173/',
|
34
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
35
|
+
);
|
28
36
|
if (authRes.isErr()) {
|
29
37
|
console.log(authRes.error.message);
|
30
38
|
return;
|
@@ -43,6 +51,64 @@ if (parseRes.isErr()) {
|
|
43
51
|
}
|
44
52
|
console.log(parseRes.value);
|
45
53
|
```
|
54
|
+
### <a name="publish"></a>publish
|
55
|
+
```js
|
56
|
+
import { publish } from '@synonymdev/react-native-pubky';
|
57
|
+
|
58
|
+
const publishRes = await publish(
|
59
|
+
'recordnametest',
|
60
|
+
'recordcontenttest',
|
61
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
62
|
+
);
|
63
|
+
if (publishRes.isErr()) {
|
64
|
+
console.log(publishRes.error.message);
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
console.log(publishRes.value);
|
68
|
+
```
|
69
|
+
### <a name="resolve"></a>resolve
|
70
|
+
```js
|
71
|
+
import { resolve } from '@synonymdev/react-native-pubky';
|
72
|
+
|
73
|
+
const resolveRes = await resolve(
|
74
|
+
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty'
|
75
|
+
);
|
76
|
+
if (resolveRes.isErr()) {
|
77
|
+
console.log(resolveRes.error.message);
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
console.log(resolveRes.value);
|
81
|
+
```
|
82
|
+
|
83
|
+
### <a name="publishHttps"></a>publishHttps
|
84
|
+
```js
|
85
|
+
import { publishHttps } from '@synonymdev/react-native-pubky';
|
86
|
+
|
87
|
+
const publishHttpsRes = await publishHttps(
|
88
|
+
'example.com', // Record Name
|
89
|
+
'target.example.com', // Target
|
90
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' // Secret Key
|
91
|
+
);
|
92
|
+
if (publishHttpsRes.isErr()) {
|
93
|
+
console.log(publishHttpsRes.error.message);
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
console.log(publishHttpsRes.value);
|
97
|
+
```
|
98
|
+
|
99
|
+
### <a name="resolveHttps"></a>resolveHttps
|
100
|
+
```js
|
101
|
+
import { resolveHttps } from '@synonymdev/react-native-pubky';
|
102
|
+
|
103
|
+
const resolveHttpsRes = await resolveHttps(
|
104
|
+
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty' // Public key
|
105
|
+
);
|
106
|
+
if (resolveHttpsRes.isErr()) {
|
107
|
+
console.log(resolveHttpsRes.error.message);
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
console.log(resolveHttpsRes.value);
|
111
|
+
```
|
46
112
|
|
47
113
|
## Local Installation
|
48
114
|
|
@@ -13,6 +13,13 @@ import uniffi.pubkymobile.auth
|
|
13
13
|
import uniffi.pubkymobile.parseAuthUrl
|
14
14
|
import uniffi.pubkymobile.publish
|
15
15
|
import uniffi.pubkymobile.resolve
|
16
|
+
import uniffi.pubkymobile.signUp
|
17
|
+
import uniffi.pubkymobile.signIn
|
18
|
+
import uniffi.pubkymobile.signOut
|
19
|
+
import uniffi.pubkymobile.put
|
20
|
+
import uniffi.pubkymobile.get
|
21
|
+
import uniffi.pubkymobile.publishHttps
|
22
|
+
import uniffi.pubkymobile.resolveHttps
|
16
23
|
|
17
24
|
class PubkyModule(reactContext: ReactApplicationContext) :
|
18
25
|
ReactContextBaseJavaModule(reactContext) {
|
@@ -91,6 +98,139 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
91
98
|
}
|
92
99
|
}
|
93
100
|
|
101
|
+
@ReactMethod
|
102
|
+
fun signUp(secretKey: String, homeserver: String, promise: Promise) {
|
103
|
+
CoroutineScope(Dispatchers.IO).launch {
|
104
|
+
try {
|
105
|
+
val result = signUp(secretKey, homeserver)
|
106
|
+
val array = Arguments.createArray().apply {
|
107
|
+
result.forEach { pushString(it) }
|
108
|
+
}
|
109
|
+
withContext(Dispatchers.Main) {
|
110
|
+
promise.resolve(array)
|
111
|
+
}
|
112
|
+
} catch (e: Exception) {
|
113
|
+
withContext(Dispatchers.Main) {
|
114
|
+
promise.reject("Error", e.message)
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
@ReactMethod
|
121
|
+
fun signIn(secretKey: String, promise: Promise) {
|
122
|
+
CoroutineScope(Dispatchers.IO).launch {
|
123
|
+
try {
|
124
|
+
val result = signIn(secretKey)
|
125
|
+
val array = Arguments.createArray().apply {
|
126
|
+
result.forEach { pushString(it) }
|
127
|
+
}
|
128
|
+
withContext(Dispatchers.Main) {
|
129
|
+
promise.resolve(array)
|
130
|
+
}
|
131
|
+
} catch (e: Exception) {
|
132
|
+
withContext(Dispatchers.Main) {
|
133
|
+
promise.reject("Error", e.message)
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
@ReactMethod
|
140
|
+
fun signOut(secretKey: String, promise: Promise) {
|
141
|
+
CoroutineScope(Dispatchers.IO).launch {
|
142
|
+
try {
|
143
|
+
val result = signOut(secretKey)
|
144
|
+
val array = Arguments.createArray().apply {
|
145
|
+
result.forEach { pushString(it) }
|
146
|
+
}
|
147
|
+
withContext(Dispatchers.Main) {
|
148
|
+
promise.resolve(array)
|
149
|
+
}
|
150
|
+
} catch (e: Exception) {
|
151
|
+
withContext(Dispatchers.Main) {
|
152
|
+
promise.reject("Error", e.message)
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
@ReactMethod
|
159
|
+
fun put(url: String, content: String, promise: Promise) {
|
160
|
+
CoroutineScope(Dispatchers.IO).launch {
|
161
|
+
try {
|
162
|
+
val result = put(url, content)
|
163
|
+
val array = Arguments.createArray().apply {
|
164
|
+
result.forEach { pushString(it) }
|
165
|
+
}
|
166
|
+
withContext(Dispatchers.Main) {
|
167
|
+
promise.resolve(array)
|
168
|
+
}
|
169
|
+
} catch (e: Exception) {
|
170
|
+
withContext(Dispatchers.Main) {
|
171
|
+
promise.reject("Error", e.message)
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
@ReactMethod
|
178
|
+
fun get(url: String, promise: Promise) {
|
179
|
+
CoroutineScope(Dispatchers.IO).launch {
|
180
|
+
try {
|
181
|
+
val result = get(url)
|
182
|
+
val array = Arguments.createArray().apply {
|
183
|
+
result.forEach { pushString(it) }
|
184
|
+
}
|
185
|
+
withContext(Dispatchers.Main) {
|
186
|
+
promise.resolve(array)
|
187
|
+
}
|
188
|
+
} catch (e: Exception) {
|
189
|
+
withContext(Dispatchers.Main) {
|
190
|
+
promise.reject("Error", e.message)
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
@ReactMethod
|
197
|
+
fun publishHttps(recordName: String, target: String, secretKey: String, promise: Promise) {
|
198
|
+
CoroutineScope(Dispatchers.IO).launch {
|
199
|
+
try {
|
200
|
+
val result = publishHttps(recordName, target, secretKey)
|
201
|
+
val array = Arguments.createArray().apply {
|
202
|
+
result.forEach { pushString(it) }
|
203
|
+
}
|
204
|
+
withContext(Dispatchers.Main) {
|
205
|
+
promise.resolve(array)
|
206
|
+
}
|
207
|
+
} catch (e: Exception) {
|
208
|
+
withContext(Dispatchers.Main) {
|
209
|
+
promise.reject("Error", e.message)
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
@ReactMethod
|
216
|
+
fun resolveHttps(publicKey: String, promise: Promise) {
|
217
|
+
CoroutineScope(Dispatchers.IO).launch {
|
218
|
+
try {
|
219
|
+
val result = resolveHttps(publicKey)
|
220
|
+
val array = Arguments.createArray().apply {
|
221
|
+
result.forEach { pushString(it) }
|
222
|
+
}
|
223
|
+
withContext(Dispatchers.Main) {
|
224
|
+
promise.resolve(array)
|
225
|
+
}
|
226
|
+
} catch (e: Exception) {
|
227
|
+
withContext(Dispatchers.Main) {
|
228
|
+
promise.reject("Error", e.message)
|
229
|
+
}
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
94
234
|
companion object {
|
95
235
|
const val NAME = "Pubky"
|
96
236
|
}
|
@@ -29,6 +29,9 @@ import java.nio.ByteOrder
|
|
29
29
|
import java.nio.CharBuffer
|
30
30
|
import java.nio.charset.CodingErrorAction
|
31
31
|
import java.util.concurrent.ConcurrentHashMap
|
32
|
+
import kotlin.coroutines.resume
|
33
|
+
import kotlinx.coroutines.CancellableContinuation
|
34
|
+
import kotlinx.coroutines.suspendCancellableCoroutine
|
32
35
|
|
33
36
|
// This is a helper for safely working with byte buffers returned from the Rust code.
|
34
37
|
// A rust-owned buffer is represented by its capacity, its current length, and a
|
@@ -377,18 +380,33 @@ internal interface _UniFFILib : Library {
|
|
377
380
|
.also { lib: _UniFFILib ->
|
378
381
|
uniffiCheckContractApiVersion(lib)
|
379
382
|
uniffiCheckApiChecksums(lib)
|
383
|
+
uniffiRustFutureContinuationCallback.register(lib)
|
380
384
|
}
|
381
385
|
}
|
382
386
|
}
|
383
387
|
|
384
388
|
fun uniffi_pubkymobile_fn_func_auth(`url`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
385
389
|
): RustBuffer.ByValue
|
390
|
+
fun uniffi_pubkymobile_fn_func_get(`url`: RustBuffer.ByValue,
|
391
|
+
): Pointer
|
386
392
|
fun uniffi_pubkymobile_fn_func_parse_auth_url(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
387
393
|
): RustBuffer.ByValue
|
388
394
|
fun uniffi_pubkymobile_fn_func_publish(`recordName`: RustBuffer.ByValue,`recordContent`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
389
395
|
): RustBuffer.ByValue
|
396
|
+
fun uniffi_pubkymobile_fn_func_publish_https(`recordName`: RustBuffer.ByValue,`target`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
397
|
+
): RustBuffer.ByValue
|
398
|
+
fun uniffi_pubkymobile_fn_func_put(`url`: RustBuffer.ByValue,`content`: RustBuffer.ByValue,
|
399
|
+
): Pointer
|
390
400
|
fun uniffi_pubkymobile_fn_func_resolve(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
391
401
|
): RustBuffer.ByValue
|
402
|
+
fun uniffi_pubkymobile_fn_func_resolve_https(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
403
|
+
): RustBuffer.ByValue
|
404
|
+
fun uniffi_pubkymobile_fn_func_sign_in(`secretKey`: RustBuffer.ByValue,
|
405
|
+
): Pointer
|
406
|
+
fun uniffi_pubkymobile_fn_func_sign_out(`secretKey`: RustBuffer.ByValue,
|
407
|
+
): Pointer
|
408
|
+
fun uniffi_pubkymobile_fn_func_sign_up(`secretKey`: RustBuffer.ByValue,`homeserver`: RustBuffer.ByValue,
|
409
|
+
): Pointer
|
392
410
|
fun ffi_pubkymobile_rustbuffer_alloc(`size`: Int,_uniffi_out_err: RustCallStatus,
|
393
411
|
): RustBuffer.ByValue
|
394
412
|
fun ffi_pubkymobile_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,_uniffi_out_err: RustCallStatus,
|
@@ -505,12 +523,26 @@ internal interface _UniFFILib : Library {
|
|
505
523
|
): Unit
|
506
524
|
fun uniffi_pubkymobile_checksum_func_auth(
|
507
525
|
): Short
|
526
|
+
fun uniffi_pubkymobile_checksum_func_get(
|
527
|
+
): Short
|
508
528
|
fun uniffi_pubkymobile_checksum_func_parse_auth_url(
|
509
529
|
): Short
|
510
530
|
fun uniffi_pubkymobile_checksum_func_publish(
|
511
531
|
): Short
|
532
|
+
fun uniffi_pubkymobile_checksum_func_publish_https(
|
533
|
+
): Short
|
534
|
+
fun uniffi_pubkymobile_checksum_func_put(
|
535
|
+
): Short
|
512
536
|
fun uniffi_pubkymobile_checksum_func_resolve(
|
513
537
|
): Short
|
538
|
+
fun uniffi_pubkymobile_checksum_func_resolve_https(
|
539
|
+
): Short
|
540
|
+
fun uniffi_pubkymobile_checksum_func_sign_in(
|
541
|
+
): Short
|
542
|
+
fun uniffi_pubkymobile_checksum_func_sign_out(
|
543
|
+
): Short
|
544
|
+
fun uniffi_pubkymobile_checksum_func_sign_up(
|
545
|
+
): Short
|
514
546
|
fun ffi_pubkymobile_uniffi_contract_version(
|
515
547
|
): Int
|
516
548
|
|
@@ -531,18 +563,83 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
|
531
563
|
if (lib.uniffi_pubkymobile_checksum_func_auth() != 61378.toShort()) {
|
532
564
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
533
565
|
}
|
566
|
+
if (lib.uniffi_pubkymobile_checksum_func_get() != 5395.toShort()) {
|
567
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
568
|
+
}
|
534
569
|
if (lib.uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088.toShort()) {
|
535
570
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
536
571
|
}
|
537
572
|
if (lib.uniffi_pubkymobile_checksum_func_publish() != 20156.toShort()) {
|
538
573
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
539
574
|
}
|
575
|
+
if (lib.uniffi_pubkymobile_checksum_func_publish_https() != 14705.toShort()) {
|
576
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
577
|
+
}
|
578
|
+
if (lib.uniffi_pubkymobile_checksum_func_put() != 47594.toShort()) {
|
579
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
580
|
+
}
|
540
581
|
if (lib.uniffi_pubkymobile_checksum_func_resolve() != 18303.toShort()) {
|
541
582
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
542
583
|
}
|
584
|
+
if (lib.uniffi_pubkymobile_checksum_func_resolve_https() != 34593.toShort()) {
|
585
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
586
|
+
}
|
587
|
+
if (lib.uniffi_pubkymobile_checksum_func_sign_in() != 53969.toShort()) {
|
588
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
589
|
+
}
|
590
|
+
if (lib.uniffi_pubkymobile_checksum_func_sign_out() != 32961.toShort()) {
|
591
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
592
|
+
}
|
593
|
+
if (lib.uniffi_pubkymobile_checksum_func_sign_up() != 28083.toShort()) {
|
594
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
595
|
+
}
|
543
596
|
}
|
544
597
|
|
545
598
|
// Async support
|
599
|
+
// Async return type handlers
|
600
|
+
|
601
|
+
internal const val UNIFFI_RUST_FUTURE_POLL_READY = 0.toShort()
|
602
|
+
internal const val UNIFFI_RUST_FUTURE_POLL_MAYBE_READY = 1.toShort()
|
603
|
+
|
604
|
+
internal val uniffiContinuationHandleMap = UniFfiHandleMap<CancellableContinuation<Short>>()
|
605
|
+
|
606
|
+
// FFI type for Rust future continuations
|
607
|
+
internal object uniffiRustFutureContinuationCallback: UniFffiRustFutureContinuationCallbackType {
|
608
|
+
override fun callback(continuationHandle: USize, pollResult: Short) {
|
609
|
+
uniffiContinuationHandleMap.remove(continuationHandle)?.resume(pollResult)
|
610
|
+
}
|
611
|
+
|
612
|
+
internal fun register(lib: _UniFFILib) {
|
613
|
+
lib.ffi_pubkymobile_rust_future_continuation_callback_set(this)
|
614
|
+
}
|
615
|
+
}
|
616
|
+
|
617
|
+
internal suspend fun<T, F, E: Exception> uniffiRustCallAsync(
|
618
|
+
rustFuture: Pointer,
|
619
|
+
pollFunc: (Pointer, USize) -> Unit,
|
620
|
+
completeFunc: (Pointer, RustCallStatus) -> F,
|
621
|
+
freeFunc: (Pointer) -> Unit,
|
622
|
+
liftFunc: (F) -> T,
|
623
|
+
errorHandler: CallStatusErrorHandler<E>
|
624
|
+
): T {
|
625
|
+
try {
|
626
|
+
do {
|
627
|
+
val pollResult = suspendCancellableCoroutine<Short> { continuation ->
|
628
|
+
pollFunc(
|
629
|
+
rustFuture,
|
630
|
+
uniffiContinuationHandleMap.insert(continuation)
|
631
|
+
)
|
632
|
+
}
|
633
|
+
} while (pollResult != UNIFFI_RUST_FUTURE_POLL_READY);
|
634
|
+
|
635
|
+
return liftFunc(
|
636
|
+
rustCallWithError(errorHandler, { status -> completeFunc(rustFuture, status) })
|
637
|
+
)
|
638
|
+
} finally {
|
639
|
+
freeFunc(rustFuture)
|
640
|
+
}
|
641
|
+
}
|
642
|
+
|
546
643
|
|
547
644
|
// Public interface members begin here.
|
548
645
|
|
@@ -626,6 +723,10 @@ public object FfiConverterSequenceString: FfiConverterRustBuffer<List<String>> {
|
|
626
723
|
}
|
627
724
|
}
|
628
725
|
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
|
629
730
|
fun `auth`(`url`: String, `secretKey`: String): List<String> {
|
630
731
|
return FfiConverterSequenceString.lift(
|
631
732
|
rustCall() { _status ->
|
@@ -634,6 +735,20 @@ fun `auth`(`url`: String, `secretKey`: String): List<String> {
|
|
634
735
|
}
|
635
736
|
|
636
737
|
|
738
|
+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
739
|
+
suspend fun `get`(`url`: String) : List<String> {
|
740
|
+
return uniffiRustCallAsync(
|
741
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_get(FfiConverterString.lower(`url`),),
|
742
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
743
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
744
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
745
|
+
// lift function
|
746
|
+
{ FfiConverterSequenceString.lift(it) },
|
747
|
+
// Error FFI converter
|
748
|
+
NullCallStatusErrorHandler,
|
749
|
+
)
|
750
|
+
}
|
751
|
+
|
637
752
|
fun `parseAuthUrl`(`url`: String): List<String> {
|
638
753
|
return FfiConverterSequenceString.lift(
|
639
754
|
rustCall() { _status ->
|
@@ -650,6 +765,28 @@ fun `publish`(`recordName`: String, `recordContent`: String, `secretKey`: String
|
|
650
765
|
}
|
651
766
|
|
652
767
|
|
768
|
+
fun `publishHttps`(`recordName`: String, `target`: String, `secretKey`: String): List<String> {
|
769
|
+
return FfiConverterSequenceString.lift(
|
770
|
+
rustCall() { _status ->
|
771
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_publish_https(FfiConverterString.lower(`recordName`),FfiConverterString.lower(`target`),FfiConverterString.lower(`secretKey`),_status)
|
772
|
+
})
|
773
|
+
}
|
774
|
+
|
775
|
+
|
776
|
+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
777
|
+
suspend fun `put`(`url`: String, `content`: String) : List<String> {
|
778
|
+
return uniffiRustCallAsync(
|
779
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_put(FfiConverterString.lower(`url`),FfiConverterString.lower(`content`),),
|
780
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
781
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
782
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
783
|
+
// lift function
|
784
|
+
{ FfiConverterSequenceString.lift(it) },
|
785
|
+
// Error FFI converter
|
786
|
+
NullCallStatusErrorHandler,
|
787
|
+
)
|
788
|
+
}
|
789
|
+
|
653
790
|
fun `resolve`(`publicKey`: String): List<String> {
|
654
791
|
return FfiConverterSequenceString.lift(
|
655
792
|
rustCall() { _status ->
|
@@ -658,3 +795,53 @@ fun `resolve`(`publicKey`: String): List<String> {
|
|
658
795
|
}
|
659
796
|
|
660
797
|
|
798
|
+
fun `resolveHttps`(`publicKey`: String): List<String> {
|
799
|
+
return FfiConverterSequenceString.lift(
|
800
|
+
rustCall() { _status ->
|
801
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_resolve_https(FfiConverterString.lower(`publicKey`),_status)
|
802
|
+
})
|
803
|
+
}
|
804
|
+
|
805
|
+
|
806
|
+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
807
|
+
suspend fun `signIn`(`secretKey`: String) : List<String> {
|
808
|
+
return uniffiRustCallAsync(
|
809
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_sign_in(FfiConverterString.lower(`secretKey`),),
|
810
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
811
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
812
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
813
|
+
// lift function
|
814
|
+
{ FfiConverterSequenceString.lift(it) },
|
815
|
+
// Error FFI converter
|
816
|
+
NullCallStatusErrorHandler,
|
817
|
+
)
|
818
|
+
}
|
819
|
+
|
820
|
+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
821
|
+
suspend fun `signOut`(`secretKey`: String) : List<String> {
|
822
|
+
return uniffiRustCallAsync(
|
823
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_sign_out(FfiConverterString.lower(`secretKey`),),
|
824
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
825
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
826
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
827
|
+
// lift function
|
828
|
+
{ FfiConverterSequenceString.lift(it) },
|
829
|
+
// Error FFI converter
|
830
|
+
NullCallStatusErrorHandler,
|
831
|
+
)
|
832
|
+
}
|
833
|
+
|
834
|
+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
835
|
+
suspend fun `signUp`(`secretKey`: String, `homeserver`: String) : List<String> {
|
836
|
+
return uniffiRustCallAsync(
|
837
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_sign_up(FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),),
|
838
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_poll_rust_buffer(future, continuation) },
|
839
|
+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_complete_rust_buffer(future, continuation) },
|
840
|
+
{ future -> _UniFFILib.INSTANCE.ffi_pubkymobile_rust_future_free_rust_buffer(future) },
|
841
|
+
// lift function
|
842
|
+
{ FfiConverterSequenceString.lift(it) },
|
843
|
+
// Error FFI converter
|
844
|
+
NullCallStatusErrorHandler,
|
845
|
+
)
|
846
|
+
}
|
847
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -65,12 +65,26 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
67
|
);
|
68
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
|
+
);
|
68
70
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
69
71
|
);
|
70
72
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
71
73
|
);
|
74
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
76
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
77
|
+
);
|
72
78
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
73
79
|
);
|
80
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
|
+
);
|
82
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
83
|
+
);
|
84
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
85
|
+
);
|
86
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_up(RustBuffer secret_key, RustBuffer homeserver
|
87
|
+
);
|
74
88
|
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
75
89
|
);
|
76
90
|
RustBuffer ffi_pubkymobile_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
|
@@ -187,15 +201,36 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
187
201
|
);
|
188
202
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
189
203
|
|
204
|
+
);
|
205
|
+
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
206
|
+
|
190
207
|
);
|
191
208
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
192
209
|
|
193
210
|
);
|
194
211
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
195
212
|
|
213
|
+
);
|
214
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
215
|
+
|
216
|
+
);
|
217
|
+
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
218
|
+
|
196
219
|
);
|
197
220
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
198
221
|
|
222
|
+
);
|
223
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
224
|
+
|
225
|
+
);
|
226
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
227
|
+
|
228
|
+
);
|
229
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_out(void
|
230
|
+
|
231
|
+
);
|
232
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_up(void
|
233
|
+
|
199
234
|
);
|
200
235
|
uint32_t ffi_pubkymobile_uniffi_contract_version(void
|
201
236
|
|
Binary file
|
@@ -65,12 +65,26 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
67
|
);
|
68
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
|
+
);
|
68
70
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
69
71
|
);
|
70
72
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
71
73
|
);
|
74
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
76
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
77
|
+
);
|
72
78
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
73
79
|
);
|
80
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
|
+
);
|
82
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
83
|
+
);
|
84
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
85
|
+
);
|
86
|
+
void* _Nonnull uniffi_pubkymobile_fn_func_sign_up(RustBuffer secret_key, RustBuffer homeserver
|
87
|
+
);
|
74
88
|
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
75
89
|
);
|
76
90
|
RustBuffer ffi_pubkymobile_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
|
@@ -187,15 +201,36 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
187
201
|
);
|
188
202
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
189
203
|
|
204
|
+
);
|
205
|
+
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
206
|
+
|
190
207
|
);
|
191
208
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
192
209
|
|
193
210
|
);
|
194
211
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
195
212
|
|
213
|
+
);
|
214
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
215
|
+
|
216
|
+
);
|
217
|
+
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
218
|
+
|
196
219
|
);
|
197
220
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
198
221
|
|
222
|
+
);
|
223
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
224
|
+
|
225
|
+
);
|
226
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
227
|
+
|
228
|
+
);
|
229
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_out(void
|
230
|
+
|
231
|
+
);
|
232
|
+
uint16_t uniffi_pubkymobile_checksum_func_sign_up(void
|
233
|
+
|
199
234
|
);
|
200
235
|
uint32_t ffi_pubkymobile_uniffi_contract_version(void
|
201
236
|
|