@synonymdev/react-native-pubky 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +26 -0
- package/android/src/main/java/com/pubky/PubkyModule.kt +39 -11
- package/ios/Frameworks/PubkyMobile.xcframework/Info.plist +4 -4
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +11 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +11 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky.mm +7 -0
- package/ios/Pubky.swift +31 -9
- package/ios/pubkymobile.swift +23 -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 +9 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +9 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +33 -0
package/README.md
CHANGED
@@ -19,6 +19,8 @@ npm install @synonymdev/react-native-pubky
|
|
19
19
|
- [x] [put](#put): Upload a small payload to a given path.
|
20
20
|
- [x] [get](#get): Download a small payload from a given path relative to a pubky author.
|
21
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.
|
22
24
|
### Methods to be Implemented
|
23
25
|
- [ ] signIn: Sign-in to a homeserver.
|
24
26
|
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
|
@@ -154,6 +156,30 @@ if (listRes.isErr()) {
|
|
154
156
|
console.log(listRes.value);
|
155
157
|
```
|
156
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
|
+
|
157
183
|
## Local Installation
|
158
184
|
|
159
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) {
|
@@ -250,6 +240,44 @@ class PubkyModule(reactContext: ReactApplicationContext) :
|
|
250
240
|
}
|
251
241
|
}
|
252
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
|
+
|
253
281
|
companion object {
|
254
282
|
const val NAME = "Pubky"
|
255
283
|
}
|
@@ -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,14 @@ 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
|
+
);
|
70
75
|
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
76
|
);
|
72
77
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
@@ -203,9 +208,15 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
203
208
|
);
|
204
209
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
205
210
|
|
211
|
+
);
|
212
|
+
uint16_t uniffi_pubkymobile_checksum_func_generate_secret_key(void
|
213
|
+
|
206
214
|
);
|
207
215
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
208
216
|
|
217
|
+
);
|
218
|
+
uint16_t uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key(void
|
219
|
+
|
209
220
|
);
|
210
221
|
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
211
222
|
|
Binary file
|
@@ -64,9 +64,14 @@ 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
|
+
);
|
70
75
|
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
76
|
);
|
72
77
|
RustBuffer uniffi_pubkymobile_fn_func_parse_auth_url(RustBuffer url, RustCallStatus *_Nonnull out_status
|
@@ -203,9 +208,15 @@ void ffi_pubkymobile_rust_future_complete_void(void* _Nonnull handle, RustCallSt
|
|
203
208
|
);
|
204
209
|
uint16_t uniffi_pubkymobile_checksum_func_auth(void
|
205
210
|
|
211
|
+
);
|
212
|
+
uint16_t uniffi_pubkymobile_checksum_func_generate_secret_key(void
|
213
|
+
|
206
214
|
);
|
207
215
|
uint16_t uniffi_pubkymobile_checksum_func_get(void
|
208
216
|
|
217
|
+
);
|
218
|
+
uint16_t uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key(void
|
219
|
+
|
209
220
|
);
|
210
221
|
uint16_t uniffi_pubkymobile_checksum_func_list(void
|
211
222
|
|
Binary file
|
package/ios/Pubky.mm
CHANGED
@@ -57,6 +57,13 @@ RCT_EXTERN_METHOD(list:(NSString *)url
|
|
57
57
|
withResolver:(RCTPromiseResolveBlock)resolve
|
58
58
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
59
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
|
+
|
60
67
|
+ (BOOL)requiresMainQueueSetup
|
61
68
|
{
|
62
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)
|
@@ -145,4 +143,28 @@ class Pubky: NSObject {
|
|
145
143
|
}
|
146
144
|
}
|
147
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
|
+
}
|
148
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,15 @@ 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
|
+
|
450
467
|
public func list(url: String) -> [String] {
|
451
468
|
return try! FfiConverterSequenceString.lift(
|
452
469
|
try! rustCall() {
|
@@ -597,9 +614,15 @@ private var initializationResult: InitializationResult {
|
|
597
614
|
if (uniffi_pubkymobile_checksum_func_auth() != 61378) {
|
598
615
|
return InitializationResult.apiChecksumMismatch
|
599
616
|
}
|
617
|
+
if (uniffi_pubkymobile_checksum_func_generate_secret_key() != 63116) {
|
618
|
+
return InitializationResult.apiChecksumMismatch
|
619
|
+
}
|
600
620
|
if (uniffi_pubkymobile_checksum_func_get() != 5395) {
|
601
621
|
return InitializationResult.apiChecksumMismatch
|
602
622
|
}
|
623
|
+
if (uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key() != 23603) {
|
624
|
+
return InitializationResult.apiChecksumMismatch
|
625
|
+
}
|
603
626
|
if (uniffi_pubkymobile_checksum_func_list() != 8522) {
|
604
627
|
return InitializationResult.apiChecksumMismatch
|
605
628
|
}
|
package/lib/commonjs/index.js
CHANGED
@@ -4,7 +4,9 @@ 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;
|
8
10
|
exports.list = list;
|
9
11
|
exports.parseAuthUrl = parseAuthUrl;
|
10
12
|
exports.publish = publish;
|
@@ -155,4 +157,26 @@ async function list(url) {
|
|
155
157
|
return (0, _result.err)(JSON.stringify(e));
|
156
158
|
}
|
157
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
|
+
}
|
158
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","list"],"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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,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;AASO,eAAeiB,iBAAiBA,CAAA,EAAwC;EAC7E,IAAI;IACF,MAAMxB,GAAG,GAAG,MAAMR,KAAK,CAACgC,iBAAiB,CAAC,CAAC;IAC3C,IAAIxB,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;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
@@ -140,4 +140,26 @@ export async function list(url) {
|
|
140
140
|
return err(JSON.stringify(e));
|
141
141
|
}
|
142
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
|
+
}
|
143
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","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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,IAAI,CAACvB,GAAG,CAAC;IACjC,IAAIE,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,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AC,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;AASA,OAAO,eAAeiB,iBAAiBA,CAAA,EAAwC;EAC7E,IAAI;IACF,MAAMtB,GAAG,GAAG,MAAMP,KAAK,CAAC6B,iBAAiB,CAAC,CAAC;IAC3C,IAAItB,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;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":[]}
|
@@ -52,5 +52,14 @@ interface IHttpsResolveResult {
|
|
52
52
|
}
|
53
53
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
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>>;
|
55
64
|
export {};
|
56
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,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,MA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M,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;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"}
|
@@ -52,5 +52,14 @@ interface IHttpsResolveResult {
|
|
52
52
|
}
|
53
53
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
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>>;
|
55
64
|
export {};
|
56
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,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,aAAa,EAAE,MAAM,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E,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;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"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -224,3 +224,36 @@ export async function list(url: string): Promise<Result<string[]>> {
|
|
224
224
|
return err(JSON.stringify(e));
|
225
225
|
}
|
226
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
|
+
}
|