@synonymdev/react-native-pubky 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/README.md +34 -11
  2. package/android/build.gradle +3 -2
  3. package/android/src/main/java/com/pubky/PubkyModule.kt +32 -18
  4. package/android/src/main/java/uniffi/{mobile/mobile.kt → pubkymobile/pubkymobile.kt} +77 -77
  5. package/android/src/main/jniLibs/arm64-v8a/{libmobile.so → libpubkymobile.so} +0 -0
  6. package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
  7. package/android/src/main/jniLibs/x86/{libmobile.so → libpubkymobile.so} +0 -0
  8. package/android/src/main/jniLibs/x86_64/{libmobile.so → libpubkymobile.so} +0 -0
  9. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/Info.plist +8 -8
  10. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/Headers/mobileFFI.h +0 -6
  11. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/Headers/module.modulemap +2 -2
  12. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +193 -0
  13. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64/libmobile.a +0 -0
  14. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
  15. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64-simulator/Headers/mobileFFI.h +0 -6
  16. package/ios/Frameworks/{Mobile.xcframework → PubkyMobile.xcframework}/ios-arm64-simulator/Headers/module.modulemap +2 -2
  17. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +193 -0
  18. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libmobile.a +0 -0
  19. package/ios/Frameworks/{Mobile.xcframework/ios-arm64-simulator/libmobile.a → PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a} +0 -0
  20. package/ios/Pubky.mm +3 -0
  21. package/ios/Pubky.swift +22 -11
  22. package/ios/{mobile.swift → pubkymobile.swift} +15 -14
  23. package/lib/commonjs/index.js +13 -0
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/module/index.js +12 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/typescript/commonjs/src/index.d.ts +11 -0
  28. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  29. package/lib/typescript/module/src/index.d.ts +11 -0
  30. package/lib/typescript/module/src/index.d.ts.map +1 -1
  31. package/package.json +10 -8
  32. package/react-native-pubky.podspec +2 -2
  33. package/src/index.tsx +26 -0
  34. package/android/src/main/java/com/pubky/pubky.iml +0 -11
  35. package/android/src/main/jniLibs/armeabi-v7a/libmobile.so +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synonymdev/react-native-pubky",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "React Native Implementation of Pubky",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -37,18 +37,20 @@
37
37
  "!**/.*"
38
38
  ],
39
39
  "scripts": {
40
- "example": "yarn workspace react-native-pubky-example",
41
40
  "test": "jest",
42
41
  "typecheck": "tsc",
43
42
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
44
43
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
45
44
  "prepare": "bob build",
46
45
  "release": "release-it",
47
- "reinstall": "npm i && npm run clean && npm run prepare",
48
- "cargo-build": "cd rust && cargo build --release && cd pubky && cargo build --release && cd pubky && cargo build --release && cd ../ && cd pubky-common && cargo build --release && cd ../ && cd pubky-homeserver && cargo build --release && cd ../../../",
46
+ "example:ios": "cd example && cd ios && rm -rf Pods && cd ../ && npm i && bundle install && npm run build:ios && npm run ios",
47
+ "example:android": "cd example && npm i && npm run build:android && npm run android",
48
+ "reinstall": "yarn install && npm run clean && npm run prepare",
49
+ "cargo-build": "cd rust && cargo build && cd pubky && cargo build && cd pubky && cargo build && cd ../ && cd pubky-common && cargo build && cd ../ && cd pubky-homeserver && cargo build && cd ../../../",
49
50
  "update-bindings:ios": "npm run cargo-build && node setup-ios-bindings.js && npm run reinstall",
50
51
  "update-bindings:android": "npm run cargo-build && node setup-android-bindings.js && npm run reinstall",
51
- "update-bindings": "npm run cargo-build && npm run update-bindings:ios && npm run update-bindings:android"
52
+ "update-bindings": "npm run reinstall && npm run cargo-build && npm run update-bindings:ios && npm run update-bindings:android",
53
+ "rebuild": "rm -rf node_modules && cd example && rm -rf node_modules && cd ios && rm -rf Pods Podfile.lock build && cd ../../ && npm run cargo-build && yarn install && npm run update-bindings && cd example && yarn install && bundle install && cd ios && pod install && cd ../ && yarn build:ios && yarn ios"
52
54
  },
53
55
  "keywords": [
54
56
  "pubky",
@@ -58,7 +60,7 @@
58
60
  ],
59
61
  "repository": {
60
62
  "type": "git",
61
- "url": "git+https://https://github.com/pubky/react-native-pubky.git"
63
+ "url": "git+https://github.com/pubky/react-native-pubky.git"
62
64
  },
63
65
  "author": "coreyphillips <corey@synonym.to> (https://github.com/coreyphillips)",
64
66
  "license": "MIT",
@@ -88,7 +90,7 @@
88
90
  "jest": "^29.7.0",
89
91
  "prettier": "^3.0.3",
90
92
  "react": "18.3.1",
91
- "react-native": "0.75.2",
93
+ "react-native": "0.75.3",
92
94
  "react-native-builder-bob": "^0.30.2",
93
95
  "release-it": "^15.0.0",
94
96
  "turbo": "^1.10.7",
@@ -193,6 +195,6 @@
193
195
  "create-react-native-library": {
194
196
  "type": "module-legacy",
195
197
  "languages": "kotlin-swift",
196
- "version": "0.41.1"
198
+ "version": "0.41.2"
197
199
  }
198
200
  }
@@ -15,11 +15,11 @@ Pod::Spec.new do |s|
15
15
 
16
16
  s.platforms = { :ios => min_ios_version_supported }
17
17
  s.ios.deployment_target = min_ios_version_supported
18
- s.source = { :git => "https://github.com/coreyphillips/react-native-pubky.git", :tag => "#{s.version}" }
18
+ s.source = { :git => "https://github.com/pubky/react-native-pubky.git", :tag => "#{s.version}" }
19
19
 
20
20
  s.source_files = "ios/**/*.{h,m,mm,swift}"
21
21
  s.ios.source_files = "ios/**/*.{h,m,mm,swift}"
22
- s.ios.vendored_frameworks = "ios/Frameworks/Mobile.xcframework"
22
+ s.ios.vendored_frameworks = "ios/Frameworks/PubkyMobile.xcframework"
23
23
 
24
24
  s.pod_target_xcconfig = {
25
25
  "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "x86_64"
package/src/index.tsx CHANGED
@@ -28,3 +28,29 @@ export async function auth(
28
28
  }
29
29
  return ok(res[1]);
30
30
  }
31
+
32
+ type Capability = {
33
+ path: string;
34
+ permission: string;
35
+ };
36
+
37
+ type PubkyAuthDetails = {
38
+ relay: string;
39
+ capabilities: Capability[];
40
+ secret: string;
41
+ };
42
+
43
+ export async function parseAuthUrl(
44
+ url: string
45
+ ): Promise<Result<PubkyAuthDetails>> {
46
+ try {
47
+ const res = await Pubky.parseAuthUrl(url);
48
+ if (res[0] === 'error') {
49
+ return err(res[1]);
50
+ }
51
+ const parsed = JSON.parse(res[1]);
52
+ return ok(parsed);
53
+ } catch (e) {
54
+ return err(JSON.stringify(e));
55
+ }
56
+ }
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$">
6
- <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" packagePrefix="com.pubky" />
7
- </content>
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- </component>
11
- </module>