@algorandfoundation/react-native-passkey-autofill 0.0.1 → 1.0.0-canary.10

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 (45) hide show
  1. package/.eslintrc.js +8 -0
  2. package/.releaserc +23 -0
  3. package/ARCHITECTURE.md +67 -0
  4. package/CHANGELOG.md +42 -0
  5. package/CONTRIBUTING.md +82 -0
  6. package/LICENSE +201 -0
  7. package/README.md +135 -4
  8. package/android/build.gradle +86 -0
  9. package/android/libs/dP256Android-release.aar +0 -0
  10. package/android/src/main/AndroidManifest.xml +37 -0
  11. package/android/src/main/java/co/algorand/passkeyautofill/CreatePasskeyActivity.kt +318 -0
  12. package/android/src/main/java/co/algorand/passkeyautofill/GetPasskeyActivity.kt +327 -0
  13. package/android/src/main/java/co/algorand/passkeyautofill/ReactNativePasskeyAutofillModule.kt +84 -0
  14. package/android/src/main/java/co/algorand/passkeyautofill/credentials/Credential.kt +11 -0
  15. package/android/src/main/java/co/algorand/passkeyautofill/credentials/CredentialRepository.kt +506 -0
  16. package/android/src/main/java/co/algorand/passkeyautofill/service/PasskeyAutofillCredentialProviderService.kt +248 -0
  17. package/android/src/main/java/co/algorand/passkeyautofill/utils/PasskeyUtils.kt +7 -0
  18. package/android/src/main/res/values/strings.xml +3 -0
  19. package/android/src/main/res/values/styles.xml +10 -0
  20. package/android/src/main/res/xml/provider.xml +5 -0
  21. package/app.plugin.js +249 -0
  22. package/assets/banner.png +0 -0
  23. package/build/ReactNativePasskeyAutofill.types.d.ts +9 -0
  24. package/build/ReactNativePasskeyAutofill.types.d.ts.map +1 -0
  25. package/build/ReactNativePasskeyAutofill.types.js +2 -0
  26. package/build/ReactNativePasskeyAutofill.types.js.map +1 -0
  27. package/build/ReactNativePasskeyAutofillModule.d.ts +12 -0
  28. package/build/ReactNativePasskeyAutofillModule.d.ts.map +1 -0
  29. package/build/ReactNativePasskeyAutofillModule.js +4 -0
  30. package/build/ReactNativePasskeyAutofillModule.js.map +1 -0
  31. package/build/index.d.ts +3 -0
  32. package/build/index.d.ts.map +1 -0
  33. package/build/index.js +5 -0
  34. package/build/index.js.map +1 -0
  35. package/expo-module.config.json +10 -0
  36. package/ios/ReactNativePasskeyAutofill.podspec +29 -0
  37. package/ios/ReactNativePasskeyAutofillModule.swift +49 -0
  38. package/ios/ReactNativePasskeyAutofillView.swift +38 -0
  39. package/lefthook.yml +13 -0
  40. package/package.json +64 -8
  41. package/src/ReactNativePasskeyAutofill.types.ts +4 -0
  42. package/src/ReactNativePasskeyAutofillModule.ts +14 -0
  43. package/src/index.ts +4 -0
  44. package/tsconfig.json +9 -0
  45. package/index.js +0 -1
