@passkeyme/auth 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -767,168 +767,21 @@ class WebPasskeySDK {
767
767
  }
768
768
 
769
769
  /**
770
- * React Native Platform SDK Implementation
771
- *
772
- * Bridges to native iOS (CocoaPods) and Android (Gradle) SDKs
773
- */
774
- /**
775
- * React Native implementation of PasskeySDK
776
- *
777
- * This implementation bridges to native iOS and Android SDKs:
778
- * - iOS: https://cocoapods.org/pods/PasskeymeSDK
779
- * - Android: https://maven.pkg.github.com/justincrosbie/passkeyme-android-sdk
770
+ * Platform SDK exports
780
771
  */
781
- class ReactNativePasskeySDK {
782
- constructor() {
783
- try {
784
- // Try to import React Native module
785
- const { NativeModules } = require("react-native");
786
- this.nativeModule = NativeModules.PasskeymeNativeModule;
787
- }
788
- catch (error) {
789
- console.warn("React Native environment not detected or PasskeymeNativeModule not available");
790
- this.nativeModule = null;
791
- }
792
- }
793
- async register(options) {
794
- try {
795
- if (!this.nativeModule) {
796
- return {
797
- success: false,
798
- error: "Native module not available",
799
- };
800
- }
801
- // Call the native module register method
802
- const result = await this.nativeModule.register({
803
- ...options,
804
- requireUserVerification: options.requireUserVerification || false,
805
- });
806
- return {
807
- success: result.success,
808
- credentialId: result.credentialId,
809
- error: result.error,
810
- data: result,
811
- };
812
- }
813
- catch (error) {
814
- return {
815
- success: false,
816
- error: error.message || "Registration failed",
817
- };
818
- }
819
- }
820
- async authenticate(options) {
821
- try {
822
- if (!this.nativeModule) {
823
- return {
824
- success: false,
825
- error: "Native module not available",
826
- };
827
- }
828
- // Call the native module authenticate method
829
- const result = await this.nativeModule.authenticate({
830
- ...options,
831
- requireUserVerification: options.requireUserVerification || false,
832
- });
833
- return {
834
- success: result.success,
835
- assertion: result.assertion,
836
- error: result.error,
837
- data: result,
838
- };
839
- }
840
- catch (error) {
841
- return {
842
- success: false,
843
- error: error.message || "Authentication failed",
844
- };
845
- }
846
- }
847
- isSupported() {
848
- return this.nativeModule != null;
849
- }
850
- async getAvailableAuthenticators() {
851
- try {
852
- if (!this.nativeModule) {
853
- return [];
854
- }
855
- // Call native method to get available authenticators
856
- const authenticators = await this.nativeModule.getAvailableAuthenticators();
857
- return authenticators || [];
858
- }
859
- catch (error) {
860
- console.warn("Failed to get available authenticators:", error);
861
- return [];
862
- }
863
- }
864
- canUseDiscoverableCredentials() {
865
- // Most modern mobile devices support discoverable credentials
866
- return this.isSupported();
867
- }
868
- supportsBiometrics() {
869
- // Mobile devices typically support biometric authentication
870
- return this.isSupported();
871
- }
872
- async initialize(config) {
873
- if (this.nativeModule &&
874
- typeof this.nativeModule.initialize === "function") {
875
- await this.nativeModule.initialize(config);
876
- }
877
- }
878
- async cleanup() {
879
- if (this.nativeModule && typeof this.nativeModule.cleanup === "function") {
880
- await this.nativeModule.cleanup();
881
- }
882
- }
883
- /**
884
- * Check if the device supports Face ID (iOS) or Face Unlock (Android)
885
- */
886
- async supportsFaceRecognition() {
887
- try {
888
- if (!this.nativeModule)
889
- return false;
890
- return await this.nativeModule.supportsFaceRecognition();
891
- }
892
- catch (_a) {
893
- return false;
894
- }
895
- }
896
- /**
897
- * Check if the device supports Touch ID (iOS) or Fingerprint (Android)
898
- */
899
- async supportsFingerprint() {
900
- try {
901
- if (!this.nativeModule)
902
- return false;
903
- return await this.nativeModule.supportsFingerprint();
904
- }
905
- catch (_a) {
906
- return false;
907
- }
908
- }
909
- /**
910
- * Get detailed biometric capabilities
911
- */
912
- async getBiometricCapabilities() {
913
- try {
914
- if (!this.nativeModule) {
915
- return {
916
- faceRecognition: false,
917
- fingerprint: false,
918
- voiceRecognition: false,
919
- };
920
- }
921
- return await this.nativeModule.getBiometricCapabilities();
922
- }
923
- catch (_a) {
924
- return {
925
- faceRecognition: false,
926
- fingerprint: false,
927
- voiceRecognition: false,
928
- };
929
- }
772
+ // Conditionally export React Native SDK only in React Native environments
773
+ exports.ReactNativePasskeySDK = null;
774
+ try {
775
+ // Only try to load React Native SDK if we're actually in a React Native environment
776
+ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
777
+ const { ReactNativePasskeySDK: RNPasskeySDK, } = require("./ReactNativePasskeySDK");
778
+ exports.ReactNativePasskeySDK = RNPasskeySDK;
930
779
  }
931
780
  }
781
+ catch (error) {
782
+ // React Native SDK not available or not in React Native environment
783
+ exports.ReactNativePasskeySDK = null;
784
+ }
932
785
 
933
786
  /**
934
787
  * Main PasskeyMe Authentication SDK class
@@ -5667,7 +5520,6 @@ exports.NoOpPasskeySDK = NoOpPasskeySDK;
5667
5520
  exports.PasskeymeApiClient = PasskeymeApiClient;
5668
5521
  exports.PasskeymeAuth = PasskeymeAuth;
5669
5522
  exports.PasskeymeError = PasskeymeError;
5670
- exports.ReactNativePasskeySDK = ReactNativePasskeySDK;
5671
5523
  exports.TokenStorage = TokenStorage;
5672
5524
  exports.WebPasskeySDK = WebPasskeySDK;
5673
5525
  exports.addAuthHeader = addAuthHeader;