@synonymdev/react-native-pubky 0.11.0 → 0.11.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/android/src/main/java/uniffi/pubkycore/pubkycore.kt +825 -1401
- package/android/src/main/jniLibs/arm64-v8a/libpubkycore.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libpubkycore.so +0 -0
- package/android/src/main/jniLibs/x86/libpubkycore.so +0 -0
- package/android/src/main/jniLibs/x86_64/libpubkycore.so +0 -0
- package/ios/Frameworks/PubkyCore.xcframework/Info.plist +4 -4
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64/Headers/module.modulemap +2 -3
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64/Headers/pubkycoreFFI.h +129 -683
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64/libpubkycore.a +0 -0
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64-simulator/Headers/module.modulemap +2 -3
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64-simulator/Headers/pubkycoreFFI.h +129 -683
- package/ios/Frameworks/PubkyCore.xcframework/ios-arm64-simulator/libpubkycore.a +0 -0
- package/ios/pubkycore.swift +503 -561
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
@file:Suppress("NAME_SHADOWING")
|
|
5
5
|
|
|
6
|
-
package uniffi.pubkycore
|
|
6
|
+
package uniffi.pubkycore;
|
|
7
7
|
|
|
8
8
|
// Common helper code.
|
|
9
9
|
//
|
|
@@ -28,54 +28,44 @@ import java.nio.ByteBuffer
|
|
|
28
28
|
import java.nio.ByteOrder
|
|
29
29
|
import java.nio.CharBuffer
|
|
30
30
|
import java.nio.charset.CodingErrorAction
|
|
31
|
-
import java.util.concurrent.atomic.AtomicLong
|
|
32
31
|
import java.util.concurrent.ConcurrentHashMap
|
|
33
32
|
import java.util.concurrent.atomic.AtomicBoolean
|
|
33
|
+
import java.util.concurrent.atomic.AtomicLong
|
|
34
|
+
import java.util.concurrent.locks.ReentrantLock
|
|
35
|
+
import kotlin.concurrent.withLock
|
|
34
36
|
|
|
35
37
|
// This is a helper for safely working with byte buffers returned from the Rust code.
|
|
36
38
|
// A rust-owned buffer is represented by its capacity, its current length, and a
|
|
37
39
|
// pointer to the underlying data.
|
|
38
40
|
|
|
39
|
-
/**
|
|
40
|
-
* @suppress
|
|
41
|
-
*/
|
|
42
41
|
@Structure.FieldOrder("capacity", "len", "data")
|
|
43
42
|
open class RustBuffer : Structure() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@JvmField var capacity: Long = 0
|
|
47
|
-
@JvmField var len: Long = 0
|
|
43
|
+
@JvmField var capacity: Int = 0
|
|
44
|
+
@JvmField var len: Int = 0
|
|
48
45
|
@JvmField var data: Pointer? = null
|
|
49
46
|
|
|
50
47
|
class ByValue: RustBuffer(), Structure.ByValue
|
|
51
48
|
class ByReference: RustBuffer(), Structure.ByReference
|
|
52
49
|
|
|
53
|
-
internal fun setValue(other: RustBuffer) {
|
|
54
|
-
capacity = other.capacity
|
|
55
|
-
len = other.len
|
|
56
|
-
data = other.data
|
|
57
|
-
}
|
|
58
|
-
|
|
59
50
|
companion object {
|
|
60
|
-
internal fun alloc(size:
|
|
61
|
-
|
|
62
|
-
UniffiLib.INSTANCE.ffi_pubkycore_rustbuffer_alloc(size.toLong(), status)
|
|
51
|
+
internal fun alloc(size: Int = 0) = rustCall() { status ->
|
|
52
|
+
_UniFFILib.INSTANCE.ffi_pubkycore_rustbuffer_alloc(size, status)
|
|
63
53
|
}.also {
|
|
64
54
|
if(it.data == null) {
|
|
65
55
|
throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
|
|
66
56
|
}
|
|
67
57
|
}
|
|
68
58
|
|
|
69
|
-
internal fun create(capacity:
|
|
59
|
+
internal fun create(capacity: Int, len: Int, data: Pointer?): RustBuffer.ByValue {
|
|
70
60
|
var buf = RustBuffer.ByValue()
|
|
71
|
-
buf.capacity = capacity
|
|
72
|
-
buf.len = len
|
|
61
|
+
buf.capacity = capacity
|
|
62
|
+
buf.len = len
|
|
73
63
|
buf.data = data
|
|
74
64
|
return buf
|
|
75
65
|
}
|
|
76
66
|
|
|
77
|
-
internal fun free(buf: RustBuffer.ByValue) =
|
|
78
|
-
|
|
67
|
+
internal fun free(buf: RustBuffer.ByValue) = rustCall() { status ->
|
|
68
|
+
_UniFFILib.INSTANCE.ffi_pubkycore_rustbuffer_free(buf, status)
|
|
79
69
|
}
|
|
80
70
|
}
|
|
81
71
|
|
|
@@ -91,8 +81,6 @@ open class RustBuffer : Structure() {
|
|
|
91
81
|
* Required for callbacks taking in an out pointer.
|
|
92
82
|
*
|
|
93
83
|
* Size is the sum of all values in the struct.
|
|
94
|
-
*
|
|
95
|
-
* @suppress
|
|
96
84
|
*/
|
|
97
85
|
class RustBufferByReference : ByReference(16) {
|
|
98
86
|
/**
|
|
@@ -101,9 +89,9 @@ class RustBufferByReference : ByReference(16) {
|
|
|
101
89
|
fun setValue(value: RustBuffer.ByValue) {
|
|
102
90
|
// NOTE: The offsets are as they are in the C-like struct.
|
|
103
91
|
val pointer = getPointer()
|
|
104
|
-
pointer.
|
|
105
|
-
pointer.
|
|
106
|
-
pointer.setPointer(
|
|
92
|
+
pointer.setInt(0, value.capacity)
|
|
93
|
+
pointer.setInt(4, value.len)
|
|
94
|
+
pointer.setPointer(8, value.data)
|
|
107
95
|
}
|
|
108
96
|
|
|
109
97
|
/**
|
|
@@ -112,9 +100,9 @@ class RustBufferByReference : ByReference(16) {
|
|
|
112
100
|
fun getValue(): RustBuffer.ByValue {
|
|
113
101
|
val pointer = getPointer()
|
|
114
102
|
val value = RustBuffer.ByValue()
|
|
115
|
-
value.writeField("capacity", pointer.
|
|
116
|
-
value.writeField("len", pointer.
|
|
117
|
-
value.writeField("data", pointer.
|
|
103
|
+
value.writeField("capacity", pointer.getInt(0))
|
|
104
|
+
value.writeField("len", pointer.getInt(4))
|
|
105
|
+
value.writeField("data", pointer.getPointer(8))
|
|
118
106
|
|
|
119
107
|
return value
|
|
120
108
|
}
|
|
@@ -127,20 +115,16 @@ class RustBufferByReference : ByReference(16) {
|
|
|
127
115
|
// completeness.
|
|
128
116
|
|
|
129
117
|
@Structure.FieldOrder("len", "data")
|
|
130
|
-
|
|
118
|
+
open class ForeignBytes : Structure() {
|
|
131
119
|
@JvmField var len: Int = 0
|
|
132
120
|
@JvmField var data: Pointer? = null
|
|
133
121
|
|
|
134
122
|
class ByValue : ForeignBytes(), Structure.ByValue
|
|
135
123
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
* type is external we need to import it's FfiConverter.
|
|
141
|
-
*
|
|
142
|
-
* @suppress
|
|
143
|
-
*/
|
|
124
|
+
// The FfiConverter interface handles converter types to and from the FFI
|
|
125
|
+
//
|
|
126
|
+
// All implementing objects should be public to support external types. When a
|
|
127
|
+
// type is external we need to import it's FfiConverter.
|
|
144
128
|
public interface FfiConverter<KotlinType, FfiType> {
|
|
145
129
|
// Convert an FFI type to a Kotlin type
|
|
146
130
|
fun lift(value: FfiType): KotlinType
|
|
@@ -159,7 +143,7 @@ public interface FfiConverter<KotlinType, FfiType> {
|
|
|
159
143
|
// encoding, so we pessimistically allocate the largest size possible (3
|
|
160
144
|
// bytes per codepoint). Allocating extra bytes is not really a big deal
|
|
161
145
|
// because the `RustBuffer` is short-lived.
|
|
162
|
-
fun allocationSize(value: KotlinType):
|
|
146
|
+
fun allocationSize(value: KotlinType): Int
|
|
163
147
|
|
|
164
148
|
// Write a Kotlin type to a `ByteBuffer`
|
|
165
149
|
fun write(value: KotlinType, buf: ByteBuffer)
|
|
@@ -173,11 +157,11 @@ public interface FfiConverter<KotlinType, FfiType> {
|
|
|
173
157
|
fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
|
|
174
158
|
val rbuf = RustBuffer.alloc(allocationSize(value))
|
|
175
159
|
try {
|
|
176
|
-
val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
|
|
160
|
+
val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity.toLong()).also {
|
|
177
161
|
it.order(ByteOrder.BIG_ENDIAN)
|
|
178
162
|
}
|
|
179
163
|
write(value, bbuf)
|
|
180
|
-
rbuf.writeField("len", bbuf.position()
|
|
164
|
+
rbuf.writeField("len", bbuf.position())
|
|
181
165
|
return rbuf
|
|
182
166
|
} catch (e: Throwable) {
|
|
183
167
|
RustBuffer.free(rbuf)
|
|
@@ -203,59 +187,38 @@ public interface FfiConverter<KotlinType, FfiType> {
|
|
|
203
187
|
}
|
|
204
188
|
}
|
|
205
189
|
|
|
206
|
-
|
|
207
|
-
* FfiConverter that uses `RustBuffer` as the FfiType
|
|
208
|
-
*
|
|
209
|
-
* @suppress
|
|
210
|
-
*/
|
|
190
|
+
// FfiConverter that uses `RustBuffer` as the FfiType
|
|
211
191
|
public interface FfiConverterRustBuffer<KotlinType>: FfiConverter<KotlinType, RustBuffer.ByValue> {
|
|
212
192
|
override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
|
|
213
193
|
override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
|
|
214
194
|
}
|
|
215
195
|
// A handful of classes and functions to support the generated data structures.
|
|
216
196
|
// This would be a good candidate for isolating in its own ffi-support lib.
|
|
217
|
-
|
|
218
|
-
internal const val UNIFFI_CALL_SUCCESS = 0.toByte()
|
|
219
|
-
internal const val UNIFFI_CALL_ERROR = 1.toByte()
|
|
220
|
-
internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
|
|
221
|
-
|
|
197
|
+
// Error runtime.
|
|
222
198
|
@Structure.FieldOrder("code", "error_buf")
|
|
223
|
-
internal open class
|
|
199
|
+
internal open class RustCallStatus : Structure() {
|
|
224
200
|
@JvmField var code: Byte = 0
|
|
225
201
|
@JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
|
|
226
202
|
|
|
227
|
-
class ByValue:
|
|
203
|
+
class ByValue: RustCallStatus(), Structure.ByValue
|
|
228
204
|
|
|
229
205
|
fun isSuccess(): Boolean {
|
|
230
|
-
return code ==
|
|
206
|
+
return code == 0.toByte()
|
|
231
207
|
}
|
|
232
208
|
|
|
233
209
|
fun isError(): Boolean {
|
|
234
|
-
return code ==
|
|
210
|
+
return code == 1.toByte()
|
|
235
211
|
}
|
|
236
212
|
|
|
237
213
|
fun isPanic(): Boolean {
|
|
238
|
-
return code ==
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
companion object {
|
|
242
|
-
fun create(code: Byte, errorBuf: RustBuffer.ByValue): UniffiRustCallStatus.ByValue {
|
|
243
|
-
val callStatus = UniffiRustCallStatus.ByValue()
|
|
244
|
-
callStatus.code = code
|
|
245
|
-
callStatus.error_buf = errorBuf
|
|
246
|
-
return callStatus
|
|
247
|
-
}
|
|
214
|
+
return code == 2.toByte()
|
|
248
215
|
}
|
|
249
216
|
}
|
|
250
217
|
|
|
251
|
-
class InternalException(message: String) :
|
|
218
|
+
class InternalException(message: String) : Exception(message)
|
|
252
219
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
* @suppress
|
|
257
|
-
*/
|
|
258
|
-
interface UniffiRustCallStatusErrorHandler<E> {
|
|
220
|
+
// Each top-level error class has a companion object that can lift the error from the call status's rust buffer
|
|
221
|
+
interface CallStatusErrorHandler<E> {
|
|
259
222
|
fun lift(error_buf: RustBuffer.ByValue): E;
|
|
260
223
|
}
|
|
261
224
|
|
|
@@ -264,15 +227,15 @@ interface UniffiRustCallStatusErrorHandler<E> {
|
|
|
264
227
|
// synchronize itself
|
|
265
228
|
|
|
266
229
|
// Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
|
|
267
|
-
private inline fun <U, E:
|
|
268
|
-
var status =
|
|
230
|
+
private inline fun <U, E: Exception> rustCallWithError(errorHandler: CallStatusErrorHandler<E>, callback: (RustCallStatus) -> U): U {
|
|
231
|
+
var status = RustCallStatus();
|
|
269
232
|
val return_value = callback(status)
|
|
270
|
-
|
|
233
|
+
checkCallStatus(errorHandler, status)
|
|
271
234
|
return return_value
|
|
272
235
|
}
|
|
273
236
|
|
|
274
|
-
// Check
|
|
275
|
-
private fun<E:
|
|
237
|
+
// Check RustCallStatus and throw an error if the call wasn't successful
|
|
238
|
+
private fun<E: Exception> checkCallStatus(errorHandler: CallStatusErrorHandler<E>, status: RustCallStatus) {
|
|
276
239
|
if (status.isSuccess()) {
|
|
277
240
|
return
|
|
278
241
|
} else if (status.isError()) {
|
|
@@ -291,12 +254,8 @@ private fun<E: kotlin.Exception> uniffiCheckCallStatus(errorHandler: UniffiRustC
|
|
|
291
254
|
}
|
|
292
255
|
}
|
|
293
256
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
* @suppress
|
|
298
|
-
*/
|
|
299
|
-
object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler<InternalException> {
|
|
257
|
+
// CallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR
|
|
258
|
+
object NullCallStatusErrorHandler: CallStatusErrorHandler<InternalException> {
|
|
300
259
|
override fun lift(error_buf: RustBuffer.ByValue): InternalException {
|
|
301
260
|
RustBuffer.free(error_buf)
|
|
302
261
|
return InternalException("Unexpected CALL_ERROR")
|
|
@@ -304,69 +263,97 @@ object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler<In
|
|
|
304
263
|
}
|
|
305
264
|
|
|
306
265
|
// Call a rust function that returns a plain value
|
|
307
|
-
private inline fun <U>
|
|
308
|
-
return
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
266
|
+
private inline fun <U> rustCall(callback: (RustCallStatus) -> U): U {
|
|
267
|
+
return rustCallWithError(NullCallStatusErrorHandler, callback);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// IntegerType that matches Rust's `usize` / C's `size_t`
|
|
271
|
+
public class USize(value: Long = 0) : IntegerType(Native.SIZE_T_SIZE, value, true) {
|
|
272
|
+
// This is needed to fill in the gaps of IntegerType's implementation of Number for Kotlin.
|
|
273
|
+
override fun toByte() = toInt().toByte()
|
|
274
|
+
// Needed until https://youtrack.jetbrains.com/issue/KT-47902 is fixed.
|
|
275
|
+
@Deprecated("`toInt().toChar()` is deprecated")
|
|
276
|
+
override fun toChar() = toInt().toChar()
|
|
277
|
+
override fun toShort() = toInt().toShort()
|
|
278
|
+
|
|
279
|
+
fun writeToBuffer(buf: ByteBuffer) {
|
|
280
|
+
// Make sure we always write usize integers using native byte-order, since they may be
|
|
281
|
+
// casted to pointer values
|
|
282
|
+
buf.order(ByteOrder.nativeOrder())
|
|
283
|
+
try {
|
|
284
|
+
when (Native.SIZE_T_SIZE) {
|
|
285
|
+
4 -> buf.putInt(toInt())
|
|
286
|
+
8 -> buf.putLong(toLong())
|
|
287
|
+
else -> throw RuntimeException("Invalid SIZE_T_SIZE: ${Native.SIZE_T_SIZE}")
|
|
288
|
+
}
|
|
289
|
+
} finally {
|
|
290
|
+
buf.order(ByteOrder.BIG_ENDIAN)
|
|
291
|
+
}
|
|
321
292
|
}
|
|
322
|
-
}
|
|
323
293
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
294
|
+
companion object {
|
|
295
|
+
val size: Int
|
|
296
|
+
get() = Native.SIZE_T_SIZE
|
|
297
|
+
|
|
298
|
+
fun readFromBuffer(buf: ByteBuffer) : USize {
|
|
299
|
+
// Make sure we always read usize integers using native byte-order, since they may be
|
|
300
|
+
// casted from pointer values
|
|
301
|
+
buf.order(ByteOrder.nativeOrder())
|
|
302
|
+
try {
|
|
303
|
+
return when (Native.SIZE_T_SIZE) {
|
|
304
|
+
4 -> USize(buf.getInt().toLong())
|
|
305
|
+
8 -> USize(buf.getLong())
|
|
306
|
+
else -> throw RuntimeException("Invalid SIZE_T_SIZE: ${Native.SIZE_T_SIZE}")
|
|
307
|
+
}
|
|
308
|
+
} finally {
|
|
309
|
+
buf.order(ByteOrder.BIG_ENDIAN)
|
|
310
|
+
}
|
|
339
311
|
}
|
|
340
312
|
}
|
|
341
313
|
}
|
|
314
|
+
|
|
315
|
+
|
|
342
316
|
// Map handles to objects
|
|
343
317
|
//
|
|
344
|
-
// This is used
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
318
|
+
// This is used when the Rust code expects an opaque pointer to represent some foreign object.
|
|
319
|
+
// Normally we would pass a pointer to the object, but JNA doesn't support getting a pointer from an
|
|
320
|
+
// object reference , nor does it support leaking a reference to Rust.
|
|
321
|
+
//
|
|
322
|
+
// Instead, this class maps USize values to objects so that we can pass a pointer-sized type to
|
|
323
|
+
// Rust when it needs an opaque pointer.
|
|
324
|
+
//
|
|
325
|
+
// TODO: refactor callbacks to use this class
|
|
326
|
+
internal class UniFfiHandleMap<T: Any> {
|
|
327
|
+
private val map = ConcurrentHashMap<USize, T>()
|
|
328
|
+
// Use AtomicInteger for our counter, since we may be on a 32-bit system. 4 billion possible
|
|
329
|
+
// values seems like enough. If somehow we generate 4 billion handles, then this will wrap
|
|
330
|
+
// around back to zero and we can assume the first handle generated will have been dropped by
|
|
331
|
+
// then.
|
|
332
|
+
private val counter = java.util.concurrent.atomic.AtomicInteger(0)
|
|
348
333
|
|
|
349
334
|
val size: Int
|
|
350
335
|
get() = map.size
|
|
351
336
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
val handle = counter.getAndAdd(1)
|
|
337
|
+
fun insert(obj: T): USize {
|
|
338
|
+
val handle = USize(counter.getAndAdd(1).toLong())
|
|
355
339
|
map.put(handle, obj)
|
|
356
340
|
return handle
|
|
357
341
|
}
|
|
358
342
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
|
|
343
|
+
fun get(handle: USize): T? {
|
|
344
|
+
return map.get(handle)
|
|
362
345
|
}
|
|
363
346
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
|
|
347
|
+
fun remove(handle: USize): T? {
|
|
348
|
+
return map.remove(handle)
|
|
367
349
|
}
|
|
368
350
|
}
|
|
369
351
|
|
|
352
|
+
// FFI type for Rust future continuations
|
|
353
|
+
internal interface UniFffiRustFutureContinuationCallbackType : com.sun.jna.Callback {
|
|
354
|
+
fun callback(continuationHandle: USize, pollResult: Short);
|
|
355
|
+
}
|
|
356
|
+
|
|
370
357
|
// Contains loading, initialization code,
|
|
371
358
|
// and the FFI Function declarations in a com.sun.jna.Library.
|
|
372
359
|
@Synchronized
|
|
@@ -384,988 +371,364 @@ private inline fun <reified Lib : Library> loadIndirect(
|
|
|
384
371
|
return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
|
|
385
372
|
}
|
|
386
373
|
|
|
387
|
-
// Define FFI callback types
|
|
388
|
-
internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
|
|
389
|
-
fun callback(`data`: Long,`pollResult`: Byte,)
|
|
390
|
-
}
|
|
391
|
-
internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
|
|
392
|
-
fun callback(`handle`: Long,)
|
|
393
|
-
}
|
|
394
|
-
internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
|
|
395
|
-
fun callback(`handle`: Long,)
|
|
396
|
-
}
|
|
397
|
-
@Structure.FieldOrder("handle", "free")
|
|
398
|
-
internal open class UniffiForeignFuture(
|
|
399
|
-
@JvmField internal var `handle`: Long = 0.toLong(),
|
|
400
|
-
@JvmField internal var `free`: UniffiForeignFutureFree? = null,
|
|
401
|
-
) : Structure() {
|
|
402
|
-
class UniffiByValue(
|
|
403
|
-
`handle`: Long = 0.toLong(),
|
|
404
|
-
`free`: UniffiForeignFutureFree? = null,
|
|
405
|
-
): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue
|
|
406
|
-
|
|
407
|
-
internal fun uniffiSetValue(other: UniffiForeignFuture) {
|
|
408
|
-
`handle` = other.`handle`
|
|
409
|
-
`free` = other.`free`
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
414
|
-
internal open class UniffiForeignFutureStructU8(
|
|
415
|
-
@JvmField internal var `returnValue`: Byte = 0.toByte(),
|
|
416
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
417
|
-
) : Structure() {
|
|
418
|
-
class UniffiByValue(
|
|
419
|
-
`returnValue`: Byte = 0.toByte(),
|
|
420
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
421
|
-
): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue
|
|
422
|
-
|
|
423
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
|
|
424
|
-
`returnValue` = other.`returnValue`
|
|
425
|
-
`callStatus` = other.`callStatus`
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
|
|
430
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,)
|
|
431
|
-
}
|
|
432
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
433
|
-
internal open class UniffiForeignFutureStructI8(
|
|
434
|
-
@JvmField internal var `returnValue`: Byte = 0.toByte(),
|
|
435
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
436
|
-
) : Structure() {
|
|
437
|
-
class UniffiByValue(
|
|
438
|
-
`returnValue`: Byte = 0.toByte(),
|
|
439
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
440
|
-
): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue
|
|
441
|
-
|
|
442
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
|
|
443
|
-
`returnValue` = other.`returnValue`
|
|
444
|
-
`callStatus` = other.`callStatus`
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
|
|
449
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,)
|
|
450
|
-
}
|
|
451
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
452
|
-
internal open class UniffiForeignFutureStructU16(
|
|
453
|
-
@JvmField internal var `returnValue`: Short = 0.toShort(),
|
|
454
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
455
|
-
) : Structure() {
|
|
456
|
-
class UniffiByValue(
|
|
457
|
-
`returnValue`: Short = 0.toShort(),
|
|
458
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
459
|
-
): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue
|
|
460
|
-
|
|
461
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
|
|
462
|
-
`returnValue` = other.`returnValue`
|
|
463
|
-
`callStatus` = other.`callStatus`
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
|
|
468
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,)
|
|
469
|
-
}
|
|
470
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
471
|
-
internal open class UniffiForeignFutureStructI16(
|
|
472
|
-
@JvmField internal var `returnValue`: Short = 0.toShort(),
|
|
473
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
474
|
-
) : Structure() {
|
|
475
|
-
class UniffiByValue(
|
|
476
|
-
`returnValue`: Short = 0.toShort(),
|
|
477
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
478
|
-
): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue
|
|
479
|
-
|
|
480
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
|
|
481
|
-
`returnValue` = other.`returnValue`
|
|
482
|
-
`callStatus` = other.`callStatus`
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
|
|
487
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,)
|
|
488
|
-
}
|
|
489
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
490
|
-
internal open class UniffiForeignFutureStructU32(
|
|
491
|
-
@JvmField internal var `returnValue`: Int = 0,
|
|
492
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
493
|
-
) : Structure() {
|
|
494
|
-
class UniffiByValue(
|
|
495
|
-
`returnValue`: Int = 0,
|
|
496
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
497
|
-
): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
498
|
-
|
|
499
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
|
|
500
|
-
`returnValue` = other.`returnValue`
|
|
501
|
-
`callStatus` = other.`callStatus`
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
|
|
506
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,)
|
|
507
|
-
}
|
|
508
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
509
|
-
internal open class UniffiForeignFutureStructI32(
|
|
510
|
-
@JvmField internal var `returnValue`: Int = 0,
|
|
511
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
512
|
-
) : Structure() {
|
|
513
|
-
class UniffiByValue(
|
|
514
|
-
`returnValue`: Int = 0,
|
|
515
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
516
|
-
): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
517
|
-
|
|
518
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
|
|
519
|
-
`returnValue` = other.`returnValue`
|
|
520
|
-
`callStatus` = other.`callStatus`
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
|
|
525
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,)
|
|
526
|
-
}
|
|
527
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
528
|
-
internal open class UniffiForeignFutureStructU64(
|
|
529
|
-
@JvmField internal var `returnValue`: Long = 0.toLong(),
|
|
530
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
531
|
-
) : Structure() {
|
|
532
|
-
class UniffiByValue(
|
|
533
|
-
`returnValue`: Long = 0.toLong(),
|
|
534
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
535
|
-
): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
536
|
-
|
|
537
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
|
|
538
|
-
`returnValue` = other.`returnValue`
|
|
539
|
-
`callStatus` = other.`callStatus`
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
|
|
544
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,)
|
|
545
|
-
}
|
|
546
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
547
|
-
internal open class UniffiForeignFutureStructI64(
|
|
548
|
-
@JvmField internal var `returnValue`: Long = 0.toLong(),
|
|
549
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
550
|
-
) : Structure() {
|
|
551
|
-
class UniffiByValue(
|
|
552
|
-
`returnValue`: Long = 0.toLong(),
|
|
553
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
554
|
-
): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
555
|
-
|
|
556
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
|
|
557
|
-
`returnValue` = other.`returnValue`
|
|
558
|
-
`callStatus` = other.`callStatus`
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
|
|
563
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,)
|
|
564
|
-
}
|
|
565
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
566
|
-
internal open class UniffiForeignFutureStructF32(
|
|
567
|
-
@JvmField internal var `returnValue`: Float = 0.0f,
|
|
568
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
569
|
-
) : Structure() {
|
|
570
|
-
class UniffiByValue(
|
|
571
|
-
`returnValue`: Float = 0.0f,
|
|
572
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
573
|
-
): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue
|
|
574
|
-
|
|
575
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
|
|
576
|
-
`returnValue` = other.`returnValue`
|
|
577
|
-
`callStatus` = other.`callStatus`
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
|
|
582
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,)
|
|
583
|
-
}
|
|
584
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
585
|
-
internal open class UniffiForeignFutureStructF64(
|
|
586
|
-
@JvmField internal var `returnValue`: Double = 0.0,
|
|
587
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
588
|
-
) : Structure() {
|
|
589
|
-
class UniffiByValue(
|
|
590
|
-
`returnValue`: Double = 0.0,
|
|
591
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
592
|
-
): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue
|
|
593
|
-
|
|
594
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
|
|
595
|
-
`returnValue` = other.`returnValue`
|
|
596
|
-
`callStatus` = other.`callStatus`
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
|
|
601
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,)
|
|
602
|
-
}
|
|
603
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
604
|
-
internal open class UniffiForeignFutureStructPointer(
|
|
605
|
-
@JvmField internal var `returnValue`: Pointer = Pointer.NULL,
|
|
606
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
607
|
-
) : Structure() {
|
|
608
|
-
class UniffiByValue(
|
|
609
|
-
`returnValue`: Pointer = Pointer.NULL,
|
|
610
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
611
|
-
): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue
|
|
612
|
-
|
|
613
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
|
|
614
|
-
`returnValue` = other.`returnValue`
|
|
615
|
-
`callStatus` = other.`callStatus`
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
}
|
|
619
|
-
internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
|
|
620
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,)
|
|
621
|
-
}
|
|
622
|
-
@Structure.FieldOrder("returnValue", "callStatus")
|
|
623
|
-
internal open class UniffiForeignFutureStructRustBuffer(
|
|
624
|
-
@JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
|
|
625
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
626
|
-
) : Structure() {
|
|
627
|
-
class UniffiByValue(
|
|
628
|
-
`returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
|
|
629
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
630
|
-
): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
|
|
631
|
-
|
|
632
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
|
|
633
|
-
`returnValue` = other.`returnValue`
|
|
634
|
-
`callStatus` = other.`callStatus`
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
|
|
639
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,)
|
|
640
|
-
}
|
|
641
|
-
@Structure.FieldOrder("callStatus")
|
|
642
|
-
internal open class UniffiForeignFutureStructVoid(
|
|
643
|
-
@JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
644
|
-
) : Structure() {
|
|
645
|
-
class UniffiByValue(
|
|
646
|
-
`callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
|
|
647
|
-
): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue
|
|
648
|
-
|
|
649
|
-
internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
|
|
650
|
-
`callStatus` = other.`callStatus`
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
|
|
655
|
-
fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,)
|
|
656
|
-
}
|
|
657
|
-
internal interface UniffiCallbackInterfaceEventListenerMethod0 : com.sun.jna.Callback {
|
|
658
|
-
fun callback(`uniffiHandle`: Long,`eventData`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,)
|
|
659
|
-
}
|
|
660
|
-
@Structure.FieldOrder("onEventOccurred", "uniffiFree")
|
|
661
|
-
internal open class UniffiVTableCallbackInterfaceEventListener(
|
|
662
|
-
@JvmField internal var `onEventOccurred`: UniffiCallbackInterfaceEventListenerMethod0? = null,
|
|
663
|
-
@JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
|
|
664
|
-
) : Structure() {
|
|
665
|
-
class UniffiByValue(
|
|
666
|
-
`onEventOccurred`: UniffiCallbackInterfaceEventListenerMethod0? = null,
|
|
667
|
-
`uniffiFree`: UniffiCallbackInterfaceFree? = null,
|
|
668
|
-
): UniffiVTableCallbackInterfaceEventListener(`onEventOccurred`,`uniffiFree`,), Structure.ByValue
|
|
669
|
-
|
|
670
|
-
internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceEventListener) {
|
|
671
|
-
`onEventOccurred` = other.`onEventOccurred`
|
|
672
|
-
`uniffiFree` = other.`uniffiFree`
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
// For large crates we prevent `MethodTooLargeException` (see #2340)
|
|
795
|
-
// N.B. the name of the extension is very misleading, since it is
|
|
796
|
-
// rather `InterfaceTooLargeException`, caused by too many methods
|
|
797
|
-
// in the interface for large crates.
|
|
798
|
-
//
|
|
799
|
-
// By splitting the otherwise huge interface into two parts
|
|
800
|
-
// * UniffiLib
|
|
801
|
-
// * IntegrityCheckingUniffiLib (this)
|
|
802
|
-
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
803
|
-
//
|
|
804
|
-
// The `ffi_uniffi_contract_version` method and all checksum methods are put
|
|
805
|
-
// into `IntegrityCheckingUniffiLib` and these methods are called only once,
|
|
806
|
-
// when the library is loaded.
|
|
807
|
-
internal interface IntegrityCheckingUniffiLib : Library {
|
|
808
|
-
// Integrity check functions only
|
|
809
|
-
fun uniffi_pubkycore_checksum_func_auth(
|
|
810
|
-
): Short
|
|
811
|
-
fun uniffi_pubkycore_checksum_func_create_recovery_file(
|
|
812
|
-
): Short
|
|
813
|
-
fun uniffi_pubkycore_checksum_func_decrypt_recovery_file(
|
|
814
|
-
): Short
|
|
815
|
-
fun uniffi_pubkycore_checksum_func_delete_file(
|
|
816
|
-
): Short
|
|
817
|
-
fun uniffi_pubkycore_checksum_func_generate_mnemonic_phrase(
|
|
818
|
-
): Short
|
|
819
|
-
fun uniffi_pubkycore_checksum_func_generate_mnemonic_phrase_and_keypair(
|
|
820
|
-
): Short
|
|
821
|
-
fun uniffi_pubkycore_checksum_func_generate_secret_key(
|
|
822
|
-
): Short
|
|
823
|
-
fun uniffi_pubkycore_checksum_func_get(
|
|
824
|
-
): Short
|
|
825
|
-
fun uniffi_pubkycore_checksum_func_get_homeserver(
|
|
826
|
-
): Short
|
|
827
|
-
fun uniffi_pubkycore_checksum_func_get_public_key_from_secret_key(
|
|
828
|
-
): Short
|
|
829
|
-
fun uniffi_pubkycore_checksum_func_get_signup_token(
|
|
830
|
-
): Short
|
|
831
|
-
fun uniffi_pubkycore_checksum_func_list(
|
|
832
|
-
): Short
|
|
833
|
-
fun uniffi_pubkycore_checksum_func_mnemonic_phrase_to_keypair(
|
|
834
|
-
): Short
|
|
835
|
-
fun uniffi_pubkycore_checksum_func_parse_auth_url(
|
|
836
|
-
): Short
|
|
837
|
-
fun uniffi_pubkycore_checksum_func_publish(
|
|
838
|
-
): Short
|
|
839
|
-
fun uniffi_pubkycore_checksum_func_publish_https(
|
|
840
|
-
): Short
|
|
841
|
-
fun uniffi_pubkycore_checksum_func_put(
|
|
842
|
-
): Short
|
|
843
|
-
fun uniffi_pubkycore_checksum_func_remove_event_listener(
|
|
844
|
-
): Short
|
|
845
|
-
fun uniffi_pubkycore_checksum_func_republish_homeserver(
|
|
846
|
-
): Short
|
|
847
|
-
fun uniffi_pubkycore_checksum_func_resolve(
|
|
848
|
-
): Short
|
|
849
|
-
fun uniffi_pubkycore_checksum_func_resolve_https(
|
|
850
|
-
): Short
|
|
851
|
-
fun uniffi_pubkycore_checksum_func_revalidate_session(
|
|
852
|
-
): Short
|
|
853
|
-
fun uniffi_pubkycore_checksum_func_set_event_listener(
|
|
854
|
-
): Short
|
|
855
|
-
fun uniffi_pubkycore_checksum_func_sign_in(
|
|
856
|
-
): Short
|
|
857
|
-
fun uniffi_pubkycore_checksum_func_sign_out(
|
|
858
|
-
): Short
|
|
859
|
-
fun uniffi_pubkycore_checksum_func_sign_up(
|
|
860
|
-
): Short
|
|
861
|
-
fun uniffi_pubkycore_checksum_func_switch_network(
|
|
862
|
-
): Short
|
|
863
|
-
fun uniffi_pubkycore_checksum_func_validate_mnemonic_phrase(
|
|
864
|
-
): Short
|
|
865
|
-
fun uniffi_pubkycore_checksum_method_eventlistener_on_event_occurred(
|
|
866
|
-
): Short
|
|
867
|
-
fun ffi_pubkycore_uniffi_contract_version(
|
|
868
|
-
): Int
|
|
869
|
-
|
|
870
|
-
}
|
|
871
|
-
|
|
872
374
|
// A JNA Library to expose the extern-C FFI definitions.
|
|
873
375
|
// This is an implementation detail which will be called internally by the public API.
|
|
874
|
-
|
|
376
|
+
|
|
377
|
+
internal interface _UniFFILib : Library {
|
|
875
378
|
companion object {
|
|
876
|
-
internal val INSTANCE:
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
//
|
|
883
|
-
// By splitting the otherwise huge interface into two parts
|
|
884
|
-
// * UniffiLib (this)
|
|
885
|
-
// * IntegrityCheckingUniffiLib
|
|
886
|
-
// And all checksum methods are put into `IntegrityCheckingUniffiLib`
|
|
887
|
-
// we allow for ~2x as many methods in the UniffiLib interface.
|
|
888
|
-
//
|
|
889
|
-
// Thus we first load the library with `loadIndirect` as `IntegrityCheckingUniffiLib`
|
|
890
|
-
// so that we can (optionally!) call `uniffiCheckApiChecksums`...
|
|
891
|
-
loadIndirect<IntegrityCheckingUniffiLib>(componentName)
|
|
892
|
-
.also { lib: IntegrityCheckingUniffiLib ->
|
|
893
|
-
uniffiCheckContractApiVersion(lib)
|
|
894
|
-
uniffiCheckApiChecksums(lib)
|
|
379
|
+
internal val INSTANCE: _UniFFILib by lazy {
|
|
380
|
+
loadIndirect<_UniFFILib>(componentName = "pubkycore")
|
|
381
|
+
.also { lib: _UniFFILib ->
|
|
382
|
+
uniffiCheckContractApiVersion(lib)
|
|
383
|
+
uniffiCheckApiChecksums(lib)
|
|
384
|
+
FfiConverterTypeEventListener.register(lib)
|
|
895
385
|
}
|
|
896
|
-
// ... and then we load the library as `UniffiLib`
|
|
897
|
-
// N.B. we cannot use `loadIndirect` once and then try to cast it to `UniffiLib`
|
|
898
|
-
// => results in `java.lang.ClassCastException: com.sun.proxy.$Proxy cannot be cast to ...`
|
|
899
|
-
// error. So we must call `loadIndirect` twice. For crates large enough
|
|
900
|
-
// to trigger this issue, the performance impact is negligible, running on
|
|
901
|
-
// a macOS M1 machine the `loadIndirect` call takes ~50ms.
|
|
902
|
-
val lib = loadIndirect<UniffiLib>(componentName)
|
|
903
|
-
// No need to check the contract version and checksums, since
|
|
904
|
-
// we already did that with `IntegrityCheckingUniffiLib` above.
|
|
905
|
-
uniffiCallbackInterfaceEventListener.register(lib)
|
|
906
|
-
// Loading of library with integrity check done.
|
|
907
|
-
lib
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
// The Cleaner for the whole library
|
|
911
|
-
internal val CLEANER: UniffiCleaner by lazy {
|
|
912
|
-
UniffiCleaner.create()
|
|
913
386
|
}
|
|
914
387
|
}
|
|
915
388
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
389
|
+
fun uniffi_pubkycore_fn_free_eventnotifier(`ptr`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
390
|
+
): Unit
|
|
391
|
+
fun uniffi_pubkycore_fn_init_callback_eventlistener(`callbackStub`: ForeignCallback,_uniffi_out_err: RustCallStatus,
|
|
392
|
+
): Unit
|
|
393
|
+
fun uniffi_pubkycore_fn_func_auth(`url`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
394
|
+
): RustBuffer.ByValue
|
|
395
|
+
fun uniffi_pubkycore_fn_func_create_recovery_file(`secretKey`: RustBuffer.ByValue,`passphrase`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
396
|
+
): RustBuffer.ByValue
|
|
397
|
+
fun uniffi_pubkycore_fn_func_decrypt_recovery_file(`recoveryFile`: RustBuffer.ByValue,`passphrase`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
398
|
+
): RustBuffer.ByValue
|
|
399
|
+
fun uniffi_pubkycore_fn_func_delete_file(`url`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
400
|
+
): RustBuffer.ByValue
|
|
401
|
+
fun uniffi_pubkycore_fn_func_generate_mnemonic_phrase(_uniffi_out_err: RustCallStatus,
|
|
402
|
+
): RustBuffer.ByValue
|
|
403
|
+
fun uniffi_pubkycore_fn_func_generate_mnemonic_phrase_and_keypair(_uniffi_out_err: RustCallStatus,
|
|
404
|
+
): RustBuffer.ByValue
|
|
405
|
+
fun uniffi_pubkycore_fn_func_generate_secret_key(_uniffi_out_err: RustCallStatus,
|
|
406
|
+
): RustBuffer.ByValue
|
|
407
|
+
fun uniffi_pubkycore_fn_func_get(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
408
|
+
): RustBuffer.ByValue
|
|
409
|
+
fun uniffi_pubkycore_fn_func_get_homeserver(`pubky`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
410
|
+
): RustBuffer.ByValue
|
|
411
|
+
fun uniffi_pubkycore_fn_func_get_public_key_from_secret_key(`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
412
|
+
): RustBuffer.ByValue
|
|
413
|
+
fun uniffi_pubkycore_fn_func_get_signup_token(`homeserverPubky`: RustBuffer.ByValue,`adminPassword`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
414
|
+
): RustBuffer.ByValue
|
|
415
|
+
fun uniffi_pubkycore_fn_func_list(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
416
|
+
): RustBuffer.ByValue
|
|
417
|
+
fun uniffi_pubkycore_fn_func_mnemonic_phrase_to_keypair(`mnemonicPhrase`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
418
|
+
): RustBuffer.ByValue
|
|
419
|
+
fun uniffi_pubkycore_fn_func_parse_auth_url(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
420
|
+
): RustBuffer.ByValue
|
|
421
|
+
fun uniffi_pubkycore_fn_func_publish(`recordName`: RustBuffer.ByValue,`recordContent`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
422
|
+
): RustBuffer.ByValue
|
|
423
|
+
fun uniffi_pubkycore_fn_func_publish_https(`recordName`: RustBuffer.ByValue,`target`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
424
|
+
): RustBuffer.ByValue
|
|
425
|
+
fun uniffi_pubkycore_fn_func_put(`url`: RustBuffer.ByValue,`content`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
426
|
+
): RustBuffer.ByValue
|
|
427
|
+
fun uniffi_pubkycore_fn_func_remove_event_listener(_uniffi_out_err: RustCallStatus,
|
|
428
|
+
): Unit
|
|
429
|
+
fun uniffi_pubkycore_fn_func_republish_homeserver(`secretKey`: RustBuffer.ByValue,`homeserver`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
430
|
+
): RustBuffer.ByValue
|
|
431
|
+
fun uniffi_pubkycore_fn_func_resolve(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
432
|
+
): RustBuffer.ByValue
|
|
433
|
+
fun uniffi_pubkycore_fn_func_resolve_https(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
434
|
+
): RustBuffer.ByValue
|
|
435
|
+
fun uniffi_pubkycore_fn_func_revalidate_session(`sessionSecret`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
436
|
+
): RustBuffer.ByValue
|
|
437
|
+
fun uniffi_pubkycore_fn_func_set_event_listener(`listener`: Long,_uniffi_out_err: RustCallStatus,
|
|
438
|
+
): Unit
|
|
439
|
+
fun uniffi_pubkycore_fn_func_sign_in(`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
440
|
+
): RustBuffer.ByValue
|
|
441
|
+
fun uniffi_pubkycore_fn_func_sign_out(`sessionSecret`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
442
|
+
): RustBuffer.ByValue
|
|
443
|
+
fun uniffi_pubkycore_fn_func_sign_up(`secretKey`: RustBuffer.ByValue,`homeserver`: RustBuffer.ByValue,`signupToken`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
444
|
+
): RustBuffer.ByValue
|
|
445
|
+
fun uniffi_pubkycore_fn_func_switch_network(`useTestnet`: Byte,_uniffi_out_err: RustCallStatus,
|
|
446
|
+
): RustBuffer.ByValue
|
|
447
|
+
fun uniffi_pubkycore_fn_func_validate_mnemonic_phrase(`mnemonicPhrase`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
448
|
+
): RustBuffer.ByValue
|
|
449
|
+
fun ffi_pubkycore_rustbuffer_alloc(`size`: Int,_uniffi_out_err: RustCallStatus,
|
|
450
|
+
): RustBuffer.ByValue
|
|
451
|
+
fun ffi_pubkycore_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,_uniffi_out_err: RustCallStatus,
|
|
452
|
+
): RustBuffer.ByValue
|
|
453
|
+
fun ffi_pubkycore_rustbuffer_free(`buf`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
|
454
|
+
): Unit
|
|
455
|
+
fun ffi_pubkycore_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Int,_uniffi_out_err: RustCallStatus,
|
|
456
|
+
): RustBuffer.ByValue
|
|
457
|
+
fun ffi_pubkycore_rust_future_continuation_callback_set(`callback`: UniFffiRustFutureContinuationCallbackType,
|
|
458
|
+
): Unit
|
|
459
|
+
fun ffi_pubkycore_rust_future_poll_u8(`handle`: Pointer,`uniffiCallback`: USize,
|
|
460
|
+
): Unit
|
|
461
|
+
fun ffi_pubkycore_rust_future_cancel_u8(`handle`: Pointer,
|
|
462
|
+
): Unit
|
|
463
|
+
fun ffi_pubkycore_rust_future_free_u8(`handle`: Pointer,
|
|
464
|
+
): Unit
|
|
465
|
+
fun ffi_pubkycore_rust_future_complete_u8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
466
|
+
): Byte
|
|
467
|
+
fun ffi_pubkycore_rust_future_poll_i8(`handle`: Pointer,`uniffiCallback`: USize,
|
|
468
|
+
): Unit
|
|
469
|
+
fun ffi_pubkycore_rust_future_cancel_i8(`handle`: Pointer,
|
|
470
|
+
): Unit
|
|
471
|
+
fun ffi_pubkycore_rust_future_free_i8(`handle`: Pointer,
|
|
472
|
+
): Unit
|
|
473
|
+
fun ffi_pubkycore_rust_future_complete_i8(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
474
|
+
): Byte
|
|
475
|
+
fun ffi_pubkycore_rust_future_poll_u16(`handle`: Pointer,`uniffiCallback`: USize,
|
|
476
|
+
): Unit
|
|
477
|
+
fun ffi_pubkycore_rust_future_cancel_u16(`handle`: Pointer,
|
|
478
|
+
): Unit
|
|
479
|
+
fun ffi_pubkycore_rust_future_free_u16(`handle`: Pointer,
|
|
480
|
+
): Unit
|
|
481
|
+
fun ffi_pubkycore_rust_future_complete_u16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
482
|
+
): Short
|
|
483
|
+
fun ffi_pubkycore_rust_future_poll_i16(`handle`: Pointer,`uniffiCallback`: USize,
|
|
484
|
+
): Unit
|
|
485
|
+
fun ffi_pubkycore_rust_future_cancel_i16(`handle`: Pointer,
|
|
486
|
+
): Unit
|
|
487
|
+
fun ffi_pubkycore_rust_future_free_i16(`handle`: Pointer,
|
|
488
|
+
): Unit
|
|
489
|
+
fun ffi_pubkycore_rust_future_complete_i16(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
490
|
+
): Short
|
|
491
|
+
fun ffi_pubkycore_rust_future_poll_u32(`handle`: Pointer,`uniffiCallback`: USize,
|
|
492
|
+
): Unit
|
|
493
|
+
fun ffi_pubkycore_rust_future_cancel_u32(`handle`: Pointer,
|
|
494
|
+
): Unit
|
|
495
|
+
fun ffi_pubkycore_rust_future_free_u32(`handle`: Pointer,
|
|
496
|
+
): Unit
|
|
497
|
+
fun ffi_pubkycore_rust_future_complete_u32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
498
|
+
): Int
|
|
499
|
+
fun ffi_pubkycore_rust_future_poll_i32(`handle`: Pointer,`uniffiCallback`: USize,
|
|
500
|
+
): Unit
|
|
501
|
+
fun ffi_pubkycore_rust_future_cancel_i32(`handle`: Pointer,
|
|
502
|
+
): Unit
|
|
503
|
+
fun ffi_pubkycore_rust_future_free_i32(`handle`: Pointer,
|
|
504
|
+
): Unit
|
|
505
|
+
fun ffi_pubkycore_rust_future_complete_i32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
506
|
+
): Int
|
|
507
|
+
fun ffi_pubkycore_rust_future_poll_u64(`handle`: Pointer,`uniffiCallback`: USize,
|
|
508
|
+
): Unit
|
|
509
|
+
fun ffi_pubkycore_rust_future_cancel_u64(`handle`: Pointer,
|
|
510
|
+
): Unit
|
|
511
|
+
fun ffi_pubkycore_rust_future_free_u64(`handle`: Pointer,
|
|
512
|
+
): Unit
|
|
513
|
+
fun ffi_pubkycore_rust_future_complete_u64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
514
|
+
): Long
|
|
515
|
+
fun ffi_pubkycore_rust_future_poll_i64(`handle`: Pointer,`uniffiCallback`: USize,
|
|
516
|
+
): Unit
|
|
517
|
+
fun ffi_pubkycore_rust_future_cancel_i64(`handle`: Pointer,
|
|
518
|
+
): Unit
|
|
519
|
+
fun ffi_pubkycore_rust_future_free_i64(`handle`: Pointer,
|
|
520
|
+
): Unit
|
|
521
|
+
fun ffi_pubkycore_rust_future_complete_i64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
522
|
+
): Long
|
|
523
|
+
fun ffi_pubkycore_rust_future_poll_f32(`handle`: Pointer,`uniffiCallback`: USize,
|
|
524
|
+
): Unit
|
|
525
|
+
fun ffi_pubkycore_rust_future_cancel_f32(`handle`: Pointer,
|
|
526
|
+
): Unit
|
|
527
|
+
fun ffi_pubkycore_rust_future_free_f32(`handle`: Pointer,
|
|
528
|
+
): Unit
|
|
529
|
+
fun ffi_pubkycore_rust_future_complete_f32(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
530
|
+
): Float
|
|
531
|
+
fun ffi_pubkycore_rust_future_poll_f64(`handle`: Pointer,`uniffiCallback`: USize,
|
|
532
|
+
): Unit
|
|
533
|
+
fun ffi_pubkycore_rust_future_cancel_f64(`handle`: Pointer,
|
|
534
|
+
): Unit
|
|
535
|
+
fun ffi_pubkycore_rust_future_free_f64(`handle`: Pointer,
|
|
536
|
+
): Unit
|
|
537
|
+
fun ffi_pubkycore_rust_future_complete_f64(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
538
|
+
): Double
|
|
539
|
+
fun ffi_pubkycore_rust_future_poll_pointer(`handle`: Pointer,`uniffiCallback`: USize,
|
|
540
|
+
): Unit
|
|
541
|
+
fun ffi_pubkycore_rust_future_cancel_pointer(`handle`: Pointer,
|
|
542
|
+
): Unit
|
|
543
|
+
fun ffi_pubkycore_rust_future_free_pointer(`handle`: Pointer,
|
|
544
|
+
): Unit
|
|
545
|
+
fun ffi_pubkycore_rust_future_complete_pointer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
546
|
+
): Pointer
|
|
547
|
+
fun ffi_pubkycore_rust_future_poll_rust_buffer(`handle`: Pointer,`uniffiCallback`: USize,
|
|
548
|
+
): Unit
|
|
549
|
+
fun ffi_pubkycore_rust_future_cancel_rust_buffer(`handle`: Pointer,
|
|
550
|
+
): Unit
|
|
551
|
+
fun ffi_pubkycore_rust_future_free_rust_buffer(`handle`: Pointer,
|
|
552
|
+
): Unit
|
|
553
|
+
fun ffi_pubkycore_rust_future_complete_rust_buffer(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
554
|
+
): RustBuffer.ByValue
|
|
555
|
+
fun ffi_pubkycore_rust_future_poll_void(`handle`: Pointer,`uniffiCallback`: USize,
|
|
556
|
+
): Unit
|
|
557
|
+
fun ffi_pubkycore_rust_future_cancel_void(`handle`: Pointer,
|
|
558
|
+
): Unit
|
|
559
|
+
fun ffi_pubkycore_rust_future_free_void(`handle`: Pointer,
|
|
560
|
+
): Unit
|
|
561
|
+
fun ffi_pubkycore_rust_future_complete_void(`handle`: Pointer,_uniffi_out_err: RustCallStatus,
|
|
562
|
+
): Unit
|
|
563
|
+
fun uniffi_pubkycore_checksum_func_auth(
|
|
564
|
+
): Short
|
|
565
|
+
fun uniffi_pubkycore_checksum_func_create_recovery_file(
|
|
566
|
+
): Short
|
|
567
|
+
fun uniffi_pubkycore_checksum_func_decrypt_recovery_file(
|
|
568
|
+
): Short
|
|
569
|
+
fun uniffi_pubkycore_checksum_func_delete_file(
|
|
570
|
+
): Short
|
|
571
|
+
fun uniffi_pubkycore_checksum_func_generate_mnemonic_phrase(
|
|
572
|
+
): Short
|
|
573
|
+
fun uniffi_pubkycore_checksum_func_generate_mnemonic_phrase_and_keypair(
|
|
574
|
+
): Short
|
|
575
|
+
fun uniffi_pubkycore_checksum_func_generate_secret_key(
|
|
576
|
+
): Short
|
|
577
|
+
fun uniffi_pubkycore_checksum_func_get(
|
|
578
|
+
): Short
|
|
579
|
+
fun uniffi_pubkycore_checksum_func_get_homeserver(
|
|
580
|
+
): Short
|
|
581
|
+
fun uniffi_pubkycore_checksum_func_get_public_key_from_secret_key(
|
|
582
|
+
): Short
|
|
583
|
+
fun uniffi_pubkycore_checksum_func_get_signup_token(
|
|
584
|
+
): Short
|
|
585
|
+
fun uniffi_pubkycore_checksum_func_list(
|
|
586
|
+
): Short
|
|
587
|
+
fun uniffi_pubkycore_checksum_func_mnemonic_phrase_to_keypair(
|
|
588
|
+
): Short
|
|
589
|
+
fun uniffi_pubkycore_checksum_func_parse_auth_url(
|
|
590
|
+
): Short
|
|
591
|
+
fun uniffi_pubkycore_checksum_func_publish(
|
|
592
|
+
): Short
|
|
593
|
+
fun uniffi_pubkycore_checksum_func_publish_https(
|
|
594
|
+
): Short
|
|
595
|
+
fun uniffi_pubkycore_checksum_func_put(
|
|
596
|
+
): Short
|
|
597
|
+
fun uniffi_pubkycore_checksum_func_remove_event_listener(
|
|
598
|
+
): Short
|
|
599
|
+
fun uniffi_pubkycore_checksum_func_republish_homeserver(
|
|
600
|
+
): Short
|
|
601
|
+
fun uniffi_pubkycore_checksum_func_resolve(
|
|
602
|
+
): Short
|
|
603
|
+
fun uniffi_pubkycore_checksum_func_resolve_https(
|
|
604
|
+
): Short
|
|
605
|
+
fun uniffi_pubkycore_checksum_func_revalidate_session(
|
|
606
|
+
): Short
|
|
607
|
+
fun uniffi_pubkycore_checksum_func_set_event_listener(
|
|
608
|
+
): Short
|
|
609
|
+
fun uniffi_pubkycore_checksum_func_sign_in(
|
|
610
|
+
): Short
|
|
611
|
+
fun uniffi_pubkycore_checksum_func_sign_out(
|
|
612
|
+
): Short
|
|
613
|
+
fun uniffi_pubkycore_checksum_func_sign_up(
|
|
614
|
+
): Short
|
|
615
|
+
fun uniffi_pubkycore_checksum_func_switch_network(
|
|
616
|
+
): Short
|
|
617
|
+
fun uniffi_pubkycore_checksum_func_validate_mnemonic_phrase(
|
|
618
|
+
): Short
|
|
619
|
+
fun uniffi_pubkycore_checksum_method_eventlistener_on_event_occurred(
|
|
620
|
+
): Short
|
|
621
|
+
fun ffi_pubkycore_uniffi_contract_version(
|
|
622
|
+
): Int
|
|
623
|
+
|
|
1092
624
|
}
|
|
1093
625
|
|
|
1094
|
-
private fun uniffiCheckContractApiVersion(lib:
|
|
626
|
+
private fun uniffiCheckContractApiVersion(lib: _UniFFILib) {
|
|
1095
627
|
// Get the bindings contract version from our ComponentInterface
|
|
1096
|
-
val bindings_contract_version =
|
|
628
|
+
val bindings_contract_version = 24
|
|
1097
629
|
// Get the scaffolding contract version by calling the into the dylib
|
|
1098
630
|
val scaffolding_contract_version = lib.ffi_pubkycore_uniffi_contract_version()
|
|
1099
631
|
if (bindings_contract_version != scaffolding_contract_version) {
|
|
1100
632
|
throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
1101
633
|
}
|
|
1102
634
|
}
|
|
635
|
+
|
|
1103
636
|
@Suppress("UNUSED_PARAMETER")
|
|
1104
|
-
private fun uniffiCheckApiChecksums(lib:
|
|
1105
|
-
if (lib.uniffi_pubkycore_checksum_func_auth() !=
|
|
637
|
+
private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
|
638
|
+
if (lib.uniffi_pubkycore_checksum_func_auth() != 51826.toShort()) {
|
|
1106
639
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1107
640
|
}
|
|
1108
|
-
if (lib.uniffi_pubkycore_checksum_func_create_recovery_file() !=
|
|
641
|
+
if (lib.uniffi_pubkycore_checksum_func_create_recovery_file() != 48846.toShort()) {
|
|
1109
642
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1110
643
|
}
|
|
1111
|
-
if (lib.uniffi_pubkycore_checksum_func_decrypt_recovery_file() !=
|
|
644
|
+
if (lib.uniffi_pubkycore_checksum_func_decrypt_recovery_file() != 26407.toShort()) {
|
|
1112
645
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1113
646
|
}
|
|
1114
|
-
if (lib.uniffi_pubkycore_checksum_func_delete_file() !=
|
|
647
|
+
if (lib.uniffi_pubkycore_checksum_func_delete_file() != 47931.toShort()) {
|
|
1115
648
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1116
649
|
}
|
|
1117
|
-
if (lib.uniffi_pubkycore_checksum_func_generate_mnemonic_phrase() !=
|
|
650
|
+
if (lib.uniffi_pubkycore_checksum_func_generate_mnemonic_phrase() != 2358.toShort()) {
|
|
1118
651
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1119
652
|
}
|
|
1120
|
-
if (lib.uniffi_pubkycore_checksum_func_generate_mnemonic_phrase_and_keypair() !=
|
|
653
|
+
if (lib.uniffi_pubkycore_checksum_func_generate_mnemonic_phrase_and_keypair() != 44395.toShort()) {
|
|
1121
654
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1122
655
|
}
|
|
1123
|
-
if (lib.uniffi_pubkycore_checksum_func_generate_secret_key() !=
|
|
656
|
+
if (lib.uniffi_pubkycore_checksum_func_generate_secret_key() != 12800.toShort()) {
|
|
1124
657
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1125
658
|
}
|
|
1126
|
-
if (lib.uniffi_pubkycore_checksum_func_get() !=
|
|
659
|
+
if (lib.uniffi_pubkycore_checksum_func_get() != 6591.toShort()) {
|
|
1127
660
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1128
661
|
}
|
|
1129
|
-
if (lib.uniffi_pubkycore_checksum_func_get_homeserver() !=
|
|
662
|
+
if (lib.uniffi_pubkycore_checksum_func_get_homeserver() != 40658.toShort()) {
|
|
1130
663
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1131
664
|
}
|
|
1132
|
-
if (lib.uniffi_pubkycore_checksum_func_get_public_key_from_secret_key() !=
|
|
665
|
+
if (lib.uniffi_pubkycore_checksum_func_get_public_key_from_secret_key() != 40316.toShort()) {
|
|
1133
666
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1134
667
|
}
|
|
1135
|
-
if (lib.uniffi_pubkycore_checksum_func_get_signup_token() !=
|
|
668
|
+
if (lib.uniffi_pubkycore_checksum_func_get_signup_token() != 47927.toShort()) {
|
|
1136
669
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1137
670
|
}
|
|
1138
|
-
if (lib.uniffi_pubkycore_checksum_func_list() !=
|
|
671
|
+
if (lib.uniffi_pubkycore_checksum_func_list() != 43198.toShort()) {
|
|
1139
672
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1140
673
|
}
|
|
1141
|
-
if (lib.uniffi_pubkycore_checksum_func_mnemonic_phrase_to_keypair() !=
|
|
674
|
+
if (lib.uniffi_pubkycore_checksum_func_mnemonic_phrase_to_keypair() != 45784.toShort()) {
|
|
1142
675
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1143
676
|
}
|
|
1144
|
-
if (lib.uniffi_pubkycore_checksum_func_parse_auth_url() !=
|
|
677
|
+
if (lib.uniffi_pubkycore_checksum_func_parse_auth_url() != 27379.toShort()) {
|
|
1145
678
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1146
679
|
}
|
|
1147
|
-
if (lib.uniffi_pubkycore_checksum_func_publish() !=
|
|
680
|
+
if (lib.uniffi_pubkycore_checksum_func_publish() != 48989.toShort()) {
|
|
1148
681
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1149
682
|
}
|
|
1150
|
-
if (lib.uniffi_pubkycore_checksum_func_publish_https() !=
|
|
683
|
+
if (lib.uniffi_pubkycore_checksum_func_publish_https() != 5614.toShort()) {
|
|
1151
684
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1152
685
|
}
|
|
1153
|
-
if (lib.uniffi_pubkycore_checksum_func_put() !=
|
|
686
|
+
if (lib.uniffi_pubkycore_checksum_func_put() != 64514.toShort()) {
|
|
1154
687
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1155
688
|
}
|
|
1156
|
-
if (lib.uniffi_pubkycore_checksum_func_remove_event_listener() !=
|
|
689
|
+
if (lib.uniffi_pubkycore_checksum_func_remove_event_listener() != 23534.toShort()) {
|
|
1157
690
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1158
691
|
}
|
|
1159
|
-
if (lib.uniffi_pubkycore_checksum_func_republish_homeserver() !=
|
|
692
|
+
if (lib.uniffi_pubkycore_checksum_func_republish_homeserver() != 63919.toShort()) {
|
|
1160
693
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1161
694
|
}
|
|
1162
|
-
if (lib.uniffi_pubkycore_checksum_func_resolve() !=
|
|
695
|
+
if (lib.uniffi_pubkycore_checksum_func_resolve() != 34317.toShort()) {
|
|
1163
696
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1164
697
|
}
|
|
1165
|
-
if (lib.uniffi_pubkycore_checksum_func_resolve_https() !=
|
|
698
|
+
if (lib.uniffi_pubkycore_checksum_func_resolve_https() != 17266.toShort()) {
|
|
1166
699
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1167
700
|
}
|
|
1168
|
-
if (lib.uniffi_pubkycore_checksum_func_revalidate_session() !=
|
|
701
|
+
if (lib.uniffi_pubkycore_checksum_func_revalidate_session() != 57726.toShort()) {
|
|
1169
702
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1170
703
|
}
|
|
1171
|
-
if (lib.uniffi_pubkycore_checksum_func_set_event_listener() !=
|
|
704
|
+
if (lib.uniffi_pubkycore_checksum_func_set_event_listener() != 60071.toShort()) {
|
|
1172
705
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1173
706
|
}
|
|
1174
|
-
if (lib.uniffi_pubkycore_checksum_func_sign_in() !=
|
|
707
|
+
if (lib.uniffi_pubkycore_checksum_func_sign_in() != 21584.toShort()) {
|
|
1175
708
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1176
709
|
}
|
|
1177
|
-
if (lib.uniffi_pubkycore_checksum_func_sign_out() !=
|
|
710
|
+
if (lib.uniffi_pubkycore_checksum_func_sign_out() != 27163.toShort()) {
|
|
1178
711
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1179
712
|
}
|
|
1180
|
-
if (lib.uniffi_pubkycore_checksum_func_sign_up() !=
|
|
713
|
+
if (lib.uniffi_pubkycore_checksum_func_sign_up() != 48789.toShort()) {
|
|
1181
714
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1182
715
|
}
|
|
1183
|
-
if (lib.uniffi_pubkycore_checksum_func_switch_network() !=
|
|
716
|
+
if (lib.uniffi_pubkycore_checksum_func_switch_network() != 64215.toShort()) {
|
|
1184
717
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1185
718
|
}
|
|
1186
|
-
if (lib.uniffi_pubkycore_checksum_func_validate_mnemonic_phrase() !=
|
|
719
|
+
if (lib.uniffi_pubkycore_checksum_func_validate_mnemonic_phrase() != 30362.toShort()) {
|
|
1187
720
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1188
721
|
}
|
|
1189
|
-
if (lib.uniffi_pubkycore_checksum_method_eventlistener_on_event_occurred() !=
|
|
722
|
+
if (lib.uniffi_pubkycore_checksum_method_eventlistener_on_event_occurred() != 11531.toShort()) {
|
|
1190
723
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
1191
724
|
}
|
|
1192
725
|
}
|
|
1193
726
|
|
|
1194
|
-
/**
|
|
1195
|
-
* @suppress
|
|
1196
|
-
*/
|
|
1197
|
-
public fun uniffiEnsureInitialized() {
|
|
1198
|
-
UniffiLib.INSTANCE
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
727
|
// Async support
|
|
1202
728
|
|
|
1203
729
|
// Public interface members begin here.
|
|
1204
730
|
|
|
1205
731
|
|
|
1206
|
-
// Interface implemented by anything that can contain an object reference.
|
|
1207
|
-
//
|
|
1208
|
-
// Such types expose a `destroy()` method that must be called to cleanly
|
|
1209
|
-
// dispose of the contained objects. Failure to call this method may result
|
|
1210
|
-
// in memory leaks.
|
|
1211
|
-
//
|
|
1212
|
-
// The easiest way to ensure this method is called is to use the `.use`
|
|
1213
|
-
// helper method to execute a block and destroy the object at the end.
|
|
1214
|
-
interface Disposable {
|
|
1215
|
-
fun destroy()
|
|
1216
|
-
companion object {
|
|
1217
|
-
fun destroy(vararg args: Any?) {
|
|
1218
|
-
for (arg in args) {
|
|
1219
|
-
when (arg) {
|
|
1220
|
-
is Disposable -> arg.destroy()
|
|
1221
|
-
is ArrayList<*> -> {
|
|
1222
|
-
for (idx in arg.indices) {
|
|
1223
|
-
val element = arg[idx]
|
|
1224
|
-
if (element is Disposable) {
|
|
1225
|
-
element.destroy()
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
is Map<*, *> -> {
|
|
1230
|
-
for (element in arg.values) {
|
|
1231
|
-
if (element is Disposable) {
|
|
1232
|
-
element.destroy()
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
is Iterable<*> -> {
|
|
1237
|
-
for (element in arg) {
|
|
1238
|
-
if (element is Disposable) {
|
|
1239
|
-
element.destroy()
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* @suppress
|
|
1251
|
-
*/
|
|
1252
|
-
inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
|
|
1253
|
-
try {
|
|
1254
|
-
block(this)
|
|
1255
|
-
} finally {
|
|
1256
|
-
try {
|
|
1257
|
-
// N.B. our implementation is on the nullable type `Disposable?`.
|
|
1258
|
-
this?.destroy()
|
|
1259
|
-
} catch (e: Throwable) {
|
|
1260
|
-
// swallow
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
/**
|
|
1265
|
-
* Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
|
|
1266
|
-
*
|
|
1267
|
-
* @suppress
|
|
1268
|
-
* */
|
|
1269
|
-
object NoPointer// Magic number for the Rust proxy to call using the same mechanism as every other method,
|
|
1270
|
-
// to free the callback once it's dropped by Rust.
|
|
1271
|
-
internal const val IDX_CALLBACK_FREE = 0
|
|
1272
|
-
// Callback return codes
|
|
1273
|
-
internal const val UNIFFI_CALLBACK_SUCCESS = 0
|
|
1274
|
-
internal const val UNIFFI_CALLBACK_ERROR = 1
|
|
1275
|
-
internal const val UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* @suppress
|
|
1279
|
-
*/
|
|
1280
|
-
public abstract class FfiConverterCallbackInterface<CallbackInterface: Any>: FfiConverter<CallbackInterface, Long> {
|
|
1281
|
-
internal val handleMap = UniffiHandleMap<CallbackInterface>()
|
|
1282
|
-
|
|
1283
|
-
internal fun drop(handle: Long) {
|
|
1284
|
-
handleMap.remove(handle)
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
override fun lift(value: Long): CallbackInterface {
|
|
1288
|
-
return handleMap.get(value)
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
override fun read(buf: ByteBuffer) = lift(buf.getLong())
|
|
1292
|
-
|
|
1293
|
-
override fun lower(value: CallbackInterface) = handleMap.insert(value)
|
|
1294
|
-
|
|
1295
|
-
override fun allocationSize(value: CallbackInterface) = 8UL
|
|
1296
|
-
|
|
1297
|
-
override fun write(value: CallbackInterface, buf: ByteBuffer) {
|
|
1298
|
-
buf.putLong(lower(value))
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
* The cleaner interface for Object finalization code to run.
|
|
1303
|
-
* This is the entry point to any implementation that we're using.
|
|
1304
|
-
*
|
|
1305
|
-
* The cleaner registers objects and returns cleanables, so now we are
|
|
1306
|
-
* defining a `UniffiCleaner` with a `UniffiClenaer.Cleanable` to abstract the
|
|
1307
|
-
* different implmentations available at compile time.
|
|
1308
|
-
*
|
|
1309
|
-
* @suppress
|
|
1310
|
-
*/
|
|
1311
|
-
interface UniffiCleaner {
|
|
1312
|
-
interface Cleanable {
|
|
1313
|
-
fun clean()
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable
|
|
1317
|
-
|
|
1318
|
-
companion object
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
// The fallback Jna cleaner, which is available for both Android, and the JVM.
|
|
1322
|
-
private class UniffiJnaCleaner : UniffiCleaner {
|
|
1323
|
-
private val cleaner = com.sun.jna.internal.Cleaner.getCleaner()
|
|
1324
|
-
|
|
1325
|
-
override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
|
|
1326
|
-
UniffiJnaCleanable(cleaner.register(value, cleanUpTask))
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
private class UniffiJnaCleanable(
|
|
1330
|
-
private val cleanable: com.sun.jna.internal.Cleaner.Cleanable,
|
|
1331
|
-
) : UniffiCleaner.Cleanable {
|
|
1332
|
-
override fun clean() = cleanable.clean()
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
// We decide at uniffi binding generation time whether we were
|
|
1337
|
-
// using Android or not.
|
|
1338
|
-
// There are further runtime checks to chose the correct implementation
|
|
1339
|
-
// of the cleaner.
|
|
1340
|
-
private fun UniffiCleaner.Companion.create(): UniffiCleaner =
|
|
1341
|
-
try {
|
|
1342
|
-
// For safety's sake: if the library hasn't been run in android_cleaner = true
|
|
1343
|
-
// mode, but is being run on Android, then we still need to think about
|
|
1344
|
-
// Android API versions.
|
|
1345
|
-
// So we check if java.lang.ref.Cleaner is there, and use that…
|
|
1346
|
-
java.lang.Class.forName("java.lang.ref.Cleaner")
|
|
1347
|
-
JavaLangRefCleaner()
|
|
1348
|
-
} catch (e: ClassNotFoundException) {
|
|
1349
|
-
// … otherwise, fallback to the JNA cleaner.
|
|
1350
|
-
UniffiJnaCleaner()
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
private class JavaLangRefCleaner : UniffiCleaner {
|
|
1354
|
-
val cleaner = java.lang.ref.Cleaner.create()
|
|
1355
|
-
|
|
1356
|
-
override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
|
|
1357
|
-
JavaLangRefCleanable(cleaner.register(value, cleanUpTask))
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
private class JavaLangRefCleanable(
|
|
1361
|
-
val cleanable: java.lang.ref.Cleaner.Cleanable
|
|
1362
|
-
) : UniffiCleaner.Cleanable {
|
|
1363
|
-
override fun clean() = cleanable.clean()
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
/**
|
|
1367
|
-
* @suppress
|
|
1368
|
-
*/
|
|
1369
732
|
public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
|
|
1370
733
|
override fun lift(value: Byte): Boolean {
|
|
1371
734
|
return value.toInt() != 0
|
|
@@ -1379,23 +742,20 @@ public object FfiConverterBoolean: FfiConverter<Boolean, Byte> {
|
|
|
1379
742
|
return if (value) 1.toByte() else 0.toByte()
|
|
1380
743
|
}
|
|
1381
744
|
|
|
1382
|
-
override fun allocationSize(value: Boolean) =
|
|
745
|
+
override fun allocationSize(value: Boolean) = 1
|
|
1383
746
|
|
|
1384
747
|
override fun write(value: Boolean, buf: ByteBuffer) {
|
|
1385
748
|
buf.put(lower(value))
|
|
1386
749
|
}
|
|
1387
750
|
}
|
|
1388
751
|
|
|
1389
|
-
/**
|
|
1390
|
-
* @suppress
|
|
1391
|
-
*/
|
|
1392
752
|
public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
1393
753
|
// Note: we don't inherit from FfiConverterRustBuffer, because we use a
|
|
1394
754
|
// special encoding when lowering/lifting. We can use `RustBuffer.len` to
|
|
1395
755
|
// store our length and avoid writing it out to the buffer.
|
|
1396
756
|
override fun lift(value: RustBuffer.ByValue): String {
|
|
1397
757
|
try {
|
|
1398
|
-
val byteArr = ByteArray(value.len
|
|
758
|
+
val byteArr = ByteArray(value.len)
|
|
1399
759
|
value.asByteBuffer()!!.get(byteArr)
|
|
1400
760
|
return byteArr.toString(Charsets.UTF_8)
|
|
1401
761
|
} finally {
|
|
@@ -1422,7 +782,7 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1422
782
|
val byteBuf = toUtf8(value)
|
|
1423
783
|
// Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
|
|
1424
784
|
// to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
|
|
1425
|
-
val rbuf = RustBuffer.alloc(byteBuf.limit()
|
|
785
|
+
val rbuf = RustBuffer.alloc(byteBuf.limit())
|
|
1426
786
|
rbuf.asByteBuffer()!!.put(byteBuf)
|
|
1427
787
|
return rbuf
|
|
1428
788
|
}
|
|
@@ -1430,9 +790,9 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1430
790
|
// We aren't sure exactly how many bytes our string will be once it's UTF-8
|
|
1431
791
|
// encoded. Allocate 3 bytes per UTF-16 code unit which will always be
|
|
1432
792
|
// enough.
|
|
1433
|
-
override fun allocationSize(value: String):
|
|
1434
|
-
val sizeForLength =
|
|
1435
|
-
val sizeForString = value.length
|
|
793
|
+
override fun allocationSize(value: String): Int {
|
|
794
|
+
val sizeForLength = 4
|
|
795
|
+
val sizeForString = value.length * 3
|
|
1436
796
|
return sizeForLength + sizeForString
|
|
1437
797
|
}
|
|
1438
798
|
|
|
@@ -1444,28 +804,57 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1444
804
|
}
|
|
1445
805
|
|
|
1446
806
|
|
|
1447
|
-
//
|
|
1448
|
-
// to the live Rust struct on the other side of the FFI.
|
|
807
|
+
// Interface implemented by anything that can contain an object reference.
|
|
1449
808
|
//
|
|
1450
|
-
//
|
|
1451
|
-
//
|
|
809
|
+
// Such types expose a `destroy()` method that must be called to cleanly
|
|
810
|
+
// dispose of the contained objects. Failure to call this method may result
|
|
811
|
+
// in memory leaks.
|
|
812
|
+
//
|
|
813
|
+
// The easiest way to ensure this method is called is to use the `.use`
|
|
814
|
+
// helper method to execute a block and destroy the object at the end.
|
|
815
|
+
interface Disposable {
|
|
816
|
+
fun destroy()
|
|
817
|
+
companion object {
|
|
818
|
+
fun destroy(vararg args: Any?) {
|
|
819
|
+
args.filterIsInstance<Disposable>()
|
|
820
|
+
.forEach(Disposable::destroy)
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
|
|
826
|
+
try {
|
|
827
|
+
block(this)
|
|
828
|
+
} finally {
|
|
829
|
+
try {
|
|
830
|
+
// N.B. our implementation is on the nullable type `Disposable?`.
|
|
831
|
+
this?.destroy()
|
|
832
|
+
} catch (e: Throwable) {
|
|
833
|
+
// swallow
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// The base class for all UniFFI Object types.
|
|
838
|
+
//
|
|
839
|
+
// This class provides core operations for working with the Rust `Arc<T>` pointer to
|
|
840
|
+
// the live Rust struct on the other side of the FFI.
|
|
1452
841
|
//
|
|
1453
842
|
// There's some subtlety here, because we have to be careful not to operate on a Rust
|
|
1454
843
|
// struct after it has been dropped, and because we must expose a public API for freeing
|
|
1455
|
-
//
|
|
844
|
+
// the Kotlin wrapper object in lieu of reliable finalizers. The core requirements are:
|
|
1456
845
|
//
|
|
1457
|
-
// * Each instance holds an opaque pointer to the underlying Rust struct.
|
|
846
|
+
// * Each `FFIObject` instance holds an opaque pointer to the underlying Rust struct.
|
|
1458
847
|
// Method calls need to read this pointer from the object's state and pass it in to
|
|
1459
848
|
// the Rust FFI.
|
|
1460
849
|
//
|
|
1461
|
-
// * When an
|
|
850
|
+
// * When an `FFIObject` is no longer needed, its pointer should be passed to a
|
|
1462
851
|
// special destructor function provided by the Rust FFI, which will drop the
|
|
1463
852
|
// underlying Rust struct.
|
|
1464
853
|
//
|
|
1465
|
-
// * Given an instance, calling code is expected to call the special
|
|
854
|
+
// * Given an `FFIObject` instance, calling code is expected to call the special
|
|
1466
855
|
// `destroy` method in order to free it after use, either by calling it explicitly
|
|
1467
|
-
// or by using a higher-level helper like the `use` method. Failing to do so
|
|
1468
|
-
//
|
|
856
|
+
// or by using a higher-level helper like the `use` method. Failing to do so will
|
|
857
|
+
// leak the underlying Rust struct.
|
|
1469
858
|
//
|
|
1470
859
|
// * We can't assume that calling code will do the right thing, and must be prepared
|
|
1471
860
|
// to handle Kotlin method calls executing concurrently with or even after a call to
|
|
@@ -1475,14 +864,6 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1475
864
|
// the destructor has been called, and must never call the destructor more than once.
|
|
1476
865
|
// Doing so may trigger memory unsafety.
|
|
1477
866
|
//
|
|
1478
|
-
// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner`
|
|
1479
|
-
// is implemented to call the destructor when the Kotlin object becomes unreachable.
|
|
1480
|
-
// This is done in a background thread. This is not a panacea, and client code should be aware that
|
|
1481
|
-
// 1. the thread may starve if some there are objects that have poorly performing
|
|
1482
|
-
// `drop` methods or do significant work in their `drop` methods.
|
|
1483
|
-
// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`,
|
|
1484
|
-
// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html).
|
|
1485
|
-
//
|
|
1486
867
|
// If we try to implement this with mutual exclusion on access to the pointer, there is the
|
|
1487
868
|
// possibility of a race between a method call and a concurrent call to `destroy`:
|
|
1488
869
|
//
|
|
@@ -1498,7 +879,7 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1498
879
|
// generate methods with any hidden blocking semantics, and a `destroy` method that might
|
|
1499
880
|
// block if called incorrectly seems to meet that bar.
|
|
1500
881
|
//
|
|
1501
|
-
// So, we achieve our goals by giving each
|
|
882
|
+
// So, we achieve our goals by giving each `FFIObject` an associated `AtomicLong` counter to track
|
|
1502
883
|
// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy`
|
|
1503
884
|
// has been called. These are updated according to the following rules:
|
|
1504
885
|
//
|
|
@@ -1524,61 +905,34 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
|
|
|
1524
905
|
// called *and* all in-flight method calls have completed, avoiding violating any of the expectations
|
|
1525
906
|
// of the underlying Rust code.
|
|
1526
907
|
//
|
|
1527
|
-
//
|
|
1528
|
-
//
|
|
1529
|
-
//
|
|
1530
|
-
//
|
|
1531
|
-
//
|
|
1532
|
-
// In this case, `destroy`ing manually may be a better solution.
|
|
1533
|
-
//
|
|
1534
|
-
// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects
|
|
1535
|
-
// with Rust peers are reclaimed:
|
|
908
|
+
// In the future we may be able to replace some of this with automatic finalization logic, such as using
|
|
909
|
+
// the new "Cleaner" functionaility in Java 9. The above scheme has been designed to work even if `destroy` is
|
|
910
|
+
// invoked by garbage-collection machinery rather than by calling code (which by the way, it's apparently also
|
|
911
|
+
// possible for the JVM to finalize an object while there is an in-flight call to one of its methods [1],
|
|
912
|
+
// so there would still be some complexity here).
|
|
1536
913
|
//
|
|
1537
|
-
//
|
|
1538
|
-
// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then:
|
|
1539
|
-
// 3. The memory is reclaimed when the process terminates.
|
|
914
|
+
// Sigh...all of this for want of a robust finalization mechanism.
|
|
1540
915
|
//
|
|
1541
916
|
// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219
|
|
1542
917
|
//
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
companion object
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
open class EventNotifier: Disposable, AutoCloseable, EventNotifierInterface
|
|
1551
|
-
{
|
|
1552
|
-
|
|
1553
|
-
constructor(pointer: Pointer) {
|
|
1554
|
-
this.pointer = pointer
|
|
1555
|
-
this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer))
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
/**
|
|
1559
|
-
* This constructor can be used to instantiate a fake object. Only used for tests. Any
|
|
1560
|
-
* attempt to actually use an object constructed this way will fail as there is no
|
|
1561
|
-
* connected Rust object.
|
|
1562
|
-
*/
|
|
1563
|
-
@Suppress("UNUSED_PARAMETER")
|
|
1564
|
-
constructor(noPointer: NoPointer) {
|
|
1565
|
-
this.pointer = null
|
|
1566
|
-
this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer))
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
protected val pointer: Pointer?
|
|
1570
|
-
protected val cleanable: UniffiCleaner.Cleanable
|
|
918
|
+
abstract class FFIObject(
|
|
919
|
+
protected val pointer: Pointer
|
|
920
|
+
): Disposable, AutoCloseable {
|
|
1571
921
|
|
|
1572
922
|
private val wasDestroyed = AtomicBoolean(false)
|
|
1573
923
|
private val callCounter = AtomicLong(1)
|
|
1574
924
|
|
|
925
|
+
open protected fun freeRustArcPtr() {
|
|
926
|
+
// To be overridden in subclasses.
|
|
927
|
+
}
|
|
928
|
+
|
|
1575
929
|
override fun destroy() {
|
|
1576
930
|
// Only allow a single call to this method.
|
|
1577
931
|
// TODO: maybe we should log a warning if called more than once?
|
|
1578
932
|
if (this.wasDestroyed.compareAndSet(false, true)) {
|
|
1579
933
|
// This decrement always matches the initial count of 1 given at creation time.
|
|
1580
934
|
if (this.callCounter.decrementAndGet() == 0L) {
|
|
1581
|
-
|
|
935
|
+
this.freeRustArcPtr()
|
|
1582
936
|
}
|
|
1583
937
|
}
|
|
1584
938
|
}
|
|
@@ -1602,49 +956,48 @@ open class EventNotifier: Disposable, AutoCloseable, EventNotifierInterface
|
|
|
1602
956
|
} while (! this.callCounter.compareAndSet(c, c + 1L))
|
|
1603
957
|
// Now we can safely do the method call without the pointer being freed concurrently.
|
|
1604
958
|
try {
|
|
1605
|
-
return block(this.
|
|
959
|
+
return block(this.pointer)
|
|
1606
960
|
} finally {
|
|
1607
961
|
// This decrement always matches the increment we performed above.
|
|
1608
962
|
if (this.callCounter.decrementAndGet() == 0L) {
|
|
1609
|
-
|
|
963
|
+
this.freeRustArcPtr()
|
|
1610
964
|
}
|
|
1611
965
|
}
|
|
1612
966
|
}
|
|
967
|
+
}
|
|
1613
968
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
pointer?.let { ptr ->
|
|
1619
|
-
uniffiRustCall { status ->
|
|
1620
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_free_eventnotifier(ptr, status)
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
969
|
+
public interface EventNotifierInterface {
|
|
970
|
+
|
|
971
|
+
companion object
|
|
972
|
+
}
|
|
1625
973
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
974
|
+
class EventNotifier(
|
|
975
|
+
pointer: Pointer
|
|
976
|
+
) : FFIObject(pointer), EventNotifierInterface {
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Disconnect the object from the underlying Rust object.
|
|
980
|
+
*
|
|
981
|
+
* It can be called more than once, but once called, interacting with the object
|
|
982
|
+
* causes an `IllegalStateException`.
|
|
983
|
+
*
|
|
984
|
+
* Clients **must** call this method once done with the object, or cause a memory leak.
|
|
985
|
+
*/
|
|
986
|
+
override protected fun freeRustArcPtr() {
|
|
987
|
+
rustCall() { status ->
|
|
988
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_free_eventnotifier(this.pointer, status)
|
|
1629
989
|
}
|
|
1630
990
|
}
|
|
1631
991
|
|
|
1632
992
|
|
|
1633
993
|
|
|
1634
994
|
|
|
1635
|
-
|
|
1636
995
|
companion object
|
|
1637
996
|
|
|
1638
997
|
}
|
|
1639
998
|
|
|
1640
|
-
/**
|
|
1641
|
-
* @suppress
|
|
1642
|
-
*/
|
|
1643
999
|
public object FfiConverterTypeEventNotifier: FfiConverter<EventNotifier, Pointer> {
|
|
1644
|
-
|
|
1645
|
-
override fun lower(value: EventNotifier): Pointer {
|
|
1646
|
-
return value.uniffiClonePointer()
|
|
1647
|
-
}
|
|
1000
|
+
override fun lower(value: EventNotifier): Pointer = value.callWithPointer { it }
|
|
1648
1001
|
|
|
1649
1002
|
override fun lift(value: Pointer): EventNotifier {
|
|
1650
1003
|
return EventNotifier(value)
|
|
@@ -1656,7 +1009,7 @@ public object FfiConverterTypeEventNotifier: FfiConverter<EventNotifier, Pointer
|
|
|
1656
1009
|
return lift(Pointer(buf.getLong()))
|
|
1657
1010
|
}
|
|
1658
1011
|
|
|
1659
|
-
override fun allocationSize(value: EventNotifier) =
|
|
1012
|
+
override fun allocationSize(value: EventNotifier) = 8
|
|
1660
1013
|
|
|
1661
1014
|
override fun write(value: EventNotifier, buf: ByteBuffer) {
|
|
1662
1015
|
// The Rust code always expects pointers written as 8 bytes,
|
|
@@ -1668,79 +1021,186 @@ public object FfiConverterTypeEventNotifier: FfiConverter<EventNotifier, Pointer
|
|
|
1668
1021
|
|
|
1669
1022
|
|
|
1670
1023
|
|
|
1024
|
+
internal typealias Handle = Long
|
|
1025
|
+
internal class ConcurrentHandleMap<T>(
|
|
1026
|
+
private val leftMap: MutableMap<Handle, T> = mutableMapOf(),
|
|
1027
|
+
private val rightMap: MutableMap<T, Handle> = mutableMapOf()
|
|
1028
|
+
) {
|
|
1029
|
+
private val lock = java.util.concurrent.locks.ReentrantLock()
|
|
1030
|
+
private val currentHandle = AtomicLong(0L)
|
|
1031
|
+
private val stride = 1L
|
|
1032
|
+
|
|
1033
|
+
fun insert(obj: T): Handle =
|
|
1034
|
+
lock.withLock {
|
|
1035
|
+
rightMap[obj] ?:
|
|
1036
|
+
currentHandle.getAndAdd(stride)
|
|
1037
|
+
.also { handle ->
|
|
1038
|
+
leftMap[handle] = obj
|
|
1039
|
+
rightMap[obj] = handle
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1671
1042
|
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1043
|
+
fun get(handle: Handle) = lock.withLock {
|
|
1044
|
+
leftMap[handle]
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
fun delete(handle: Handle) {
|
|
1048
|
+
this.remove(handle)
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
fun remove(handle: Handle): T? =
|
|
1052
|
+
lock.withLock {
|
|
1053
|
+
leftMap.remove(handle)?.let { obj ->
|
|
1054
|
+
rightMap.remove(obj)
|
|
1055
|
+
obj
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1677
1058
|
}
|
|
1678
1059
|
|
|
1060
|
+
interface ForeignCallback : com.sun.jna.Callback {
|
|
1061
|
+
public fun callback(handle: Handle, method: Int, argsData: Pointer, argsLen: Int, outBuf: RustBufferByReference): Int
|
|
1062
|
+
}
|
|
1679
1063
|
|
|
1064
|
+
// Magic number for the Rust proxy to call using the same mechanism as every other method,
|
|
1065
|
+
// to free the callback once it's dropped by Rust.
|
|
1066
|
+
internal const val IDX_CALLBACK_FREE = 0
|
|
1067
|
+
// Callback return codes
|
|
1068
|
+
internal const val UNIFFI_CALLBACK_SUCCESS = 0
|
|
1069
|
+
internal const val UNIFFI_CALLBACK_ERROR = 1
|
|
1070
|
+
internal const val UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2
|
|
1680
1071
|
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1072
|
+
public abstract class FfiConverterCallbackInterface<CallbackInterface>(
|
|
1073
|
+
protected val foreignCallback: ForeignCallback
|
|
1074
|
+
): FfiConverter<CallbackInterface, Handle> {
|
|
1075
|
+
private val handleMap = ConcurrentHandleMap<CallbackInterface>()
|
|
1076
|
+
|
|
1077
|
+
// Registers the foreign callback with the Rust side.
|
|
1078
|
+
// This method is generated for each callback interface.
|
|
1079
|
+
internal abstract fun register(lib: _UniFFILib)
|
|
1080
|
+
|
|
1081
|
+
fun drop(handle: Handle): RustBuffer.ByValue {
|
|
1082
|
+
return handleMap.remove(handle).let { RustBuffer.ByValue() }
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
override fun lift(value: Handle): CallbackInterface {
|
|
1086
|
+
return handleMap.get(value) ?: throw InternalException("No callback in handlemap; this is a Uniffi bug")
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
override fun read(buf: ByteBuffer) = lift(buf.getLong())
|
|
1090
|
+
|
|
1091
|
+
override fun lower(value: CallbackInterface) =
|
|
1092
|
+
handleMap.insert(value).also {
|
|
1093
|
+
assert(handleMap.get(it) === value) { "Handle map is not returning the object we just placed there. This is a bug in the HandleMap." }
|
|
1693
1094
|
}
|
|
1095
|
+
|
|
1096
|
+
override fun allocationSize(value: CallbackInterface) = 8
|
|
1097
|
+
|
|
1098
|
+
override fun write(value: CallbackInterface, buf: ByteBuffer) {
|
|
1099
|
+
buf.putLong(lower(value))
|
|
1694
1100
|
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// Declaration and FfiConverters for EventListener Callback Interface
|
|
1104
|
+
|
|
1105
|
+
public interface EventListener {
|
|
1106
|
+
fun `onEventOccurred`(`eventData`: String)
|
|
1107
|
+
|
|
1108
|
+
companion object
|
|
1109
|
+
}
|
|
1695
1110
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1111
|
+
// The ForeignCallback that is passed to Rust.
|
|
1112
|
+
internal class ForeignCallbackTypeEventListener : ForeignCallback {
|
|
1113
|
+
@Suppress("TooGenericExceptionCaught")
|
|
1114
|
+
override fun callback(handle: Handle, method: Int, argsData: Pointer, argsLen: Int, outBuf: RustBufferByReference): Int {
|
|
1115
|
+
val cb = FfiConverterTypeEventListener.lift(handle)
|
|
1116
|
+
return when (method) {
|
|
1117
|
+
IDX_CALLBACK_FREE -> {
|
|
1118
|
+
FfiConverterTypeEventListener.drop(handle)
|
|
1119
|
+
// Successful return
|
|
1120
|
+
// See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
|
|
1121
|
+
UNIFFI_CALLBACK_SUCCESS
|
|
1122
|
+
}
|
|
1123
|
+
1 -> {
|
|
1124
|
+
// Call the method, write to outBuf and return a status code
|
|
1125
|
+
// See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs` for info
|
|
1126
|
+
try {
|
|
1127
|
+
this.`invokeOnEventOccurred`(cb, argsData, argsLen, outBuf)
|
|
1128
|
+
} catch (e: Throwable) {
|
|
1129
|
+
// Unexpected error
|
|
1130
|
+
try {
|
|
1131
|
+
// Try to serialize the error into a string
|
|
1132
|
+
outBuf.setValue(FfiConverterString.lower(e.toString()))
|
|
1133
|
+
} catch (e: Throwable) {
|
|
1134
|
+
// If that fails, then it's time to give up and just return
|
|
1135
|
+
}
|
|
1136
|
+
UNIFFI_CALLBACK_UNEXPECTED_ERROR
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
else -> {
|
|
1141
|
+
// An unexpected error happened.
|
|
1142
|
+
// See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
|
|
1143
|
+
try {
|
|
1144
|
+
// Try to serialize the error into a string
|
|
1145
|
+
outBuf.setValue(FfiConverterString.lower("Invalid Callback index"))
|
|
1146
|
+
} catch (e: Throwable) {
|
|
1147
|
+
// If that fails, then it's time to give up and just return
|
|
1148
|
+
}
|
|
1149
|
+
UNIFFI_CALLBACK_UNEXPECTED_ERROR
|
|
1150
|
+
}
|
|
1699
1151
|
}
|
|
1700
1152
|
}
|
|
1701
1153
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1154
|
+
|
|
1155
|
+
@Suppress("UNUSED_PARAMETER")
|
|
1156
|
+
private fun `invokeOnEventOccurred`(kotlinCallbackInterface: EventListener, argsData: Pointer, argsLen: Int, outBuf: RustBufferByReference): Int {
|
|
1157
|
+
val argsBuf = argsData.getByteBuffer(0, argsLen.toLong()).also {
|
|
1158
|
+
it.order(ByteOrder.BIG_ENDIAN)
|
|
1159
|
+
}
|
|
1160
|
+
fun makeCall() : Int {
|
|
1161
|
+
kotlinCallbackInterface.`onEventOccurred`(
|
|
1162
|
+
FfiConverterString.read(argsBuf)
|
|
1163
|
+
)
|
|
1164
|
+
return UNIFFI_CALLBACK_SUCCESS
|
|
1165
|
+
}
|
|
1166
|
+
fun makeCallAndHandleError() : Int = makeCall()
|
|
1706
1167
|
|
|
1707
|
-
|
|
1708
|
-
// This method is generated for each callback interface.
|
|
1709
|
-
internal fun register(lib: UniffiLib) {
|
|
1710
|
-
lib.uniffi_pubkycore_fn_init_callback_vtable_eventlistener(vtable)
|
|
1168
|
+
return makeCallAndHandleError()
|
|
1711
1169
|
}
|
|
1170
|
+
|
|
1712
1171
|
}
|
|
1713
1172
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1173
|
+
// The ffiConverter which transforms the Callbacks in to Handles to pass to Rust.
|
|
1174
|
+
public object FfiConverterTypeEventListener: FfiConverterCallbackInterface<EventListener>(
|
|
1175
|
+
foreignCallback = ForeignCallbackTypeEventListener()
|
|
1176
|
+
) {
|
|
1177
|
+
override fun register(lib: _UniFFILib) {
|
|
1178
|
+
rustCall() { status ->
|
|
1179
|
+
lib.uniffi_pubkycore_fn_init_callback_eventlistener(this.foreignCallback, status)
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1720
1183
|
|
|
1721
1184
|
|
|
1722
1185
|
|
|
1723
1186
|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
*/
|
|
1727
|
-
public object FfiConverterOptionalString: FfiConverterRustBuffer<kotlin.String?> {
|
|
1728
|
-
override fun read(buf: ByteBuffer): kotlin.String? {
|
|
1187
|
+
public object FfiConverterOptionalString: FfiConverterRustBuffer<String?> {
|
|
1188
|
+
override fun read(buf: ByteBuffer): String? {
|
|
1729
1189
|
if (buf.get().toInt() == 0) {
|
|
1730
1190
|
return null
|
|
1731
1191
|
}
|
|
1732
1192
|
return FfiConverterString.read(buf)
|
|
1733
1193
|
}
|
|
1734
1194
|
|
|
1735
|
-
override fun allocationSize(value:
|
|
1195
|
+
override fun allocationSize(value: String?): Int {
|
|
1736
1196
|
if (value == null) {
|
|
1737
|
-
return
|
|
1197
|
+
return 1
|
|
1738
1198
|
} else {
|
|
1739
|
-
return
|
|
1199
|
+
return 1 + FfiConverterString.allocationSize(value)
|
|
1740
1200
|
}
|
|
1741
1201
|
}
|
|
1742
1202
|
|
|
1743
|
-
override fun write(value:
|
|
1203
|
+
override fun write(value: String?, buf: ByteBuffer) {
|
|
1744
1204
|
if (value == null) {
|
|
1745
1205
|
buf.put(0)
|
|
1746
1206
|
} else {
|
|
@@ -1753,285 +1213,249 @@ public object FfiConverterOptionalString: FfiConverterRustBuffer<kotlin.String?>
|
|
|
1753
1213
|
|
|
1754
1214
|
|
|
1755
1215
|
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
*/
|
|
1759
|
-
public object FfiConverterSequenceString: FfiConverterRustBuffer<List<kotlin.String>> {
|
|
1760
|
-
override fun read(buf: ByteBuffer): List<kotlin.String> {
|
|
1216
|
+
public object FfiConverterSequenceString: FfiConverterRustBuffer<List<String>> {
|
|
1217
|
+
override fun read(buf: ByteBuffer): List<String> {
|
|
1761
1218
|
val len = buf.getInt()
|
|
1762
|
-
return List<
|
|
1219
|
+
return List<String>(len) {
|
|
1763
1220
|
FfiConverterString.read(buf)
|
|
1764
1221
|
}
|
|
1765
1222
|
}
|
|
1766
1223
|
|
|
1767
|
-
override fun allocationSize(value: List<
|
|
1768
|
-
val sizeForLength =
|
|
1224
|
+
override fun allocationSize(value: List<String>): Int {
|
|
1225
|
+
val sizeForLength = 4
|
|
1769
1226
|
val sizeForItems = value.map { FfiConverterString.allocationSize(it) }.sum()
|
|
1770
1227
|
return sizeForLength + sizeForItems
|
|
1771
1228
|
}
|
|
1772
1229
|
|
|
1773
|
-
override fun write(value: List<
|
|
1230
|
+
override fun write(value: List<String>, buf: ByteBuffer) {
|
|
1774
1231
|
buf.putInt(value.size)
|
|
1775
|
-
value.
|
|
1232
|
+
value.forEach {
|
|
1776
1233
|
FfiConverterString.write(it, buf)
|
|
1777
1234
|
}
|
|
1778
1235
|
}
|
|
1779
|
-
} fun `auth`(`url`: kotlin.String, `secretKey`: kotlin.String): List<kotlin.String> {
|
|
1780
|
-
return FfiConverterSequenceString.lift(
|
|
1781
|
-
uniffiRustCall() { _status ->
|
|
1782
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_func_auth(
|
|
1783
|
-
FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),_status)
|
|
1784
1236
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_func_create_recovery_file(
|
|
1792
|
-
FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`passphrase`),_status)
|
|
1237
|
+
|
|
1238
|
+
fun `auth`(`url`: String, `secretKey`: String): List<String> {
|
|
1239
|
+
return FfiConverterSequenceString.lift(
|
|
1240
|
+
rustCall() { _status ->
|
|
1241
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_auth(FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),_status)
|
|
1242
|
+
})
|
|
1793
1243
|
}
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
FfiConverterString.lower(`recoveryFile`),FfiConverterString.lower(`passphrase`),_status)
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
fun `createRecoveryFile`(`secretKey`: String, `passphrase`: String): List<String> {
|
|
1247
|
+
return FfiConverterSequenceString.lift(
|
|
1248
|
+
rustCall() { _status ->
|
|
1249
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_create_recovery_file(FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`passphrase`),_status)
|
|
1250
|
+
})
|
|
1802
1251
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),_status)
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
fun `decryptRecoveryFile`(`recoveryFile`: String, `passphrase`: String): List<String> {
|
|
1255
|
+
return FfiConverterSequenceString.lift(
|
|
1256
|
+
rustCall() { _status ->
|
|
1257
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_decrypt_recovery_file(FfiConverterString.lower(`recoveryFile`),FfiConverterString.lower(`passphrase`),_status)
|
|
1258
|
+
})
|
|
1811
1259
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
_status)
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
fun `deleteFile`(`url`: String, `secretKey`: String): List<String> {
|
|
1263
|
+
return FfiConverterSequenceString.lift(
|
|
1264
|
+
rustCall() { _status ->
|
|
1265
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_delete_file(FfiConverterString.lower(`url`),FfiConverterString.lower(`secretKey`),_status)
|
|
1266
|
+
})
|
|
1820
1267
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
_status)
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
fun `generateMnemonicPhrase`(): List<String> {
|
|
1271
|
+
return FfiConverterSequenceString.lift(
|
|
1272
|
+
rustCall() { _status ->
|
|
1273
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_generate_mnemonic_phrase(_status)
|
|
1274
|
+
})
|
|
1829
1275
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
_status)
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
fun `generateMnemonicPhraseAndKeypair`(): List<String> {
|
|
1279
|
+
return FfiConverterSequenceString.lift(
|
|
1280
|
+
rustCall() { _status ->
|
|
1281
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_generate_mnemonic_phrase_and_keypair(_status)
|
|
1282
|
+
})
|
|
1838
1283
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
FfiConverterString.lower(`url`),_status)
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
fun `generateSecretKey`(): List<String> {
|
|
1287
|
+
return FfiConverterSequenceString.lift(
|
|
1288
|
+
rustCall() { _status ->
|
|
1289
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_generate_secret_key(_status)
|
|
1290
|
+
})
|
|
1847
1291
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
FfiConverterString.lower(`pubky`),_status)
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
fun `get`(`url`: String): List<String> {
|
|
1295
|
+
return FfiConverterSequenceString.lift(
|
|
1296
|
+
rustCall() { _status ->
|
|
1297
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_get(FfiConverterString.lower(`url`),_status)
|
|
1298
|
+
})
|
|
1856
1299
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
FfiConverterString.lower(`secretKey`),_status)
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
fun `getHomeserver`(`pubky`: String): List<String> {
|
|
1303
|
+
return FfiConverterSequenceString.lift(
|
|
1304
|
+
rustCall() { _status ->
|
|
1305
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_get_homeserver(FfiConverterString.lower(`pubky`),_status)
|
|
1306
|
+
})
|
|
1865
1307
|
}
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
FfiConverterString.lower(`homeserverPubky`),FfiConverterString.lower(`adminPassword`),_status)
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
fun `getPublicKeyFromSecretKey`(`secretKey`: String): List<String> {
|
|
1311
|
+
return FfiConverterSequenceString.lift(
|
|
1312
|
+
rustCall() { _status ->
|
|
1313
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_get_public_key_from_secret_key(FfiConverterString.lower(`secretKey`),_status)
|
|
1314
|
+
})
|
|
1874
1315
|
}
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
FfiConverterString.lower(`url`),_status)
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
fun `getSignupToken`(`homeserverPubky`: String, `adminPassword`: String): List<String> {
|
|
1319
|
+
return FfiConverterSequenceString.lift(
|
|
1320
|
+
rustCall() { _status ->
|
|
1321
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_get_signup_token(FfiConverterString.lower(`homeserverPubky`),FfiConverterString.lower(`adminPassword`),_status)
|
|
1322
|
+
})
|
|
1883
1323
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
FfiConverterString.lower(`mnemonicPhrase`),_status)
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
fun `list`(`url`: String): List<String> {
|
|
1327
|
+
return FfiConverterSequenceString.lift(
|
|
1328
|
+
rustCall() { _status ->
|
|
1329
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_list(FfiConverterString.lower(`url`),_status)
|
|
1330
|
+
})
|
|
1892
1331
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
FfiConverterString.lower(`url`),_status)
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
fun `mnemonicPhraseToKeypair`(`mnemonicPhrase`: String): List<String> {
|
|
1335
|
+
return FfiConverterSequenceString.lift(
|
|
1336
|
+
rustCall() { _status ->
|
|
1337
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_mnemonic_phrase_to_keypair(FfiConverterString.lower(`mnemonicPhrase`),_status)
|
|
1338
|
+
})
|
|
1901
1339
|
}
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
FfiConverterString.lower(`recordName`),FfiConverterString.lower(`recordContent`),FfiConverterString.lower(`secretKey`),_status)
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
fun `parseAuthUrl`(`url`: String): List<String> {
|
|
1343
|
+
return FfiConverterSequenceString.lift(
|
|
1344
|
+
rustCall() { _status ->
|
|
1345
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_parse_auth_url(FfiConverterString.lower(`url`),_status)
|
|
1346
|
+
})
|
|
1910
1347
|
}
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
FfiConverterString.lower(`recordName`),FfiConverterString.lower(`target`),FfiConverterString.lower(`secretKey`),_status)
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
fun `publish`(`recordName`: String, `recordContent`: String, `secretKey`: String): List<String> {
|
|
1351
|
+
return FfiConverterSequenceString.lift(
|
|
1352
|
+
rustCall() { _status ->
|
|
1353
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_publish(FfiConverterString.lower(`recordName`),FfiConverterString.lower(`recordContent`),FfiConverterString.lower(`secretKey`),_status)
|
|
1354
|
+
})
|
|
1919
1355
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
FfiConverterString.lower(`url`),FfiConverterString.lower(`content`),FfiConverterString.lower(`secretKey`),_status)
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
fun `publishHttps`(`recordName`: String, `target`: String, `secretKey`: String): List<String> {
|
|
1359
|
+
return FfiConverterSequenceString.lift(
|
|
1360
|
+
rustCall() { _status ->
|
|
1361
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_publish_https(FfiConverterString.lower(`recordName`),FfiConverterString.lower(`target`),FfiConverterString.lower(`secretKey`),_status)
|
|
1362
|
+
})
|
|
1928
1363
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
_status)
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
fun `put`(`url`: String, `content`: String, `secretKey`: String): List<String> {
|
|
1367
|
+
return FfiConverterSequenceString.lift(
|
|
1368
|
+
rustCall() { _status ->
|
|
1369
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_put(FfiConverterString.lower(`url`),FfiConverterString.lower(`content`),FfiConverterString.lower(`secretKey`),_status)
|
|
1370
|
+
})
|
|
1937
1371
|
}
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
fun `removeEventListener`() =
|
|
1938
1375
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
return FfiConverterSequenceString.lift(
|
|
1942
|
-
uniffiRustCall() { _status ->
|
|
1943
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_func_republish_homeserver(
|
|
1944
|
-
FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),_status)
|
|
1376
|
+
rustCall() { _status ->
|
|
1377
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_remove_event_listener(_status)
|
|
1945
1378
|
}
|
|
1946
|
-
)
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
1379
|
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
return FfiConverterSequenceString.lift(
|
|
1958
|
-
uniffiRustCall() { _status ->
|
|
1959
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_func_resolve(
|
|
1960
|
-
FfiConverterString.lower(`publicKey`),_status)
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
fun `republishHomeserver`(`secretKey`: String, `homeserver`: String): List<String> {
|
|
1383
|
+
return FfiConverterSequenceString.lift(
|
|
1384
|
+
rustCall() { _status ->
|
|
1385
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_republish_homeserver(FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),_status)
|
|
1386
|
+
})
|
|
1961
1387
|
}
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
FfiConverterString.lower(`publicKey`),_status)
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
fun `resolve`(`publicKey`: String): List<String> {
|
|
1391
|
+
return FfiConverterSequenceString.lift(
|
|
1392
|
+
rustCall() { _status ->
|
|
1393
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_resolve(FfiConverterString.lower(`publicKey`),_status)
|
|
1394
|
+
})
|
|
1970
1395
|
}
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
FfiConverterString.lower(`sessionSecret`),_status)
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
fun `resolveHttps`(`publicKey`: String): List<String> {
|
|
1399
|
+
return FfiConverterSequenceString.lift(
|
|
1400
|
+
rustCall() { _status ->
|
|
1401
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_resolve_https(FfiConverterString.lower(`publicKey`),_status)
|
|
1402
|
+
})
|
|
1979
1403
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
FfiConverterTypeEventListener.lower(`listener`),_status)
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
fun `revalidateSession`(`sessionSecret`: String): List<String> {
|
|
1407
|
+
return FfiConverterSequenceString.lift(
|
|
1408
|
+
rustCall() { _status ->
|
|
1409
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_revalidate_session(FfiConverterString.lower(`sessionSecret`),_status)
|
|
1410
|
+
})
|
|
1988
1411
|
}
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
fun `setEventListener`(`listener`: EventListener) =
|
|
1989
1415
|
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
return FfiConverterSequenceString.lift(
|
|
1993
|
-
uniffiRustCall() { _status ->
|
|
1994
|
-
UniffiLib.INSTANCE.uniffi_pubkycore_fn_func_sign_in(
|
|
1995
|
-
FfiConverterString.lower(`secretKey`),_status)
|
|
1416
|
+
rustCall() { _status ->
|
|
1417
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_set_event_listener(FfiConverterTypeEventListener.lower(`listener`),_status)
|
|
1996
1418
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
fun `signIn`(`secretKey`: String): List<String> {
|
|
1423
|
+
return FfiConverterSequenceString.lift(
|
|
1424
|
+
rustCall() { _status ->
|
|
1425
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_sign_in(FfiConverterString.lower(`secretKey`),_status)
|
|
1426
|
+
})
|
|
2005
1427
|
}
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),FfiConverterOptionalString.lower(`signupToken`),_status)
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
fun `signOut`(`sessionSecret`: String): List<String> {
|
|
1431
|
+
return FfiConverterSequenceString.lift(
|
|
1432
|
+
rustCall() { _status ->
|
|
1433
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_sign_out(FfiConverterString.lower(`sessionSecret`),_status)
|
|
1434
|
+
})
|
|
2014
1435
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
FfiConverterBoolean.lower(`useTestnet`),_status)
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
fun `signUp`(`secretKey`: String, `homeserver`: String, `signupToken`: String?): List<String> {
|
|
1439
|
+
return FfiConverterSequenceString.lift(
|
|
1440
|
+
rustCall() { _status ->
|
|
1441
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_sign_up(FfiConverterString.lower(`secretKey`),FfiConverterString.lower(`homeserver`),FfiConverterOptionalString.lower(`signupToken`),_status)
|
|
1442
|
+
})
|
|
2023
1443
|
}
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
fun `switchNetwork`(`useTestnet`: Boolean): List<String> {
|
|
1447
|
+
return FfiConverterSequenceString.lift(
|
|
1448
|
+
rustCall() { _status ->
|
|
1449
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_switch_network(FfiConverterBoolean.lower(`useTestnet`),_status)
|
|
1450
|
+
})
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
fun `validateMnemonicPhrase`(`mnemonicPhrase`: String): List<String> {
|
|
1455
|
+
return FfiConverterSequenceString.lift(
|
|
1456
|
+
rustCall() { _status ->
|
|
1457
|
+
_UniFFILib.INSTANCE.uniffi_pubkycore_fn_func_validate_mnemonic_phrase(FfiConverterString.lower(`mnemonicPhrase`),_status)
|
|
1458
|
+
})
|
|
2032
1459
|
}
|
|
2033
|
-
)
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
1460
|
|
|
2037
1461
|
|