@@ -0,0 +1,49 @@
1
+ import ExpoModulesCore
2
+
3
+ public class ReactNativePasskeyAutofillModule: Module {
4
+ // Each module class must implement the definition function. The definition consists of components
5
+ // that describes the module's functionality and behavior.
6
+ // See https://docs.expo.dev/modules/module-api for more details about available components.
7
+ public func definition() -> ModuleDefinition {
8
+ // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
9
+ // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
10
+ // The module will be accessible from `requireNativeModule('ReactNativePasskeyAutofill')` in JavaScript.
11
+ Name("ReactNativePasskeyAutofill")
12
+
13
+ Events("onPasskeyAdded", "onPasskeyAuthenticated")
14
+
15
+ AsyncFunction("setMasterKey") { (secret: String) in
16
+ // TODO: Implement for iOS
17
+ }
18
+
19
+ AsyncFunction("setHdRootKeyId") { (id: String) in
20
+ // TODO: Implement for iOS
21
+ }
22
+
23
+ AsyncFunction("getHdRootKeyId") { () -> String? in
24
+ // TODO: Implement for iOS
25
+ return nil
26
+ }
27
+
28
+ AsyncFunction("clearCredentials") {
29
+ // TODO: Implement for iOS
30
+ }
31
+
32
+ AsyncFunction("configureIntentActions") { (getPasskeyAction: String, createPasskeyAction: String) in
33
+ // TODO: Implement for iOS
34
+ }
35
+
36
+ // Enables the module to be used as a native view. Definition components that are accepted as part of the
37
+ // view definition: Prop, Events.
38
+ View(ReactNativePasskeyAutofillView.self) {
39
+ // Defines a setter for the `url` prop.
40
+ Prop("url") { (view: ReactNativePasskeyAutofillView, url: URL) in
41
+ if view.webView.url != url {
42
+ view.webView.load(URLRequest(url: url))
43
+ }
44
+ }
45
+
46
+ Events("onLoad")
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,38 @@
1
+ import ExpoModulesCore
2
+ import WebKit
3
+
4
+ // This view will be used as a native component. Make sure to inherit from `ExpoView`
5
+ // to apply the proper styling (e.g. border radius and shadows).
6
+ class ReactNativePasskeyAutofillView: ExpoView {
7
+ let webView = WKWebView()
8
+ let onLoad = EventDispatcher()
9
+ var delegate: WebViewDelegate?
10
+
11
+ required init(appContext: AppContext? = nil) {
12
+ super.init(appContext: appContext)
13
+ clipsToBounds = true
14
+ delegate = WebViewDelegate { url in
15
+ self.onLoad(["url": url])
16
+ }
17
+ webView.navigationDelegate = delegate
18
+ addSubview(webView)
19
+ }
20
+
21
+ override func layoutSubviews() {
22
+ webView.frame = bounds
23
+ }
24
+ }
25
+
26
+ class WebViewDelegate: NSObject, WKNavigationDelegate {
27
+ let onUrlChange: (String) -> Void
28
+
29
+ init(onUrlChange: @escaping (String) -> Void) {
30
+ self.onUrlChange = onUrlChange
31
+ }
32
+
33
+ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) {
34
+ if let url = webView.url {
35
+ onUrlChange(url.absoluteString)
36
+ }
37
+ }
38
+ }
package/lefthook.yml ADDED
@@ -0,0 +1,13 @@
1
+ # Lefthook configuration
2
+ # Refer to https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
3
+
4
+ pre-commit:
5
+ commands:
6
+ lint:
7
+ run: npm run lint
8
+
9
+ pre-push:
10
+ parallel: true
11
+ commands:
12
+ test:
13
+ run: npm run test:all
package/package.json CHANGED
@@ -1,13 +1,69 @@
1
1
  {
2
2
  "name": "@algorandfoundation/react-native-passkey-autofill",
3
- "version": "0.0.1",
4
- "description": "react-native-passkey-autofill for Algorand",
5
- "main": "index.js",
3
+ "version": "1.0.0-canary.10",
4
+ "description": "Passkey AutoFill React Native",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "provenance": true
10
+ },
6
11
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
12
+ "build": "expo-module build",
13
+ "clean": "expo-module clean",
14
+ "lint": "ESLINT_USE_FLAT_CONFIG=false expo-module lint",
15
+ "test": "CI=true expo-module test",
16
+ "test:android": "cd example/android && ./gradlew :algorandfoundation-react-native-passkey-autofill:testDebugUnitTest --no-daemon",
17
+ "test:android:instrumented": "cd example/android && ./gradlew :algorandfoundation-react-native-passkey-autofill:connectedDebugAndroidTest --no-daemon",
18
+ "test:all": "npm run test && npm run test:android",
19
+ "prepare": "expo-module prepare",
20
+ "prepublishOnly": "expo-module prepublishOnly",
21
+ "expo-module": "expo-module",
22
+ "open:ios": "xed example/ios",
23
+ "open:android": "open -a \"Android Studio\" example/android"
24
+ },
25
+ "keywords": [
26
+ "react-native",
27
+ "expo",
28
+ "@algorandfoundation/react-native-passkey-autofill",
29
+ "ReactNativePasskeyAutofill"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+ssh://git@github.com/algorandfoundation/react-native-passkey-autofill.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/algorandfoundation/react-native-passkey-autofill/issues"
37
+ },
38
+ "author": "Algorand Foundation",
39
+ "license": "Apache-2.0",
40
+ "homepage": "https://github.com/algorandfoundation/react-native-passkey-autofill#readme",
41
+ "dependencies": {
42
+ "@algorandfoundation/react-native-keystore": "^1.0.0-canary.6"
43
+ },
44
+ "jest": {
45
+ "preset": "ts-jest",
46
+ "testEnvironment": "node",
47
+ "testMatch": [
48
+ "<rootDir>/src/**/__tests__/**/*.test.ts"
49
+ ]
50
+ },
51
+ "devDependencies": {
52
+ "@expo/config-plugins": "^9.0.0",
53
+ "@semantic-release/changelog": "^6.0.3",
54
+ "@semantic-release/git": "^10.0.1",
55
+ "@semantic-release/github": "^12.0.6",
56
+ "@semantic-release/npm": "^13.1.5",
57
+ "@types/react": "~19.1.1",
58
+ "expo": "^55.0.1",
59
+ "expo-module-scripts": "^55.0.2",
60
+ "lefthook": "^2.1.4",
61
+ "react-native": "0.82.1",
62
+ "semantic-release": "^25.0.3"
8
63
  },
9
- "keywords": [],
10
- "author": "",
11
- "license": "MIT",
12
- "type": "commonjs"
64
+ "peerDependencies": {
65
+ "expo": "*",
66
+ "react": "*",
67
+ "react-native": "*"
68
+ }
13
69
  }
