capacitor-biometric-authentication
Version:
Framework-agnostic biometric authentication library. Works with React, Vue, Angular, or vanilla JS. No providers required!
43 lines • 2.22 kB
JavaScript
import { BiometricAuthCore } from './core/BiometricAuthCore';
// Create singleton instance
const biometricAuth = BiometricAuthCore.getInstance();
// Export the main API (provider-less, like Zustand)
const BiometricAuth = {
// Core methods
configure: (config) => biometricAuth.configure(config),
isAvailable: () => biometricAuth.isAvailable(),
getSupportedBiometrics: () => biometricAuth.getSupportedBiometrics(),
authenticate: (options) => biometricAuth.authenticate(options),
deleteCredentials: () => biometricAuth.deleteCredentials(),
hasCredentials: () => biometricAuth.hasCredentials(),
// State management
logout: () => biometricAuth.logout(),
getState: () => biometricAuth.getState(),
isAuthenticated: () => biometricAuth.isAuthenticated(),
subscribe: (callback) => biometricAuth.subscribe(callback),
// Utility methods
requireAuthentication: (callback, options) => biometricAuth.requireAuthentication(callback, options),
withAuthentication: (callback, options) => biometricAuth.withAuthentication(callback, options),
// Advanced usage
registerAdapter: (name, adapter) => biometricAuth.registerAdapter(name, adapter),
};
export { BiometricErrorCode } from './core/types';
// Export the main API as default
export default BiometricAuth;
// Also export named for flexibility
export { BiometricAuth };
// Export core classes for advanced usage
export { BiometricAuthCore } from './core/BiometricAuthCore';
export { PlatformDetector } from './core/platform-detector';
// Export adapters for those who want to use them directly
export { WebAdapter } from './adapters/WebAdapter';
export { CapacitorAdapter } from './adapters/CapacitorAdapter';
// NOTE: Web plugin registration has been REMOVED
//
// The BiometricAuth package now works as follows:
// - On NATIVE (Android/iOS): Uses Capacitor.Plugins.BiometricAuth which is auto-registered by native layer
// - On WEB: Uses WebAdapter which implements WebAuthn API directly
//
// DO NOT add registerPlugin() calls here - it causes ".then() is not implemented" errors
// on native platforms because it creates a conflicting proxy over the already-registered native plugin
//# sourceMappingURL=index.js.map