@passkeyme/auth 1.1.0 → 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.esm.js +13 -160
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -161
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +13 -161
- package/dist/index.umd.js.map +1 -1
- package/dist/src/platform/index.d.ts +2 -1
- package/dist/src/platform/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -763,168 +763,21 @@ class WebPasskeySDK {
|
|
|
763
763
|
}
|
|
764
764
|
|
|
765
765
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
* Bridges to native iOS (CocoaPods) and Android (Gradle) SDKs
|
|
769
|
-
*/
|
|
770
|
-
/**
|
|
771
|
-
* React Native implementation of PasskeySDK
|
|
772
|
-
*
|
|
773
|
-
* This implementation bridges to native iOS and Android SDKs:
|
|
774
|
-
* - iOS: https://cocoapods.org/pods/PasskeymeSDK
|
|
775
|
-
* - Android: https://maven.pkg.github.com/justincrosbie/passkeyme-android-sdk
|
|
766
|
+
* Platform SDK exports
|
|
776
767
|
*/
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
catch (error) {
|
|
785
|
-
console.warn("React Native environment not detected or PasskeymeNativeModule not available");
|
|
786
|
-
this.nativeModule = null;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
async register(options) {
|
|
790
|
-
try {
|
|
791
|
-
if (!this.nativeModule) {
|
|
792
|
-
return {
|
|
793
|
-
success: false,
|
|
794
|
-
error: "Native module not available",
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
// Call the native module register method
|
|
798
|
-
const result = await this.nativeModule.register({
|
|
799
|
-
...options,
|
|
800
|
-
requireUserVerification: options.requireUserVerification || false,
|
|
801
|
-
});
|
|
802
|
-
return {
|
|
803
|
-
success: result.success,
|
|
804
|
-
credentialId: result.credentialId,
|
|
805
|
-
error: result.error,
|
|
806
|
-
data: result,
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
catch (error) {
|
|
810
|
-
return {
|
|
811
|
-
success: false,
|
|
812
|
-
error: error.message || "Registration failed",
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
async authenticate(options) {
|
|
817
|
-
try {
|
|
818
|
-
if (!this.nativeModule) {
|
|
819
|
-
return {
|
|
820
|
-
success: false,
|
|
821
|
-
error: "Native module not available",
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
// Call the native module authenticate method
|
|
825
|
-
const result = await this.nativeModule.authenticate({
|
|
826
|
-
...options,
|
|
827
|
-
requireUserVerification: options.requireUserVerification || false,
|
|
828
|
-
});
|
|
829
|
-
return {
|
|
830
|
-
success: result.success,
|
|
831
|
-
assertion: result.assertion,
|
|
832
|
-
error: result.error,
|
|
833
|
-
data: result,
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
catch (error) {
|
|
837
|
-
return {
|
|
838
|
-
success: false,
|
|
839
|
-
error: error.message || "Authentication failed",
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
isSupported() {
|
|
844
|
-
return this.nativeModule != null;
|
|
845
|
-
}
|
|
846
|
-
async getAvailableAuthenticators() {
|
|
847
|
-
try {
|
|
848
|
-
if (!this.nativeModule) {
|
|
849
|
-
return [];
|
|
850
|
-
}
|
|
851
|
-
// Call native method to get available authenticators
|
|
852
|
-
const authenticators = await this.nativeModule.getAvailableAuthenticators();
|
|
853
|
-
return authenticators || [];
|
|
854
|
-
}
|
|
855
|
-
catch (error) {
|
|
856
|
-
console.warn("Failed to get available authenticators:", error);
|
|
857
|
-
return [];
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
canUseDiscoverableCredentials() {
|
|
861
|
-
// Most modern mobile devices support discoverable credentials
|
|
862
|
-
return this.isSupported();
|
|
863
|
-
}
|
|
864
|
-
supportsBiometrics() {
|
|
865
|
-
// Mobile devices typically support biometric authentication
|
|
866
|
-
return this.isSupported();
|
|
867
|
-
}
|
|
868
|
-
async initialize(config) {
|
|
869
|
-
if (this.nativeModule &&
|
|
870
|
-
typeof this.nativeModule.initialize === "function") {
|
|
871
|
-
await this.nativeModule.initialize(config);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
async cleanup() {
|
|
875
|
-
if (this.nativeModule && typeof this.nativeModule.cleanup === "function") {
|
|
876
|
-
await this.nativeModule.cleanup();
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
/**
|
|
880
|
-
* Check if the device supports Face ID (iOS) or Face Unlock (Android)
|
|
881
|
-
*/
|
|
882
|
-
async supportsFaceRecognition() {
|
|
883
|
-
try {
|
|
884
|
-
if (!this.nativeModule)
|
|
885
|
-
return false;
|
|
886
|
-
return await this.nativeModule.supportsFaceRecognition();
|
|
887
|
-
}
|
|
888
|
-
catch (_a) {
|
|
889
|
-
return false;
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
/**
|
|
893
|
-
* Check if the device supports Touch ID (iOS) or Fingerprint (Android)
|
|
894
|
-
*/
|
|
895
|
-
async supportsFingerprint() {
|
|
896
|
-
try {
|
|
897
|
-
if (!this.nativeModule)
|
|
898
|
-
return false;
|
|
899
|
-
return await this.nativeModule.supportsFingerprint();
|
|
900
|
-
}
|
|
901
|
-
catch (_a) {
|
|
902
|
-
return false;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Get detailed biometric capabilities
|
|
907
|
-
*/
|
|
908
|
-
async getBiometricCapabilities() {
|
|
909
|
-
try {
|
|
910
|
-
if (!this.nativeModule) {
|
|
911
|
-
return {
|
|
912
|
-
faceRecognition: false,
|
|
913
|
-
fingerprint: false,
|
|
914
|
-
voiceRecognition: false,
|
|
915
|
-
};
|
|
916
|
-
}
|
|
917
|
-
return await this.nativeModule.getBiometricCapabilities();
|
|
918
|
-
}
|
|
919
|
-
catch (_a) {
|
|
920
|
-
return {
|
|
921
|
-
faceRecognition: false,
|
|
922
|
-
fingerprint: false,
|
|
923
|
-
voiceRecognition: false,
|
|
924
|
-
};
|
|
925
|
-
}
|
|
768
|
+
// Conditionally export React Native SDK only in React Native environments
|
|
769
|
+
let ReactNativePasskeySDK = null;
|
|
770
|
+
try {
|
|
771
|
+
// Only try to load React Native SDK if we're actually in a React Native environment
|
|
772
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
773
|
+
const { ReactNativePasskeySDK: RNPasskeySDK, } = require("./ReactNativePasskeySDK");
|
|
774
|
+
ReactNativePasskeySDK = RNPasskeySDK;
|
|
926
775
|
}
|
|
927
776
|
}
|
|
777
|
+
catch (error) {
|
|
778
|
+
// React Native SDK not available or not in React Native environment
|
|
779
|
+
ReactNativePasskeySDK = null;
|
|
780
|
+
}
|
|
928
781
|
|
|
929
782
|
/**
|
|
930
783
|
* Main PasskeyMe Authentication SDK class
|
|
@@ -1483,7 +1336,7 @@ class PasskeymeAuth {
|
|
|
1483
1336
|
const { default: axios } = await Promise.resolve().then(function () { return index; });
|
|
1484
1337
|
// Create axios instance for PasskeyMe API
|
|
1485
1338
|
const axiosInstance = axios.create({
|
|
1486
|
-
baseURL: `${this.config.baseUrl}/
|
|
1339
|
+
baseURL: `${this.config.baseUrl}/webauthn/${this.config.appId}`,
|
|
1487
1340
|
headers: {
|
|
1488
1341
|
"x-api-key": apiKey,
|
|
1489
1342
|
"Content-Type": "application/json",
|