@aparajita/capacitor-biometric-auth
Advanced tools
Comparing version 7.2.0 to 8.0.0
@@ -11,3 +11,3 @@ import { WebPlugin } from '@capacitor/core'; | ||
protected abstract internalAuthenticate(options?: AuthenticateOptions): Promise<void>; | ||
addResumeListener(listener: ResumeListener): Promise<PluginListenerHandle> & PluginListenerHandle; | ||
addResumeListener(listener: ResumeListener): Promise<PluginListenerHandle>; | ||
} |
@@ -13,5 +13,3 @@ import { App } from '@capacitor/app'; | ||
if (error instanceof CapacitorException) { | ||
throw new BiometryError(error.message, | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we are converting from ExceptionCode to BiometryErrorType | ||
error.code); | ||
throw new BiometryError(error.message, error.code); | ||
} | ||
@@ -23,3 +21,3 @@ else { | ||
} | ||
addResumeListener(listener) { | ||
async addResumeListener(listener) { | ||
return App.addListener('appStateChange', ({ isActive }) => { | ||
@@ -26,0 +24,0 @@ if (isActive) { |
import { BiometricAuthBase } from './base'; | ||
import { BiometryErrorType, BiometryType } from './definitions'; | ||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/require-await */ | ||
// eslint-disable-next-line import/prefer-default-export | ||
@@ -15,3 +16,2 @@ export class BiometricAuthNative extends BiometricAuthBase { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
const proxy = capProxy; | ||
@@ -21,3 +21,3 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
this.internalAuthenticate = proxy.internalAuthenticate; | ||
/* eslint-enable */ | ||
/* eslint-enable @typescript-eslint/unbound-method */ | ||
} | ||
@@ -41,26 +41,15 @@ // @native | ||
// On native platforms, this will present the native authentication UI. | ||
async internalAuthenticate( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { } | ||
async internalAuthenticate(options) { } | ||
// Web only, used for simulating biometric authentication. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryType( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
type) { | ||
throw this.unimplemented('setBiometryType() is web only'); | ||
async setBiometryType(type) { | ||
console.warn('setBiometryType() is web only'); | ||
} | ||
// Web only, used for simulating biometry enrollment. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryIsEnrolled( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
enrolled) { | ||
throw this.unimplemented('setBiometryEnrolled() is web only'); | ||
async setBiometryIsEnrolled(enrolled) { | ||
console.warn('setBiometryEnrolled() is web only'); | ||
} | ||
// Web only, used for simulating device security. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setDeviceIsSecure( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
isSecure) { | ||
throw this.unimplemented('setDeviceIsSecure() is web only'); | ||
async setDeviceIsSecure(isSecure) { | ||
console.warn('setDeviceIsSecure() is web only'); | ||
} | ||
} |
@@ -105,5 +105,3 @@ import { BiometricAuthBase } from './base'; | ||
if (BiometryType.hasOwnProperty(types[i])) { | ||
const biometryType = | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
BiometryType[types[i]]; | ||
const biometryType = BiometryType[types[i]]; | ||
if (this.biometryType === BiometryType.none) { | ||
@@ -135,4 +133,3 @@ this.biometryTypes = []; | ||
function isBiometryTypes(value) { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
return Object.values(BiometryType).includes(value[0]); | ||
} |
@@ -110,5 +110,3 @@ 'use strict'; | ||
if (error instanceof core.CapacitorException) { | ||
throw new BiometryError(error.message, | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we are converting from ExceptionCode to BiometryErrorType | ||
error.code); | ||
throw new BiometryError(error.message, error.code); | ||
} | ||
@@ -120,3 +118,3 @@ else { | ||
} | ||
addResumeListener(listener) { | ||
async addResumeListener(listener) { | ||
return app.App.addListener('appStateChange', ({ isActive }) => { | ||
@@ -235,5 +233,3 @@ if (isActive) { | ||
if (exports.BiometryType.hasOwnProperty(types[i])) { | ||
const biometryType = | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
exports.BiometryType[types[i]]; | ||
const biometryType = exports.BiometryType[types[i]]; | ||
if (this.biometryType === exports.BiometryType.none) { | ||
@@ -265,3 +261,2 @@ this.biometryTypes = []; | ||
function isBiometryTypes(value) { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
return Object.values(exports.BiometryType).includes(value[0]); | ||
@@ -275,2 +270,3 @@ } | ||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/require-await */ | ||
// eslint-disable-next-line import/prefer-default-export | ||
@@ -288,3 +284,2 @@ class BiometricAuthNative extends BiometricAuthBase { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
const proxy = capProxy; | ||
@@ -294,3 +289,3 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
this.internalAuthenticate = proxy.internalAuthenticate; | ||
/* eslint-enable */ | ||
/* eslint-enable @typescript-eslint/unbound-method */ | ||
} | ||
@@ -314,25 +309,14 @@ // @native | ||
// On native platforms, this will present the native authentication UI. | ||
async internalAuthenticate( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { } | ||
async internalAuthenticate(options) { } | ||
// Web only, used for simulating biometric authentication. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryType( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
type) { | ||
throw this.unimplemented('setBiometryType() is web only'); | ||
async setBiometryType(type) { | ||
console.warn('setBiometryType() is web only'); | ||
} | ||
// Web only, used for simulating biometry enrollment. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryIsEnrolled( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
enrolled) { | ||
throw this.unimplemented('setBiometryEnrolled() is web only'); | ||
async setBiometryIsEnrolled(enrolled) { | ||
console.warn('setBiometryEnrolled() is web only'); | ||
} | ||
// Web only, used for simulating device security. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setDeviceIsSecure( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
isSecure) { | ||
throw this.unimplemented('setDeviceIsSecure() is web only'); | ||
async setDeviceIsSecure(isSecure) { | ||
console.warn('setDeviceIsSecure() is web only'); | ||
} | ||
@@ -339,0 +323,0 @@ } |
@@ -108,5 +108,3 @@ var capacitorBiometricAuth = (function (exports, core, app) { | ||
if (error instanceof core.CapacitorException) { | ||
throw new BiometryError(error.message, | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we are converting from ExceptionCode to BiometryErrorType | ||
error.code); | ||
throw new BiometryError(error.message, error.code); | ||
} | ||
@@ -118,3 +116,3 @@ else { | ||
} | ||
addResumeListener(listener) { | ||
async addResumeListener(listener) { | ||
return app.App.addListener('appStateChange', ({ isActive }) => { | ||
@@ -233,5 +231,3 @@ if (isActive) { | ||
if (exports.BiometryType.hasOwnProperty(types[i])) { | ||
const biometryType = | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
exports.BiometryType[types[i]]; | ||
const biometryType = exports.BiometryType[types[i]]; | ||
if (this.biometryType === exports.BiometryType.none) { | ||
@@ -263,3 +259,2 @@ this.biometryTypes = []; | ||
function isBiometryTypes(value) { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
return Object.values(exports.BiometryType).includes(value[0]); | ||
@@ -273,2 +268,3 @@ } | ||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/require-await */ | ||
// eslint-disable-next-line import/prefer-default-export | ||
@@ -286,3 +282,2 @@ class BiometricAuthNative extends BiometricAuthBase { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
const proxy = capProxy; | ||
@@ -292,3 +287,3 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
this.internalAuthenticate = proxy.internalAuthenticate; | ||
/* eslint-enable */ | ||
/* eslint-enable @typescript-eslint/unbound-method */ | ||
} | ||
@@ -312,25 +307,14 @@ // @native | ||
// On native platforms, this will present the native authentication UI. | ||
async internalAuthenticate( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
options) { } | ||
async internalAuthenticate(options) { } | ||
// Web only, used for simulating biometric authentication. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryType( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
type) { | ||
throw this.unimplemented('setBiometryType() is web only'); | ||
async setBiometryType(type) { | ||
console.warn('setBiometryType() is web only'); | ||
} | ||
// Web only, used for simulating biometry enrollment. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setBiometryIsEnrolled( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
enrolled) { | ||
throw this.unimplemented('setBiometryEnrolled() is web only'); | ||
async setBiometryIsEnrolled(enrolled) { | ||
console.warn('setBiometryEnrolled() is web only'); | ||
} | ||
// Web only, used for simulating device security. | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async setDeviceIsSecure( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
isSecure) { | ||
throw this.unimplemented('setDeviceIsSecure() is web only'); | ||
async setDeviceIsSecure(isSecure) { | ||
console.warn('setDeviceIsSecure() is web only'); | ||
} | ||
@@ -337,0 +321,0 @@ } |
{ | ||
"name": "@aparajita/capacitor-biometric-auth", | ||
"version": "7.2.0", | ||
"version": "8.0.0", | ||
"description": "Provides access to the native biometric auth & device security APIs for Capacitor apps", | ||
@@ -60,11 +60,11 @@ "author": "Aparajita Fishman", | ||
"@aparajita/swiftly": "^1.0.4", | ||
"@capacitor/cli": "^5.7.4", | ||
"@commitlint/cli": "^19.2.1", | ||
"@commitlint/config-conventional": "^19.1.0", | ||
"@capacitor/cli": "^6.0.0", | ||
"@commitlint/cli": "^19.2.2", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@ionic/swiftlint-config": "^1.1.2", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@types/node": "^20.12.4", | ||
"@typescript-eslint/eslint-plugin": "^7.5.0", | ||
"@typescript-eslint/parser": "^7.5.0", | ||
"commit-and-tag-version": "^12.2.0", | ||
"@types/node": "^20.12.7", | ||
"@typescript-eslint/eslint-plugin": "^7.7.0", | ||
"@typescript-eslint/parser": "^7.7.0", | ||
"commit-and-tag-version": "^12.4.0", | ||
"eslint": "^8.57.0", | ||
@@ -81,12 +81,12 @@ "eslint-config-prettier": "^9.1.0", | ||
"rimraf": "^5.0.5", | ||
"rollup": "^4.14.0", | ||
"rollup": "^4.16.1", | ||
"simple-git-hooks": "^2.11.1", | ||
"swiftlint": "^1.0.2", | ||
"typescript": "~5.4.3" | ||
"typescript": "~5.4.5" | ||
}, | ||
"dependencies": { | ||
"@capacitor/android": "^5.7.4", | ||
"@capacitor/app": "^5.0.7", | ||
"@capacitor/core": "^5.7.4", | ||
"@capacitor/ios": "^5.7.4" | ||
"@capacitor/android": "^6.0.0", | ||
"@capacitor/app": "^6.0.0", | ||
"@capacitor/core": "^6.0.0", | ||
"@capacitor/ios": "^6.0.0" | ||
}, | ||
@@ -93,0 +93,0 @@ "scripts": { |
@@ -5,3 +5,3 @@ <div class="markdown-body"> | ||
This plugin for [Capacitor 5](https://capacitorjs.com) provides access to native biometry and device credentials on iOS and Android. It supports every type of biometry and every configuration option on both platforms. In addition, biometry and device credentials are simulated on the web so you can test your logic without making any changes to your code. | ||
This plugin for [Capacitor 6](https://capacitorjs.com) provides access to native biometry and device credentials on iOS and Android. It supports every type of biometry and every configuration option on both platforms. In addition, biometry and device credentials are simulated on the web so you can test your logic without making any changes to your code. | ||
@@ -11,4 +11,9 @@ 🛑 **BREAKING CHANGES:** | ||
- If you are upgrading from a version prior to 6.0.0, please note that [`authenticate()`](#authenticate) now throws an instance of `BiometryError`, and `BiometryError.code` is now typed as [`BiometryErrorType`](#biometryerrortype). | ||
- If you are upgrading from a version prior to 7.0.0, please note that [`authenticate()`](#authenticate) will _immediately_ present a prompt for device credentials if `deviceIsSecure` is true, `allowDeviceCredentials` is true, and no biometry of the requested strength is available. | ||
- If you are upgrading from a version prior to 8.0.0, please note that this plugin now requires Capacitor 6+. | ||
- If you are upgrading from a version prior to 8.0.0, please note that [`addResumeListener`](#addresumelistener) now always returns a Promise and must be awaited. | ||
## Installation | ||
@@ -15,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
388
129512
1740
+ Added@capacitor/android@6.2.0(transitive)
+ Added@capacitor/app@6.0.2(transitive)
+ Added@capacitor/core@6.2.0(transitive)
+ Added@capacitor/ios@6.2.0(transitive)
- Removed@capacitor/android@5.7.8(transitive)
- Removed@capacitor/app@5.0.8(transitive)
- Removed@capacitor/core@5.7.8(transitive)
- Removed@capacitor/ios@5.7.8(transitive)
Updated@capacitor/android@^6.0.0
Updated@capacitor/app@^6.0.0
Updated@capacitor/core@^6.0.0
Updated@capacitor/ios@^6.0.0