@functionland/react-native-fula 1.41.1 → 1.44.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.
Files changed (91) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +226 -226
  3. package/android/build.gradle +1 -1
  4. package/android/gradle.properties +5 -5
  5. package/android/src/main/AndroidManifest.xml +3 -3
  6. package/android/src/main/AndroidManifestNew.xml +2 -2
  7. package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
  8. package/android/src/main/java/land/fx/fula/Cryptography.java +62 -62
  9. package/android/src/main/java/land/fx/fula/FulaModule.java +31 -0
  10. package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
  11. package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
  12. package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
  13. package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
  14. package/ios/Cryptography.swift +49 -49
  15. package/ios/Fula-Bridging-Header.h +3 -3
  16. package/ios/Fula.mm +9 -0
  17. package/ios/Fula.swift +27 -1
  18. package/ios/UserDataHelper.swift +143 -143
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/interfaces/augment-api-errors.js.map +1 -1
  21. package/lib/commonjs/interfaces/augment-api-rpc.js.map +1 -1
  22. package/lib/commonjs/interfaces/augment-api-runtime.js.map +1 -1
  23. package/lib/commonjs/interfaces/augment-api.js.map +1 -1
  24. package/lib/commonjs/interfaces/augment-types.js.map +1 -1
  25. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  26. package/lib/commonjs/interfaces/index.js.map +1 -1
  27. package/lib/commonjs/interfaces/lookup.js +278 -278
  28. package/lib/commonjs/interfaces/lookup.js.map +1 -1
  29. package/lib/commonjs/interfaces/registry.js.map +1 -1
  30. package/lib/commonjs/interfaces/types-lookup.js.map +1 -1
  31. package/lib/commonjs/interfaces/types.js.map +1 -1
  32. package/lib/commonjs/protocols/blockchain.js +25 -2
  33. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  34. package/lib/commonjs/protocols/chain-api.js.map +1 -1
  35. package/lib/commonjs/protocols/fula.js +106 -106
  36. package/lib/commonjs/protocols/fula.js.map +1 -1
  37. package/lib/commonjs/protocols/fxblox.js +23 -1
  38. package/lib/commonjs/protocols/fxblox.js.map +1 -1
  39. package/lib/commonjs/types/blockchain.js.map +1 -1
  40. package/lib/commonjs/types/fxblox.js.map +1 -1
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/interfaces/augment-api-errors.js.map +1 -1
  43. package/lib/module/interfaces/augment-api-rpc.js.map +1 -1
  44. package/lib/module/interfaces/augment-api-runtime.js.map +1 -1
  45. package/lib/module/interfaces/augment-api.js.map +1 -1
  46. package/lib/module/interfaces/augment-types.js.map +1 -1
  47. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  48. package/lib/module/interfaces/index.js.map +1 -1
  49. package/lib/module/interfaces/lookup.js +278 -278
  50. package/lib/module/interfaces/lookup.js.map +1 -1
  51. package/lib/module/interfaces/registry.js.map +1 -1
  52. package/lib/module/interfaces/types-lookup.js.map +1 -1
  53. package/lib/module/interfaces/types.js.map +1 -1
  54. package/lib/module/protocols/blockchain.js +22 -0
  55. package/lib/module/protocols/blockchain.js.map +1 -1
  56. package/lib/module/protocols/chain-api.js.map +1 -1
  57. package/lib/module/protocols/fula.js +106 -106
  58. package/lib/module/protocols/fula.js.map +1 -1
  59. package/lib/module/protocols/fxblox.js +21 -0
  60. package/lib/module/protocols/fxblox.js.map +1 -1
  61. package/lib/module/types/blockchain.js.map +1 -1
  62. package/lib/module/types/fxblox.js.map +1 -1
  63. package/lib/typescript/interfaces/fulaNativeModule.d.ts +2 -0
  64. package/lib/typescript/interfaces/fulaNativeModule.d.ts.map +1 -1
  65. package/lib/typescript/protocols/blockchain.d.ts +1 -0
  66. package/lib/typescript/protocols/blockchain.d.ts.map +1 -1
  67. package/lib/typescript/protocols/fxblox.d.ts +1 -0
  68. package/lib/typescript/protocols/fxblox.d.ts.map +1 -1
  69. package/lib/typescript/types/blockchain.d.ts +5 -0
  70. package/lib/typescript/types/blockchain.d.ts.map +1 -1
  71. package/lib/typescript/types/fxblox.d.ts +4 -0
  72. package/lib/typescript/types/fxblox.d.ts.map +1 -1
  73. package/package.json +1 -1
  74. package/react-native-fula.podspec +47 -47
  75. package/src/index.tsx +4 -4
  76. package/src/interfaces/augment-api-errors.ts +449 -449
  77. package/src/interfaces/augment-api-rpc.ts +617 -617
  78. package/src/interfaces/augment-api-runtime.ts +224 -224
  79. package/src/interfaces/augment-api.ts +10 -10
  80. package/src/interfaces/augment-types.ts +1230 -1230
  81. package/src/interfaces/fulaNativeModule.ts +5 -1
  82. package/src/interfaces/index.ts +4 -4
  83. package/src/interfaces/lookup.ts +1889 -1889
  84. package/src/interfaces/registry.ts +152 -152
  85. package/src/interfaces/types-lookup.ts +2043 -2043
  86. package/src/interfaces/types.ts +3 -3
  87. package/src/protocols/blockchain.ts +26 -0
  88. package/src/protocols/fula.ts +427 -427
  89. package/src/protocols/fxblox.ts +26 -0
  90. package/src/types/blockchain.ts +6 -0
  91. package/src/types/fxblox.ts +5 -0
