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