@synonymdev/react-native-pubky 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,16 +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
- ### Methods to be Implemented
28
- - [ ] getProfile: Retrieve the profile of a user.
29
- - [ ] editProfile: Submit changes to the specified profile.
29
+ - [x] [create_recovery_file](#createRecoveryFile): Create a recovery file.
30
+ - [x] [decrypt_recovery_file](#decryptRecoveryFile): Decrypt a recovery file.
30
31
 
32
+ ### Methods to be Implemented
33
+ - [ ] setProfile: Set profile information for a pubky.
34
+ - [ ] getProfile: Get profile information for a pubky.
31
35
 
32
36
  ## Usage
33
37
  ### <a name="auth"></a>Auth
@@ -158,6 +162,20 @@ if (listRes.isErr()) {
158
162
  console.log(listRes.value);
159
163
  ```
160
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
+
161
179
  ### <a name="generateSecretKey"></a>generateSecretKey
162
180
  ```js
163
181
  import { generateSecretKey } from '@synonymdev/react-native-pubky';
@@ -211,6 +229,20 @@ if (signInRes.isErr()) {
211
229
  console.log(signInRes.value);
212
230
  ```
213
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
+
214
246
  ### <a name="signOut"></a>signIn
215
247
  ```js
216
248
  import { signOut } from '@synonymdev/react-native-pubky';
@@ -225,6 +257,36 @@ if (signOutRes.isErr()) {
225
257
  console.log(signOutRes.value);
226
258
  ```
227
259
 
260
+ ### <a name="createRecoveryFile"></a>createRecoveryFile
261
+ ```js
262
+ import { createRecoveryFile } from '@synonymdev/react-native-pubky';
263
+
264
+ const createRecoveryFileRes = await createRecoveryFile(
265
+ 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', // Secret Key
266
+ 'passphrase', // Passphrase
267
+ );
268
+ if (createRecoveryFileRes.isErr()) {
269
+ console.log(createRecoveryFileRes.error.message);
270
+ return;
271
+ }
272
+ console.log(createRecoveryFileRes.value);
273
+ ```
274
+
275
+ ### <a name="decryptRecoveryFile"></a>decryptRecoveryFile
276
+ ```js
277
+ import { decryptRecoveryFile } from '@synonymdev/react-native-pubky';
278
+
279
+ const decryptRecoveryFileRes = await decryptRecoveryFile(
280
+ 'cHVia3kub3JnL3JlY292ZXJ5CkZRt1NHIjxyTo0whSSgTgNrH56MPpGrSxvAQSE0x5FeklVJpNJqcNP4zjdwW/OpdBOsEC1qZ5MI/mcEUKFKVAEZwikdclsLZg==', // Recovery File
281
+ 'passphrase', // Passphrase
282
+ );
283
+ if (decryptRecoveryFileRes.isErr()) {
284
+ console.log(decryptRecoveryFileRes.error.message);
285
+ return;
286
+ }
287
+ console.log(decryptRecoveryFileRes.value);
288
+ ```
289
+
228
290
  ## Local Installation
229
291
 
230
292
  1. Clone & npm install:
@@ -245,6 +307,16 @@ After making changes to any of the Rust files, the bindings will need to be upda
245
307
  npm run update-bindings
246
308
  ```
247
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
+
248
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.
249
321
 
250
322
  ## License