@synonymdev/react-native-pubky 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +32 -0
- package/android/src/main/java/com/pubky/PubkyModule.kt +40 -0
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +30 -0
- package/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86_64/libpubkymobile.so +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/Info.plist +4 -4
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +10 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +10 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +10 -0
- package/ios/Pubky.swift +24 -0
- package/ios/pubkymobile.swift +26 -0
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +22 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +19 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +19 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +49 -2
package/README.md
CHANGED
@@ -14,6 +14,8 @@ npm install @synonymdev/react-native-pubky
|
|
14
14
|
- [x] [parseAuthUrl](#parseAuthUrl): Method to decode an authUrl.
|
15
15
|
- [x] [publish](#publish): Functionality to publish content.
|
16
16
|
- [x] [resolve](#resolve): Functionality to resolve content.
|
17
|
+
- [x] [publishHttps](#publishHttps): Publish HTTPS records.
|
18
|
+
- [x] [resolveHttps](#resolveHttps): Resolve HTTPS records.
|
17
19
|
### Methods to be Implemented
|
18
20
|
- [ ] signIn: Sign-in to a homeserver.
|
19
21
|
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
|
@@ -78,6 +80,36 @@ if (resolveRes.isErr()) {
|
|
78
80
|
console.log(resolveRes.value);
|
79
81
|
```
|
80
82
|
|
83
|
+
### <a name="publishHttps"></a>publishHttps
|
84
|
+
```js
|
85
|
+
import { publishHttps } from '@synonymdev/react-native-pubky';
|
86
|
+
|
87
|
+
const publishHttpsRes = await publishHttps(
|
88
|
+
'example.com', // Record Name
|
89
|
+
'target.example.com', // Target
|
90
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' // Secret Key
|
91
|
+
);
|
92
|
+
if (publishHttpsRes.isErr()) {
|
93
|
+
console.log(publishHttpsRes.error.message);
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
console.log(publishHttpsRes.value);
|
97
|
+
```
|
98
|
+
|
99
|
+
### <a name="resolveHttps"></a>resolveHttps
|
100
|
+
```js
|
101
|
+
import { resolveHttps } from '@synonymdev/react-native-pubky';
|
102
|
+
|
103
|
+
const resolveHttpsRes = await resolveHttps(
|
104
|
+
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty' // Public key
|
105
|
+
);
|
106
|
+
if (resolveHttpsRes.isErr()) {
|
107
|
+
console.log(resolveHttpsRes.error.message);
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
console.log(resolveHttpsRes.value);
|
111
|
+
```
|
112
|
+
|
81
113
|
## Local Installation
|
82
114
|
|
83
115
|
1. Clone & npm install:
|
@@ -18,6 +18,8 @@ import uniffi.pubkymobile.signIn
|
|
18
18
|
import uniffi.pubkymobile.signOut
|
19
19
|
import uniffi.pubkymobile.put
|
20
20
|
import uniffi.pubkymobile.get
|
21
|
+
import uniffi.pubkymobile.publishHttps
|
22
|
+
import uniffi.pubkymobile.resolveHttps
|
21
23
|
|
22
24
|
class PubkyModule(reactContext: ReactApplicationContext) :
|
23
25
|
ReactContextBaseJavaModule(reactContext) {
|
@@ -191,6 +193,44 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
191
193
|
}
|
192
194
|
}
|
193
195
|
|
196
|
+
@ReactMethod
|
197
|
+
fun publishHttps(recordName: String, target: String, secretKey: String, promise: Promise) {
|
198
|
+
CoroutineScope(Dispatchers.IO).launch {
|
199
|
+
try {
|
200
|
+
val result = publishHttps(recordName, target, secretKey)
|
201
|
+
val array = Arguments.createArray().apply {
|
202
|
+
result.forEach { pushString(it) }
|
203
|
+
}
|
204
|
+
withContext(Dispatchers.Main) {
|
205
|
+
promise.resolve(array)
|
206
|
+
}
|
207
|
+
} catch (e: Exception) {
|
208
|
+
withContext(Dispatchers.Main) {
|
209
|
+
promise.reject("Error", e.message)
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
@ReactMethod
|
216
|
+
fun resolveHttps(publicKey: String, promise: Promise) {
|
217
|
+
CoroutineScope(Dispatchers.IO).launch {
|
218
|
+
try {
|
219
|
+
val result = resolveHttps(publicKey)
|
220
|
+
val array = Arguments.createArray().apply {
|
221
|
+
result.forEach { pushString(it) }
|
222
|
+
}
|
223
|
+
withContext(Dispatchers.Main) {
|
224
|
+
promise.resolve(array)
|
225
|
+
}
|
226
|
+
} catch (e: Exception) {
|
227
|
+
withContext(Dispatchers.Main) {
|
228
|
+
promise.reject("Error", e.message)
|
229
|
+
}
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
194
234
|
companion object {
|
195
235
|
const val NAME = "Pubky"
|
196
236
|
}
|
@@ -393,10 +393,14 @@ internal interface _UniFFILib : Library {
|
|
393
393
|
): RustBuffer.ByValue
|
394
394
|
fun uniffi_pubkymobile_fn_func_publish(`recordName`: RustBuffer.ByValue,`recordContent`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
395
395
|
): RustBuffer.ByValue
|
396
|
+
fun uniffi_pubkymobile_fn_func_publish_https(`recordName`: RustBuffer.ByValue,`target`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
397
|
+
): RustBuffer.ByValue
|
396
398
|
fun uniffi_pubkymobile_fn_func_put(`url`: RustBuffer.ByValue,`content`: RustBuffer.ByValue,
|
397
399
|
): Pointer
|
398
400
|
fun uniffi_pubkymobile_fn_func_resolve(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
399
401
|
): RustBuffer.ByValue
|
402
|
+
fun uniffi_pubkymobile_fn_func_resolve_https(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
403
|
+
): RustBuffer.ByValue
|
400
404
|
fun uniffi_pubkymobile_fn_func_sign_in(`secretKey`: RustBuffer.ByValue,
|
401
405
|
): Pointer
|
402
406
|
fun uniffi_pubkymobile_fn_func_sign_out(`secretKey`: RustBuffer.ByValue,
|
@@ -525,10 +529,14 @@ internal interface _UniFFILib : Library {
|
|
525
529
|
): Short
|
526
530
|
fun uniffi_pubkymobile_checksum_func_publish(
|
527
531
|
): Short
|
532
|
+
fun uniffi_pubkymobile_checksum_func_publish_https(
|
533
|
+
): Short
|
528
534
|
fun uniffi_pubkymobile_checksum_func_put(
|
529
535
|
): Short
|
530
536
|
fun uniffi_pubkymobile_checksum_func_resolve(
|
531
537
|
): Short
|
538
|
+
fun uniffi_pubkymobile_checksum_func_resolve_https(
|
539
|
+
): Short
|
532
540
|
fun uniffi_pubkymobile_checksum_func_sign_in(
|
533
541
|
): Short
|
534
542
|
fun uniffi_pubkymobile_checksum_func_sign_out(
|
@@ -564,12 +572,18 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
|
564
572
|
if (lib.uniffi_pubkymobile_checksum_func_publish() != 20156.toShort()) {
|
565
573
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
566
574
|
}
|
575
|
+
if (lib.uniffi_pubkymobile_checksum_func_publish_https() != 14705.toShort()) {
|
576
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
577
|
+
}
|
567
578
|
if (lib.uniffi_pubkymobile_checksum_func_put() != 47594.toShort()) {
|
568
579
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
569
580
|
}
|
570
581
|
if (lib.uniffi_pubkymobile_checksum_func_resolve() != 18303.toShort()) {
|
571
582
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
572
583
|
}
|
584
|
+
if (lib.uniffi_pubkymobile_checksum_func_resolve_https() != 34593.toShort()) {
|
585
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
586
|
+
}
|
573
587
|
if (lib.uniffi_pubkymobile_checksum_func_sign_in() != 53969.toShort()) {
|
574
588
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
575
589
|
}
|
@@ -751,6 +765,14 @@ fun `publish`(`recordName`: String, `recordContent`: String, `secretKey`: String
|
|
751
765
|
}
|
752
766
|
|
753
767
|
|
768
|
+
fun `publishHttps`(`recordName`: String, `target`: String, `secretKey`: String): List<String> {
|
769
|
+
return FfiConverterSequenceString.lift(
|
770
|
+
rustCall() { _status ->
|
771
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_publish_https(FfiConverterString.lower(`recordName`),FfiConverterString.lower(`target`),FfiConverterString.lower(`secretKey`),_status)
|
772
|
+
})
|
773
|
+
}
|
774
|
+
|
775
|
+
|
754
776
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
755
777
|
suspend fun `put`(`url`: String, `content`: String) : List<String> {
|
756
778
|
return uniffiRustCallAsync(
|
@@ -773,6 +795,14 @@ fun `resolve`(`publicKey`: String): List<String> {
|
|
773
795
|
}
|
774
796
|
|
775
797
|
|
798
|
+
fun `resolveHttps`(`publicKey`: String): List<String> {
|
799
|
+
return FfiConverterSequenceString.lift(
|
800
|
+
rustCall() { _status ->
|
801
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_resolve_https(FfiConverterString.lower(`publicKey`),_status)
|
802
|
+
})
|
803
|
+
}
|
804
|
+
|
805
|
+
|
776
806
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
777
807
|
suspend fun `signIn`(`secretKey`: String) : List<String> {
|
778
808
|
return uniffiRustCallAsync(
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<key>HeadersPath</key>
|
11
11
|
<string>Headers</string>
|
12
12
|
<key>LibraryIdentifier</key>
|
13
|
-
<string>ios-arm64</string>
|
13
|
+
<string>ios-arm64-simulator</string>
|
14
14
|
<key>LibraryPath</key>
|
15
15
|
<string>libpubkymobile.a</string>
|
16
16
|
<key>SupportedArchitectures</key>
|
@@ -19,6 +19,8 @@
|
|
19
19
|
</array>
|
20
20
|
<key>SupportedPlatform</key>
|
21
21
|
<string>ios</string>
|
22
|
+
<key>SupportedPlatformVariant</key>
|
23
|
+
<string>simulator</string>
|
22
24
|
</dict>
|
23
25
|
<dict>
|
24
26
|
<key>BinaryPath</key>
|
@@ -26,7 +28,7 @@
|
|
26
28
|
<key>HeadersPath</key>
|
27
29
|
<string>Headers</string>
|
28
30
|
<key>LibraryIdentifier</key>
|
29
|
-
<string>ios-arm64
|
31
|
+
<string>ios-arm64</string>
|
30
32
|
<key>LibraryPath</key>
|
31
33
|
<string>libpubkymobile.a</string>
|
32
34
|
<key>SupportedArchitectures</key>
|
@@ -35,8 +37,6 @@
|
|
35
37
|
</array>
|
36
38
|
<key>SupportedPlatform</key>
|
37
39
|
<string>ios</string>
|
38
|
-
<key>SupportedPlatformVariant</key>
|
39
|
-
<string>simulator</string>
|
40
40
|
</dict>
|
41
41
|
</array>
|
42
42
|
<key>CFBundlePackageType</key>
|
@@ -71,10 +71,14 @@ RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallSta
|
|
71
71
|
);
|
72
72
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
73
73
|
);
|
74
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
74
76
|
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
75
77
|
);
|
76
78
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
77
79
|
);
|
80
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
|
+
);
|
78
82
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
79
83
|
);
|
80
84
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
@@ -206,12 +210,18 @@ uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
|
206
210
|
);
|
207
211
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
208
212
|
|
213
|
+
);
|
214
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
215
|
+
|
209
216
|
);
|
210
217
|
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
211
218
|
|
212
219
|
);
|
213
220
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
214
221
|
|
222
|
+
);
|
223
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
224
|
+
|
215
225
|
);
|
216
226
|
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
217
227
|
|
Binary file
|
@@ -71,10 +71,14 @@ RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallSta
|
|
71
71
|
);
|
72
72
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
73
73
|
);
|
74
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
75
|
+
);
|
74
76
|
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
75
77
|
);
|
76
78
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
77
79
|
);
|
80
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
|
+
);
|
78
82
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
79
83
|
);
|
80
84
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
@@ -206,12 +210,18 @@ uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
|
206
210
|
);
|
207
211
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
208
212
|
|
213
|
+
);
|
214
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
215
|
+
|
209
216
|
);
|
210
217
|
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
211
218
|
|
212
219
|
);
|
213
220
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
214
221
|
|
222
|
+
);
|
223
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
224
|
+
|
215
225
|
);
|
216
226
|
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
217
227
|
|
Binary file
|
package/ios/Pubky.mm
CHANGED
@@ -43,6 +43,16 @@ RCT_EXTERN_METHOD(get:(NSString *)url
|
|
43
43
|
withResolver:(RCTPromiseResolveBlock)resolve
|
44
44
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
45
45
|
|
46
|
+
RCT_EXTERN_METHOD(publishHttps:(NSString *)recordName
|
47
|
+
target:(NSString *)target
|
48
|
+
secretKey:(NSString *)secretKey
|
49
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
50
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
51
|
+
|
52
|
+
RCT_EXTERN_METHOD(resolveHttps:(NSString *)publicKey
|
53
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
54
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
55
|
+
|
46
56
|
+ (BOOL)requiresMainQueueSetup
|
47
57
|
{
|
48
58
|
return NO;
|
package/ios/Pubky.swift
CHANGED
@@ -109,4 +109,28 @@ class Pubky: NSObject {
|
|
109
109
|
}
|
110
110
|
}
|
111
111
|
}
|
112
|
+
|
113
|
+
@objc(publishHttps:target:secretKey:withResolver:withRejecter:)
|
114
|
+
func publishHttps(_ recordName: String, target: String, secretKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
115
|
+
Task {
|
116
|
+
do {
|
117
|
+
let result = try await react_native_pubky.publishHttps(recordName: recordName, target: target, secretKey: secretKey)
|
118
|
+
resolve(result)
|
119
|
+
} catch {
|
120
|
+
reject("publishHttps Error", "Failed to publish HTTPS record", error)
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
@objc(resolveHttps:withResolver:withRejecter:)
|
126
|
+
func resolveHttps(_ publicKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
127
|
+
Task {
|
128
|
+
do {
|
129
|
+
let result = try await react_native_pubky.resolveHttps(publicKey: publicKey)
|
130
|
+
resolve(result)
|
131
|
+
} catch {
|
132
|
+
reject("resolveHttps Error", "Failed to resolve HTTPS record", error)
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
112
136
|
}
|
package/ios/pubkymobile.swift
CHANGED
@@ -467,6 +467,17 @@ public func publish(recordName: String, recordContent: String, secretKey: String
|
|
467
467
|
)
|
468
468
|
}
|
469
469
|
|
470
|
+
public func publishHttps(recordName: String, target: String, secretKey: String) -> [String] {
|
471
|
+
return try! FfiConverterSequenceString.lift(
|
472
|
+
try! rustCall() {
|
473
|
+
uniffi_pubkymobile_fn_func_publish_https(
|
474
|
+
FfiConverterString.lower(recordName),
|
475
|
+
FfiConverterString.lower(target),
|
476
|
+
FfiConverterString.lower(secretKey),$0)
|
477
|
+
}
|
478
|
+
)
|
479
|
+
}
|
480
|
+
|
470
481
|
public func put(url: String, content: String) async -> [String] {
|
471
482
|
return try! await uniffiRustCallAsync(
|
472
483
|
rustFutureFunc: {
|
@@ -495,6 +506,15 @@ public func resolve(publicKey: String) -> [String] {
|
|
495
506
|
)
|
496
507
|
}
|
497
508
|
|
509
|
+
public func resolveHttps(publicKey: String) -> [String] {
|
510
|
+
return try! FfiConverterSequenceString.lift(
|
511
|
+
try! rustCall() {
|
512
|
+
uniffi_pubkymobile_fn_func_resolve_https(
|
513
|
+
FfiConverterString.lower(publicKey),$0)
|
514
|
+
}
|
515
|
+
)
|
516
|
+
}
|
517
|
+
|
498
518
|
public func signIn(secretKey: String) async -> [String] {
|
499
519
|
return try! await uniffiRustCallAsync(
|
500
520
|
rustFutureFunc: {
|
@@ -577,12 +597,18 @@ private var initializationResult: InitializationResult {
|
|
577
597
|
if (uniffi_pubkymobile_checksum_func_publish() != 20156) {
|
578
598
|
return InitializationResult.apiChecksumMismatch
|
579
599
|
}
|
600
|
+
if (uniffi_pubkymobile_checksum_func_publish_https() != 14705) {
|
601
|
+
return InitializationResult.apiChecksumMismatch
|
602
|
+
}
|
580
603
|
if (uniffi_pubkymobile_checksum_func_put() != 47594) {
|
581
604
|
return InitializationResult.apiChecksumMismatch
|
582
605
|
}
|
583
606
|
if (uniffi_pubkymobile_checksum_func_resolve() != 18303) {
|
584
607
|
return InitializationResult.apiChecksumMismatch
|
585
608
|
}
|
609
|
+
if (uniffi_pubkymobile_checksum_func_resolve_https() != 34593) {
|
610
|
+
return InitializationResult.apiChecksumMismatch
|
611
|
+
}
|
586
612
|
if (uniffi_pubkymobile_checksum_func_sign_in() != 53969) {
|
587
613
|
return InitializationResult.apiChecksumMismatch
|
588
614
|
}
|
package/lib/commonjs/index.js
CHANGED
@@ -7,8 +7,10 @@ exports.auth = auth;
|
|
7
7
|
exports.get = get;
|
8
8
|
exports.parseAuthUrl = parseAuthUrl;
|
9
9
|
exports.publish = publish;
|
10
|
+
exports.publishHttps = publishHttps;
|
10
11
|
exports.put = put;
|
11
12
|
exports.resolve = resolve;
|
13
|
+
exports.resolveHttps = resolveHttps;
|
12
14
|
exports.signIn = signIn;
|
13
15
|
exports.signOut = signOut;
|
14
16
|
exports.signUp = signUp;
|
@@ -119,4 +121,26 @@ async function put(url, content) {
|
|
119
121
|
return (0, _result.err)(JSON.stringify(e));
|
120
122
|
}
|
121
123
|
}
|
124
|
+
async function publishHttps(recordName, target, secretKey) {
|
125
|
+
try {
|
126
|
+
const res = await Pubky.publishHttps(recordName, target, secretKey);
|
127
|
+
if (res[0] === 'error') {
|
128
|
+
return (0, _result.err)(res[1]);
|
129
|
+
}
|
130
|
+
return (0, _result.ok)(res[1]);
|
131
|
+
} catch (e) {
|
132
|
+
return (0, _result.err)(JSON.stringify(e));
|
133
|
+
}
|
134
|
+
}
|
135
|
+
async function resolveHttps(publicKey) {
|
136
|
+
try {
|
137
|
+
const res = await Pubky.resolveHttps(publicKey);
|
138
|
+
if (res[0] === 'error') {
|
139
|
+
return (0, _result.err)(res[1]);
|
140
|
+
}
|
141
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
142
|
+
} catch (e) {
|
143
|
+
return (0, _result.err)(JSON.stringify(e));
|
144
|
+
}
|
145
|
+
}
|
122
146
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_result","LINKING_ERROR","Platform","select","ios","default","Pubky","NativeModules","Proxy","get","Error","auth","url","secretKey","res","err","ok","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
1
|
+
{"version":3,"names":["_reactNative","require","_result","LINKING_ERROR","Platform","select","ios","default","Pubky","NativeModules","Proxy","get","Error","auth","url","secretKey","res","err","ok","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,aAAa,GACjB,6EAA6E,GAC7EC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,KAAK,GAAGC,0BAAa,CAACD,KAAK,GAC7BC,0BAAa,CAACD,KAAK,GACnB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,eAAeU,IAAIA,CACxBC,GAAW,EACXC,SAAiB,EACU;EAC3B,MAAMC,GAAG,GAAG,MAAMR,KAAK,CAACK,IAAI,CAACC,GAAG,EAAEC,SAAS,CAAC;EAC5C,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;IACtB,OAAO,IAAAC,WAAG,EAACD,GAAG,CAAC,CAAC,CAAC,CAAC;EACpB;EACA,OAAO,IAAAE,UAAE,EAACF,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB;AAaO,eAAeG,YAAYA,CAChCL,GAAW,EACwB;EACnC,IAAI;IACF,MAAME,GAAG,GAAG,MAAMR,KAAK,CA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GAAG,MAAMR,KAAK,CAAC4B,YAAY,CAACV,UAAU,EAAEW,MAAM,EAAEtB,SAAS,CAAC;IACnE,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAO,IAAAC,WAAG,EAACD,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAO,IAAAE,UAAE,EAACF,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOO,CAAC,EAAE;IACV,OAAO,IAAAN,WAAG,EAACI,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AAiBO,eAAee,YAAYA,CAChCT,SAAiB,EACqB;EACtC,IAAI;IACF,MAAMb,GAAG,GAAG,MAAMR,KAAK,CAAC8B,YAAY,CAACT,SAAS,CAAC;IAC/C,IAAIb,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAO,IAAAC,WAAG,EAACD,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAO,IAAAE,UAAE,EAACG,IAAI,CAACC,KAAK,CAACN,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOO,CAAC,EAAE;IACV,OAAO,IAAAN,WAAG,EAACI,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -107,4 +107,26 @@ export async function put(url, content) {
|
|
107
107
|
return err(JSON.stringify(e));
|
108
108
|
}
|
109
109
|
}
|
110
|
+
export async function publishHttps(recordName, target, secretKey) {
|
111
|
+
try {
|
112
|
+
const res = await Pubky.publishHttps(recordName, target, secretKey);
|
113
|
+
if (res[0] === 'error') {
|
114
|
+
return err(res[1]);
|
115
|
+
}
|
116
|
+
return ok(res[1]);
|
117
|
+
} catch (e) {
|
118
|
+
return err(JSON.stringify(e));
|
119
|
+
}
|
120
|
+
}
|
121
|
+
export async function resolveHttps(publicKey) {
|
122
|
+
try {
|
123
|
+
const res = await Pubky.resolveHttps(publicKey);
|
124
|
+
if (res[0] === 'error') {
|
125
|
+
return err(res[1]);
|
126
|
+
}
|
127
|
+
return ok(JSON.parse(res[1]));
|
128
|
+
} catch (e) {
|
129
|
+
return err(JSON.stringify(e));
|
130
|
+
}
|
131
|
+
}
|
110
132
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","ok","err","LINKING_ERROR","select","ios","default","Pubky","Proxy","get","Error","auth","url","secretKey","res","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,EAAE,EAAEC,GAAG,QAAqB,oBAAoB;AAEzD,MAAMC,aAAa,GACjB,6EAA6E,GAC7EH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,KAAK,GAAGR,aAAa,CAACQ,KAAK,GAC7BR,aAAa,CAACQ,KAAK,GACnB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,eAAeQ,IAAIA,CACxBC,GAAW,EACXC,SAAiB,EACU;EAC3B,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAACI,IAAI,CAACC,GAAG,EAAEC,SAAS,CAAC;EAC5C,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;IACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;EACpB;EACA,OAAOb,EAAE,CAACa,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB;AAaA,OAAO,eAAeC,YAAYA,CAChCH,GAAW,EACwB;EACnC,IAAI;IACF,MAAME,GAAG,GAAG,MAAMP,KAAK,CAACQ,YAAY,CAACH,GAAG,CAAC;IACzC,IAAIE,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,MAAME,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAC,CAAC;IACjC,OAAOb,EAAE,CAACe,MAAM,CAAC;EACnB,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAeE,OAAOA,CAC3BC,UAAkB,EAClBC,aAAqB,EACrBV,SAAiB,EACU;EAC3B,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAACc,OAAO,CAACC,UAAU,EAAEC,aAAa,EAAEV,SAAS,CAAC;IACrE,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOb,EAAE,CAACa,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;
|
1
|
+
{"version":3,"names":["NativeModules","Platform","ok","err","LINKING_ERROR","select","ios","default","Pubky","Proxy","get","Error","auth","url","secretKey","res","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,S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G,GAAG,MAAMP,KAAK,CAAC2B,YAAY,CAACT,SAAS,CAAC;IAC/C,IAAIX,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOb,EAAE,CAACgB,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
|
@@ -22,11 +22,13 @@ interface ITxt {
|
|
22
22
|
ttl: number;
|
23
23
|
}
|
24
24
|
interface IDNSPacket {
|
25
|
-
|
25
|
+
signed_packet: string;
|
26
26
|
public_key: string;
|
27
|
-
records: ITxt[];
|
28
27
|
signature: string;
|
29
28
|
timestamp: number;
|
29
|
+
last_seen: number;
|
30
|
+
dns_packet: string;
|
31
|
+
records: ITxt[];
|
30
32
|
}
|
31
33
|
export declare function resolve(publicKey: string): Promise<Result<IDNSPacket>>;
|
32
34
|
export declare function signUp(secretKey: string, homeserver: string): Promise<Result<string[]>>;
|
@@ -34,5 +36,20 @@ export declare function signIn(secretKey: string): Promise<Result<string[]>>;
|
|
34
36
|
export declare function signOut(secretKey: string): Promise<Result<string[]>>;
|
35
37
|
export declare function get(url: string): Promise<Result<string[]>>;
|
36
38
|
export declare function put(url: string, content: Object): Promise<Result<string[]>>;
|
39
|
+
export declare function publishHttps(recordName: string, target: string, secretKey: string): Promise<Result<string[]>>;
|
40
|
+
interface IHttpsRecord {
|
41
|
+
name: string;
|
42
|
+
class: string;
|
43
|
+
ttl: number;
|
44
|
+
priority: number;
|
45
|
+
target: string;
|
46
|
+
port?: number;
|
47
|
+
alpn?: string[];
|
48
|
+
}
|
49
|
+
interface IHttpsResolveResult {
|
50
|
+
public_key: string;
|
51
|
+
https_records: IHttpsRecord[];
|
52
|
+
}
|
53
|
+
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
37
54
|
export {};
|
38
55
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAmB1D,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAM3B;AAED,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAWnC;AAED,wBAAsB,OAAO,CAC3B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAU3B;AAED,UAAU,IAAI;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,GAAG,EAAE,MAAM,CAAC;CACb;AACD,UAAU,UAAU;IAClB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,M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Packet {
|
25
|
-
|
25
|
+
signed_packet: string;
|
26
26
|
public_key: string;
|
27
|
-
records: ITxt[];
|
28
27
|
signature: string;
|
29
28
|
timestamp: number;
|
29
|
+
last_seen: number;
|
30
|
+
dns_packet: string;
|
31
|
+
records: ITxt[];
|
30
32
|
}
|
31
33
|
export declare function resolve(publicKey: string): Promise<Result<IDNSPacket>>;
|
32
34
|
export declare function signUp(secretKey: string, homeserver: string): Promise<Result<string[]>>;
|
@@ -34,5 +36,20 @@ export declare function signIn(secretKey: string): Promise<Result<string[]>>;
|
|
34
36
|
export declare function signOut(secretKey: string): Promise<Result<string[]>>;
|
35
37
|
export declare function get(url: string): Promise<Result<string[]>>;
|
36
38
|
export declare function put(url: string, content: Object): Promise<Result<string[]>>;
|
39
|
+
export declare function publishHttps(recordName: string, target: string, secretKey: string): Promise<Result<string[]>>;
|
40
|
+
interface IHttpsRecord {
|
41
|
+
name: string;
|
42
|
+
class: string;
|
43
|
+
ttl: number;
|
44
|
+
priority: number;
|
45
|
+
target: string;
|
46
|
+
port?: number;
|
47
|
+
alpn?: string[];
|
48
|
+
}
|
49
|
+
interface IHttpsResolveResult {
|
50
|
+
public_key: string;
|
51
|
+
https_records: IHttpsRecord[];
|
52
|
+
}
|
53
|
+
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
37
54
|
export {};
|
38
55
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAmB1D,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAM3B;AAED,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,C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,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAU3B;AAED,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAU3B;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAUtC"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -82,11 +82,13 @@ interface ITxt {
|
|
82
82
|
ttl: number;
|
83
83
|
}
|
84
84
|
interface IDNSPacket {
|
85
|
-
|
85
|
+
signed_packet: string;
|
86
86
|
public_key: string;
|
87
|
-
records: ITxt[];
|
88
87
|
signature: string;
|
89
88
|
timestamp: number;
|
89
|
+
last_seen: number;
|
90
|
+
dns_packet: string;
|
91
|
+
records: ITxt[];
|
90
92
|
}
|
91
93
|
export async function resolve(publicKey: string): Promise<Result<IDNSPacket>> {
|
92
94
|
try {
|
@@ -165,3 +167,48 @@ export async function put(
|
|
165
167
|
return err(JSON.stringify(e));
|
166
168
|
}
|
167
169
|
}
|
170
|
+
|
171
|
+
export async function publishHttps(
|
172
|
+
recordName: string,
|
173
|
+
target: string,
|
174
|
+
secretKey: string
|
175
|
+
): Promise<Result<string[]>> {
|
176
|
+
try {
|
177
|
+
const res = await Pubky.publishHttps(recordName, target, secretKey);
|
178
|
+
if (res[0] === 'error') {
|
179
|
+
return err(res[1]);
|
180
|
+
}
|
181
|
+
return ok(res[1]);
|
182
|
+
} catch (e) {
|
183
|
+
return err(JSON.stringify(e));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
interface IHttpsRecord {
|
188
|
+
name: string;
|
189
|
+
class: string;
|
190
|
+
ttl: number;
|
191
|
+
priority: number;
|
192
|
+
target: string;
|
193
|
+
port?: number;
|
194
|
+
alpn?: string[];
|
195
|
+
}
|
196
|
+
|
197
|
+
interface IHttpsResolveResult {
|
198
|
+
public_key: string;
|
199
|
+
https_records: IHttpsRecord[];
|
200
|
+
}
|
201
|
+
|
202
|
+
export async function resolveHttps(
|
203
|
+
publicKey: string
|
204
|
+
): Promise<Result<IHttpsResolveResult>> {
|
205
|
+
try {
|
206
|
+
const res = await Pubky.resolveHttps(publicKey);
|
207
|
+
if (res[0] === 'error') {
|
208
|
+
return err(res[1]);
|
209
|
+
}
|
210
|
+
return ok(JSON.parse(res[1]));
|
211
|
+
} catch (e) {
|
212
|
+
return err(JSON.stringify(e));
|
213
|
+
}
|
214
|
+
}
|