diff --git a/.gitignore b/.gitignore index 4ca989923cd..feb3ede744a 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,7 @@ xcuserdata/ !*.xcworkspace/contents.xcworkspacedata /*.gcno **/xcshareddata/WorkspaceSettings.xcsettings -**/.xcode.env.local +*.xcode.env.local ### Coverage ### coverage/ @@ -65,7 +65,12 @@ coverage-ts/ **/example/ios/Podfile.lock **/example/.bundle **/example/yarn.lock +**/example/amplify_outputs.json # rollup **/.rollup.cache **/buildMeta + +# ruby +vendor/ +Gemfile.lock diff --git a/eslint.config.mjs b/eslint.config.mjs index 827e92ef627..7ca71b5e131 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -301,6 +301,7 @@ export default [ '**/__tests__/**', '**/packages/adapter-nextjs/**', '**/packages/react-native/example/**', + '**/packages/rtn-passkeys/example/**', ], rules: { 'import/no-extraneous-dependencies': 'error', diff --git a/package.json b/package.json index 9b197d5a624..281760b33dc 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,8 @@ "packages/rtn-web-browser", "packages/react-native", "packages/react-native/example", + "packages/rtn-passkeys", + "packages/rtn-passkeys/example", "scripts/tsc-compliance-test" ], "nohoist": [ diff --git a/packages/rtn-passkeys/AmplifyRtnPasskeys.podspec b/packages/rtn-passkeys/AmplifyRtnPasskeys.podspec new file mode 100644 index 00000000000..cc258b74e63 --- /dev/null +++ b/packages/rtn-passkeys/AmplifyRtnPasskeys.podspec @@ -0,0 +1,30 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' + +Pod::Spec.new do |s| + s.name = "AmplifyRtnPasskeys" + s.version = package["version"] + s.summary = package["description"] + s.homepage = package["homepage"] + s.license = package["license"] + s.authors = package["author"] + + s.platforms = { :ios => '15.1' } + s.source = { :git => "https://github.com/aws-amplify/amplify-js.git", :tag => "#{s.version}" } + + s.source_files = "ios/**/*.{h,m,mm,cpp,swift}" + s.exclude_files = [ 'ios/tests' ] + s.private_header_files = "ios/generated/**/*.h" + + install_modules_dependencies(s) + + s.test_spec 'tests' do |test_spec| + test_spec.source_files = 'ios/tests/*.swift' + test_spec.frameworks ='XCTest' + end +end diff --git a/packages/rtn-passkeys/android/build.gradle b/packages/rtn-passkeys/android/build.gradle new file mode 100644 index 00000000000..35ed70ae2e3 --- /dev/null +++ b/packages/rtn-passkeys/android/build.gradle @@ -0,0 +1,92 @@ +buildscript { + ext.getExtOrDefault = { name -> + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['AmplifyRtnPasskeys_' + name] + } + + repositories { + google() + mavenCentral() + } + + dependencies { + classpath "com.android.tools.build:gradle:8.7.3" + // noinspection DifferentKotlinGradleVersion + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}" + } +} + + +apply plugin: "com.android.library" +apply plugin: "kotlin-android" +apply plugin: "com.facebook.react" + +def getExtOrIntegerDefault(name) { + return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["AmplifyRtnPasskeys_" + name]).toInteger() +} + + +android { + namespace "com.amazonaws.amplify.rtnpasskeys" + + compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") + + defaultConfig { + minSdkVersion getExtOrIntegerDefault("minSdkVersion") + targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") + } + + buildFeatures { + buildConfig true + } + + buildTypes { + release { + minifyEnabled false + } + } + + lintOptions { + disable "GradleCompatible" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + sourceSets { + main { + java.srcDirs += [ + "generated/java", + "generated/jni" + ] + } + } +} + +repositories { + mavenCentral() + google() +} + +def kotlin_version = getExtOrDefault("kotlinVersion") + +dependencies { + implementation "com.facebook.react:react-android" + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + implementation "androidx.credentials:credentials:1.5.0" + implementation "androidx.credentials:credentials-play-services-auth:1.5.0" + + testImplementation "junit:junit:4.13.2" + testImplementation "org.robolectric:robolectric:4.14.1" + testImplementation "io.mockk:mockk:1.14.2" + testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2" + testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2" +} + +react { + jsRootDir = file("../src/") + libraryName = "AmplifyRtnPasskeys" + codegenJavaPackageName = "com.amazonaws.amplify.rtnpasskeys" +} diff --git a/packages/rtn-passkeys/android/generated/java/com/facebook/fbreact/specs/NativeAmplifyRtnPasskeysSpec.java b/packages/rtn-passkeys/android/generated/java/com/facebook/fbreact/specs/NativeAmplifyRtnPasskeysSpec.java new file mode 100644 index 00000000000..90751f879c9 --- /dev/null +++ b/packages/rtn-passkeys/android/generated/java/com/facebook/fbreact/specs/NativeAmplifyRtnPasskeysSpec.java @@ -0,0 +1,47 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs; + +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; +import javax.annotation.Nonnull; + +public abstract class NativeAmplifyRtnPasskeysSpec extends ReactContextBaseJavaModule implements TurboModule { + public static final String NAME = "AmplifyRtnPasskeys"; + + public NativeAmplifyRtnPasskeysSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public @Nonnull String getName() { + return NAME; + } + + @ReactMethod(isBlockingSynchronousMethod = true) + @DoNotStrip + public abstract boolean getIsPasskeySupported(); + + @ReactMethod + @DoNotStrip + public abstract void createPasskey(ReadableMap input, Promise promise); + + @ReactMethod + @DoNotStrip + public abstract void getPasskey(ReadableMap input, Promise promise); +} diff --git a/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec-generated.cpp b/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec-generated.cpp new file mode 100644 index 00000000000..ed9813e0395 --- /dev/null +++ b/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec-generated.cpp @@ -0,0 +1,44 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniCpp.js + */ + +#include "AmplifyRtnPasskeysSpec.h" + +namespace facebook::react { + +static facebook::jsi::Value __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_getIsPasskeySupported(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, BooleanKind, "getIsPasskeySupported", "()Z", args, count, cachedMethodId); +} + +static facebook::jsi::Value __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_createPasskey(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, "createPasskey", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId); +} + +static facebook::jsi::Value __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_getPasskey(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, "getPasskey", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId); +} + +NativeAmplifyRtnPasskeysSpecJSI::NativeAmplifyRtnPasskeysSpecJSI(const JavaTurboModule::InitParams ¶ms) + : JavaTurboModule(params) { + methodMap_["getIsPasskeySupported"] = MethodMetadata {0, __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_getIsPasskeySupported}; + methodMap_["createPasskey"] = MethodMetadata {1, __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_createPasskey}; + methodMap_["getPasskey"] = MethodMetadata {1, __hostFunction_NativeAmplifyRtnPasskeysSpecJSI_getPasskey}; +} + +std::shared_ptr AmplifyRtnPasskeysSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { + if (moduleName == "AmplifyRtnPasskeys") { + return std::make_shared(params); + } + return nullptr; +} + +} // namespace facebook::react diff --git a/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec.h b/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec.h new file mode 100644 index 00000000000..c8d2646a0e2 --- /dev/null +++ b/packages/rtn-passkeys/android/generated/jni/AmplifyRtnPasskeysSpec.h @@ -0,0 +1,31 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook::react { + +/** + * JNI C++ class for module 'NativeAmplifyRtnPasskeys' + */ +class JSI_EXPORT NativeAmplifyRtnPasskeysSpecJSI : public JavaTurboModule { +public: + NativeAmplifyRtnPasskeysSpecJSI(const JavaTurboModule::InitParams ¶ms); +}; + + +JSI_EXPORT +std::shared_ptr AmplifyRtnPasskeysSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); + +} // namespace facebook::react diff --git a/packages/rtn-passkeys/android/generated/jni/CMakeLists.txt b/packages/rtn-passkeys/android/generated/jni/CMakeLists.txt new file mode 100644 index 00000000000..7472ab3341a --- /dev/null +++ b/packages/rtn-passkeys/android/generated/jni/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/AmplifyRtnPasskeysSpec/*.cpp) + +add_library( + react_codegen_AmplifyRtnPasskeysSpec + OBJECT + ${react_codegen_SRCS} +) + +target_include_directories(react_codegen_AmplifyRtnPasskeysSpec PUBLIC . react/renderer/components/AmplifyRtnPasskeysSpec) + +target_link_libraries( + react_codegen_AmplifyRtnPasskeysSpec + fbjni + jsi + # We need to link different libraries based on whether we are building rncore or not, that's necessary + # because we want to break a circular dependency between react_codegen_rncore and reactnative + reactnative +) + +target_compile_options( + react_codegen_AmplifyRtnPasskeysSpec + PRIVATE + -DLOG_TAG=\"ReactNative\" + -fexceptions + -frtti + -std=c++20 + -Wall +) diff --git a/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI-generated.cpp b/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI-generated.cpp new file mode 100644 index 00000000000..9de6d33592d --- /dev/null +++ b/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI-generated.cpp @@ -0,0 +1,40 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleCpp.js + */ + +#include "AmplifyRtnPasskeysSpecJSI.h" + +namespace facebook::react { + +static jsi::Value __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_getIsPasskeySupported(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->getIsPasskeySupported( + rt + ); +} +static jsi::Value __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_createPasskey(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->createPasskey( + rt, + count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt) + ); +} +static jsi::Value __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_getPasskey(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->getPasskey( + rt, + count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt) + ); +} + +NativeAmplifyRtnPasskeysCxxSpecJSI::NativeAmplifyRtnPasskeysCxxSpecJSI(std::shared_ptr jsInvoker) + : TurboModule("AmplifyRtnPasskeys", jsInvoker) { + methodMap_["getIsPasskeySupported"] = MethodMetadata {0, __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_getIsPasskeySupported}; + methodMap_["createPasskey"] = MethodMetadata {1, __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_createPasskey}; + methodMap_["getPasskey"] = MethodMetadata {1, __hostFunction_NativeAmplifyRtnPasskeysCxxSpecJSI_getPasskey}; +} + + +} // namespace facebook::react diff --git a/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI.h b/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI.h new file mode 100644 index 00000000000..64b5ecc4690 --- /dev/null +++ b/packages/rtn-passkeys/android/generated/jni/react/renderer/components/AmplifyRtnPasskeysSpec/AmplifyRtnPasskeysSpecJSI.h @@ -0,0 +1,534 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include +#include + +namespace facebook::react { + + + +#pragma mark - NativeAmplifyRtnPasskeysPasskeyCreateOptionsJson + +template +struct NativeAmplifyRtnPasskeysPasskeyCreateOptionsJson { + P0 challenge; + P1 rp; + P2 user; + P3 excludeCredentials; + bool operator==(const NativeAmplifyRtnPasskeysPasskeyCreateOptionsJson &other) const { + return challenge == other.challenge && rp == other.rp && user == other.user && excludeCredentials == other.excludeCredentials; + } +}; + +template +struct NativeAmplifyRtnPasskeysPasskeyCreateOptionsJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "challenge"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "rp"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "user"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "excludeCredentials"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String challengeToJs(jsi::Runtime &rt, decltype(types.challenge) value) { + return bridging::toJs(rt, value); + } + + static jsi::Object rpToJs(jsi::Runtime &rt, decltype(types.rp) value) { + return bridging::toJs(rt, value); + } + + static jsi::Object userToJs(jsi::Runtime &rt, decltype(types.user) value) { + return bridging::toJs(rt, value); + } + + static jsi::Array excludeCredentialsToJs(jsi::Runtime &rt, decltype(types.excludeCredentials) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "challenge", bridging::toJs(rt, value.challenge, jsInvoker)); + result.setProperty(rt, "rp", bridging::toJs(rt, value.rp, jsInvoker)); + result.setProperty(rt, "user", bridging::toJs(rt, value.user, jsInvoker)); + if (value.excludeCredentials) { + result.setProperty(rt, "excludeCredentials", bridging::toJs(rt, value.excludeCredentials.value(), jsInvoker)); + } + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPasskeyCreateResultJson + +template +struct NativeAmplifyRtnPasskeysPasskeyCreateResultJson { + P0 id; + P1 rawId; + P2 type; + P3 authenticatorAttachment; + P4 response; + bool operator==(const NativeAmplifyRtnPasskeysPasskeyCreateResultJson &other) const { + return id == other.id && rawId == other.rawId && type == other.type && authenticatorAttachment == other.authenticatorAttachment && response == other.response; + } +}; + +template +struct NativeAmplifyRtnPasskeysPasskeyCreateResultJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "id"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "rawId"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "type"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "authenticatorAttachment"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "response"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) { + return bridging::toJs(rt, value); + } + + static jsi::String rawIdToJs(jsi::Runtime &rt, decltype(types.rawId) value) { + return bridging::toJs(rt, value); + } + + static jsi::String typeToJs(jsi::Runtime &rt, decltype(types.type) value) { + return bridging::toJs(rt, value); + } + + static jsi::String authenticatorAttachmentToJs(jsi::Runtime &rt, decltype(types.authenticatorAttachment) value) { + return bridging::toJs(rt, value); + } + + static jsi::Object responseToJs(jsi::Runtime &rt, decltype(types.response) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker)); + result.setProperty(rt, "rawId", bridging::toJs(rt, value.rawId, jsInvoker)); + result.setProperty(rt, "type", bridging::toJs(rt, value.type, jsInvoker)); + if (value.authenticatorAttachment) { + result.setProperty(rt, "authenticatorAttachment", bridging::toJs(rt, value.authenticatorAttachment.value(), jsInvoker)); + } + result.setProperty(rt, "response", bridging::toJs(rt, value.response, jsInvoker)); + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPasskeyGetOptionsJson + +template +struct NativeAmplifyRtnPasskeysPasskeyGetOptionsJson { + P0 challenge; + P1 rpId; + P2 allowCredentials; + P3 userVerification; + bool operator==(const NativeAmplifyRtnPasskeysPasskeyGetOptionsJson &other) const { + return challenge == other.challenge && rpId == other.rpId && allowCredentials == other.allowCredentials && userVerification == other.userVerification; + } +}; + +template +struct NativeAmplifyRtnPasskeysPasskeyGetOptionsJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "challenge"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "rpId"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "allowCredentials"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "userVerification"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String challengeToJs(jsi::Runtime &rt, decltype(types.challenge) value) { + return bridging::toJs(rt, value); + } + + static jsi::String rpIdToJs(jsi::Runtime &rt, decltype(types.rpId) value) { + return bridging::toJs(rt, value); + } + + static jsi::Array allowCredentialsToJs(jsi::Runtime &rt, decltype(types.allowCredentials) value) { + return bridging::toJs(rt, value); + } + + static jsi::String userVerificationToJs(jsi::Runtime &rt, decltype(types.userVerification) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "challenge", bridging::toJs(rt, value.challenge, jsInvoker)); + result.setProperty(rt, "rpId", bridging::toJs(rt, value.rpId, jsInvoker)); + if (value.allowCredentials) { + result.setProperty(rt, "allowCredentials", bridging::toJs(rt, value.allowCredentials.value(), jsInvoker)); + } + result.setProperty(rt, "userVerification", bridging::toJs(rt, value.userVerification, jsInvoker)); + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPasskeyGetResultJson + +template +struct NativeAmplifyRtnPasskeysPasskeyGetResultJson { + P0 id; + P1 rawId; + P2 type; + P3 response; + P4 authenticatorAttachment; + bool operator==(const NativeAmplifyRtnPasskeysPasskeyGetResultJson &other) const { + return id == other.id && rawId == other.rawId && type == other.type && response == other.response && authenticatorAttachment == other.authenticatorAttachment; + } +}; + +template +struct NativeAmplifyRtnPasskeysPasskeyGetResultJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "id"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "rawId"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "type"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "response"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "authenticatorAttachment"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) { + return bridging::toJs(rt, value); + } + + static jsi::String rawIdToJs(jsi::Runtime &rt, decltype(types.rawId) value) { + return bridging::toJs(rt, value); + } + + static jsi::String typeToJs(jsi::Runtime &rt, decltype(types.type) value) { + return bridging::toJs(rt, value); + } + + static jsi::Object responseToJs(jsi::Runtime &rt, decltype(types.response) value) { + return bridging::toJs(rt, value); + } + + static jsi::String authenticatorAttachmentToJs(jsi::Runtime &rt, decltype(types.authenticatorAttachment) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker)); + result.setProperty(rt, "rawId", bridging::toJs(rt, value.rawId, jsInvoker)); + result.setProperty(rt, "type", bridging::toJs(rt, value.type, jsInvoker)); + result.setProperty(rt, "response", bridging::toJs(rt, value.response, jsInvoker)); + if (value.authenticatorAttachment) { + result.setProperty(rt, "authenticatorAttachment", bridging::toJs(rt, value.authenticatorAttachment.value(), jsInvoker)); + } + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPkcAssertionResponseJson + +template +struct NativeAmplifyRtnPasskeysPkcAssertionResponseJson { + P0 authenticatorData; + P1 clientDataJSON; + P2 signature; + P3 userHandle; + bool operator==(const NativeAmplifyRtnPasskeysPkcAssertionResponseJson &other) const { + return authenticatorData == other.authenticatorData && clientDataJSON == other.clientDataJSON && signature == other.signature && userHandle == other.userHandle; + } +}; + +template +struct NativeAmplifyRtnPasskeysPkcAssertionResponseJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "authenticatorData"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "clientDataJSON"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "signature"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "userHandle"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String authenticatorDataToJs(jsi::Runtime &rt, decltype(types.authenticatorData) value) { + return bridging::toJs(rt, value); + } + + static jsi::String clientDataJSONToJs(jsi::Runtime &rt, decltype(types.clientDataJSON) value) { + return bridging::toJs(rt, value); + } + + static jsi::String signatureToJs(jsi::Runtime &rt, decltype(types.signature) value) { + return bridging::toJs(rt, value); + } + + static jsi::String userHandleToJs(jsi::Runtime &rt, decltype(types.userHandle) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "authenticatorData", bridging::toJs(rt, value.authenticatorData, jsInvoker)); + result.setProperty(rt, "clientDataJSON", bridging::toJs(rt, value.clientDataJSON, jsInvoker)); + result.setProperty(rt, "signature", bridging::toJs(rt, value.signature, jsInvoker)); + if (value.userHandle) { + result.setProperty(rt, "userHandle", bridging::toJs(rt, value.userHandle.value(), jsInvoker)); + } + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPkcAttestationResponseJson + +template +struct NativeAmplifyRtnPasskeysPkcAttestationResponseJson { + P0 clientDataJSON; + P1 attestationObject; + P2 transports; + bool operator==(const NativeAmplifyRtnPasskeysPkcAttestationResponseJson &other) const { + return clientDataJSON == other.clientDataJSON && attestationObject == other.attestationObject && transports == other.transports; + } +}; + +template +struct NativeAmplifyRtnPasskeysPkcAttestationResponseJsonBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "clientDataJSON"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "attestationObject"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "transports"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String clientDataJSONToJs(jsi::Runtime &rt, decltype(types.clientDataJSON) value) { + return bridging::toJs(rt, value); + } + + static jsi::String attestationObjectToJs(jsi::Runtime &rt, decltype(types.attestationObject) value) { + return bridging::toJs(rt, value); + } + + static jsi::Array transportsToJs(jsi::Runtime &rt, decltype(types.transports) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "clientDataJSON", bridging::toJs(rt, value.clientDataJSON, jsInvoker)); + result.setProperty(rt, "attestationObject", bridging::toJs(rt, value.attestationObject, jsInvoker)); + result.setProperty(rt, "transports", bridging::toJs(rt, value.transports, jsInvoker)); + return result; + } +}; + + + +#pragma mark - NativeAmplifyRtnPasskeysPkcDescriptor + +template +struct NativeAmplifyRtnPasskeysPkcDescriptor { + P0 type; + P1 id; + P2 transports; + bool operator==(const NativeAmplifyRtnPasskeysPkcDescriptor &other) const { + return type == other.type && id == other.id && transports == other.transports; + } +}; + +template +struct NativeAmplifyRtnPasskeysPkcDescriptorBridging { + static T types; + + static T fromJs( + jsi::Runtime &rt, + const jsi::Object &value, + const std::shared_ptr &jsInvoker) { + T result{ + bridging::fromJs(rt, value.getProperty(rt, "type"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "id"), jsInvoker), + bridging::fromJs(rt, value.getProperty(rt, "transports"), jsInvoker)}; + return result; + } + +#ifdef DEBUG + static jsi::String typeToJs(jsi::Runtime &rt, decltype(types.type) value) { + return bridging::toJs(rt, value); + } + + static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) { + return bridging::toJs(rt, value); + } + + static jsi::Array transportsToJs(jsi::Runtime &rt, decltype(types.transports) value) { + return bridging::toJs(rt, value); + } +#endif + + static jsi::Object toJs( + jsi::Runtime &rt, + const T &value, + const std::shared_ptr &jsInvoker) { + auto result = facebook::jsi::Object(rt); + result.setProperty(rt, "type", bridging::toJs(rt, value.type, jsInvoker)); + result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker)); + if (value.transports) { + result.setProperty(rt, "transports", bridging::toJs(rt, value.transports.value(), jsInvoker)); + } + return result; + } +}; + +class JSI_EXPORT NativeAmplifyRtnPasskeysCxxSpecJSI : public TurboModule { +protected: + NativeAmplifyRtnPasskeysCxxSpecJSI(std::shared_ptr jsInvoker); + +public: + virtual bool getIsPasskeySupported(jsi::Runtime &rt) = 0; + virtual jsi::Value createPasskey(jsi::Runtime &rt, jsi::Object input) = 0; + virtual jsi::Value getPasskey(jsi::Runtime &rt, jsi::Object input) = 0; + +}; + +template +class JSI_EXPORT NativeAmplifyRtnPasskeysCxxSpec : public TurboModule { +public: + jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override { + return delegate_.create(rt, propName); + } + + std::vector getPropertyNames(jsi::Runtime& runtime) override { + return delegate_.getPropertyNames(runtime); + } + + static constexpr std::string_view kModuleName = "AmplifyRtnPasskeys"; + +protected: + NativeAmplifyRtnPasskeysCxxSpec(std::shared_ptr jsInvoker) + : TurboModule(std::string{NativeAmplifyRtnPasskeysCxxSpec::kModuleName}, jsInvoker), + delegate_(reinterpret_cast(this), jsInvoker) {} + + +private: + class Delegate : public NativeAmplifyRtnPasskeysCxxSpecJSI { + public: + Delegate(T *instance, std::shared_ptr jsInvoker) : + NativeAmplifyRtnPasskeysCxxSpecJSI(std::move(jsInvoker)), instance_(instance) { + + } + + bool getIsPasskeySupported(jsi::Runtime &rt) override { + static_assert( + bridging::getParameterCount(&T::getIsPasskeySupported) == 1, + "Expected getIsPasskeySupported(...) to have 1 parameters"); + + return bridging::callFromJs( + rt, &T::getIsPasskeySupported, jsInvoker_, instance_); + } + jsi::Value createPasskey(jsi::Runtime &rt, jsi::Object input) override { + static_assert( + bridging::getParameterCount(&T::createPasskey) == 2, + "Expected createPasskey(...) to have 2 parameters"); + + return bridging::callFromJs( + rt, &T::createPasskey, jsInvoker_, instance_, std::move(input)); + } + jsi::Value getPasskey(jsi::Runtime &rt, jsi::Object input) override { + static_assert( + bridging::getParameterCount(&T::getPasskey) == 2, + "Expected getPasskey(...) to have 2 parameters"); + + return bridging::callFromJs( + rt, &T::getPasskey, jsInvoker_, instance_, std::move(input)); + } + + private: + friend class NativeAmplifyRtnPasskeysCxxSpec; + T *instance_; + }; + + Delegate delegate_; +}; + +} // namespace facebook::react diff --git a/packages/rtn-passkeys/android/gradle.properties b/packages/rtn-passkeys/android/gradle.properties new file mode 100644 index 00000000000..1fc598543f7 --- /dev/null +++ b/packages/rtn-passkeys/android/gradle.properties @@ -0,0 +1,6 @@ +AmplifyRtnPasskeys_kotlinVersion=2.1.20 +AmplifyRtnPasskeys_minSdkVersion=24 +AmplifyRtnPasskeys_targetSdkVersion=34 +AmplifyRtnPasskeys_compileSdkVersion=35 +AmplifyRtnPasskeys_ndkVersion=27.1.12297006 +android.useAndroidX=true diff --git a/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.jar b/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..1b33c55baab Binary files /dev/null and b/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.properties b/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..ca025c83a7c --- /dev/null +++ b/packages/rtn-passkeys/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/packages/rtn-passkeys/android/gradlew b/packages/rtn-passkeys/android/gradlew new file mode 100755 index 00000000000..23d15a93670 --- /dev/null +++ b/packages/rtn-passkeys/android/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/packages/rtn-passkeys/android/gradlew.bat b/packages/rtn-passkeys/android/gradlew.bat new file mode 100644 index 00000000000..5eed7ee8452 --- /dev/null +++ b/packages/rtn-passkeys/android/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/rtn-passkeys/android/src/main/AndroidManifest.xml b/packages/rtn-passkeys/android/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..a2f47b6057d --- /dev/null +++ b/packages/rtn-passkeys/android/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/packages/rtn-passkeys/example/.watchmanconfig b/packages/rtn-passkeys/example/.watchmanconfig new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/packages/rtn-passkeys/example/.watchmanconfig @@ -0,0 +1 @@ +{} diff --git a/packages/rtn-passkeys/example/Gemfile b/packages/rtn-passkeys/example/Gemfile new file mode 100644 index 00000000000..6a4c5f17185 --- /dev/null +++ b/packages/rtn-passkeys/example/Gemfile @@ -0,0 +1,16 @@ +source 'https://rubygems.org' + +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version +ruby ">= 2.6.10" + +# Exclude problematic versions of cocoapods and activesupport that causes build failures. +gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1' +gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0' +gem 'xcodeproj', '< 1.26.0' +gem 'concurrent-ruby', '< 1.3.4' + +# Ruby 3.4.0 has removed some libraries from the standard library. +gem 'bigdecimal' +gem 'logger' +gem 'benchmark' +gem 'mutex_m' diff --git a/packages/rtn-passkeys/example/README.md b/packages/rtn-passkeys/example/README.md new file mode 100644 index 00000000000..3e2c3f85055 --- /dev/null +++ b/packages/rtn-passkeys/example/README.md @@ -0,0 +1,97 @@ +This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). + +# Getting Started + +> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding. + +## Step 1: Start Metro + +First, you will need to run **Metro**, the JavaScript build tool for React Native. + +To start the Metro dev server, run the following command from the root of your React Native project: + +```sh +# Using npm +npm start + +# OR using Yarn +yarn start +``` + +## Step 2: Build and run your app + +With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app: + +### Android + +```sh +# Using npm +npm run android + +# OR using Yarn +yarn android +``` + +### iOS + +For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps). + +The first time you create a new project, run the Ruby bundler to install CocoaPods itself: + +```sh +bundle install +``` + +Then, and every time you update your native dependencies, run: + +```sh +bundle exec pod install +``` + +For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html). + +```sh +# Using npm +npm run ios + +# OR using Yarn +yarn ios +``` + +If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device. + +This is one way to run your app — you can also build it directly from Android Studio or Xcode. + +## Step 3: Modify your app + +Now that you have successfully run the app, let's make changes! + +Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh). + +When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload: + +- **Android**: Press the R key twice or select **"Reload"** from the **Dev Menu**, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS). +- **iOS**: Press R in iOS Simulator. + +## Congratulations! :tada: + +You've successfully run and modified your React Native App. :partying_face: + +### Now what? + +- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). +- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started). + +# Troubleshooting + +If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. + +# Learn More + +To learn more about React Native, take a look at the following resources: + +- [React Native Website](https://reactnative.dev) - learn more about React Native. +- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. +- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. +- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. +- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. diff --git a/packages/rtn-passkeys/example/android/app/build.gradle b/packages/rtn-passkeys/example/android/app/build.gradle new file mode 100644 index 00000000000..7aa8b093e03 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/build.gradle @@ -0,0 +1,132 @@ +apply plugin: "com.android.application" +apply plugin: "org.jetbrains.kotlin.android" +apply plugin: "com.facebook.react" + +/** + * This is the configuration block to customize your React Native Android app. + * By default you don't need to apply any configuration, just uncomment the lines you need. + */ +react { + /* Folders */ + // The root of your project, i.e. where "package.json" lives. Default is '../..' + // root = file("../../") + // The folder where the react-native NPM package is. Default is ../../node_modules/react-native + // reactNativeDir = file("../../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen + // codegenDir = file("../../node_modules/@react-native/codegen") + // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js + // cliFile = file("../../node_modules/react-native/cli.js") + + /* Variants */ + // The list of variants to that are debuggable. For those we're going to + // skip the bundling of the JS bundle and the assets. By default is just 'debug'. + // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. + // debuggableVariants = ["liteDebug", "prodDebug"] + + /* Bundling */ + // A list containing the node command and its flags. Default is just 'node'. + // nodeExecutableAndArgs = ["node"] + // + // The command to run when bundling. By default is 'bundle' + // bundleCommand = "ram-bundle" + // + // The path to the CLI configuration file. Default is empty. + // bundleConfig = file(../rn-cli.config.js) + // + // The name of the generated asset file containing your JS bundle + // bundleAssetName = "MyApplication.android.bundle" + // + // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' + // entryFile = file("../js/MyApplication.android.js") + // + // A list of extra flags to pass to the 'bundle' commands. + // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle + // extraPackagerArgs = [] + + /* Hermes Commands */ + // The hermes compiler command to run. By default it is 'hermesc' + // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" + // + // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" + // hermesFlags = ["-O", "-output-source-map"] + + /* Autolinking */ + autolinkLibrariesWithApp() +} + +/** + * Set this to true to Run Proguard on Release builds to minify the Java bytecode. + */ +def enableProguardInReleaseBuilds = false + +/** + * The preferred build flavor of JavaScriptCore (JSC) + * + * For example, to use the international variant, you can use: + * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+` + * + * The international variant includes ICU i18n library and necessary data + * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that + * give correct results when using with locales other than en-US. Note that + * this variant is about 6MiB larger per architecture than default. + */ +def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+' + +android { + ndkVersion rootProject.ext.ndkVersion + buildToolsVersion rootProject.ext.buildToolsVersion + compileSdk rootProject.ext.compileSdkVersion + + namespace "com.amazonaws.amplify.rtnpasskeys.example" + defaultConfig { + applicationId "com.amazonaws.amplify.rtnpasskeys.example" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode 1 + versionName "1.0" + } + signingConfigs { + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' + } + } + buildTypes { + debug { + signingConfig signingConfigs.debug + } + release { + // Caution! In production, you need to generate your own keystore file. + // see https://reactnative.dev/docs/signed-apk-android. + signingConfig signingConfigs.debug + minifyEnabled enableProguardInReleaseBuilds + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } + } +} + +dependencies { + // The version of react-native is set by the React Native Gradle Plugin + implementation("com.facebook.react:react-android") + + if (hermesEnabled.toBoolean()) { + implementation("com.facebook.react:hermes-android") + } else { + implementation jscFlavor + } +} + +def isNewArchitectureEnabled() { + return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" +} + +if (isNewArchitectureEnabled()) { + // Since our library doesn't invoke codegen automatically we need to do it here. + tasks.register('invokeLibraryCodegen', Exec) { + workingDir "$rootDir/../../" + commandLine 'sh', '-c', 'yarn codegen:android' + } + preBuild.dependsOn invokeLibraryCodegen +} diff --git a/packages/rtn-passkeys/example/android/app/debug.keystore b/packages/rtn-passkeys/example/android/app/debug.keystore new file mode 100644 index 00000000000..364e105ed39 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/debug.keystore differ diff --git a/packages/rtn-passkeys/example/android/app/proguard-rules.pro b/packages/rtn-passkeys/example/android/app/proguard-rules.pro new file mode 100644 index 00000000000..11b025724a3 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/proguard-rules.pro @@ -0,0 +1,10 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: diff --git a/packages/rtn-passkeys/example/android/app/src/debug/AndroidManifest.xml b/packages/rtn-passkeys/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000000..eb98c01afd7 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/packages/rtn-passkeys/example/android/app/src/main/AndroidManifest.xml b/packages/rtn-passkeys/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..9a0def9826e --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainActivity.kt b/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainActivity.kt new file mode 100644 index 00000000000..bad3f92d424 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainActivity.kt @@ -0,0 +1,22 @@ +package com.amazonaws.amplify.rtnpasskeys.example + +import com.facebook.react.ReactActivity +import com.facebook.react.ReactActivityDelegate +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled +import com.facebook.react.defaults.DefaultReactActivityDelegate + +class MainActivity : ReactActivity() { + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + override fun getMainComponentName(): String = "AmplifyRtnPasskeysExample" + + /** + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] + */ + override fun createReactActivityDelegate(): ReactActivityDelegate = + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) +} diff --git a/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainApplication.kt b/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainApplication.kt new file mode 100644 index 00000000000..3b8f5a94127 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/java/awsamplify/rtnpasskeys/example/MainApplication.kt @@ -0,0 +1,44 @@ +package com.amazonaws.amplify.rtnpasskeys.example + +import android.app.Application +import com.facebook.react.PackageList +import com.facebook.react.ReactApplication +import com.facebook.react.ReactHost +import com.facebook.react.ReactNativeHost +import com.facebook.react.ReactPackage +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost +import com.facebook.react.defaults.DefaultReactNativeHost +import com.facebook.react.soloader.OpenSourceMergedSoMapping +import com.facebook.soloader.SoLoader + +class MainApplication : Application(), ReactApplication { + + override val reactNativeHost: ReactNativeHost = + object : DefaultReactNativeHost(this) { + override fun getPackages(): List = + PackageList(this).packages.apply { + // Packages that cannot be autolinked yet can be added manually here, for example: + // add(MyReactNativePackage()) + } + + override fun getJSMainModuleName(): String = "index" + + override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG + + override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED + override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED + } + + override val reactHost: ReactHost + get() = getDefaultReactHost(applicationContext, reactNativeHost) + + override fun onCreate() { + super.onCreate() + SoLoader.init(this, OpenSourceMergedSoMapping) + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + load() + } + } +} diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/drawable/rn_edit_text_material.xml b/packages/rtn-passkeys/example/android/app/src/main/res/drawable/rn_edit_text_material.xml new file mode 100644 index 00000000000..5c25e728ea2 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000000..a2f5908281d Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000000..1b523998081 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000000..ff10afd6e18 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000000..115a4c768a2 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000000..dcd3cd80833 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000000..459ca609d3a Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000000..8ca12fe024b Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000000..8e19b410a1b Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000000..b824ebdd48d Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000000..4c19a13c239 Binary files /dev/null and b/packages/rtn-passkeys/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/values/strings.xml b/packages/rtn-passkeys/example/android/app/src/main/res/values/strings.xml new file mode 100644 index 00000000000..c4cbebbd4c3 --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + AmplifyRtnPasskeysExample + + [{ + \"include\": \"https://staging.d375f6hcyb75ic.amplifyapp.com/.well-known/assetlinks.json\" + }] + + diff --git a/packages/rtn-passkeys/example/android/app/src/main/res/values/styles.xml b/packages/rtn-passkeys/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000000..7ba83a2ad5a --- /dev/null +++ b/packages/rtn-passkeys/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/packages/rtn-passkeys/example/android/build.gradle b/packages/rtn-passkeys/example/android/build.gradle new file mode 100644 index 00000000000..f229d7c6836 --- /dev/null +++ b/packages/rtn-passkeys/example/android/build.gradle @@ -0,0 +1,21 @@ +buildscript { + ext { + buildToolsVersion = "35.0.0" + minSdkVersion = 24 + compileSdkVersion = 35 + targetSdkVersion = 35 + ndkVersion = "27.1.12297006" + kotlinVersion = "2.0.21" + } + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle") + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") + } +} + +// apply plugin: "com.facebook.react.rootproject" diff --git a/packages/rtn-passkeys/example/android/gradle.properties b/packages/rtn-passkeys/example/android/gradle.properties new file mode 100644 index 00000000000..46ccd2fdbfa --- /dev/null +++ b/packages/rtn-passkeys/example/android/gradle.properties @@ -0,0 +1,42 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true + +# Use this property to specify which architecture you want to build. +# You can also override it from the CLI using +# ./gradlew -PreactNativeArchitectures=x86_64 +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 + +# Use this property to enable support to the new architecture. +# This will allow you to use TurboModules and the Fabric render in +# your application. You should enable this flag either if you want +# to write custom TurboModules/Fabric components OR use libraries that +# are providing them. +newArchEnabled=true + +# Use this property to enable or disable the Hermes JS engine. +# If set to false, you will be using JSC instead. +hermesEnabled=true + +# enable logging +# org.gradle.logging.level=info diff --git a/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.jar b/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..a4b76b9530d Binary files /dev/null and b/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..37f853b1c84 --- /dev/null +++ b/packages/rtn-passkeys/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/packages/rtn-passkeys/example/android/gradlew b/packages/rtn-passkeys/example/android/gradlew new file mode 100755 index 00000000000..f3b75f3b0d4 --- /dev/null +++ b/packages/rtn-passkeys/example/android/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/packages/rtn-passkeys/example/android/gradlew.bat b/packages/rtn-passkeys/example/android/gradlew.bat new file mode 100644 index 00000000000..9b42019c791 --- /dev/null +++ b/packages/rtn-passkeys/example/android/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/rtn-passkeys/example/android/settings.gradle b/packages/rtn-passkeys/example/android/settings.gradle new file mode 100644 index 00000000000..6d1d62073c9 --- /dev/null +++ b/packages/rtn-passkeys/example/android/settings.gradle @@ -0,0 +1,6 @@ +pluginManagement { includeBuild("../../node_modules/@react-native/gradle-plugin") } +plugins { id("com.facebook.react.settings") } +extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } +rootProject.name = 'com.amazonaws.amplify.rtnpasskeys.example' +include ':app' +includeBuild('../../node_modules/@react-native/gradle-plugin') diff --git a/packages/rtn-passkeys/example/app.json b/packages/rtn-passkeys/example/app.json new file mode 100644 index 00000000000..c75eeb323bc --- /dev/null +++ b/packages/rtn-passkeys/example/app.json @@ -0,0 +1,4 @@ +{ + "name": "AmplifyRtnPasskeysExample", + "displayName": "AmplifyRtnPasskeysExample" +} diff --git a/packages/rtn-passkeys/example/babel.config.js b/packages/rtn-passkeys/example/babel.config.js new file mode 100644 index 00000000000..903ccef0608 --- /dev/null +++ b/packages/rtn-passkeys/example/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['module:@react-native/babel-preset'], +}; diff --git a/packages/rtn-passkeys/example/index.js b/packages/rtn-passkeys/example/index.js new file mode 100644 index 00000000000..733692d9506 --- /dev/null +++ b/packages/rtn-passkeys/example/index.js @@ -0,0 +1,9 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { AppRegistry } from 'react-native'; + +import App from './src/App'; +import { name as appName } from './app.json'; + +AppRegistry.registerComponent(appName, () => App); diff --git a/packages/rtn-passkeys/example/ios/.xcode.env b/packages/rtn-passkeys/example/ios/.xcode.env new file mode 100644 index 00000000000..3d5782c7156 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/.xcode.env @@ -0,0 +1,11 @@ +# This `.xcode.env` file is versioned and is used to source the environment +# used when running script phases inside Xcode. +# To customize your local environment, you can create an `.xcode.env.local` +# file that is not versioned. + +# NODE_BINARY variable contains the PATH to the node executable. +# +# Customize the NODE_BINARY variable here. +# For example, to use nvm with brew, add the following line +# . "$(brew --prefix nvm)/nvm.sh" --no-use +export NODE_BINARY=$(command -v node) diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/project.pbxproj b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..16f76bbaa60 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/project.pbxproj @@ -0,0 +1,633 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 0C80B921A6F3F58F76C31292 /* libPods-AmplifyRtnPasskeysExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-AmplifyRtnPasskeysExample.a */; }; + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; }; + 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; + C6C4B65C3851578AB80D5744 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1D7533FB2DD2898F00B464C4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = AmplifyRtnPasskeysExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 13B07F961A680F5B00A75B9A /* AmplifyRtnPasskeysExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmplifyRtnPasskeysExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AmplifyRtnPasskeysExample/Images.xcassets; sourceTree = ""; }; + 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AmplifyRtnPasskeysExample/Info.plist; sourceTree = ""; }; + 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = AmplifyRtnPasskeysExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 1D7533F72DD2898F00B464C4 /* AmplifyRtnPasskeysExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AmplifyRtnPasskeysExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DDFCE8A2D82166300CFD52E /* AmplifyRtnPasskeysExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = AmplifyRtnPasskeysExample.entitlements; path = AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements; sourceTree = ""; }; + 28B60A264610278F0F5A136A /* Pods-AmplifyRtnPasskeysExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmplifyRtnPasskeysExample.release.xcconfig"; path = "Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample.release.xcconfig"; sourceTree = ""; }; + 35DEFAAFB11EC5A06275E6CA /* Pods-AmplifyRtnPasskeysExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmplifyRtnPasskeysExample.debug.xcconfig"; path = "Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample.debug.xcconfig"; sourceTree = ""; }; + 5DCACB8F33CDC322A6C60F78 /* libPods-AmplifyRtnPasskeysExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AmplifyRtnPasskeysExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = AmplifyRtnPasskeysExample/AppDelegate.swift; sourceTree = ""; }; + 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AmplifyRtnPasskeysExample/LaunchScreen.storyboard; sourceTree = ""; }; + ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0C80B921A6F3F58F76C31292 /* libPods-AmplifyRtnPasskeysExample.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1D7533F42DD2898F00B464C4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 13B07FAE1A68108700A75B9A /* AmplifyRtnPasskeysExample */ = { + isa = PBXGroup; + children = ( + 1DDFCE8A2D82166300CFD52E /* AmplifyRtnPasskeysExample.entitlements */, + 13B07FB51A68108700A75B9A /* Images.xcassets */, + 761780EC2CA45674006654EE /* AppDelegate.swift */, + 13B07FB61A68108700A75B9A /* Info.plist */, + 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, + 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */, + ); + name = AmplifyRtnPasskeysExample; + sourceTree = ""; + }; + 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { + isa = PBXGroup; + children = ( + ED297162215061F000B7C4FE /* JavaScriptCore.framework */, + 5DCACB8F33CDC322A6C60F78 /* libPods-AmplifyRtnPasskeysExample.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 56E5D2791365D644F24728F6 /* Pods */ = { + isa = PBXGroup; + children = ( + 35DEFAAFB11EC5A06275E6CA /* Pods-AmplifyRtnPasskeysExample.debug.xcconfig */, + 28B60A264610278F0F5A136A /* Pods-AmplifyRtnPasskeysExample.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 832341AE1AAA6A7D00B99B32 /* Libraries */ = { + isa = PBXGroup; + children = ( + ); + name = Libraries; + sourceTree = ""; + }; + 83CBB9F61A601CBA00E9B192 = { + isa = PBXGroup; + children = ( + 13B07FAE1A68108700A75B9A /* AmplifyRtnPasskeysExample */, + 832341AE1AAA6A7D00B99B32 /* Libraries */, + 83CBBA001A601CBA00E9B192 /* Products */, + 2D16E6871FA4F8E400B85C8A /* Frameworks */, + 56E5D2791365D644F24728F6 /* Pods */, + ); + indentWidth = 2; + sourceTree = ""; + tabWidth = 2; + usesTabs = 0; + }; + 83CBBA001A601CBA00E9B192 /* Products */ = { + isa = PBXGroup; + children = ( + 13B07F961A680F5B00A75B9A /* AmplifyRtnPasskeysExample.app */, + 1D7533F72DD2898F00B464C4 /* AmplifyRtnPasskeysExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 13B07F861A680F5B00A75B9A /* AmplifyRtnPasskeysExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AmplifyRtnPasskeysExample" */; + buildPhases = ( + C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, + 13B07F871A680F5B00A75B9A /* Sources */, + 13B07F8C1A680F5B00A75B9A /* Frameworks */, + 13B07F8E1A680F5B00A75B9A /* Resources */, + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, + 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, + E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AmplifyRtnPasskeysExample; + productName = AmplifyRtnPasskeysExample; + productReference = 13B07F961A680F5B00A75B9A /* AmplifyRtnPasskeysExample.app */; + productType = "com.apple.product-type.application"; + }; + 1D7533F62DD2898F00B464C4 /* AmplifyRtnPasskeysExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D7533FF2DD2898F00B464C4 /* Build configuration list for PBXNativeTarget "AmplifyRtnPasskeysExampleTests" */; + buildPhases = ( + 1D7533F32DD2898F00B464C4 /* Sources */, + 1D7533F42DD2898F00B464C4 /* Frameworks */, + 1D7533F52DD2898F00B464C4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1D7533FC2DD2898F00B464C4 /* PBXTargetDependency */, + ); + name = AmplifyRtnPasskeysExampleTests; + productName = AmplifyRtnPasskeysExampleTests; + productReference = 1D7533F72DD2898F00B464C4 /* AmplifyRtnPasskeysExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83CBB9F71A601CBA00E9B192 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1610; + LastUpgradeCheck = 1210; + TargetAttributes = { + 13B07F861A680F5B00A75B9A = { + LastSwiftMigration = 1120; + }; + 1D7533F62DD2898F00B464C4 = { + CreatedOnToolsVersion = 16.1; + TestTargetID = 13B07F861A680F5B00A75B9A; + }; + }; + }; + buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AmplifyRtnPasskeysExample" */; + compatibilityVersion = "Xcode 12.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 83CBB9F61A601CBA00E9B192; + productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 13B07F861A680F5B00A75B9A /* AmplifyRtnPasskeysExample */, + 1D7533F62DD2898F00B464C4 /* AmplifyRtnPasskeysExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 13B07F8E1A680F5B00A75B9A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, + C6C4B65C3851578AB80D5744 /* PrivacyInfo.xcprivacy in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1D7533F52DD2898F00B464C4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/.xcode.env.local", + "$(SRCROOT)/.xcode.env", + ); + name = "Bundle React Native code and images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; + }; + 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AmplifyRtnPasskeysExample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AmplifyRtnPasskeysExample/Pods-AmplifyRtnPasskeysExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 13B07F871A680F5B00A75B9A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1D7533F32DD2898F00B464C4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1D7533FC2DD2898F00B464C4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* AmplifyRtnPasskeysExample */; + targetProxy = 1D7533FB2DD2898F00B464C4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 13B07F941A680F5B00A75B9A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 35DEFAAFB11EC5A06275E6CA /* Pods-AmplifyRtnPasskeysExample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = LXJMF8N53N; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = AmplifyRtnPasskeysExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.amplify.rtnpasskeys.example; + PRODUCT_NAME = AmplifyRtnPasskeysExample; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 13B07F951A680F5B00A75B9A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 28B60A264610278F0F5A136A /* Pods-AmplifyRtnPasskeysExample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = LXJMF8N53N; + INFOPLIST_FILE = AmplifyRtnPasskeysExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.amplify.rtnpasskeys.example; + PRODUCT_NAME = AmplifyRtnPasskeysExample; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + 1D7533FD2DD2898F00B464C4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = LXJMF8N53N; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.amplify.AmplifyRtnPasskeysExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmplifyRtnPasskeysExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmplifyRtnPasskeysExample"; + }; + name = Debug; + }; + 1D7533FE2DD2898F00B464C4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = LXJMF8N53N; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.amazonaws.amplify.AmplifyRtnPasskeysExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AmplifyRtnPasskeysExample.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AmplifyRtnPasskeysExample"; + }; + name = Release; + }; + 83CBBA201A601CBA00E9B192 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + /usr/lib/swift, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + "-DFOLLY_CFG_NO_COROUTINES=1", + "-DFOLLY_HAVE_CLOCK_GETTIME=1", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; + USE_HERMES = true; + }; + name = Debug; + }; + 83CBBA211A601CBA00E9B192 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + /usr/lib/swift, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + "-DFOLLY_CFG_NO_COROUTINES=1", + "-DFOLLY_HAVE_CLOCK_GETTIME=1", + ); + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; + SDKROOT = iphoneos; + USE_HERMES = true; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AmplifyRtnPasskeysExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 13B07F941A680F5B00A75B9A /* Debug */, + 13B07F951A680F5B00A75B9A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1D7533FF2DD2898F00B464C4 /* Build configuration list for PBXNativeTarget "AmplifyRtnPasskeysExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D7533FD2DD2898F00B464C4 /* Debug */, + 1D7533FE2DD2898F00B464C4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AmplifyRtnPasskeysExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83CBBA201A601CBA00E9B192 /* Debug */, + 83CBBA211A601CBA00E9B192 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; +} diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/xcshareddata/xcschemes/AmplifyRtnPasskeysExample.xcscheme b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/xcshareddata/xcschemes/AmplifyRtnPasskeysExample.xcscheme new file mode 100644 index 00000000000..511b44bd8a9 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcodeproj/xcshareddata/xcschemes/AmplifyRtnPasskeysExample.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcworkspace/contents.xcworkspacedata b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..14de2dec51f --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements new file mode 100644 index 00000000000..dcd13ea48c7 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AmplifyRtnPasskeysExample.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.developer.associated-domains + + webcredentials:staging.d375f6hcyb75ic.amplifyapp.com?mode=developer + + + diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AppDelegate.swift b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AppDelegate.swift new file mode 100644 index 00000000000..fae6665ce07 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/AppDelegate.swift @@ -0,0 +1,48 @@ +import React +import ReactAppDependencyProvider +import React_RCTAppDelegate +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + var reactNativeDelegate: ReactNativeDelegate? + var reactNativeFactory: RCTReactNativeFactory? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil + ) -> Bool { + let delegate: ReactNativeDelegate = ReactNativeDelegate() + let factory = RCTReactNativeFactory(delegate: delegate) + delegate.dependencyProvider = RCTAppDependencyProvider() + + reactNativeDelegate = delegate + reactNativeFactory = factory + + window = UIWindow(frame: UIScreen.main.bounds) + + factory.startReactNative( + withModuleName: "AmplifyRtnPasskeysExample", + in: window, + launchOptions: launchOptions + ) + + return true + } +} + +class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate { + override func sourceURL(for bridge: RCTBridge) -> URL? { + self.bundleURL() + } + + override func bundleURL() -> URL? { + #if DEBUG + RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") + #else + Bundle.main.url(forResource: "main", withExtension: "jsbundle") + #endif + } +} diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/AppIcon.appiconset/Contents.json b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..81213230deb --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/Contents.json b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/Contents.json new file mode 100644 index 00000000000..2d92bd53fdb --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Info.plist b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Info.plist new file mode 100644 index 00000000000..fdca64275fe --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + AmplifyRtnPasskeysExample + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + + NSLocationWhenInUseUsageDescription + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/LaunchScreen.storyboard b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/LaunchScreen.storyboard new file mode 100644 index 00000000000..2a4dd29620a --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/LaunchScreen.storyboard @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/PrivacyInfo.xcprivacy b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..41b8317f065 --- /dev/null +++ b/packages/rtn-passkeys/example/ios/AmplifyRtnPasskeysExample/PrivacyInfo.xcprivacy @@ -0,0 +1,37 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/rtn-passkeys/example/ios/Podfile b/packages/rtn-passkeys/example/ios/Podfile new file mode 100644 index 00000000000..926ee2d557f --- /dev/null +++ b/packages/rtn-passkeys/example/ios/Podfile @@ -0,0 +1,40 @@ +ENV['RCT_NEW_ARCH_ENABLED'] = '1' + +# Resolve react_native_pods.rb with node to allow for hoisting +require Pod::Executable.execute_command('node', ['-p', + 'require.resolve( + "react-native/scripts/react_native_pods.rb", + {paths: [process.argv[1]]}, + )', __dir__]).strip + +platform :ios, '17.4' +prepare_react_native_project! + +linkage = ENV['USE_FRAMEWORKS'] +if linkage != nil + Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green + use_frameworks! :linkage => linkage.to_sym +end + +target 'AmplifyRtnPasskeysExample' do + pod 'AmplifyRtnPasskeys', :path => '../..', :testspecs => ['tests'] + + config = use_native_modules! + + use_react_native!( + :path => config[:reactNativePath], + # An absolute path to your application root. + :app_path => "#{Pod::Config.instance.installation_root}/.." + ) + + post_install do |installer| + # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 + react_native_post_install( + installer, + config[:reactNativePath], + :mac_catalyst_enabled => false, + # :ccache_enabled => true + ) + end +end + diff --git a/packages/rtn-passkeys/example/jest.config.js b/packages/rtn-passkeys/example/jest.config.js new file mode 100644 index 00000000000..8eb675e9bc6 --- /dev/null +++ b/packages/rtn-passkeys/example/jest.config.js @@ -0,0 +1,3 @@ +module.exports = { + preset: 'react-native', +}; diff --git a/packages/rtn-passkeys/example/metro.config.js b/packages/rtn-passkeys/example/metro.config.js new file mode 100644 index 00000000000..e1b1ea12b86 --- /dev/null +++ b/packages/rtn-passkeys/example/metro.config.js @@ -0,0 +1,56 @@ +const path = require('path'); + +const { getDefaultConfig } = require('@react-native/metro-config'); + +const projectRoot = __dirname; +const monorepoRoot = path.resolve(projectRoot, '../../../'); + +const config = getDefaultConfig(projectRoot); + +// only look for internal deps from monorepo root +const monorepoPackages = { + 'aws-amplify': path.resolve(monorepoRoot, 'packages/aws-amplify'), + '@aws-amplify/react-native': path.resolve( + monorepoRoot, + 'packages/react-native', + ), + '@aws-amplify/rtn-passkeys': path.resolve( + monorepoRoot, + 'packages/rtn-passkeys', + ), +}; + +config.watchFolders = [ + projectRoot, + monorepoRoot, + ...Object.values(monorepoPackages), +]; + +config.transformer = { + ...config.transformer, + getTransformOptions: () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: true, + }, + }), +}; + +// add internal deps as extra node modules +config.resolver.extraNodeModules = monorepoPackages; + +// disable default node dependency resolution functionality +config.resolver.disableHierarchicalLookup = true; + +// only look for node modules here +config.resolver.nodeModulesPaths = [ + path.resolve(projectRoot, 'node_modules'), + path.resolve(monorepoRoot, 'node_modules'), +]; + +config.projectRoot = projectRoot; + +// can be disabled +config.resetCache = true; + +module.exports = config; diff --git a/packages/rtn-passkeys/example/package.json b/packages/rtn-passkeys/example/package.json new file mode 100644 index 00000000000..d4ab9b1f88b --- /dev/null +++ b/packages/rtn-passkeys/example/package.json @@ -0,0 +1,37 @@ +{ + "name": "@aws-amplify/rtn-passkeys-example", + "version": "0.0.1", + "private": true, + "scripts": { + "android": "react-native run-android", + "ios": "react-native run-ios", + "start": "react-native start", + "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", + "build:ios": "react-native build-ios --scheme AmplifyRtnPasskeysExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"", + "generate": "AWS_REGION=us-west-1 npx @aws-amplify/backend-cli@latest generate outputs --stack amplify-Passkeys-passkeys-sandbox-f77bdb9853" + }, + "dependencies": { + "react": "19.0.0", + "react-native": "0.79.2", + "aws-amplify": "*", + "@aws-amplify/react-native": "*", + "@aws-amplify/rtn-passkeys": "*", + "@react-native-async-storage/async-storage": "^2.1.2", + "react-native-get-random-values": "^1.11.0" + }, + "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.3", + "@babel/runtime": "^7.25.0", + "@react-native-community/cli": "18.0.0", + "@react-native-community/cli-platform-android": "18.0.0", + "@react-native-community/cli-platform-ios": "18.0.0", + "@react-native/babel-preset": "0.79.2", + "@react-native/eslint-config": "0.79.2", + "@react-native/metro-config": "0.79.2", + "@react-native/typescript-config": "0.79.2" + }, + "engines": { + "node": ">=18" + } +} diff --git a/packages/rtn-passkeys/example/react-native.config.js b/packages/rtn-passkeys/example/react-native.config.js new file mode 100644 index 00000000000..046e095d41f --- /dev/null +++ b/packages/rtn-passkeys/example/react-native.config.js @@ -0,0 +1,22 @@ +const path = require('path'); + +const pkg = require('../package.json'); + +module.exports = { + project: { + ios: { + automaticPodsInstallation: true, + }, + }, + dependencies: { + [pkg.name]: { + root: path.join(__dirname, '..'), + platforms: { + // Codegen script incorrectly fails without this + // So we explicitly specify the platforms with empty object + ios: {}, + android: {}, + }, + }, + }, +}; diff --git a/packages/rtn-passkeys/example/src/App.tsx b/packages/rtn-passkeys/example/src/App.tsx new file mode 100644 index 00000000000..605f81212c9 --- /dev/null +++ b/packages/rtn-passkeys/example/src/App.tsx @@ -0,0 +1,223 @@ +/* eslint-disable no-console */ +import { + associateWebAuthnCredential, + deleteUser, + signIn, + signOut, + signUp, +} from 'aws-amplify/auth'; +import React, { useState } from 'react'; +import { + Button, + SafeAreaView, + ScrollView, + StyleSheet, + Text, + View, +} from 'react-native'; +import { Amplify } from 'aws-amplify'; + +import config from '../amplify_outputs.json'; + +Amplify.configure(config); + +const testUser = { + username: 'user@example.com', + password: 'Test123#', +}; + +function App(): React.JSX.Element { + const [signedUp, setSignedUp] = useState(false); + const [signedIn, setSignedIn] = useState(false); + const [webAuthNAssociated, setWebAuthNAssociated] = useState(false); + const [readySignInWithPassKeys, setReadySignInWithPassKeys] = useState(false); + const [signedInWithPasskeys, setSignedInWithPasskeys] = useState(false); + const [testComplete, setTestComplete] = useState(false); + + const resetState = () => { + setSignedUp(false); + setSignedIn(false); + setWebAuthNAssociated(false); + setReadySignInWithPassKeys(false); + setSignedInWithPasskeys(false); + setTestComplete(false); + }; + + const handleSignUp = async () => { + try { + await signUp(testUser); + + setSignedUp(true); + } catch (error) { + console.error('Error signing up:', error); + } + }; + + const handleSignin = async () => { + try { + await signIn(testUser); + + setSignedIn(true); + } catch (error) { + if ((error as any).name === 'UserAlreadyAuthenticatedException') { + await signOut(); + } + console.error('Error signing up:', error); + } + }; + + const handleSignOut = async () => { + await signOut(); + + setReadySignInWithPassKeys(true); + }; + + const handleAssociateWebAuthNCredentials = async () => { + try { + await associateWebAuthnCredential(); + setWebAuthNAssociated(true); + } catch (error) { + console.error('Error associating WebAuthN credentials:'); + console.error(error); + console.error((error as any).name); + console.error((error as any).underlyingError); + } + }; + + const handleSignInWithPasskeys = async () => { + try { + await signIn({ + username: testUser.username, + options: { + authFlowType: 'USER_AUTH', + preferredChallenge: 'WEB_AUTHN', + }, + }); + setSignedInWithPasskeys(true); + } catch (error) { + console.error('Error signing in with webauthN: ', error); + } + }; + + const handleDeleteUser = async () => { + try { + await deleteUser(); + setTestComplete(true); + } catch (error) { + console.error('Error deleting user:', error); + } + }; + + const renderInCompleteTests = () => ( + <> + + Step 1: sign up a user (with auto confirm) +