@synonymdev/react-native-pubky 0.6.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +78 -7
- package/android/src/main/java/com/pubky/PubkyModule.kt +39 -11
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +16 -5
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +16 -5
- 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 +58 -143
- 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
@@ -16,13 +16,17 @@ 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] [signUp](#signUp): Sign-up to a homeserver and update Pkarr accordingly.
|
20
|
+
- [x] [signIn](#signIn): Sign-in to a homeserver.
|
21
|
+
- [x] [signOut](#signOut): Sign-out from a homeserver.
|
19
22
|
- [x] [put](#put): Upload a small payload to a given path.
|
20
23
|
- [x] [get](#get): Download a small payload from a given path relative to a pubky author.
|
21
24
|
- [x] [list](#list): Returns a list of Pubky URLs of the files in the path of the `url` provided.
|
25
|
+
- [x] [generateSecretKey](#generateSecretKey): Generate a secret key.
|
26
|
+
- [x] [getPublicKeyFromSecretKey](#getPublicKeyFromSecretKey): Get the public key string and uri from a secret key.
|
22
27
|
### Methods to be Implemented
|
23
|
-
- [ ]
|
24
|
-
- [ ]
|
25
|
-
- [ ] signOut: Sign-out from a homeserver.
|
28
|
+
- [ ] getProfile: Retrieve the profile of a user.
|
29
|
+
- [ ] editProfile: Submit changes to the specified profile.
|
26
30
|
|
27
31
|
|
28
32
|
## Usage
|
@@ -116,8 +120,8 @@ console.log(resolveHttpsRes.value);
|
|
116
120
|
import { put } from '@synonymdev/react-native-pubky';
|
117
121
|
|
118
122
|
const putRes = await put(
|
119
|
-
'
|
120
|
-
'content', // Content
|
123
|
+
'pubky://z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty/pub/synonym.to', // URL
|
124
|
+
{ data: 'test content' }, // Content
|
121
125
|
);
|
122
126
|
if (putRes.isErr()) {
|
123
127
|
console.log(putRes.error.message);
|
@@ -131,7 +135,7 @@ console.log(putRes.value);
|
|
131
135
|
import { get } from '@synonymdev/react-native-pubky';
|
132
136
|
|
133
137
|
const getRes = await get(
|
134
|
-
'
|
138
|
+
'pubky://z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty/pub/synonym.to' // URL
|
135
139
|
);
|
136
140
|
if (getRes.isErr()) {
|
137
141
|
console.log(getRes.error.message);
|
@@ -145,7 +149,7 @@ console.log(getRes.value);
|
|
145
149
|
import { list } from '@synonymdev/react-native-pubky';
|
146
150
|
|
147
151
|
const listRes = await list(
|
148
|
-
'
|
152
|
+
'pubky://z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty/pub/' // URL
|
149
153
|
);
|
150
154
|
if (listRes.isErr()) {
|
151
155
|
console.log(listRes.error.message);
|
@@ -154,6 +158,73 @@ if (listRes.isErr()) {
|
|
154
158
|
console.log(listRes.value);
|
155
159
|
```
|
156
160
|
|
161
|
+
### <a name="generateSecretKey"></a>generateSecretKey
|
162
|
+
```js
|
163
|
+
import { generateSecretKey } from '@synonymdev/react-native-pubky';
|
164
|
+
|
165
|
+
const generateSecretKeyRes = await generateSecretKey();
|
166
|
+
if (generateSecretKeyRes.isErr()) {
|
167
|
+
console.log(generateSecretKeyRes.error.message);
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
console.log(generateSecretKeyRes.value);
|
171
|
+
```
|
172
|
+
|
173
|
+
### <a name="getPublicKeyFromSecretKey"></a>getPublicKeyFromSecretKey
|
174
|
+
```js
|
175
|
+
import { getPublicKeyFromSecretKey } from '@synonymdev/react-native-pubky';
|
176
|
+
|
177
|
+
const getPublicKeyFromSecretKeyRes = await getPublicKeyFromSecretKey('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
|
178
|
+
if (getPublicKeyFromSecretKeyRes.isErr()) {
|
179
|
+
console.log(getPublicKeyFromSecretKeyRes.error.message);
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
console.log(getPublicKeyFromSecretKeyRes.value);
|
183
|
+
```
|
184
|
+
|
185
|
+
### <a name="signUp"></a>signUp
|
186
|
+
```js
|
187
|
+
import { signUp } from '@synonymdev/react-native-pubky';
|
188
|
+
|
189
|
+
const signUpRes = await signUp(
|
190
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', // Secret
|
191
|
+
'pubky://8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo', // Homeserver
|
192
|
+
);
|
193
|
+
if (signUpRes.isErr()) {
|
194
|
+
console.log(signUpRes.error.message);
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
console.log(signUpRes.value);
|
198
|
+
```
|
199
|
+
|
200
|
+
### <a name="signIn"></a>signIn
|
201
|
+
```js
|
202
|
+
import { signIn } from '@synonymdev/react-native-pubky';
|
203
|
+
|
204
|
+
const signInRes = await signIn(
|
205
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' // Secret Key
|
206
|
+
);
|
207
|
+
if (signInRes.isErr()) {
|
208
|
+
console.log(signInRes.error.message);
|
209
|
+
return;
|
210
|
+
}
|
211
|
+
console.log(signInRes.value);
|
212
|
+
```
|
213
|
+
|
214
|
+
### <a name="signOut"></a>signIn
|
215
|
+
```js
|
216
|
+
import { signOut } from '@synonymdev/react-native-pubky';
|
217
|
+
|
218
|
+
const signOutRes = await signOut(
|
219
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' // Secret Key
|
220
|
+
);
|
221
|
+
if (signOutRes.isErr()) {
|
222
|
+
console.log(signOutRes.error.message);
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
console.log(signOutRes.value);
|
226
|
+
```
|
227
|
+
|
157
228
|
## Local Installation
|
158
229
|
|
159
230
|
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
|
}
|
@@ -65,7 +65,12 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
67
|
);
|
68
|
-
|
68
|
+
RustBuffer uniffi_pubkymobile_fn_func_generate_secret_key(RustCallStatus *_Nonnull out_status
|
69
|
+
|
70
|
+
);
|
71
|
+
RustBuffer uniffi_pubkymobile_fn_func_get(RustBuffer url, RustCallStatus *_Nonnull out_status
|
72
|
+
);
|
73
|
+
RustBuffer uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
69
74
|
);
|
70
75
|
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
76
|
);
|
@@ -75,17 +80,17 @@ RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer
|
|
75
80
|
);
|
76
81
|
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
77
82
|
);
|
78
|
-
|
83
|
+
RustBuffer uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content, RustCallStatus *_Nonnull out_status
|
79
84
|
);
|
80
85
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
86
|
);
|
82
87
|
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
83
88
|
);
|
84
|
-
|
89
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
85
90
|
);
|
86
|
-
|
91
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
87
92
|
);
|
88
|
-
|
93
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_up(RustBuffer secret_key, RustBuffer homeserver, RustCallStatus *_Nonnull out_status
|
89
94
|
);
|
90
95
|
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
91
96
|
);
|
@@ -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
|
@@ -65,7 +65,12 @@ typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
|
|
65
65
|
// Scaffolding functions
|
66
66
|
RustBuffer uniffi_pubkymobile_fn_func_auth(RustBuffer url, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
67
67
|
);
|
68
|
-
|
68
|
+
RustBuffer uniffi_pubkymobile_fn_func_generate_secret_key(RustCallStatus *_Nonnull out_status
|
69
|
+
|
70
|
+
);
|
71
|
+
RustBuffer uniffi_pubkymobile_fn_func_get(RustBuffer url, RustCallStatus *_Nonnull out_status
|
72
|
+
);
|
73
|
+
RustBuffer uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
69
74
|
);
|
70
75
|
RustBuffer uniffi_pubkymobile_fn_func_list(RustBuffer url, RustCallStatus *_Nonnull out_status
|
71
76
|
);
|
@@ -75,17 +80,17 @@ RustBuffer uniffi_pubkymobile_fn_func_publish(RustBuffer record_name, RustBuffer
|
|
75
80
|
);
|
76
81
|
RustBuffer uniffi_pubkymobile_fn_func_publish_https(RustBuffer record_name, RustBuffer target, RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
77
82
|
);
|
78
|
-
|
83
|
+
RustBuffer uniffi_pubkymobile_fn_func_put(RustBuffer url, RustBuffer content, RustCallStatus *_Nonnull out_status
|
79
84
|
);
|
80
85
|
RustBuffer uniffi_pubkymobile_fn_func_resolve(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
81
86
|
);
|
82
87
|
RustBuffer uniffi_pubkymobile_fn_func_resolve_https(RustBuffer public_key, RustCallStatus *_Nonnull out_status
|
83
88
|
);
|
84
|
-
|
89
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_in(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
85
90
|
);
|
86
|
-
|
91
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_out(RustBuffer secret_key, RustCallStatus *_Nonnull out_status
|
87
92
|
);
|
88
|
-
|
93
|
+
RustBuffer uniffi_pubkymobile_fn_func_sign_up(RustBuffer secret_key, RustBuffer homeserver, RustCallStatus *_Nonnull out_status
|
89
94
|
);
|
90
95
|
RustBuffer ffi_pubkymobile_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
|
91
96
|
);
|
@@ -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
@@ -356,68 +356,6 @@ fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer {
|
|
356
356
|
return seq
|
357
357
|
}
|
358
358
|
}
|
359
|
-
private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0
|
360
|
-
private let UNIFFI_RUST_FUTURE_POLL_MAYBE_READY: Int8 = 1
|
361
|
-
|
362
|
-
fileprivate func uniffiRustCallAsync<F, T>(
|
363
|
-
rustFutureFunc: () -> UnsafeMutableRawPointer,
|
364
|
-
pollFunc: (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> (),
|
365
|
-
completeFunc: (UnsafeMutableRawPointer, UnsafeMutablePointer<RustCallStatus>) -> F,
|
366
|
-
freeFunc: (UnsafeMutableRawPointer) -> (),
|
367
|
-
liftFunc: (F) throws -> T,
|
368
|
-
errorHandler: ((RustBuffer) throws -> Error)?
|
369
|
-
) async throws -> T {
|
370
|
-
// Make sure to call uniffiEnsureInitialized() since future creation doesn't have a
|
371
|
-
// RustCallStatus param, so doesn't use makeRustCall()
|
372
|
-
uniffiEnsureInitialized()
|
373
|
-
let rustFuture = rustFutureFunc()
|
374
|
-
defer {
|
375
|
-
freeFunc(rustFuture)
|
376
|
-
}
|
377
|
-
var pollResult: Int8;
|
378
|
-
repeat {
|
379
|
-
pollResult = await withUnsafeContinuation {
|
380
|
-
pollFunc(rustFuture, ContinuationHolder($0).toOpaque())
|
381
|
-
}
|
382
|
-
} while pollResult != UNIFFI_RUST_FUTURE_POLL_READY
|
383
|
-
|
384
|
-
return try liftFunc(makeRustCall(
|
385
|
-
{ completeFunc(rustFuture, $0) },
|
386
|
-
errorHandler: errorHandler
|
387
|
-
))
|
388
|
-
}
|
389
|
-
|
390
|
-
// Callback handlers for an async calls. These are invoked by Rust when the future is ready. They
|
391
|
-
// lift the return value or error and resume the suspended function.
|
392
|
-
fileprivate func uniffiFutureContinuationCallback(ptr: UnsafeMutableRawPointer, pollResult: Int8) {
|
393
|
-
ContinuationHolder.fromOpaque(ptr).resume(pollResult)
|
394
|
-
}
|
395
|
-
|
396
|
-
// Wraps UnsafeContinuation in a class so that we can use reference counting when passing it across
|
397
|
-
// the FFI
|
398
|
-
fileprivate class ContinuationHolder {
|
399
|
-
let continuation: UnsafeContinuation<Int8, Never>
|
400
|
-
|
401
|
-
init(_ continuation: UnsafeContinuation<Int8, Never>) {
|
402
|
-
self.continuation = continuation
|
403
|
-
}
|
404
|
-
|
405
|
-
func resume(_ pollResult: Int8) {
|
406
|
-
self.continuation.resume(returning: pollResult)
|
407
|
-
}
|
408
|
-
|
409
|
-
func toOpaque() -> UnsafeMutableRawPointer {
|
410
|
-
return Unmanaged<ContinuationHolder>.passRetained(self).toOpaque()
|
411
|
-
}
|
412
|
-
|
413
|
-
static func fromOpaque(_ ptr: UnsafeRawPointer) -> ContinuationHolder {
|
414
|
-
return Unmanaged<ContinuationHolder>.fromOpaque(ptr).takeRetainedValue()
|
415
|
-
}
|
416
|
-
}
|
417
|
-
|
418
|
-
fileprivate func uniffiInitContinuationCallback() {
|
419
|
-
ffi_pubkymobile_rust_future_continuation_callback_set(uniffiFutureContinuationCallback)
|
420
|
-
}
|
421
359
|
|
422
360
|
public func auth(url: String, secretKey: String) -> [String] {
|
423
361
|
return try! FfiConverterSequenceString.lift(
|
@@ -429,23 +367,31 @@ public func auth(url: String, secretKey: String) -> [String] {
|
|
429
367
|
)
|
430
368
|
}
|
431
369
|
|
432
|
-
public func
|
433
|
-
return try!
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
)
|
438
|
-
},
|
439
|
-
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
440
|
-
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
441
|
-
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
442
|
-
liftFunc: FfiConverterSequenceString.lift,
|
443
|
-
errorHandler: nil
|
444
|
-
|
370
|
+
public func generateSecretKey() -> [String] {
|
371
|
+
return try! FfiConverterSequenceString.lift(
|
372
|
+
try! rustCall() {
|
373
|
+
uniffi_pubkymobile_fn_func_generate_secret_key($0)
|
374
|
+
}
|
445
375
|
)
|
446
376
|
}
|
447
377
|
|
378
|
+
public func get(url: String) -> [String] {
|
379
|
+
return try! FfiConverterSequenceString.lift(
|
380
|
+
try! rustCall() {
|
381
|
+
uniffi_pubkymobile_fn_func_get(
|
382
|
+
FfiConverterString.lower(url),$0)
|
383
|
+
}
|
384
|
+
)
|
385
|
+
}
|
448
386
|
|
387
|
+
public func getPublicKeyFromSecretKey(secretKey: String) -> [String] {
|
388
|
+
return try! FfiConverterSequenceString.lift(
|
389
|
+
try! rustCall() {
|
390
|
+
uniffi_pubkymobile_fn_func_get_public_key_from_secret_key(
|
391
|
+
FfiConverterString.lower(secretKey),$0)
|
392
|
+
}
|
393
|
+
)
|
394
|
+
}
|
449
395
|
|
450
396
|
public func list(url: String) -> [String] {
|
451
397
|
return try! FfiConverterSequenceString.lift(
|
@@ -487,25 +433,16 @@ public func publishHttps(recordName: String, target: String, secretKey: String)
|
|
487
433
|
)
|
488
434
|
}
|
489
435
|
|
490
|
-
public func put(url: String, content: String)
|
491
|
-
return try!
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
},
|
498
|
-
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
499
|
-
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
500
|
-
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
501
|
-
liftFunc: FfiConverterSequenceString.lift,
|
502
|
-
errorHandler: nil
|
503
|
-
|
436
|
+
public func put(url: String, content: String) -> [String] {
|
437
|
+
return try! FfiConverterSequenceString.lift(
|
438
|
+
try! rustCall() {
|
439
|
+
uniffi_pubkymobile_fn_func_put(
|
440
|
+
FfiConverterString.lower(url),
|
441
|
+
FfiConverterString.lower(content),$0)
|
442
|
+
}
|
504
443
|
)
|
505
444
|
}
|
506
445
|
|
507
|
-
|
508
|
-
|
509
446
|
public func resolve(publicKey: String) -> [String] {
|
510
447
|
return try! FfiConverterSequenceString.lift(
|
511
448
|
try! rustCall() {
|
@@ -524,61 +461,34 @@ public func resolveHttps(publicKey: String) -> [String] {
|
|
524
461
|
)
|
525
462
|
}
|
526
463
|
|
527
|
-
public func signIn(secretKey: String)
|
528
|
-
return try!
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
},
|
534
|
-
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
535
|
-
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
536
|
-
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
537
|
-
liftFunc: FfiConverterSequenceString.lift,
|
538
|
-
errorHandler: nil
|
539
|
-
|
464
|
+
public func signIn(secretKey: String) -> [String] {
|
465
|
+
return try! FfiConverterSequenceString.lift(
|
466
|
+
try! rustCall() {
|
467
|
+
uniffi_pubkymobile_fn_func_sign_in(
|
468
|
+
FfiConverterString.lower(secretKey),$0)
|
469
|
+
}
|
540
470
|
)
|
541
471
|
}
|
542
472
|
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
FfiConverterString.lower(secretKey)
|
550
|
-
)
|
551
|
-
},
|
552
|
-
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
553
|
-
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
554
|
-
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
555
|
-
liftFunc: FfiConverterSequenceString.lift,
|
556
|
-
errorHandler: nil
|
557
|
-
|
473
|
+
public func signOut(secretKey: String) -> [String] {
|
474
|
+
return try! FfiConverterSequenceString.lift(
|
475
|
+
try! rustCall() {
|
476
|
+
uniffi_pubkymobile_fn_func_sign_out(
|
477
|
+
FfiConverterString.lower(secretKey),$0)
|
478
|
+
}
|
558
479
|
)
|
559
480
|
}
|
560
481
|
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
FfiConverterString.lower(homeserver)
|
569
|
-
)
|
570
|
-
},
|
571
|
-
pollFunc: ffi_pubkymobile_rust_future_poll_rust_buffer,
|
572
|
-
completeFunc: ffi_pubkymobile_rust_future_complete_rust_buffer,
|
573
|
-
freeFunc: ffi_pubkymobile_rust_future_free_rust_buffer,
|
574
|
-
liftFunc: FfiConverterSequenceString.lift,
|
575
|
-
errorHandler: nil
|
576
|
-
|
482
|
+
public func signUp(secretKey: String, homeserver: String) -> [String] {
|
483
|
+
return try! FfiConverterSequenceString.lift(
|
484
|
+
try! rustCall() {
|
485
|
+
uniffi_pubkymobile_fn_func_sign_up(
|
486
|
+
FfiConverterString.lower(secretKey),
|
487
|
+
FfiConverterString.lower(homeserver),$0)
|
488
|
+
}
|
577
489
|
)
|
578
490
|
}
|
579
491
|
|
580
|
-
|
581
|
-
|
582
492
|
private enum InitializationResult {
|
583
493
|
case ok
|
584
494
|
case contractVersionMismatch
|
@@ -597,7 +507,13 @@ private var initializationResult: InitializationResult {
|
|
597
507
|
if (uniffi_pubkymobile_checksum_func_auth() != 61378) {
|
598
508
|
return InitializationResult.apiChecksumMismatch
|
599
509
|
}
|
600
|
-
if (
|
510
|
+
if (uniffi_pubkymobile_checksum_func_generate_secret_key() != 63116) {
|
511
|
+
return InitializationResult.apiChecksumMismatch
|
512
|
+
}
|
513
|
+
if (uniffi_pubkymobile_checksum_func_get() != 21596) {
|
514
|
+
return InitializationResult.apiChecksumMismatch
|
515
|
+
}
|
516
|
+
if (uniffi_pubkymobile_checksum_func_get_public_key_from_secret_key() != 23603) {
|
601
517
|
return InitializationResult.apiChecksumMismatch
|
602
518
|
}
|
603
519
|
if (uniffi_pubkymobile_checksum_func_list() != 8522) {
|
@@ -612,7 +528,7 @@ private var initializationResult: InitializationResult {
|
|
612
528
|
if (uniffi_pubkymobile_checksum_func_publish_https() != 14705) {
|
613
529
|
return InitializationResult.apiChecksumMismatch
|
614
530
|
}
|
615
|
-
if (uniffi_pubkymobile_checksum_func_put() !=
|
531
|
+
if (uniffi_pubkymobile_checksum_func_put() != 51107) {
|
616
532
|
return InitializationResult.apiChecksumMismatch
|
617
533
|
}
|
618
534
|
if (uniffi_pubkymobile_checksum_func_resolve() != 18303) {
|
@@ -621,17 +537,16 @@ private var initializationResult: InitializationResult {
|
|
621
537
|
if (uniffi_pubkymobile_checksum_func_resolve_https() != 34593) {
|
622
538
|
return InitializationResult.apiChecksumMismatch
|
623
539
|
}
|
624
|
-
if (uniffi_pubkymobile_checksum_func_sign_in() !=
|
540
|
+
if (uniffi_pubkymobile_checksum_func_sign_in() != 21006) {
|
625
541
|
return InitializationResult.apiChecksumMismatch
|
626
542
|
}
|
627
|
-
if (uniffi_pubkymobile_checksum_func_sign_out() !=
|
543
|
+
if (uniffi_pubkymobile_checksum_func_sign_out() != 59116) {
|
628
544
|
return InitializationResult.apiChecksumMismatch
|
629
545
|
}
|
630
|
-
if (uniffi_pubkymobile_checksum_func_sign_up() !=
|
546
|
+
if (uniffi_pubkymobile_checksum_func_sign_up() != 58756) {
|
631
547
|
return InitializationResult.apiChecksumMismatch
|
632
548
|
}
|
633
549
|
|
634
|
-
uniffiInitContinuationCallback()
|
635
550
|
return InitializationResult.ok
|
636
551
|
}
|
637
552
|
|
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;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,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;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,M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,IAAIA,CAACvB,GAAW,EAA6B;EACjE,IAAI;IACF,MAAME,GAAG,GAAG,MAAMP,KAAK,CAAC4B,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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@@ -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,I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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;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;K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AAU,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"}
|
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
|
+
}
|