@functionland/react-native-fula 0.4.2 → 1.0.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 (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +133 -100
  3. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  9. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  10. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  11. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  13. package/android/.gradle/7.5.1/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/vcs-1/gc.properties +0 -0
  18. package/android/.idea/compiler.xml +5 -5
  19. package/android/.idea/gradle.xml +17 -18
  20. package/android/.idea/jarRepositories.xml +44 -49
  21. package/android/.idea/misc.xml +9 -9
  22. package/android/.idea/vcs.xml +5 -5
  23. package/android/build.gradle +69 -67
  24. package/android/gradle/wrapper/gradle-wrapper.properties +1 -0
  25. package/android/gradlew +375 -240
  26. package/android/local.properties +8 -8
  27. package/android/src/main/AndroidManifest.xml +4 -4
  28. package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
  29. package/android/src/main/java/land/fx/fula/Cryptography.java +47 -47
  30. package/android/src/main/java/land/fx/fula/FulaModule.java +701 -480
  31. package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
  32. package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
  33. package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
  34. package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
  35. package/ios/FulaModule.h +10 -10
  36. package/ios/FulaModule.m +149 -149
  37. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  38. package/lib/commonjs/protocols/fula.js +127 -70
  39. package/lib/commonjs/protocols/fula.js.map +1 -1
  40. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  41. package/lib/module/protocols/fula.js +122 -68
  42. package/lib/module/protocols/fula.js.map +1 -1
  43. package/lib/typescript/index.d.ts +1 -1
  44. package/lib/typescript/interfaces/fulaNativeModule.d.ts +28 -20
  45. package/lib/typescript/protocols/fula.d.ts +99 -77
  46. package/package.json +149 -152
  47. package/react-native-fula.podspec +19 -19
  48. package/src/interfaces/fulaNativeModule.ts +52 -42
  49. package/src/protocols/fula.ts +212 -138
  50. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  51. package/android/.gradle/file-system.probe +0 -0
@@ -1,20 +1,28 @@
1
- interface FulaNativeModule {
2
- init: (identity: string | null, //Private key of did identity
3
- storePath: string | null, //You can leave empty
4
- bloxAddr: string, //Blox multiadddr needs to be manually entered now
5
- exchange: string) => Promise<[string, string, string]>;
6
- get: (key: string) => Promise<string>;
7
- has: (key: Uint8Array) => Promise<boolean>;
8
- push: () => Promise<string>;
9
- put: (content: string, codec: string) => Promise<string>;
10
- mkdir: (path: string) => Promise<string>;
11
- writeFileContent: (path: string, content: string) => Promise<string>;
12
- writeFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
13
- ls: (path: string) => Promise<string>;
14
- rm: (path: string) => Promise<string>;
15
- readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
16
- readFileContent: (path: string) => Promise<string>;
17
- shutdown: () => Promise<void>;
18
- }
19
- declare const _default: FulaNativeModule;
20
- export default _default;
1
+ interface FulaNativeModule {
2
+ init: (identity: string, //Private key of did identity
3
+ storePath: string, //You can leave empty
4
+ bloxAddr: string, //Blox multiadddr needs to be manually entered now
5
+ exchange: string, //set to 'noope' for testing
6
+ rootCid: string | null) => Promise<{
7
+ peerId: string;
8
+ rootCid: string;
9
+ private_ref: string;
10
+ }>;
11
+ logout: (identity: string, storePath: string) => Promise<boolean>;
12
+ get: (key: string) => Promise<string>;
13
+ has: (key: Uint8Array) => Promise<boolean>;
14
+ push: () => Promise<string>;
15
+ put: (content: string, codec: string) => Promise<string>;
16
+ mkdir: (path: string) => Promise<string>;
17
+ writeFileContent: (path: string, content: string) => Promise<string>;
18
+ writeFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
19
+ ls: (path: string) => Promise<string>;
20
+ rm: (path: string) => Promise<string>;
21
+ cp: (sourcePath: string, targetPath: string) => Promise<string>;
22
+ mv: (sourcePath: string, targetPath: string) => Promise<string>;
23
+ readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
24
+ readFileContent: (path: string) => Promise<string>;
25
+ shutdown: () => Promise<void>;
26
+ }
27
+ declare const _default: FulaNativeModule;
28
+ export default _default;
@@ -1,77 +1,99 @@
1
- /**
2
- * Get gets the value corresponding to the given key from the local datastore.
3
- // The key must be a valid ipld.Link.
4
- * @param config
5
- * @returns boolean
6
- */
7
- export declare const init: (identity: string, storePath: string, bloxAddr: string, exchange: string) => Promise<[string, string, string]>;
8
- /**
9
- * Get gets the value corresponding to the given key from the local datastore.
10
- // The key must be a valid ipld.Link.
11
- * @param key
12
- * @returns value
13
- */
14
- export declare const get: (key: string) => Promise<string>;
15
- /**
16
- * Has checks whether the value corresponding to the given key is present in the local datastore.
17
- // The key must be a valid ipld.Link.
18
- * @param key
19
- * @returns boolean
20
- */
21
- export declare const has: (key: Uint8Array) => Promise<boolean>;
22
- /**
23
- * Push requests the given addr to download the root cid from this node.
24
- // The addr must be a valid multiaddr that includes peer ID.
25
- // this function.
26
- * @param addr
27
- * @returns null or error
28
- */
29
- export declare const push: () => Promise<string>;
30
- /**
31
- * Put stores the given key value onto the local datastore.
32
- // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
33
- // to the given key.
34
- * @param key, value
35
- * @returns null or string
36
- */
37
- export declare const put: (value: string, codec: string) => Promise<string>;
38
- /**
39
- * mkdir creates a directory at the given path.
40
- * @param path
41
- * @returns string: new cid of the root
42
- */
43
- export declare const mkdir: (path: string) => Promise<string>;
44
- /**
45
- * writeFileContent writes content at a given path
46
- * @param path
47
- * @returns string: new cid of the root
48
- */
49
- export declare const writeFileContent: (path: string, content: string) => Promise<string>;
50
- export declare const writeFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
51
- /**
52
- * ls lists the name of files and folders at a given path
53
- * @param path
54
- * @returns string: list of items
55
- * TODO: Findout how is the string and convert to array
56
- */
57
- export declare const ls: (path: string) => Promise<string>;
58
- /**
59
- * rm removes all files and folders at a given path
60
- * @param path
61
- * @returns string: new cid of the root
62
- */
63
- export declare const rm: (path: string) => Promise<string>;
64
- export declare const readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
65
- /**
66
- * readFile reads content of a given path
67
- * @param path
68
- * @returns string: cotent
69
- */
70
- export declare const readFileContent: (path: string) => Promise<string>;
71
- /**
72
- * Shutdown closes all resources used by Client.
73
- // After calling this function Client must be discarded.
74
- * @param
75
- * @returns
76
- */
77
- export declare const shutdown: () => Promise<void>;
1
+ /**
2
+ * Get gets the value corresponding to the given key from the local datastore.
3
+ // The key must be a valid ipld.Link.
4
+ * @param config
5
+ * @returns boolean
6
+ */
7
+ export declare const init: (identity: string, storePath: string, bloxAddr: string, exchange: string, rootCid?: string | null) => Promise<{
8
+ peerId: string;
9
+ rootCid: string;
10
+ private_ref: string;
11
+ }>;
12
+ /**
13
+ * rm removes all data
14
+ * @param path
15
+ * @returns string: new cid of the root
16
+ */
17
+ export declare const logout: (identity: string, storePath: string) => Promise<boolean>;
18
+ /**
19
+ * Get gets the value corresponding to the given key from the local datastore.
20
+ // The key must be a valid ipld.Link.
21
+ * @param key
22
+ * @returns value
23
+ */
24
+ export declare const get: (key: string) => Promise<string>;
25
+ /**
26
+ * Has checks whether the value corresponding to the given key is present in the local datastore.
27
+ // The key must be a valid ipld.Link.
28
+ * @param key
29
+ * @returns boolean
30
+ */
31
+ export declare const has: (key: Uint8Array) => Promise<boolean>;
32
+ /**
33
+ * Push requests the given addr to download the root cid from this node.
34
+ // The addr must be a valid multiaddr that includes peer ID.
35
+ // this function.
36
+ * @param addr
37
+ * @returns null or error
38
+ */
39
+ export declare const push: () => Promise<string>;
40
+ /**
41
+ * Put stores the given key value onto the local datastore.
42
+ // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
43
+ // to the given key.
44
+ * @param key, value
45
+ * @returns null or string
46
+ */
47
+ export declare const put: (value: string, codec: string) => Promise<string>;
48
+ /**
49
+ * mkdir creates a directory at the given path.
50
+ * @param path
51
+ * @returns string: new cid of the root
52
+ */
53
+ export declare const mkdir: (path: string) => Promise<string>;
54
+ /**
55
+ * writeFileContent writes content at a given path
56
+ * @param path
57
+ * @returns string: new cid of the root
58
+ */
59
+ export declare const writeFileContent: (path: string, content: string) => Promise<string>;
60
+ export declare const writeFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
61
+ /**
62
+ * ls lists the name of files and folders at a given path
63
+ * @param path
64
+ * @returns string: list of items
65
+ * TODO: Findout how is the string and convert to array
66
+ */
67
+ export declare const ls: (path: string) => Promise<void | JSON>;
68
+ /**
69
+ * rm removes all files and folders at a given path
70
+ * @param path
71
+ * @returns string: new cid of the root
72
+ */
73
+ export declare const rm: (path: string) => Promise<string>;
74
+ /**
75
+ * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
76
+ * @param sourcePath, targetPath
77
+ * @returns string: new cid of the root
78
+ */
79
+ export declare const cp: (sourcePath: string, targetPath: string) => Promise<string>;
80
+ /**
81
+ * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
82
+ * @param sourcePath, targetPath
83
+ * @returns string: new cid of the root
84
+ */
85
+ export declare const mv: (sourcePath: string, targetPath: string) => Promise<string>;
86
+ export declare const readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
87
+ /**
88
+ * readFile reads content of a given path
89
+ * @param path
90
+ * @returns string: cotent
91
+ */
92
+ export declare const readFileContent: (path: string) => Promise<string>;
93
+ /**
94
+ * Shutdown closes all resources used by Client.
95
+ // After calling this function Client must be discarded.
96
+ * @param
97
+ * @returns
98
+ */
99
+ export declare const shutdown: () => Promise<void>;
package/package.json CHANGED
@@ -1,152 +1,149 @@
1
- {
2
- "name": "@functionland/react-native-fula",
3
- "version": "0.4.2",
4
- "description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/index.d.ts",
8
- "react-native": "src/index",
9
- "source": "src/index",
10
- "files": [
11
- "src",
12
- "lib",
13
- "android",
14
- "ios",
15
- "cpp",
16
- "!example/",
17
- "react-native-fula.podspec",
18
- "!lib/typescript/example",
19
- "!android/build",
20
- "!ios/build",
21
- "!**/__tests__",
22
- "!**/__fixtures__",
23
- "!**/__mocks__"
24
- ],
25
- "scripts": {
26
- "test": "jest",
27
- "typescript": "tsc --noEmit",
28
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
29
- "prepare": "bob build",
30
- "release": "release-it",
31
- "example": "yarn --cwd example",
32
- "pods": "cd example && pod-install --quiet",
33
- "bootstrap": "yarn example && yarn && yarn pods"
34
- },
35
- "keywords": [
36
- "react-native",
37
- "ios",
38
- "android"
39
- ],
40
- "repository": "https://github.com/functionland/react-native-fula",
41
- "author": "Ehsan Shariati <ehsan6sha@gmail.com> (https://github.com/ehsan6sha)",
42
- "license": "MIT",
43
- "bugs": {
44
- "url": "https://github.com/functionland/react-native-fula/issues"
45
- },
46
- "homepage": "https://github.com/functionland/react-native-fula#readme",
47
- "publishConfig": {
48
- "registry": "https://registry.npmjs.org"
49
- },
50
- "dependencies": {
51
-
52
- },
53
- "devDependencies": {
54
- "@babel/plugin-proposal-export-namespace-from": "^7.16.7",
55
- "@commitlint/config-conventional": "^11.0.0",
56
- "@react-native-community/eslint-config": "^2.0.0",
57
- "@release-it/conventional-changelog": "^2.0.0",
58
- "@types/jest": "^26.0.0",
59
- "@types/react": "^16.9.19",
60
- "@types/react-native": "0.62.13",
61
- "commitlint": "^11.0.0",
62
- "eslint": "^7.2.0",
63
- "eslint-config-prettier": "^7.0.0",
64
- "eslint-plugin-prettier": "^3.1.3",
65
- "husky": "^6.0.0",
66
- "jest": "^26.0.1",
67
- "pod-install": "^0.1.0",
68
- "prettier": "^2.0.5",
69
- "react": "16.13.1",
70
- "react-native": "0.63.4",
71
- "react-native-builder-bob": "^0.18.0",
72
- "release-it": "^14.2.2",
73
- "typescript": "^4.1.3"
74
- },
75
- "peerDependencies": {
76
- "react": "*",
77
- "react-native": "*"
78
- },
79
- "jest": {
80
- "preset": "react-native",
81
- "modulePathIgnorePatterns": [
82
- "<rootDir>/example/node_modules",
83
- "<rootDir>/lib/"
84
- ]
85
- },
86
- "commitlint": {
87
- "extends": [
88
- "@commitlint/config-conventional"
89
- ]
90
- },
91
- "release-it": {
92
- "git": {
93
- "commitMessage": "chore: release ${version}",
94
- "tagName": "v${version}"
95
- },
96
- "npm": {
97
- "publish": true
98
- },
99
- "github": {
100
- "release": true
101
- },
102
- "plugins": {
103
- "@release-it/conventional-changelog": {
104
- "preset": "angular"
105
- }
106
- }
107
- },
108
- "eslintConfig": {
109
- "root": true,
110
- "extends": [
111
- "@react-native-community",
112
- "prettier"
113
- ],
114
- "rules": {
115
- "prettier/prettier": [
116
- "error",
117
- {
118
- "quoteProps": "consistent",
119
- "singleQuote": true,
120
- "tabWidth": 2,
121
- "trailingComma": "es5",
122
- "useTabs": false
123
- }
124
- ]
125
- }
126
- },
127
- "eslintIgnore": [
128
- "node_modules/",
129
- "lib/"
130
- ],
131
- "prettier": {
132
- "quoteProps": "consistent",
133
- "singleQuote": true,
134
- "tabWidth": 2,
135
- "trailingComma": "es5",
136
- "useTabs": false
137
- },
138
- "react-native-builder-bob": {
139
- "source": "src",
140
- "output": "lib",
141
- "targets": [
142
- "commonjs",
143
- "module",
144
- [
145
- "typescript",
146
- {
147
- "project": "tsconfig.build.json"
148
- }
149
- ]
150
- ]
151
- }
152
- }
1
+ {
2
+ "name": "@functionland/react-native-fula",
3
+ "version": "1.0.0",
4
+ "description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "!example/",
17
+ "react-native-fula.podspec",
18
+ "!lib/typescript/example",
19
+ "!android/build",
20
+ "!ios/build",
21
+ "!**/__tests__",
22
+ "!**/__fixtures__",
23
+ "!**/__mocks__"
24
+ ],
25
+ "scripts": {
26
+ "test": "jest",
27
+ "typescript": "tsc --noEmit",
28
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
29
+ "prepare": "bob build",
30
+ "release": "release-it",
31
+ "example": "set NODE_OPTIONS=--openssl-legacy-provider && yarn --cwd example",
32
+ "pods": "cd example && pod-install --quiet",
33
+ "bootstrap": "yarn example && yarn && yarn pods"
34
+ },
35
+ "keywords": [
36
+ "react-native",
37
+ "ios",
38
+ "android"
39
+ ],
40
+ "repository": "https://github.com/functionland/react-native-fula",
41
+ "author": "Ehsan Shariati <ehsan6sha@gmail.com> (https://github.com/ehsan6sha)",
42
+ "license": "MIT",
43
+ "bugs": {
44
+ "url": "https://github.com/functionland/react-native-fula/issues"
45
+ },
46
+ "homepage": "https://github.com/functionland/react-native-fula#readme",
47
+ "publishConfig": {
48
+ "registry": "https://registry.npmjs.org"
49
+ },
50
+ "devDependencies": {
51
+ "@babel/plugin-proposal-export-namespace-from": "^7.16.7",
52
+ "@commitlint/config-conventional": "^11.0.0",
53
+ "@react-native-community/eslint-config": "^2.0.0",
54
+ "@release-it/conventional-changelog": "^2.0.0",
55
+ "@types/jest": "^26.0.0",
56
+ "@types/react": "^16.9.19",
57
+ "@types/react-native": "0.70.8",
58
+ "commitlint": "^11.0.0",
59
+ "eslint": "^7.2.0",
60
+ "eslint-config-prettier": "^7.0.0",
61
+ "eslint-plugin-prettier": "^3.1.3",
62
+ "husky": "^6.0.0",
63
+ "jest": "^26.0.1",
64
+ "pod-install": "^0.1.0",
65
+ "prettier": "^2.0.5",
66
+ "react": "^18.1.0",
67
+ "react-native": "0.70.6",
68
+ "react-native-builder-bob": "^0.18.0",
69
+ "release-it": "^14.2.2",
70
+ "typescript": "^4.1.3"
71
+ },
72
+ "peerDependencies": {
73
+ "react": "*",
74
+ "react-native": "*"
75
+ },
76
+ "jest": {
77
+ "preset": "react-native",
78
+ "modulePathIgnorePatterns": [
79
+ "<rootDir>/example/node_modules",
80
+ "<rootDir>/lib/"
81
+ ]
82
+ },
83
+ "commitlint": {
84
+ "extends": [
85
+ "@commitlint/config-conventional"
86
+ ]
87
+ },
88
+ "release-it": {
89
+ "git": {
90
+ "commitMessage": "chore: release ${version}",
91
+ "tagName": "v${version}"
92
+ },
93
+ "npm": {
94
+ "publish": true
95
+ },
96
+ "github": {
97
+ "release": true
98
+ },
99
+ "plugins": {
100
+ "@release-it/conventional-changelog": {
101
+ "preset": "angular"
102
+ }
103
+ }
104
+ },
105
+ "eslintConfig": {
106
+ "root": true,
107
+ "extends": [
108
+ "@react-native-community",
109
+ "prettier"
110
+ ],
111
+ "rules": {
112
+ "prettier/prettier": [
113
+ "error",
114
+ {
115
+ "quoteProps": "consistent",
116
+ "singleQuote": true,
117
+ "tabWidth": 2,
118
+ "trailingComma": "es5",
119
+ "useTabs": false
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ "eslintIgnore": [
125
+ "node_modules/",
126
+ "lib/"
127
+ ],
128
+ "prettier": {
129
+ "quoteProps": "consistent",
130
+ "singleQuote": true,
131
+ "tabWidth": 2,
132
+ "trailingComma": "es5",
133
+ "useTabs": false
134
+ },
135
+ "react-native-builder-bob": {
136
+ "source": "src",
137
+ "output": "lib",
138
+ "targets": [
139
+ "commonjs",
140
+ "module",
141
+ [
142
+ "typescript",
143
+ {
144
+ "project": "tsconfig.build.json"
145
+ }
146
+ ]
147
+ ]
148
+ }
149
+ }
@@ -1,19 +1,19 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "react-native-fula"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.homepage = package["homepage"]
10
- s.license = package["license"]
11
- s.authors = package["author"]
12
-
13
- s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/functionland/react-native-fula.git", :tag => "#{s.version}" }
15
-
16
- s.source_files = "ios/**/*.{h,m,mm}"
17
- s.dependency "React-Core"
18
- s.dependency 'Mobile','~> 0.0.3'
19
- end
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-fula"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => "10.0" }
14
+ s.source = { :git => "https://github.com/functionland/react-native-fula.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm}"
17
+ s.dependency "React-Core"
18
+ s.dependency 'Mobile','~> 0.0.3'
19
+ end