@@ -0,0 +1,4 @@
1
+ export type ReactNativePasskeyAutofillModuleEvents = {
2
+ onPasskeyAdded: (event: { success: boolean }) => void;
3
+ onPasskeyAuthenticated: (event: { success: boolean }) => void;
4
+ };
@@ -0,0 +1,14 @@
1
+ import { NativeModule, requireNativeModule } from 'expo';
2
+
3
+ import { ReactNativePasskeyAutofillModuleEvents } from './ReactNativePasskeyAutofill.types';
4
+
5
+ declare class ReactNativePasskeyAutofillModule extends NativeModule<ReactNativePasskeyAutofillModuleEvents> {
6
+ setMasterKey(secret: string): Promise<void>;
7
+ setHdRootKeyId(id: string): Promise<void>;
8
+ getHdRootKeyId(): Promise<string | null>;
9
+ configureIntentActions(getPasskeyAction: string, createPasskeyAction: string): Promise<void>;
10
+ clearCredentials(): Promise<void>;
11
+ }
12
+
13
+ // This call loads the native module object from the JSI.
14
+ export default requireNativeModule<ReactNativePasskeyAutofillModule>('ReactNativePasskeyAutofill');
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Reexport the native module. On web, it will be resolved to ReactNativePasskeyAutofillModule.web.ts
2
+ // and on native platforms to ReactNativePasskeyAutofillModule.ts
3
+ export { default } from './ReactNativePasskeyAutofillModule';
4
+ export * from './ReactNativePasskeyAutofill.types';
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ // @generated by expo-module-scripts
2
+ {
3
+ "extends": "expo-module-scripts/tsconfig.base",
4
+ "compilerOptions": {
5
+ "outDir": "./build"
6
+ },
7
+ "include": ["./src"],
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__rsc_tests__/*"]
9
+ }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = function () { return 'react-native-passkey-autofill placeholder'; };