@synonymdev/react-native-pubky 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +42 -3
- package/android/src/main/java/com/pubky/PubkyModule.kt +363 -272
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +557 -127
- 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/ios-arm64/Headers/pubkymobileFFI.h +28 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +28 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky-Bridging-Header.h +1 -0
- package/ios/Pubky.mm +16 -1
- package/ios/Pubky.swift +64 -1
- package/ios/pubkymobile.swift +284 -0
- package/lib/commonjs/index.js +45 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +42 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +54 -1
package/README.md
CHANGED
@@ -18,19 +18,20 @@ npm install @synonymdev/react-native-pubky
|
|
18
18
|
- [x] [resolveHttps](#resolveHttps): Resolve HTTPS records.
|
19
19
|
- [x] [signUp](#signUp): Sign-up to a homeserver and update Pkarr accordingly.
|
20
20
|
- [x] [signIn](#signIn): Sign-in to a homeserver.
|
21
|
+
- [x] [session](#session): Check the current session for a given Pubky in its homeserver.
|
21
22
|
- [x] [signOut](#signOut): Sign-out from a homeserver.
|
22
23
|
- [x] [put](#put): Upload a small payload to a given path.
|
23
24
|
- [x] [get](#get): Download a small payload from a given path relative to a pubky author.
|
24
25
|
- [x] [list](#list): Returns a list of Pubky URLs of the files in the path of the `url` provided.
|
26
|
+
- [x] [delete](#delete): Delete a file at a path relative to a pubky author.
|
25
27
|
- [x] [generateSecretKey](#generateSecretKey): Generate a secret key.
|
26
28
|
- [x] [getPublicKeyFromSecretKey](#getPublicKeyFromSecretKey): Get the public key string and uri from a secret key.
|
27
29
|
- [x] [create_recovery_file](#createRecoveryFile): Create a recovery file.
|
28
30
|
- [x] [decrypt_recovery_file](#decryptRecoveryFile): Decrypt a recovery file.
|
29
31
|
|
30
32
|
### Methods to be Implemented
|
31
|
-
- [ ]
|
32
|
-
- [ ]
|
33
|
-
|
33
|
+
- [ ] setProfile: Set profile information for a pubky.
|
34
|
+
- [ ] getProfile: Get profile information for a pubky.
|
34
35
|
|
35
36
|
## Usage
|
36
37
|
### <a name="auth"></a>Auth
|
@@ -161,6 +162,20 @@ if (listRes.isErr()) {
|
|
161
162
|
console.log(listRes.value);
|
162
163
|
```
|
163
164
|
|
165
|
+
### <a name="deleteFile"></a>deleteFile
|
166
|
+
```js
|
167
|
+
import { deleteFile } from '@synonymdev/react-native-pubky';
|
168
|
+
|
169
|
+
const deleteFileRes = await deleteFile(
|
170
|
+
'pubky://z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty/pub/' // URL
|
171
|
+
);
|
172
|
+
if (deleteFileRes.isErr()) {
|
173
|
+
console.log(deleteFileRes.error.message);
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
console.log(deleteFileRes.value);
|
177
|
+
```
|
178
|
+
|
164
179
|
### <a name="generateSecretKey"></a>generateSecretKey
|
165
180
|
```js
|
166
181
|
import { generateSecretKey } from '@synonymdev/react-native-pubky';
|
@@ -214,6 +229,20 @@ if (signInRes.isErr()) {
|
|
214
229
|
console.log(signInRes.value);
|
215
230
|
```
|
216
231
|
|
232
|
+
### <a name="session"></a>sessionRes
|
233
|
+
```js
|
234
|
+
import { session } from '@synonymdev/react-native-pubky';
|
235
|
+
|
236
|
+
const sessionRes = await session(
|
237
|
+
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty' // Public Key
|
238
|
+
);
|
239
|
+
if (sessionRes.isErr()) {
|
240
|
+
console.log(sessionRes.error.message);
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
console.log(sessionRes.value);
|
244
|
+
```
|
245
|
+
|
217
246
|
### <a name="signOut"></a>signIn
|
218
247
|
```js
|
219
248
|
import { signOut } from '@synonymdev/react-native-pubky';
|
@@ -278,6 +307,16 @@ After making changes to any of the Rust files, the bindings will need to be upda
|
|
278
307
|
npm run update-bindings
|
279
308
|
```
|
280
309
|
|
310
|
+
## Run React Native Example App
|
311
|
+
1. Run Homeserver:
|
312
|
+
```sh
|
313
|
+
cd rust/pubky/pubky-homeserver && cargo run -- --config=./src/config.toml
|
314
|
+
```
|
315
|
+
2. Run the React Native Example App:
|
316
|
+
```sh
|
317
|
+
cd example && yarn install && cd ios && pod install && cd ../ && yarn ios
|
318
|
+
```
|
319
|
+
|
281
320
|
Finally, ensure that `PubkyModule.kt`, `Pubky.swift`, `Pubky.mm` & `src/index.tsx` are updated accordingly based on the changes made to the Rust files.
|
282
321
|
|
283
322
|
## License
|