@synonymdev/react-native-pubky 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +78 -2
- package/android/src/main/java/com/pubky/PubkyModule.kt +59 -0
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +45 -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 +15 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +15 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +14 -0
- package/ios/Pubky.swift +36 -0
- package/ios/pubkymobile.swift +38 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +33 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +20 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +20 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +61 -2
package/README.md
CHANGED
@@ -14,12 +14,15 @@ 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.
|
19
|
+
- [x] [put](#put): Upload a small payload to a given path.
|
20
|
+
- [x] [get](#get): Download a small payload from a given path relative to a pubky author.
|
21
|
+
- [x] [list](#list): Returns a list of Pubky URLs of the files in the path of the `url` provided.
|
17
22
|
### Methods to be Implemented
|
18
23
|
- [ ] signIn: Sign-in to a homeserver.
|
19
24
|
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
|
20
25
|
- [ ] signOut: Sign-out from a homeserver.
|
21
|
-
- [ ] put: Upload a small payload to a given path.
|
22
|
-
- [ ] get: Download a small payload from a given path relative to a pubky author.
|
23
26
|
|
24
27
|
|
25
28
|
## Usage
|
@@ -78,6 +81,79 @@ if (resolveRes.isErr()) {
|
|
78
81
|
console.log(resolveRes.value);
|
79
82
|
```
|
80
83
|
|
84
|
+
### <a name="publishHttps"></a>publishHttps
|
85
|
+
```js
|
86
|
+
import { publishHttps } from '@synonymdev/react-native-pubky';
|
87
|
+
|
88
|
+
const publishHttpsRes = await publishHttps(
|
89
|
+
'example.com', // Record Name
|
90
|
+
'target.example.com', // Target
|
91
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' // Secret Key
|
92
|
+
);
|
93
|
+
if (publishHttpsRes.isErr()) {
|
94
|
+
console.log(publishHttpsRes.error.message);
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
console.log(publishHttpsRes.value);
|
98
|
+
```
|
99
|
+
|
100
|
+
### <a name="resolveHttps"></a>resolveHttps
|
101
|
+
```js
|
102
|
+
import { resolveHttps } from '@synonymdev/react-native-pubky';
|
103
|
+
|
104
|
+
const resolveHttpsRes = await resolveHttps(
|
105
|
+
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty' // Public key
|
106
|
+
);
|
107
|
+
if (resolveHttpsRes.isErr()) {
|
108
|
+
console.log(resolveHttpsRes.error.message);
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
console.log(resolveHttpsRes.value);
|
112
|
+
```
|
113
|
+
|
114
|
+
### <a name="put"></a>put
|
115
|
+
```js
|
116
|
+
import { put } from '@synonymdev/react-native-pubky';
|
117
|
+
|
118
|
+
const putRes = await put(
|
119
|
+
'url', // URL
|
120
|
+
'content', // Content
|
121
|
+
);
|
122
|
+
if (putRes.isErr()) {
|
123
|
+
console.log(putRes.error.message);
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
console.log(putRes.value);
|
127
|
+
```
|
128
|
+
|
129
|
+
### <a name="get"></a>get
|
130
|
+
```js
|
131
|
+
import { get } from '@synonymdev/react-native-pubky';
|
132
|
+
|
133
|
+
const getRes = await get(
|
134
|
+
'url' // URL
|
135
|
+
);
|
136
|
+
if (getRes.isErr()) {
|
137
|
+
console.log(getRes.error.message);
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
console.log(getRes.value);
|
141
|
+
```
|
142
|
+
|
143
|
+
### <a name="list"></a>list
|
144
|
+
```js
|
145
|
+
import { list } from '@synonymdev/react-native-pubky';
|
146
|
+
|
147
|
+
const listRes = await list(
|
148
|
+
'url' // URL
|
149
|
+
);
|
150
|
+
if (listRes.isErr()) {
|
151
|
+
console.log(listRes.error.message);
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
console.log(listRes.value);
|
155
|
+
```
|
156
|
+
|
81
157
|
## Local Installation
|
82
158
|
|
83
159
|
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,63 @@ 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
|
+
|
234
|
+
@ReactMethod
|
235
|
+
fun list(url: String, promise: Promise) {
|
236
|
+
CoroutineScope(Dispatchers.IO).launch {
|
237
|
+
try {
|
238
|
+
val result = list(url)
|
239
|
+
val array = Arguments.createArray().apply {
|
240
|
+
result.forEach { pushString(it) }
|
241
|
+
}
|
242
|
+
withContext(Dispatchers.Main) {
|
243
|
+
promise.resolve(array)
|
244
|
+
}
|
245
|
+
} catch (e: Exception) {
|
246
|
+
withContext(Dispatchers.Main) {
|
247
|
+
promise.reject("Error", e.message)
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
194
253
|
companion object {
|
195
254
|
const val NAME = "Pubky"
|
196
255
|
}
|
@@ -389,14 +389,20 @@ internal interface _UniFFILib : Library {
|
|
389
389
|
): RustBuffer.ByValue
|
390
390
|
fun uniffi_pubkymobile_fn_func_get(`url`: RustBuffer.ByValue,
|
391
391
|
): Pointer
|
392
|
+
fun uniffi_pubkymobile_fn_func_list(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
393
|
+
): RustBuffer.ByValue
|
392
394
|
fun uniffi_pubkymobile_fn_func_parse_auth_url(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
393
395
|
): RustBuffer.ByValue
|
394
396
|
fun uniffi_pubkymobile_fn_func_publish(`recordName`: RustBuffer.ByValue,`recordContent`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
395
397
|
): RustBuffer.ByValue
|
398
|
+
fun uniffi_pubkymobile_fn_func_publish_https(`recordName`: RustBuffer.ByValue,`target`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
399
|
+
): RustBuffer.ByValue
|
396
400
|
fun uniffi_pubkymobile_fn_func_put(`url`: RustBuffer.ByValue,`content`: RustBuffer.ByValue,
|
397
401
|
): Pointer
|
398
402
|
fun uniffi_pubkymobile_fn_func_resolve(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
399
403
|
): RustBuffer.ByValue
|
404
|
+
fun uniffi_pubkymobile_fn_func_resolve_https(`publicKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
|
405
|
+
): RustBuffer.ByValue
|
400
406
|
fun uniffi_pubkymobile_fn_func_sign_in(`secretKey`: RustBuffer.ByValue,
|
401
407
|
): Pointer
|
402
408
|
fun uniffi_pubkymobile_fn_func_sign_out(`secretKey`: RustBuffer.ByValue,
|
@@ -521,14 +527,20 @@ internal interface _UniFFILib : Library {
|
|
521
527
|
): Short
|
522
528
|
fun uniffi_pubkymobile_checksum_func_get(
|
523
529
|
): Short
|
530
|
+
fun uniffi_pubkymobile_checksum_func_list(
|
531
|
+
): Short
|
524
532
|
fun uniffi_pubkymobile_checksum_func_parse_auth_url(
|
525
533
|
): Short
|
526
534
|
fun uniffi_pubkymobile_checksum_func_publish(
|
527
535
|
): Short
|
536
|
+
fun uniffi_pubkymobile_checksum_func_publish_https(
|
537
|
+
): Short
|
528
538
|
fun uniffi_pubkymobile_checksum_func_put(
|
529
539
|
): Short
|
530
540
|
fun uniffi_pubkymobile_checksum_func_resolve(
|
531
541
|
): Short
|
542
|
+
fun uniffi_pubkymobile_checksum_func_resolve_https(
|
543
|
+
): Short
|
532
544
|
fun uniffi_pubkymobile_checksum_func_sign_in(
|
533
545
|
): Short
|
534
546
|
fun uniffi_pubkymobile_checksum_func_sign_out(
|
@@ -558,18 +570,27 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
|
558
570
|
if (lib.uniffi_pubkymobile_checksum_func_get() != 5395.toShort()) {
|
559
571
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
560
572
|
}
|
573
|
+
if (lib.uniffi_pubkymobile_checksum_func_list() != 8522.toShort()) {
|
574
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
575
|
+
}
|
561
576
|
if (lib.uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088.toShort()) {
|
562
577
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
563
578
|
}
|
564
579
|
if (lib.uniffi_pubkymobile_checksum_func_publish() != 20156.toShort()) {
|
565
580
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
566
581
|
}
|
582
|
+
if (lib.uniffi_pubkymobile_checksum_func_publish_https() != 14705.toShort()) {
|
583
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
584
|
+
}
|
567
585
|
if (lib.uniffi_pubkymobile_checksum_func_put() != 47594.toShort()) {
|
568
586
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
569
587
|
}
|
570
588
|
if (lib.uniffi_pubkymobile_checksum_func_resolve() != 18303.toShort()) {
|
571
589
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
572
590
|
}
|
591
|
+
if (lib.uniffi_pubkymobile_checksum_func_resolve_https() != 34593.toShort()) {
|
592
|
+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
593
|
+
}
|
573
594
|
if (lib.uniffi_pubkymobile_checksum_func_sign_in() != 53969.toShort()) {
|
574
595
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
575
596
|
}
|
@@ -735,6 +756,14 @@ suspend fun `get`(`url`: String) : List<String> {
|
|
735
756
|
)
|
736
757
|
}
|
737
758
|
|
759
|
+
fun `list`(`url`: String): List<String> {
|
760
|
+
return FfiConverterSequenceString.lift(
|
761
|
+
rustCall() { _status ->
|
762
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_list(FfiConverterString.lower(`url`),_status)
|
763
|
+
})
|
764
|
+
}
|
765
|
+
|
766
|
+
|
738
767
|
fun `parseAuthUrl`(`url`: String): List<String> {
|
739
768
|
return FfiConverterSequenceString.lift(
|
740
769
|
rustCall() { _status ->
|
@@ -751,6 +780,14 @@ fun `publish`(`recordName`: String, `recordContent`: String, `secretKey`: String
|
|
751
780
|
}
|
752
781
|
|
753
782
|
|
783
|
+
fun `publishHttps`(`recordName`: String, `target`: String, `secretKey`: String): List<String> {
|
784
|
+
return FfiConverterSequenceString.lift(
|
785
|
+
rustCall() { _status ->
|
786
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_publish_https(FfiConverterString.lower(`recordName`),FfiConverterString.lower(`target`),FfiConverterString.lower(`secretKey`),_status)
|
787
|
+
})
|
788
|
+
}
|
789
|
+
|
790
|
+
|
754
791
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
755
792
|
suspend fun `put`(`url`: String, `content`: String) : List<String> {
|
756
793
|
return uniffiRustCallAsync(
|
@@ -773,6 +810,14 @@ fun `resolve`(`publicKey`: String): List<String> {
|
|
773
810
|
}
|
774
811
|
|
775
812
|
|
813
|
+
fun `resolveHttps`(`publicKey`: String): List<String> {
|
814
|
+
return FfiConverterSequenceString.lift(
|
815
|
+
rustCall() { _status ->
|
816
|
+
_UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_resolve_https(FfiConverterString.lower(`publicKey`),_status)
|
817
|
+
})
|
818
|
+
}
|
819
|
+
|
820
|
+
|
776
821
|
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
|
777
822
|
suspend fun `signIn`(`secretKey`: String) : List<String> {
|
778
823
|
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>
|
@@ -67,14 +67,20 @@ RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
|
67
67
|
);
|
68
68
|
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
69
|
);
|
70
|
+
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
|
+
);
|
70
72
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
73
|
);
|
72
74
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
73
75
|
);
|
76
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
77
|
+
);
|
74
78
|
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
75
79
|
);
|
76
80
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
77
81
|
);
|
82
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
83
|
+
);
|
78
84
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
79
85
|
);
|
80
86
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
@@ -200,18 +206,27 @@ uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
|
200
206
|
);
|
201
207
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
202
208
|
|
209
|
+
);
|
210
|
+
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
211
|
+
|
203
212
|
);
|
204
213
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
205
214
|
|
206
215
|
);
|
207
216
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
208
217
|
|
218
|
+
);
|
219
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
220
|
+
|
209
221
|
);
|
210
222
|
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
211
223
|
|
212
224
|
);
|
213
225
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
214
226
|
|
227
|
+
);
|
228
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
229
|
+
|
215
230
|
);
|
216
231
|
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
217
232
|
|
Binary file
|
@@ -67,14 +67,20 @@ RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key
|
|
67
67
|
);
|
68
68
|
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
69
|
);
|
70
|
+
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
|
+
);
|
70
72
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
73
|
);
|
72
74
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
73
75
|
);
|
76
|
+
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
77
|
+
);
|
74
78
|
void* _Nonnull uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content
|
75
79
|
);
|
76
80
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
77
81
|
);
|
82
|
+
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
83
|
+
);
|
78
84
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key
|
79
85
|
);
|
80
86
|
void* _Nonnull uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key
|
@@ -200,18 +206,27 @@ uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
|
200
206
|
);
|
201
207
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
202
208
|
|
209
|
+
);
|
210
|
+
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
211
|
+
|
203
212
|
);
|
204
213
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
205
214
|
|
206
215
|
);
|
207
216
|
uint16_t uniffi_pubkymobile_checksum_func_publish(void
|
208
217
|
|
218
|
+
);
|
219
|
+
uint16_t uniffi_pubkymobile_checksum_func_publish_https(void
|
220
|
+
|
209
221
|
);
|
210
222
|
uint16_t uniffi_pubkymobile_checksum_func_put(void
|
211
223
|
|
212
224
|
);
|
213
225
|
uint16_t uniffi_pubkymobile_checksum_func_resolve(void
|
214
226
|
|
227
|
+
);
|
228
|
+
uint16_t uniffi_pubkymobile_checksum_func_resolve_https(void
|
229
|
+
|
215
230
|
);
|
216
231
|
uint16_t uniffi_pubkymobile_checksum_func_sign_in(void
|
217
232
|
|
Binary file
|
package/ios/Pubky.mm
CHANGED
@@ -43,6 +43,20 @@ 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
|
+
|
56
|
+
RCT_EXTERN_METHOD(list:(NSString *)url
|
57
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
58
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
59
|
+
|
46
60
|
+ (BOOL)requiresMainQueueSetup
|
47
61
|
{
|
48
62
|
return NO;
|
package/ios/Pubky.swift
CHANGED
@@ -109,4 +109,40 @@ 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
|
+
}
|
136
|
+
|
137
|
+
@objc(list:withResolver:withRejecter:)
|
138
|
+
func list(_ url: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
139
|
+
Task {
|
140
|
+
do {
|
141
|
+
let result = try await react_native_pubky.list(url: url)
|
142
|
+
resolve(result)
|
143
|
+
} catch {
|
144
|
+
reject("list Error", "Failed to list", error)
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
112
148
|
}
|
package/ios/pubkymobile.swift
CHANGED
@@ -447,6 +447,15 @@ public func get(url: String) async -> [String] {
|
|
447
447
|
|
448
448
|
|
449
449
|
|
450
|
+
public func list(url: String) -> [String] {
|
451
|
+
return try! FfiConverterSequenceString.lift(
|
452
|
+
try! rustCall() {
|
453
|
+
uniffi_pubkymobile_fn_func_list(
|
454
|
+
FfiConverterString.lower(url),$0)
|
455
|
+
}
|
456
|
+
)
|
457
|
+
}
|
458
|
+
|
450
459
|
public func parseAuthUrl(url: String) -> [String] {
|
451
460
|
return try! FfiConverterSequenceString.lift(
|
452
461
|
try! rustCall() {
|
@@ -467,6 +476,17 @@ public func publish(recordName: String, recordContent: String, secretKey: String
|
|
467
476
|
)
|
468
477
|
}
|
469
478
|
|
479
|
+
public func publishHttps(recordName: String, target: String, secretKey: String) -> [String] {
|
480
|
+
return try! FfiConverterSequenceString.lift(
|
481
|
+
try! rustCall() {
|
482
|
+
uniffi_pubkymobile_fn_func_publish_https(
|
483
|
+
FfiConverterString.lower(recordName),
|
484
|
+
FfiConverterString.lower(target),
|
485
|
+
FfiConverterString.lower(secretKey),$0)
|
486
|
+
}
|
487
|
+
)
|
488
|
+
}
|
489
|
+
|
470
490
|
public func put(url: String, content: String) async -> [String] {
|
471
491
|
return try! await uniffiRustCallAsync(
|
472
492
|
rustFutureFunc: {
|
@@ -495,6 +515,15 @@ public func resolve(publicKey: String) -> [String] {
|
|
495
515
|
)
|
496
516
|
}
|
497
517
|
|
518
|
+
public func resolveHttps(publicKey: String) -> [String] {
|
519
|
+
return try! FfiConverterSequenceString.lift(
|
520
|
+
try! rustCall() {
|
521
|
+
uniffi_pubkymobile_fn_func_resolve_https(
|
522
|
+
FfiConverterString.lower(publicKey),$0)
|
523
|
+
}
|
524
|
+
)
|
525
|
+
}
|
526
|
+
|
498
527
|
public func signIn(secretKey: String) async -> [String] {
|
499
528
|
return try! await uniffiRustCallAsync(
|
500
529
|
rustFutureFunc: {
|
@@ -571,18 +600,27 @@ private var initializationResult: InitializationResult {
|
|
571
600
|
if (uniffi_pubkymobile_checksum_func_get() != 5395) {
|
572
601
|
return InitializationResult.apiChecksumMismatch
|
573
602
|
}
|
603
|
+
if (uniffi_pubkymobile_checksum_func_list() != 8522) {
|
604
|
+
return InitializationResult.apiChecksumMismatch
|
605
|
+
}
|
574
606
|
if (uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088) {
|
575
607
|
return InitializationResult.apiChecksumMismatch
|
576
608
|
}
|
577
609
|
if (uniffi_pubkymobile_checksum_func_publish() != 20156) {
|
578
610
|
return InitializationResult.apiChecksumMismatch
|
579
611
|
}
|
612
|
+
if (uniffi_pubkymobile_checksum_func_publish_https() != 14705) {
|
613
|
+
return InitializationResult.apiChecksumMismatch
|
614
|
+
}
|
580
615
|
if (uniffi_pubkymobile_checksum_func_put() != 47594) {
|
581
616
|
return InitializationResult.apiChecksumMismatch
|
582
617
|
}
|
583
618
|
if (uniffi_pubkymobile_checksum_func_resolve() != 18303) {
|
584
619
|
return InitializationResult.apiChecksumMismatch
|
585
620
|
}
|
621
|
+
if (uniffi_pubkymobile_checksum_func_resolve_https() != 34593) {
|
622
|
+
return InitializationResult.apiChecksumMismatch
|
623
|
+
}
|
586
624
|
if (uniffi_pubkymobile_checksum_func_sign_in() != 53969) {
|
587
625
|
return InitializationResult.apiChecksumMismatch
|
588
626
|
}
|
package/lib/commonjs/index.js
CHANGED
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.auth = auth;
|
7
7
|
exports.get = get;
|
8
|
+
exports.list = list;
|
8
9
|
exports.parseAuthUrl = parseAuthUrl;
|
9
10
|
exports.publish = publish;
|
11
|
+
exports.publishHttps = publishHttps;
|
10
12
|
exports.put = put;
|
11
13
|
exports.resolve = resolve;
|
14
|
+
exports.resolveHttps = resolveHttps;
|
12
15
|
exports.signIn = signIn;
|
13
16
|
exports.signOut = signOut;
|
14
17
|
exports.signUp = signUp;
|
@@ -119,4 +122,37 @@ async function put(url, content) {
|
|
119
122
|
return (0, _result.err)(JSON.stringify(e));
|
120
123
|
}
|
121
124
|
}
|
125
|
+
async function publishHttps(recordName, target, secretKey) {
|
126
|
+
try {
|
127
|
+
const res = await Pubky.publishHttps(recordName, target, secretKey);
|
128
|
+
if (res[0] === 'error') {
|
129
|
+
return (0, _result.err)(res[1]);
|
130
|
+
}
|
131
|
+
return (0, _result.ok)(res[1]);
|
132
|
+
} catch (e) {
|
133
|
+
return (0, _result.err)(JSON.stringify(e));
|
134
|
+
}
|
135
|
+
}
|
136
|
+
async function resolveHttps(publicKey) {
|
137
|
+
try {
|
138
|
+
const res = await Pubky.resolveHttps(publicKey);
|
139
|
+
if (res[0] === 'error') {
|
140
|
+
return (0, _result.err)(res[1]);
|
141
|
+
}
|
142
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
143
|
+
} catch (e) {
|
144
|
+
return (0, _result.err)(JSON.stringify(e));
|
145
|
+
}
|
146
|
+
}
|
147
|
+
async function list(url) {
|
148
|
+
try {
|
149
|
+
const res = await Pubky.list(url);
|
150
|
+
if (res[0] === 'error') {
|
151
|
+
return (0, _result.err)(res[1]);
|
152
|
+
}
|
153
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
154
|
+
} catch (e) {
|
155
|
+
return (0, _result.err)(JSON.stringify(e));
|
156
|
+
}
|
157
|
+
}
|
122
158
|
//# 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","list"],"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,CAACW,YAAY,CAACL,GAAG,CAAC;IACzC,IAAIE,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;M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package/lib/module/index.js
CHANGED
@@ -107,4 +107,37 @@ 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
|
+
}
|
132
|
+
export async function list(url) {
|
133
|
+
try {
|
134
|
+
const res = await Pubky.list(url);
|
135
|
+
if (res[0] === 'error') {
|
136
|
+
return err(res[1]);
|
137
|
+
}
|
138
|
+
return ok(JSON.parse(res[1]));
|
139
|
+
} catch (e) {
|
140
|
+
return err(JSON.stringify(e));
|
141
|
+
}
|
142
|
+
}
|
110
143
|
//# 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,CA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,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","list"],"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,KAA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AAE,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,21 @@ 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>>;
|
54
|
+
export declare function list(url: string): Promise<Result<string[]>>;
|
37
55
|
export {};
|
38
56
|
//# 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,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAmB1D,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC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|
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,21 @@ 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>>;
|
54
|
+
export declare function list(url: string): Promise<Result<string[]>>;
|
37
55
|
export {};
|
38
56
|
//# 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;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,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;AAED,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAUjE"}
|
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,60 @@ 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
|
+
}
|
215
|
+
|
216
|
+
export async function list(url: string): Promise<Result<string[]>> {
|
217
|
+
try {
|
218
|
+
const res = await Pubky.list(url);
|
219
|
+
if (res[0] === 'error') {
|
220
|
+
return err(res[1]);
|
221
|
+
}
|
222
|
+
return ok(JSON.parse(res[1]));
|
223
|
+
} catch (e) {
|
224
|
+
return err(JSON.stringify(e));
|
225
|
+
}
|
226
|
+
}
|