@synonymdev/react-native-pubky 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +72 -2
- package/android/src/main/java/com/pubky/PubkyModule.kt +58 -11
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +15 -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 +16 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +16 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +11 -0
- package/ios/Pubky.swift +43 -9
- package/ios/pubkymobile.swift +35 -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 +10 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +10 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +45 -0
package/README.md
CHANGED
@@ -16,12 +16,15 @@ npm install @synonymdev/react-native-pubky
|
|
16
16
|
- [x] [resolve](#resolve): Functionality to resolve content.
|
17
17
|
- [x] [publishHttps](#publishHttps): Publish HTTPS records.
|
18
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.
|
22
|
+
- [x] [generateSecretKey](#generateSecretKey): Generate a secret key.
|
23
|
+
- [x] [getPublicKeyFromSecretKey](#getPublicKeyFromSecretKey): Get the public key string and uri from a secret key.
|
19
24
|
### Methods to be Implemented
|
20
25
|
- [ ] signIn: Sign-in to a homeserver.
|
21
26
|
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
|
22
27
|
- [ ] signOut: Sign-out from a homeserver.
|
23
|
-
- [ ] put: Upload a small payload to a given path.
|
24
|
-
- [ ] get: Download a small payload from a given path relative to a pubky author.
|
25
28
|
|
26
29
|
|
27
30
|
## Usage
|
@@ -110,6 +113,73 @@ if (resolveHttpsRes.isErr()) {
|
|
110
113
|
console.log(resolveHttpsRes.value);
|
111
114
|
```
|
112
115
|
|
116
|
+
### <a name="put"></a>put
|
117
|
+
```js
|
118
|
+
import { put } from '@synonymdev/react-native-pubky';
|
119
|
+
|
120
|
+
const putRes = await put(
|
121
|
+
'url', // URL
|
122
|
+
'content', // Content
|
123
|
+
);
|
124
|
+
if (putRes.isErr()) {
|
125
|
+
console.log(putRes.error.message);
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
console.log(putRes.value);
|
129
|
+
```
|
130
|
+
|
131
|
+
### <a name="get"></a>get
|
132
|
+
```js
|
133
|
+
import { get } from '@synonymdev/react-native-pubky';
|
134
|
+
|
135
|
+
const getRes = await get(
|
136
|
+
'url' // URL
|
137
|
+
);
|
138
|
+
if (getRes.isErr()) {
|
139
|
+
console.log(getRes.error.message);
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
console.log(getRes.value);
|
143
|
+
```
|
144
|
+
|
145
|
+
### <a name="list"></a>list
|
146
|
+
```js
|
147
|
+
import { list } from '@synonymdev/react-native-pubky';
|
148
|
+
|
149
|
+
const listRes = await list(
|
150
|
+
'url' // URL
|
151
|
+
);
|
152
|
+
if (listRes.isErr()) {
|
153
|
+
console.log(listRes.error.message);
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
console.log(listRes.value);
|
157
|
+
```
|
158
|
+
|
159
|
+
### <a name="generateSecretKey"></a>generateSecretKey
|
160
|
+
```js
|
161
|
+
import { generateSecretKey } from '@synonymdev/react-native-pubky';
|
162
|
+
|
163
|
+
const generateSecretKeyRes = await generateSecretKey();
|
164
|
+
if (generateSecretKeyRes.isErr()) {
|
165
|
+
console.log(generateSecretKeyRes.error.message);
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
console.log(generateSecretKeyRes.value);
|
169
|
+
```
|
170
|
+
|
171
|
+
### <a name="getPublicKeyFromSecretKey"></a>getPublicKeyFromSecretKey
|
172
|
+
```js
|
173
|
+
import { getPublicKeyFromSecretKey } from '@synonymdev/react-native-pubky';
|
174
|
+
|
175
|
+
const getPublicKeyFromSecretKeyRes = await getPublicKeyFromSecretKey('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
|
176
|
+
if (getPublicKeyFromSecretKeyRes.isErr()) {
|
177
|
+
console.log(getPublicKeyFromSecretKeyRes.error.message);
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
console.log(getPublicKeyFromSecretKeyRes.value);
|
181
|
+
```
|
182
|
+
|
113
183
|
## Local Installation
|
114
184
|
|
115
185
|
1. Clone & npm install:
|
@@ -9,17 +9,7 @@ import kotlinx.coroutines.CoroutineScope
|
|
9
9
|
import kotlinx.coroutines.Dispatchers
|
10
10
|
import kotlinx.coroutines.launch
|
11
11
|
import kotlinx.coroutines.withContext
|
12
|
-
import uniffi.pubkymobile
|
13
|
-
import uniffi.pubkymobile.parseAuthUrl
|
14
|
-
import uniffi.pubkymobile.publish
|
15
|
-
import uniffi.pubkymobile.resolve
|
16
|
-
import uniffi.pubkymobile.signUp
|
17
|
-
import uniffi.pubkymobile.signIn
|
18
|
-
import uniffi.pubkymobile.signOut
|
19
|
-
import uniffi.pubkymobile.put
|
20
|
-
import uniffi.pubkymobile.get
|
21
|
-
import uniffi.pubkymobile.publishHttps
|
22
|
-
import uniffi.pubkymobile.resolveHttps
|
12
|
+
import uniffi.pubkymobile.*
|
23
13
|
|
24
14
|
class PubkyModule(reactContext: ReactApplicationContext) :
|
25
15
|
ReactContextBaseJavaModule(reactContext) {
|
@@ -231,6 +221,63 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
231
221
|
}
|
232
222
|
}
|
233
223
|
|
224
|
+
@ReactMethod
|
225
|
+
fun list(url: String, promise: Promise) {
|
226
|
+
CoroutineScope(Dispatchers.IO).launch {
|
227
|
+
try {
|
228
|
+
val result = list(url)
|
229
|
+
val array = Arguments.createArray().apply {
|
230
|
+
result.forEach { pushString(it) }
|
231
|
+
}
|
232
|
+
withContext(Dispatchers.Main) {
|
233
|
+
promise.resolve(array)
|
234
|
+
}
|
235
|
+
} catch (e: Exception) {
|
236
|
+
withContext(Dispatchers.Main) {
|
237
|
+
promise.reject("Error", e.message)
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
@ReactMethod
|
244
|
+
fun generateSecretKey(promise: Promise) {
|
245
|
+
CoroutineScope(Dispatchers.IO).launch {
|
246
|
+
try {
|
247
|
+
val result = generate_secret_key()
|
248
|
+
val array = Arguments.createArray().apply {
|
249
|
+
result.forEach { pushString(it) }
|
250
|
+
}
|
251
|
+
withContext(Dispatchers.Main) {
|
252
|
+
promise.resolve(array)
|
253
|
+
}
|
254
|
+
} catch (e: Exception) {
|
255
|
+
withContext(Dispatchers.Main) {
|
256
|
+
promise.reject("Error", e.message)
|
257
|
+
}
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
@ReactMethod
|
263
|
+
fun getPublicKeyFromSecretKey(secretKey: String, promise: Promise) {
|
264
|
+
CoroutineScope(Dispatchers.IO).launch {
|
265
|
+
try {
|
266
|
+
val result = getPublicKeyFromSecretKey(secretKey)
|
267
|
+
val array = Arguments.createArray().apply {
|
268
|
+
result.forEach { pushString(it) }
|
269
|
+
}
|
270
|
+
withContext(Dispatchers.Main) {
|
271
|
+
promise.resolve(array)
|
272
|
+
}
|
273
|
+
} catch (e: Exception) {
|
274
|
+
withContext(Dispatchers.Main) {
|
275
|
+
promise.reject("Error", e.message)
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
234
281
|
companion object {
|
235
282
|
const val NAME = "Pubky"
|
236
283
|
}
|
@@ -389,6 +389,8 @@ 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,
|
@@ -525,6 +527,8 @@ internal interface _UniFFILib : Library {
|
|
525
527
|
): Short
|
526
528
|
fun uniffi_pubkymobile_checksum_func_get(
|
527
529
|
): Short
|
530
|
+
fun uniffi_pubkymobile_checksum_func_list(
|
531
|
+
): Short
|
528
532
|
fun uniffi_pubkymobile_checksum_func_parse_auth_url(
|
529
533
|
): Short
|
530
534
|
fun uniffi_pubkymobile_checksum_func_publish(
|
@@ -566,6 +570,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
|
|
566
570
|
if (lib.uniffi_pubkymobile_checksum_func_get() != 5395.toShort()) {
|
567
571
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
568
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
|
+
}
|
569
576
|
if (lib.uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088.toShort()) {
|
570
577
|
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
571
578
|
}
|
@@ -749,6 +756,14 @@ suspend fun `get`(`url`: String) : List<String> {
|
|
749
756
|
)
|
750
757
|
}
|
751
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
|
+
|
752
767
|
fun `parseAuthUrl`(`url`: String): List<String> {
|
753
768
|
return FfiConverterSequenceString.lift(
|
754
769
|
rustCall() { _status ->
|
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
|
13
|
+
<string>ios-arm64</string>
|
14
14
|
<key>LibraryPath</key>
|
15
15
|
<string>libpubkymobile.a</string>
|
16
16
|
<key>SupportedArchitectures</key>
|
@@ -19,8 +19,6 @@
|
|
19
19
|
</array>
|
20
20
|
<key>SupportedPlatform</key>
|
21
21
|
<string>ios</string>
|
22
|
-
<key>SupportedPlatformVariant</key>
|
23
|
-
<string>simulator</string>
|
24
22
|
</dict>
|
25
23
|
<dict>
|
26
24
|
<key>BinaryPath</key>
|
@@ -28,7 +26,7 @@
|
|
28
26
|
<key>HeadersPath</key>
|
29
27
|
<string>Headers</string>
|
30
28
|
<key>LibraryIdentifier</key>
|
31
|
-
<string>ios-arm64</string>
|
29
|
+
<string>ios-arm64-simulator</string>
|
32
30
|
<key>LibraryPath</key>
|
33
31
|
<string>libpubkymobile.a</string>
|
34
32
|
<key>SupportedArchitectures</key>
|
@@ -37,6 +35,8 @@
|
|
37
35
|
</array>
|
38
36
|
<key>SupportedPlatform</key>
|
39
37
|
<string>ios</string>
|
38
|
+
<key>SupportedPlatformVariant</key>
|
39
|
+
<string>simulator</string>
|
40
40
|
</dict>
|
41
41
|
</array>
|
42
42
|
<key>CFBundlePackageType</key>
|
@@ -64,9 +64,16 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
64
64
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
|
+
);
|
68
|
+
RustBuffer uniffi_pubkymobile_fn_func_generate_secret_key(RustCallStatus *_Nonnull out_status
|
69
|
+
|
67
70
|
);
|
68
71
|
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
72
|
);
|
73
|
+
RustBuffer uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
74
|
+
);
|
75
|
+
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
76
|
+
);
|
70
77
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
78
|
);
|
72
79
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
@@ -201,9 +208,18 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
201
208
|
);
|
202
209
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
203
210
|
|
211
|
+
);
|
212
|
+
uint16_t uniffi_pubkymobile_checksum_func_generate_secret_key(void
|
213
|
+
|
204
214
|
);
|
205
215
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
206
216
|
|
217
|
+
);
|
218
|
+
uint16_t uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key(void
|
219
|
+
|
220
|
+
);
|
221
|
+
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
222
|
+
|
207
223
|
);
|
208
224
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
209
225
|
|
Binary file
|
@@ -64,9 +64,16 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
64
64
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
|
+
);
|
68
|
+
RustBuffer uniffi_pubkymobile_fn_func_generate_secret_key(RustCallStatus *_Nonnull out_status
|
69
|
+
|
67
70
|
);
|
68
71
|
void* _Nonnull uniffi_pubkymobile_fn_func_get(RustBuffer url
|
69
72
|
);
|
73
|
+
RustBuffer uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
74
|
+
);
|
75
|
+
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
76
|
+
);
|
70
77
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
78
|
);
|
72
79
|
RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer record_content, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
@@ -201,9 +208,18 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
201
208
|
);
|
202
209
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
203
210
|
|
211
|
+
);
|
212
|
+
uint16_t uniffi_pubkymobile_checksum_func_generate_secret_key(void
|
213
|
+
|
204
214
|
);
|
205
215
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
206
216
|
|
217
|
+
);
|
218
|
+
uint16_t uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key(void
|
219
|
+
|
220
|
+
);
|
221
|
+
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
222
|
+
|
207
223
|
);
|
208
224
|
uint16_t uniffi_pubkymobile_checksum_func_parse_auth_url(void
|
209
225
|
|
Binary file
|
package/ios/Pubky.mm
CHANGED
@@ -53,6 +53,17 @@ RCT_EXTERN_METHOD(resolveHttps:(NSString *)publicKey
|
|
53
53
|
withResolver:(RCTPromiseResolveBlock)resolve
|
54
54
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
55
55
|
|
56
|
+
RCT_EXTERN_METHOD(list:(NSString *)url
|
57
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
58
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
59
|
+
|
60
|
+
RCT_EXTERN_METHOD(generateSecretKey:(RCTPromiseResolveBlock)resolve
|
61
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
62
|
+
|
63
|
+
RCT_EXTERN_METHOD(getPublicKeyFromSecretKey:(NSString *)secretKey
|
64
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
65
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
66
|
+
|
56
67
|
+ (BOOL)requiresMainQueueSetup
|
57
68
|
{
|
58
69
|
return NO;
|
package/ios/Pubky.swift
CHANGED
@@ -16,13 +16,11 @@ class Pubky: NSObject {
|
|
16
16
|
|
17
17
|
@objc(parseAuthUrl:withResolver:withRejecter:)
|
18
18
|
func parseAuthUrl(_ url: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
reject("parseAuthUrl Error", "Failed to parse auth url", error)
|
25
|
-
}
|
19
|
+
do {
|
20
|
+
let result = react_native_pubky.parseAuthUrl(url: url)
|
21
|
+
resolve(result)
|
22
|
+
} catch {
|
23
|
+
reject("parseAuthUrl Error", "Failed to parse auth url", error)
|
26
24
|
}
|
27
25
|
}
|
28
26
|
|
@@ -30,7 +28,7 @@ class Pubky: NSObject {
|
|
30
28
|
func publish(recordName: String, recordContent: String, secretKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
31
29
|
Task {
|
32
30
|
do {
|
33
|
-
let result = react_native_pubky.publish(recordName: recordName, recordContent: recordContent, secretKey: secretKey)
|
31
|
+
let result = try await react_native_pubky.publish(recordName: recordName, recordContent: recordContent, secretKey: secretKey)
|
34
32
|
resolve(result)
|
35
33
|
} catch {
|
36
34
|
reject("publish Error", "Failed to publish", error)
|
@@ -42,7 +40,7 @@ class Pubky: NSObject {
|
|
42
40
|
func resolve(publicKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
43
41
|
Task {
|
44
42
|
do {
|
45
|
-
let result = react_native_pubky.resolve(publicKey: publicKey)
|
43
|
+
let result = try await react_native_pubky.resolve(publicKey: publicKey)
|
46
44
|
resolve(result)
|
47
45
|
} catch {
|
48
46
|
reject("resolve Error", "Failed to resolve", error)
|
@@ -133,4 +131,40 @@ class Pubky: NSObject {
|
|
133
131
|
}
|
134
132
|
}
|
135
133
|
}
|
134
|
+
|
135
|
+
@objc(list:withResolver:withRejecter:)
|
136
|
+
func list(_ url: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
137
|
+
Task {
|
138
|
+
do {
|
139
|
+
let result = try await react_native_pubky.list(url: url)
|
140
|
+
resolve(result)
|
141
|
+
} catch {
|
142
|
+
reject("list Error", "Failed to list", error)
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
@objc(generateSecretKey:withRejecter:)
|
148
|
+
func generateSecretKey(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
149
|
+
Task {
|
150
|
+
do {
|
151
|
+
let result = react_native_pubky.generateSecretKey()
|
152
|
+
resolve(result)
|
153
|
+
} catch {
|
154
|
+
reject("generateSecretKey Error", "Failed to generate secret key", error)
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
@objc(getPublicKeyFromSecretKey:withResolver:withRejecter:)
|
160
|
+
func getPublicKeyFromSecretKey(_ secretKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
161
|
+
Task {
|
162
|
+
do {
|
163
|
+
let result = react_native_pubky.getPublicKeyFromSecretKey(secretKey: secretKey)
|
164
|
+
resolve(result)
|
165
|
+
} catch {
|
166
|
+
reject("getPublicKeyFromSecretKey Error", "Failed to get public key", error)
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
136
170
|
}
|
package/ios/pubkymobile.swift
CHANGED
@@ -429,6 +429,14 @@ public func auth(url: String, secretKey: String) -> [String] {
|
|
429
429
|
)
|
430
430
|
}
|
431
431
|
|
432
|
+
public func generateSecretKey() -> [String] {
|
433
|
+
return try! FfiConverterSequenceString.lift(
|
434
|
+
try! rustCall() {
|
435
|
+
uniffi_pubkymobile_fn_func_generate_secret_key($0)
|
436
|
+
}
|
437
|
+
)
|
438
|
+
}
|
439
|
+
|
432
440
|
public func get(url: String) async -> [String] {
|
433
441
|
return try! await uniffiRustCallAsync(
|
434
442
|
rustFutureFunc: {
|
@@ -447,6 +455,24 @@ public func get(url: String) async -> [String] {
|
|
447
455
|
|
448
456
|
|
449
457
|
|
458
|
+
public func getPublicKeyFromSecretKey(secretKey: String) -> [String] {
|
459
|
+
return try! FfiConverterSequenceString.lift(
|
460
|
+
try! rustCall() {
|
461
|
+
uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(
|
462
|
+
FfiConverterString.lower(secretKey),$0)
|
463
|
+
}
|
464
|
+
)
|
465
|
+
}
|
466
|
+
|
467
|
+
public func list(url: String) -> [String] {
|
468
|
+
return try! FfiConverterSequenceString.lift(
|
469
|
+
try! rustCall() {
|
470
|
+
uniffi_pubkymobile_fn_func_list(
|
471
|
+
FfiConverterString.lower(url),$0)
|
472
|
+
}
|
473
|
+
)
|
474
|
+
}
|
475
|
+
|
450
476
|
public func parseAuthUrl(url: String) -> [String] {
|
451
477
|
return try! FfiConverterSequenceString.lift(
|
452
478
|
try! rustCall() {
|
@@ -588,9 +614,18 @@ private var initializationResult: InitializationResult {
|
|
588
614
|
if (uniffi_pubkymobile_checksum_func_auth() != 61378) {
|
589
615
|
return InitializationResult.apiChecksumMismatch
|
590
616
|
}
|
617
|
+
if (uniffi_pubkymobile_checksum_func_generate_secret_key() != 63116) {
|
618
|
+
return InitializationResult.apiChecksumMismatch
|
619
|
+
}
|
591
620
|
if (uniffi_pubkymobile_checksum_func_get() != 5395) {
|
592
621
|
return InitializationResult.apiChecksumMismatch
|
593
622
|
}
|
623
|
+
if (uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key() != 23603) {
|
624
|
+
return InitializationResult.apiChecksumMismatch
|
625
|
+
}
|
626
|
+
if (uniffi_pubkymobile_checksum_func_list() != 8522) {
|
627
|
+
return InitializationResult.apiChecksumMismatch
|
628
|
+
}
|
594
629
|
if (uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088) {
|
595
630
|
return InitializationResult.apiChecksumMismatch
|
596
631
|
}
|
package/lib/commonjs/index.js
CHANGED
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.auth = auth;
|
7
|
+
exports.generateSecretKey = generateSecretKey;
|
7
8
|
exports.get = get;
|
9
|
+
exports.getPublicKeyFromSecretKey = getPublicKeyFromSecretKey;
|
10
|
+
exports.list = list;
|
8
11
|
exports.parseAuthUrl = parseAuthUrl;
|
9
12
|
exports.publish = publish;
|
10
13
|
exports.publishHttps = publishHttps;
|
@@ -143,4 +146,37 @@ async function resolveHttps(publicKey) {
|
|
143
146
|
return (0, _result.err)(JSON.stringify(e));
|
144
147
|
}
|
145
148
|
}
|
149
|
+
async function list(url) {
|
150
|
+
try {
|
151
|
+
const res = await Pubky.list(url);
|
152
|
+
if (res[0] === 'error') {
|
153
|
+
return (0, _result.err)(res[1]);
|
154
|
+
}
|
155
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
156
|
+
} catch (e) {
|
157
|
+
return (0, _result.err)(JSON.stringify(e));
|
158
|
+
}
|
159
|
+
}
|
160
|
+
async function generateSecretKey() {
|
161
|
+
try {
|
162
|
+
const res = await Pubky.generateSecretKey();
|
163
|
+
if (res[0] === 'error') {
|
164
|
+
return (0, _result.err)(res[1]);
|
165
|
+
}
|
166
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
167
|
+
} catch (e) {
|
168
|
+
return (0, _result.err)(JSON.stringify(e));
|
169
|
+
}
|
170
|
+
}
|
171
|
+
async function getPublicKeyFromSecretKey(secretKey) {
|
172
|
+
try {
|
173
|
+
const res = await Pubky.getPublicKeyFromSecretKey(secretKey);
|
174
|
+
if (res[0] === 'error') {
|
175
|
+
return (0, _result.err)(res[1]);
|
176
|
+
}
|
177
|
+
return (0, _result.ok)(JSON.parse(res[1]));
|
178
|
+
} catch (e) {
|
179
|
+
return (0, _result.err)(JSON.stringify(e));
|
180
|
+
}
|
181
|
+
}
|
146
182
|
//# 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","publishHttps","target","resolveHttps"],"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","generateSecretKey","getPublicKeyFromSecretKey"],"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;MACtB,OAAO,IAAAC,WAAG,EAACD,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,MAAMI,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACN,GAAG,CAAC,CAAC,CAAC,CAAC;IACjC,O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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;AAEO,eAAekB,yBAAyBA,CAC7C1B,SAAiB,EACgB;EACjC,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMR,KAAK,CAACiC,yBAAyB,CAAC1B,SAAS,CAAC;IAC5D,IAAIC,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
@@ -129,4 +129,37 @@ export async function resolveHttps(publicKey) {
|
|
129
129
|
return err(JSON.stringify(e));
|
130
130
|
}
|
131
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
|
+
}
|
143
|
+
export async function generateSecretKey() {
|
144
|
+
try {
|
145
|
+
const res = await Pubky.generateSecretKey();
|
146
|
+
if (res[0] === 'error') {
|
147
|
+
return err(res[1]);
|
148
|
+
}
|
149
|
+
return ok(JSON.parse(res[1]));
|
150
|
+
} catch (e) {
|
151
|
+
return err(JSON.stringify(e));
|
152
|
+
}
|
153
|
+
}
|
154
|
+
export async function getPublicKeyFromSecretKey(secretKey) {
|
155
|
+
try {
|
156
|
+
const res = await Pubky.getPublicKeyFromSecretKey(secretKey);
|
157
|
+
if (res[0] === 'error') {
|
158
|
+
return err(res[1]);
|
159
|
+
}
|
160
|
+
return ok(JSON.parse(res[1]));
|
161
|
+
} catch (e) {
|
162
|
+
return err(JSON.stringify(e));
|
163
|
+
}
|
164
|
+
}
|
132
165
|
//# 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","publishHttps","target","resolveHttps"],"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,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EACnB,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAea,YAAYA,CAChCV,UAAkB,EAClBW,MAAc,EACdpB,SAAiB,EACU;EAC3B,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAACyB,YAAY,CAACV,UAAU,EAAEW,MAAM,EAAEpB,SAAS,CAAC;IACnE,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;AAiBA,OAAO,eAAee,YAAYA,CAChCT,SAAiB,EACqB;EACtC,IAAI;IACF,MAAMX,GAAG,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":[]}
|
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","generateSecretKey","getPublicKeyFromSecretKey"],"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,CAA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,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAekB,yBAAyBA,CAC7CxB,SAAiB,EACgB;EACjC,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAAC8B,yBAAyB,CAACxB,SAAS,CAAC;IAC5D,IAAIC,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":[]}
|
@@ -51,5 +51,15 @@ interface IHttpsResolveResult {
|
|
51
51
|
https_records: IHttpsRecord[];
|
52
52
|
}
|
53
53
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
|
+
export declare function list(url: string): Promise<Result<string[]>>;
|
55
|
+
interface IPublicKeyInfo {
|
56
|
+
public_key: string;
|
57
|
+
uri: string;
|
58
|
+
}
|
59
|
+
interface IGenerateSecretKey extends IPublicKeyInfo {
|
60
|
+
secret_key: string;
|
61
|
+
}
|
62
|
+
export declare function generateSecretKey(): Promise<Result<IGenerateSecretKey>>;
|
63
|
+
export declare function getPublicKeyFromSecretKey(secretKey: string): Promise<Result<IPublicKeyInfo>>;
|
54
64
|
export {};
|
55
65
|
//# 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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C,CAAC,CAUjE;AAED,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb;AACD,UAAU,kBAAmB,SAAQ,cAAc;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAU7E;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAUjC"}
|
@@ -51,5 +51,15 @@ interface IHttpsResolveResult {
|
|
51
51
|
https_records: IHttpsRecord[];
|
52
52
|
}
|
53
53
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
|
+
export declare function list(url: string): Promise<Result<string[]>>;
|
55
|
+
interface IPublicKeyInfo {
|
56
|
+
public_key: string;
|
57
|
+
uri: string;
|
58
|
+
}
|
59
|
+
interface IGenerateSecretKey extends IPublicKeyInfo {
|
60
|
+
secret_key: string;
|
61
|
+
}
|
62
|
+
export declare function generateSecretKey(): Promise<Result<IGenerateSecretKey>>;
|
63
|
+
export declare function getPublicKeyFromSecretKey(secretKey: string): Promise<Result<IPublicKeyInfo>>;
|
54
64
|
export {};
|
55
65
|
//# 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,G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AsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAUjC"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -212,3 +212,48 @@ export async function resolveHttps(
|
|
212
212
|
return err(JSON.stringify(e));
|
213
213
|
}
|
214
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
|
+
}
|
227
|
+
|
228
|
+
interface IPublicKeyInfo {
|
229
|
+
public_key: string;
|
230
|
+
uri: string;
|
231
|
+
}
|
232
|
+
interface IGenerateSecretKey extends IPublicKeyInfo {
|
233
|
+
secret_key: string;
|
234
|
+
}
|
235
|
+
export async function generateSecretKey(): Promise<Result<IGenerateSecretKey>> {
|
236
|
+
try {
|
237
|
+
const res = await Pubky.generateSecretKey();
|
238
|
+
if (res[0] === 'error') {
|
239
|
+
return err(res[1]);
|
240
|
+
}
|
241
|
+
return ok(JSON.parse(res[1]));
|
242
|
+
} catch (e) {
|
243
|
+
return err(JSON.stringify(e));
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
export async function getPublicKeyFromSecretKey(
|
248
|
+
secretKey: string
|
249
|
+
): Promise<Result<IPublicKeyInfo>> {
|
250
|
+
try {
|
251
|
+
const res = await Pubky.getPublicKeyFromSecretKey(secretKey);
|
252
|
+
if (res[0] === 'error') {
|
253
|
+
return err(res[1]);
|
254
|
+
}
|
255
|
+
return ok(JSON.parse(res[1]));
|
256
|
+
} catch (e) {
|
257
|
+
return err(JSON.stringify(e));
|
258
|
+
}
|
259
|
+
}
|