capacitor-biometric-authentication
Version:
Framework-agnostic biometric authentication library. Works with React, Vue, Angular, or vanilla JS. No providers required!
40 lines • 1.24 kB
JavaScript
/**
* Get platform capabilities based on platform info
*/
export function getPlatformCapabilities(platform) {
if (platform.isWeb) {
return {
webAuthn: typeof window !== 'undefined' && 'PublicKeyCredential' in window,
nativeBiometric: false,
secureStorage: false,
platformAuthenticator: true,
roamingAuthenticator: true,
};
}
if (platform.isIOS || platform.isAndroid) {
return {
webAuthn: false,
nativeBiometric: true,
secureStorage: true,
platformAuthenticator: true,
roamingAuthenticator: false,
};
}
if (platform.isElectron) {
return {
webAuthn: true,
nativeBiometric: platform.isMacOS || platform.isWindows || false,
secureStorage: platform.isMacOS || false,
platformAuthenticator: platform.isMacOS || platform.isWindows || false,
roamingAuthenticator: true,
};
}
return {
webAuthn: false,
nativeBiometric: false,
secureStorage: false,
platformAuthenticator: false,
roamingAuthenticator: false,
};
}
//# sourceMappingURL=platform.js.map