package/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Ehsan Shariati <ehsan6sha@gmail.com> (https://github.com/ehsan6sha)
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Ehsan Shariati <ehsan6sha@gmail.com> (https://github.com/ehsan6sha)
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md CHANGED
@@ -1,226 +1,226 @@
1
- # react-native-fula
2
-
3
- This package is a bridge to use the [Fula protocols](https://github.com/functionland/go-fula) in the react-native. It uses [WNFS](https://github.com/wnfs-wg/rs-wnfs) to create the Merkle dag from files and folders and transfer the DAG using Graphsync to the nodes.
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm install react-native-fula
9
- ```
10
-
11
- ## Usage
12
-
13
- ```js
14
- import { fula } from 'react-native-fula'; // Until the library becomes stable, we suggest importing from github directly
15
- ```
16
-
17
- ```js
18
- // Creates a new client without creating a filesystem. It is better to call this instead of directly calling init
19
- const peerId //returns peerId as string
20
- = newClient(
21
- identity: string, //privateKey of did identity
22
- storePath: string, // leave empty to use the default temp one
23
- bloxAddr: string, //leave empty for testing without a backend node
24
- exchange: 'noop'|'', //add noop for testing without a backend
25
- autoFlush: boolean, //Default to false. Always set to false unless you know what you are doing. explicitly write data to disk after each operation if set to true
26
- useRelay: boolean, //default to true. If true it forces the connection through relay
27
- refresh: boolean? //forces the fula object to be recreated. default is false
28
- )
29
- ```
30
-
31
- ```js
32
- //Initialize the fula client, which creates the libp2p connection if newClient is not called before, and creates filesystem. Note that input is not an object e.g. init('','','','noop', false)
33
- [
34
- peerId, //returns peerId of the created libp2p instance in form of a string of bytes
35
- cid, //return the root cid of the WNFS merkle DAG in form of a string
36
- private_ref //return the keys needed to decode hte encrypted WNFS tree in form of a string of object
37
- ]
38
- =
39
- await fula.init(
40
- identity: string, //bytes of the privateKey of did identity in string format
41
- storePath: string, // leave empty to use the default temp one
42
- bloxAddr: string, //leave empty for testing without a backend node
43
- exchange: 'noop'|'', //add noop for testing without a backend
44
- autoFlush: boolean, //Default to false. Always set to false unless you know what you are doing. explicitly write data to disk after each operation if set to true
45
- useRelay: boolean, //default to true. If true it forces the connection through relay
46
- refresh: boolean? //forces the fula object to be recreated. default is false
47
- );
48
- ```
49
-
50
- ```js
51
- //Creates a Folder
52
- const cid //returns the cid of the new root. Note that on every write action the root cid changes.
53
- =
54
- await fula.mkdir(
55
- path: string // This is the Fula path to create a folder and always starts with "root/" and should not start or end with a slash e.g "root/pictures"
56
- );
57
- ```
58
-
59
- ```js
60
- //Write a local file on the device to the Fula tree (upload). It keeps the original file modification date.
61
- const cid //returns the cid of the new root. Note that on every write action the root cid changes.
62
- =
63
- await fula.writeFile(
64
- fulaTargetFilename: string, //path to the file on the tree. It should include the filename and extension and start from the "root/". e.g. "root/pictures/cat.jpg"
65
- localFilename: string //path to the local file. e.g the file that needs to be uploaded
66
- );
67
- //// TODO: This needs to be improved by using stream to not overload the memory for large files
68
- ```
69
-
70
- ```js
71
- //reads a file on fula tree to a local file on the device (download). It is stream so does not affect memory for large files.
72
- const localFilePath //returns the path to the local file and includes the filename
73
- =
74
- await fula.readFile(
75
- fulaTargetFilename: string, //path to the file on the tree. It should include the filename and extension and start from the "root/". e.g. "root/pictures/cat.jpg"
76
- localFilename: string //path to the local file. It should include the filename and extension. e.g. "/temp/cat.jpg"
77
- );
78
- ```
79
-
80
- ```js
81
- //shows all files and folders under the specified path on Fula
82
- const fileList //returns all the files and folders in a string separated by \n
83
- =
84
- await fula.ls(
85
- path: string, //path to the folder on the tree. It always starts from the "root". e.g. "root" or "root/pictures"
86
- );
87
- //// TODO: This needs to be improved by returning an array of files and folders and in chunks to not overload hte memory for large folders
88
- ```
89
-
90
- ```js
91
- //removes all files and folders at the specified path on Fula
92
- const cid //returns the cid of the new root. Note that on every write action the root cid changes.
93
- =
94
- await fula.rm(
95
- path: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
96
- );
97
-
98
- ```
99
-
100
- ```js
101
- //copies the specified file or folder at sourcePath to the filename at targetPath. the path itself(apart from filename) must exist
102
- const cid //returns the cid of the new root. Note that on every write action the root cid changes.
103
- =
104
- await fula.cp(
105
- sourcePath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
106
- targetPath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures2" or "root/pictures2/cat.jpg"
107
- );
108
-
109
- ```
110
-
111
- ```js
112
- //moves the specified file or folder at sourcePath to the filename at targetPath. the path itself(apart from filename) must exist
113
- const cid //returns the cid of the new root. Note that on every write action the root cid changes.
114
- =
115
- await fula.mv(
116
- sourcePath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
117
- targetPath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures2" or "root/pictures2/cat.jpg"
118
- );
119
-
120
- ```
121
-
122
- ```js
123
- //checks if fula is ready (initialized through newClient or init)
124
- const result //returns true if succesful and false if fails
125
- =
126
- await fula.isReady(
127
- filesystemCheck: boolean //Default is true. If true it checks if both WNFS and Fula are ready. If false it only checks fula
128
- );
129
-
130
- ```
131
-
132
- ```js
133
- //checks if client can reach server
134
- const result //returns true if it can, and false if it cannot
135
- =
136
- await fula.checkConnection(
137
- timeout: number? //default to 20. Maximum time in seconds that checkConnection waits before throwing an error
138
- );
139
-
140
- ```
141
-
142
- ```js
143
- //checks if there are any un-synced actions on the client
144
- const result //returns true if there are, and false if everything is synced with server
145
- =
146
- await fula.checkFailedActions(
147
- retry: boolean //if true, it tries to sync device with server, if not, it only checks
148
- timeout: number? //default to 20. Maximum time in seconds that checkConnection waits before throwing an error
149
- );
150
- ```
151
-
152
- ```js
153
- //lists any cids that are failed to be pushed to backend and only exist on client device
154
- const result //returns an array of cids or false if no cid is found
155
- =
156
- await fula.listFailedActions(
157
- cids: string[] //if [], it returns all failed cids, and if provided, it only return the failed cids that are in the array of cids provided as input
158
- );
159
- ```
160
-
161
- ```js
162
- //Gives access to the blox for a specific peerId. This call must be made from the authorizer only.
163
- const result //returns true if succesful and false if fails
164
- =
165
- await fula.setAuth(
166
- peerId: string, //peer ID of the app that needs access to the blox
167
- allow: boolean, // true to allow and false to remove access
168
- );
169
-
170
- ```
171
-
172
- ```js
173
- //shuts down the fula libp2p and datastore
174
- await fula.shutdown();
175
- ```
176
-
177
- ```js
178
- //removes all Fula related data and information (Except the encrypted filesystem) at the specified storage local path
179
- const result //returns true if succesful and false if fails
180
- =
181
- await fula.logout(
182
- identity: string, //bytes of the privateKey of did identity in string format
183
- storePath: string, // leave empty to use the default temp one
184
- );
185
-
186
- ```
187
-
188
- ## Polkadot type creation
189
-
190
- You can follow the documentation here: https://polkadot.js.org/docs/api/examples/promise/typegen
191
-
192
- Alternatively you do the below on a Linux or WSL inside the react-native-fula folder:
193
-
194
- ```bash
195
- curl -H "Content-Type: application/json" -d "{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}" https://node3.functionyard.fula.network > edgeware.json
196
-
197
- yarn build:polkadot
198
- ```
199
-
200
- ## Roadmap
201
-
202
- Please note the following might not be done in order:
203
-
204
- - [x] Initial version with all functions included
205
- - [x] Add WNFS tree encryption key generation from an input (deterministically)
206
- - [x] Improve ead function to use a stream. ( :100: v1 Release here )
207
- - [x] Connect to backend
208
- - [ ] Connect to Blockchain codes using APIs
209
-
210
- ## Other related libraries
211
-
212
- | Name | Description |
213
- | --- | --- |
214
- | [WNFS for Android](https://github.com/functionland/wnfs-android) | Android build for WNFS rust version |
215
- | [WNFS for iOS](https://github.com/functionland/wnfs-ios) | iOS build for WNFS rust version |
216
- | [WNFS Build](https://github.com/functionland/wnfs-build-aar) | Android .aar for WNFS |
217
- | [Fula Build](https://github.com/functionland/fula-build-aar) | android .aar file for Fula |
218
- | [Fx Fotos](https://github.com/functionland/fx-fotos) | Fx Fotos dApp using react-native-fula |
219
-
220
- ## Contributing
221
-
222
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
223
-
224
- ## License
225
-
226
- MIT
1
+ # react-native-fula
2
+
3
+ This package is a bridge to use the [Fula protocols](https://github.com/functionland/go-fula) in the react-native. It uses [WNFS](https://github.com/wnfs-wg/rs-wnfs) to create the Merkle dag from files and folders and transfer the DAG using Graphsync to the nodes.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install react-native-fula
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import { fula } from 'react-native-fula'; // Until the library becomes stable, we suggest importing from github directly
15
+ ```
16
+
17
+ ```js
18
+ // Creates a new client without creating a filesystem. It is better to call this instead of directly calling init
19
+ const peerId //returns peerId as string
20
+ = newClient(
21
+ identity: string, //privateKey of did identity
22
+ storePath: string, // leave empty to use the default temp one
23
+ bloxAddr: string, //leave empty for testing without a backend node
24
+ exchange: 'noop'|'', //add noop for testing without a backend
25
+ autoFlush: boolean, //Default to false. Always set to false unless you know what you are doing. explicitly write data to disk after each operation if set to true
26
+ useRelay: boolean, //default to true. If true it forces the connection through relay
27
+ refresh: boolean? //forces the fula object to be recreated. default is false
28
+ )
29
+ ```
30
+
31
+ ```js
32
+ //Initialize the fula client, which creates the libp2p connection if newClient is not called before, and creates filesystem. Note that input is not an object e.g. init('','','','noop', false)
33
+ [
34
+ peerId, //returns peerId of the created libp2p instance in form of a string of bytes
35
+ cid, //return the root cid of the WNFS merkle DAG in form of a string
36
+ private_ref //return the keys needed to decode hte encrypted WNFS tree in form of a string of object
37
+ ]
38
+ =
39
+ await fula.init(
40
+ identity: string, //bytes of the privateKey of did identity in string format
41
+ storePath: string, // leave empty to use the default temp one
42
+ bloxAddr: string, //leave empty for testing without a backend node
43
+ exchange: 'noop'|'', //add noop for testing without a backend
44
+ autoFlush: boolean, //Default to false. Always set to false unless you know what you are doing. explicitly write data to disk after each operation if set to true
45
+ useRelay: boolean, //default to true. If true it forces the connection through relay
46
+ refresh: boolean? //forces the fula object to be recreated. default is false
47
+ );
48
+ ```
49
+
50
+ ```js
51
+ //Creates a Folder
52
+ const cid //returns the cid of the new root. Note that on every write action the root cid changes.
53
+ =
54
+ await fula.mkdir(
55
+ path: string // This is the Fula path to create a folder and always starts with "root/" and should not start or end with a slash e.g "root/pictures"
56
+ );
57
+ ```
58
+
59
+ ```js
60
+ //Write a local file on the device to the Fula tree (upload). It keeps the original file modification date.
61
+ const cid //returns the cid of the new root. Note that on every write action the root cid changes.
62
+ =
63
+ await fula.writeFile(
64
+ fulaTargetFilename: string, //path to the file on the tree. It should include the filename and extension and start from the "root/". e.g. "root/pictures/cat.jpg"
65
+ localFilename: string //path to the local file. e.g the file that needs to be uploaded
66
+ );
67
+ //// TODO: This needs to be improved by using stream to not overload the memory for large files
68
+ ```
69
+
70
+ ```js
71
+ //reads a file on fula tree to a local file on the device (download). It is stream so does not affect memory for large files.
72
+ const localFilePath //returns the path to the local file and includes the filename
73
+ =
74
+ await fula.readFile(
75
+ fulaTargetFilename: string, //path to the file on the tree. It should include the filename and extension and start from the "root/". e.g. "root/pictures/cat.jpg"
76
+ localFilename: string //path to the local file. It should include the filename and extension. e.g. "/temp/cat.jpg"
77
+ );
78
+ ```
79
+
80
+ ```js
81
+ //shows all files and folders under the specified path on Fula
82
+ const fileList //returns all the files and folders in a string separated by \n
83
+ =
84
+ await fula.ls(
85
+ path: string, //path to the folder on the tree. It always starts from the "root". e.g. "root" or "root/pictures"
86
+ );
87
+ //// TODO: This needs to be improved by returning an array of files and folders and in chunks to not overload hte memory for large folders
88
+ ```
89
+
90
+ ```js
91
+ //removes all files and folders at the specified path on Fula
92
+ const cid //returns the cid of the new root. Note that on every write action the root cid changes.
93
+ =
94
+ await fula.rm(
95
+ path: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
96
+ );
97
+
98
+ ```
99
+
100
+ ```js
101
+ //copies the specified file or folder at sourcePath to the filename at targetPath. the path itself(apart from filename) must exist
102
+ const cid //returns the cid of the new root. Note that on every write action the root cid changes.
103
+ =
104
+ await fula.cp(
105
+ sourcePath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
106
+ targetPath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures2" or "root/pictures2/cat.jpg"
107
+ );
108
+
109
+ ```
110
+
111
+ ```js
112
+ //moves the specified file or folder at sourcePath to the filename at targetPath. the path itself(apart from filename) must exist
113
+ const cid //returns the cid of the new root. Note that on every write action the root cid changes.
114
+ =
115
+ await fula.mv(
116
+ sourcePath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures" or "root/pictures/cat.jpg"
117
+ targetPath: string, //path to the file or folder on the tree. It always starts from the "root". e.g. "root/pictures2" or "root/pictures2/cat.jpg"
118
+ );
119
+
120
+ ```
121
+
122
+ ```js
123
+ //checks if fula is ready (initialized through newClient or init)
124
+ const result //returns true if succesful and false if fails
125
+ =
126
+ await fula.isReady(
127
+ filesystemCheck: boolean //Default is true. If true it checks if both WNFS and Fula are ready. If false it only checks fula
128
+ );
129
+
130
+ ```
131
+
132
+ ```js
133
+ //checks if client can reach server
134
+ const result //returns true if it can, and false if it cannot
135
+ =
136
+ await fula.checkConnection(
137
+ timeout: number? //default to 20. Maximum time in seconds that checkConnection waits before throwing an error
138
+ );
139
+
140
+ ```
141
+
142
+ ```js
143
+ //checks if there are any un-synced actions on the client
144
+ const result //returns true if there are, and false if everything is synced with server
145
+ =
146
+ await fula.checkFailedActions(
147
+ retry: boolean //if true, it tries to sync device with server, if not, it only checks
148
+ timeout: number? //default to 20. Maximum time in seconds that checkConnection waits before throwing an error
149
+ );
150
+ ```
151
+
152
+ ```js
153
+ //lists any cids that are failed to be pushed to backend and only exist on client device
154
+ const result //returns an array of cids or false if no cid is found
155
+ =
156
+ await fula.listFailedActions(
157
+ cids: string[] //if [], it returns all failed cids, and if provided, it only return the failed cids that are in the array of cids provided as input
158
+ );
159
+ ```
160
+
161
+ ```js
162
+ //Gives access to the blox for a specific peerId. This call must be made from the authorizer only.
163
+ const result //returns true if succesful and false if fails
164
+ =
165
+ await fula.setAuth(
166
+ peerId: string, //peer ID of the app that needs access to the blox
167
+ allow: boolean, // true to allow and false to remove access
168
+ );
169
+
170
+ ```
171
+
172
+ ```js
173
+ //shuts down the fula libp2p and datastore
174
+ await fula.shutdown();
175
+ ```
176
+
177
+ ```js
178
+ //removes all Fula related data and information (Except the encrypted filesystem) at the specified storage local path
179
+ const result //returns true if succesful and false if fails
180
+ =
181
+ await fula.logout(
182
+ identity: string, //bytes of the privateKey of did identity in string format
183
+ storePath: string, // leave empty to use the default temp one
184
+ );
185
+
186
+ ```
187
+
188
+ ## Polkadot type creation
189
+
190
+ You can follow the documentation here: https://polkadot.js.org/docs/api/examples/promise/typegen
191
+
192
+ Alternatively you do the below on a Linux or WSL inside the react-native-fula folder:
193
+
194
+ ```bash
195
+ curl -H "Content-Type: application/json" -d "{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}" https://node3.functionyard.fula.network > edgeware.json
196
+
197
+ yarn build:polkadot
198
+ ```
199
+
200
+ ## Roadmap
201
+
202
+ Please note the following might not be done in order:
203
+
204
+ - [x] Initial version with all functions included
205
+ - [x] Add WNFS tree encryption key generation from an input (deterministically)
206
+ - [x] Improve ead function to use a stream. ( :100: v1 Release here )
207
+ - [x] Connect to backend
208
+ - [ ] Connect to Blockchain codes using APIs
209
+
210
+ ## Other related libraries
211
+
212
+ | Name | Description |
213
+ | --- | --- |
214
+ | [WNFS for Android](https://github.com/functionland/wnfs-android) | Android build for WNFS rust version |
215
+ | [WNFS for iOS](https://github.com/functionland/wnfs-ios) | iOS build for WNFS rust version |
216
+ | [WNFS Build](https://github.com/functionland/wnfs-build-aar) | Android .aar for WNFS |
217
+ | [Fula Build](https://github.com/functionland/fula-build-aar) | android .aar file for Fula |
218
+ | [Fx Fotos](https://github.com/functionland/fx-fotos) | Fx Fotos dApp using react-native-fula |
219
+
220
+ ## Contributing
221
+
222
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
223
+
224
+ ## License
225
+
226
+ MIT
@@ -94,7 +94,7 @@ dependencies {
94
94
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
95
95
  //noinspection GradleDynamicVersion
96
96
  implementation "com.facebook.react:react-native:+"
97
- implementation 'com.github.functionland:fula-build-aar:v1.41.0' // From jitpack.io
97
+ implementation 'com.github.functionland:fula-build-aar:v1.44.0' // From jitpack.io
98
98
  implementation 'com.github.functionland:wnfs-android:v1.8.1' // From jitpack.io
99
99
  implementation 'commons-io:commons-io:20030203.000550'
100
100
  implementation 'commons-codec:commons-codec:1.15'
@@ -1,5 +1,5 @@
1
- Fula_kotlinVersion=1.7.0
2
- Fula_minSdkVersion=26
3
- Fula_targetSdkVersion=31
4
- Fula_compileSdkVersion=31
5
- Fula_ndkversion=21.4.7075529
1
+ Fula_kotlinVersion=1.7.0
2
+ Fula_minSdkVersion=26
3
+ Fula_targetSdkVersion=31
4
+ Fula_compileSdkVersion=31
5
+ Fula_ndkversion=21.4.7075529
@@ -1,3 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="land.fx.fula">
3
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="land.fx.fula">
3
+ </manifest>
@@ -1,2 +1,2 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -1,7 +1,7 @@
1
- package land.fx.fula;
2
-
3
- public final class ConfigRef {
4
- public byte[] identity;
5
- public java.lang.String storePath;
6
- }
7
-
1
+ package land.fx.fula;
2
+
3
+ public final class ConfigRef {
4
+ public byte[] identity;
5
+ public java.lang.String storePath;
6
+ }
7
+