@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.
- package/.eslintrc.js +8 -0
- package/.releaserc +23 -0
- package/ARCHITECTURE.md +67 -0
- package/CHANGELOG.md +42 -0
- package/CONTRIBUTING.md +82 -0
- package/LICENSE +201 -0
- package/README.md +135 -4
- package/android/build.gradle +86 -0
- package/android/libs/dP256Android-release.aar +0 -0
- package/android/src/main/AndroidManifest.xml +37 -0
- package/android/src/main/java/co/algorand/passkeyautofill/CreatePasskeyActivity.kt +318 -0
- package/android/src/main/java/co/algorand/passkeyautofill/GetPasskeyActivity.kt +327 -0
- package/android/src/main/java/co/algorand/passkeyautofill/ReactNativePasskeyAutofillModule.kt +84 -0
- package/android/src/main/java/co/algorand/passkeyautofill/credentials/Credential.kt +11 -0
- package/android/src/main/java/co/algorand/passkeyautofill/credentials/CredentialRepository.kt +506 -0
- package/android/src/main/java/co/algorand/passkeyautofill/service/PasskeyAutofillCredentialProviderService.kt +248 -0
- package/android/src/main/java/co/algorand/passkeyautofill/utils/PasskeyUtils.kt +7 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +10 -0
- package/android/src/main/res/xml/provider.xml +5 -0
- package/app.plugin.js +249 -0
- package/assets/banner.png +0 -0
- package/build/ReactNativePasskeyAutofill.types.d.ts +9 -0
- package/build/ReactNativePasskeyAutofill.types.d.ts.map +1 -0
- package/build/ReactNativePasskeyAutofill.types.js +2 -0
- package/build/ReactNativePasskeyAutofill.types.js.map +1 -0
- package/build/ReactNativePasskeyAutofillModule.d.ts +12 -0
- package/build/ReactNativePasskeyAutofillModule.d.ts.map +1 -0
- package/build/ReactNativePasskeyAutofillModule.js +4 -0
- package/build/ReactNativePasskeyAutofillModule.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -0
- package/expo-module.config.json +10 -0
- package/ios/ReactNativePasskeyAutofill.podspec +29 -0
- package/ios/ReactNativePasskeyAutofillModule.swift +49 -0
- package/ios/ReactNativePasskeyAutofillView.swift +38 -0
- package/lefthook.yml +13 -0
- package/package.json +64 -8
- package/src/ReactNativePasskeyAutofill.types.ts +4 -0
- package/src/ReactNativePasskeyAutofillModule.ts +14 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +9 -0
- 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
package/package.json
CHANGED
|
@@ -1,13 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algorandfoundation/react-native-passkey-autofill",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
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
|
-
"
|
|
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
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"expo": "*",
|
|
66
|
+
"react": "*",
|
|
67
|
+
"react-native": "*"
|
|
68
|
+
}
|
|
13
69
|
}
|
|
@@ -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
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = function () { return 'react-native-passkey-autofill placeholder'; };
|