Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aparajita/capacitor-biometric-auth

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aparajita/capacitor-biometric-auth - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0

android/src/main/java/com/aparajita/capacitor/biometricauth/BiometricAuthNative.java

8

dist/esm/definitions.d.ts

@@ -1,3 +0,2 @@

import type { DecoratedNativePlugin } from '@aparajita/capacitor-native-decorator';
import type { PluginListenerHandle, PluginResultError } from '@capacitor/core';
import type { PluginListenerHandle, PluginResultError, WebPlugin } from '@capacitor/core';
export declare enum BiometryType {

@@ -155,3 +154,3 @@ /**

export declare type ResumeListener = (info: CheckBiometryResult) => void;
export interface BiometricAuthPlugin extends DecoratedNativePlugin {
export interface BiometricAuthPlugin extends WebPlugin {
/**

@@ -169,3 +168,3 @@ * Check to see what biometry type (if any) is available.

*/
setBiometryType: (type: BiometryType | string | undefined) => void;
setBiometryType: (type: BiometryType | string | undefined) => Promise<void>;
/**

@@ -194,2 +193,1 @@ * Prompt the user for authentication. If authorization fails for any reason,

}
export declare const kPluginName = "BiometricAuth";

@@ -57,2 +57,1 @@ export var BiometryType;

}
export const kPluginName = 'BiometricAuth';

@@ -1,5 +0,5 @@

import { BiometricAuth } from './web';
declare const plugin: BiometricAuth;
import type { BiometricAuthPlugin } from './definitions';
declare const proxy: BiometricAuthPlugin;
export * from './definitions';
export { plugin as BiometricAuth };
export { getBiometryName } from './web';
export * from './web-utils';
export { proxy as BiometricAuth };
import { registerPlugin } from '@capacitor/core';
import { kPluginName } from './definitions';
import info from './info.json';
import { BiometricAuth } from './web';
console.log(`loaded ${info.name} v${info.version}`);
// Because we are using @aparajita/capacitor-native-decorator,
// we have one version of the TS code to rule them all, and there
// is no need to lazy load. 😁
const plugin = new BiometricAuth();
registerPlugin(kPluginName, {
web: plugin,
ios: plugin,
android: plugin
const proxy = registerPlugin('BiometricAuthNative', {
web: async () => import('./web').then((module) => new module.BiometricAuthWeb(proxy)),
ios: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy)),
android: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy))
});
export * from './definitions';
export { plugin as BiometricAuth };
export { getBiometryName } from './web';
export * from './web-utils';
export { proxy as BiometricAuth };
{
"name": "@aparajita/capacitor-biometric-auth",
"version": "3.0.2"
"version": "3.1.0"
}

@@ -1,19 +0,9 @@

import { WebPlugin } from '@capacitor/core';
import type { PluginListenerHandle } from '@capacitor/core';
import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult, ResumeListener } from './definitions';
import { BiometricAuthBase } from './base';
import type { AuthenticateOptions, CheckBiometryResult } from './definitions';
import { BiometryType } from './definitions';
export declare class BiometricAuth extends WebPlugin implements BiometricAuthPlugin {
export declare class BiometricAuthWeb extends BiometricAuthBase {
private biometryType;
getRegisteredPluginName(): string;
setBiometryType(type: BiometryType | string | undefined): void;
checkBiometry(): Promise<CheckBiometryResult>;
authenticate(options?: AuthenticateOptions): Promise<void>;
addResumeListener(listener: ResumeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
setBiometryType(type: BiometryType | string | undefined): Promise<void>;
}
/**
* Return a human-readable name for a BiometryType.
*
* @param {BiometryType} type
* @returns {string}
*/
export declare function getBiometryName(type: BiometryType): string;

@@ -1,15 +0,6 @@

import { __decorate } from "tslib";
import { native } from '@aparajita/capacitor-native-decorator';
import { App } from '@capacitor/app';
import { WebPlugin } from '@capacitor/core';
import { BiometryError, BiometryErrorType, BiometryType, kPluginName } from './definitions';
const kBiometryTypeNameMap = {
[BiometryType.none]: '',
[BiometryType.touchId]: 'Touch ID',
[BiometryType.faceId]: 'Face ID',
[BiometryType.fingerprintAuthentication]: 'Fingerprint Authentication',
[BiometryType.faceAuthentication]: 'Face Authentication',
[BiometryType.irisAuthentication]: 'Iris Authentication'
};
export class BiometricAuth extends WebPlugin {
import { BiometricAuthBase } from './base';
import { BiometryError, BiometryErrorType, BiometryType } from './definitions';
import { getBiometryName } from './web-utils';
// eslint-disable-next-line import/prefer-default-export
export class BiometricAuthWeb extends BiometricAuthBase {
constructor() {

@@ -19,20 +10,2 @@ super(...arguments);

}
getRegisteredPluginName() {
return kPluginName;
}
setBiometryType(type) {
if (typeof type === 'undefined') {
return;
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = BiometryType[type];
}
}
else {
this.biometryType = type;
}
}
async checkBiometry() {

@@ -51,3 +24,3 @@ return Promise.resolve({

confirm((options === null || options === void 0 ? void 0 : options.reason) ||
`Authenticate with ${kBiometryTypeNameMap[biometryType]}?`)) {
`Authenticate with ${getBiometryName(biometryType)}?`)) {
return;

@@ -60,30 +33,18 @@ }

}
addResumeListener(listener) {
return App.addListener('appStateChange', ({ isActive }) => {
if (isActive) {
this.checkBiometry()
.then((info) => {
listener(info);
})
.catch((error) => {
console.error(error.message);
});
async setBiometryType(type) {
if (typeof type === 'undefined') {
return Promise.resolve();
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = BiometryType[type];
}
});
}
else {
this.biometryType = type;
}
return Promise.resolve();
}
}
__decorate([
native()
], BiometricAuth.prototype, "checkBiometry", null);
__decorate([
native()
], BiometricAuth.prototype, "authenticate", null);
/**
* Return a human-readable name for a BiometryType.
*
* @param {BiometryType} type
* @returns {string}
*/
export function getBiometryName(type) {
return kBiometryTypeNameMap[type] || '';
}

@@ -6,6 +6,9 @@ 'use strict';

var core = require('@capacitor/core');
var tslib = require('tslib');
var capacitorNativeDecorator = require('@aparajita/capacitor-native-decorator');
var app = require('@capacitor/app');
var info = {
name: "@aparajita/capacitor-biometric-auth",
version: "3.1.0"
};
exports.BiometryType = void 0;

@@ -67,9 +70,3 @@ (function (BiometryType) {

}
const kPluginName = 'BiometricAuth';
var info = {
name: "@aparajita/capacitor-biometric-auth",
version: "3.0.2"
};
const kBiometryTypeNameMap = {

@@ -83,3 +80,41 @@ [exports.BiometryType.none]: '',

};
class BiometricAuth extends core.WebPlugin {
/**
* Return a human-readable name for a BiometryType.
*/
// eslint-disable-next-line import/prefer-default-export
function getBiometryName(type) {
return kBiometryTypeNameMap[type] || '';
}
console.log(`loaded ${info.name} v${info.version}`);
const proxy = core.registerPlugin('BiometricAuthNative', {
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb(proxy)),
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
});
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthBase extends core.WebPlugin {
constructor(plugin) {
super();
this._plugin = plugin;
}
addResumeListener(listener) {
return app.App.addListener('appStateChange', ({ isActive }) => {
if (isActive) {
this._plugin
.checkBiometry()
.then((info) => {
listener(info);
})
.catch((error) => {
console.error(error.message);
});
}
});
}
}
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthWeb extends BiometricAuthBase {
constructor() {

@@ -89,20 +124,2 @@ super(...arguments);

}
getRegisteredPluginName() {
return kPluginName;
}
setBiometryType(type) {
if (typeof type === 'undefined') {
return;
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (exports.BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = exports.BiometryType[type];
}
}
else {
this.biometryType = type;
}
}
async checkBiometry() {

@@ -121,3 +138,3 @@ return Promise.resolve({

confirm((options === null || options === void 0 ? void 0 : options.reason) ||
`Authenticate with ${kBiometryTypeNameMap[biometryType]}?`)) {
`Authenticate with ${getBiometryName(biometryType)}?`)) {
return;

@@ -130,46 +147,52 @@ }

}
addResumeListener(listener) {
return app.App.addListener('appStateChange', ({ isActive }) => {
if (isActive) {
this.checkBiometry()
.then((info) => {
listener(info);
})
.catch((error) => {
console.error(error.message);
});
async setBiometryType(type) {
if (typeof type === 'undefined') {
return Promise.resolve();
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (exports.BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = exports.BiometryType[type];
}
}
else {
this.biometryType = type;
}
return Promise.resolve();
}
}
var web = /*#__PURE__*/Object.freeze({
__proto__: null,
BiometricAuthWeb: BiometricAuthWeb
});
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthNative extends BiometricAuthBase {
async checkBiometry() {
// Never used, satisfy the compiler
return Promise.resolve({
isAvailable: true,
biometryType: exports.BiometryType.none,
reason: ''
});
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
async authenticate(options) { }
// 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');
}
}
tslib.__decorate([
capacitorNativeDecorator.native()
], BiometricAuth.prototype, "checkBiometry", null);
tslib.__decorate([
capacitorNativeDecorator.native()
], BiometricAuth.prototype, "authenticate", null);
/**
* Return a human-readable name for a BiometryType.
*
* @param {BiometryType} type
* @returns {string}
*/
function getBiometryName(type) {
return kBiometryTypeNameMap[type] || '';
}
console.log(`loaded ${info.name} v${info.version}`);
// Because we are using @aparajita/capacitor-native-decorator,
// we have one version of the TS code to rule them all, and there
// is no need to lazy load. 😁
const plugin = new BiometricAuth();
core.registerPlugin(kPluginName, {
web: plugin,
ios: plugin,
android: plugin
var native = /*#__PURE__*/Object.freeze({
__proto__: null,
BiometricAuthNative: BiometricAuthNative
});
exports.BiometricAuth = plugin;
exports.BiometricAuth = proxy;
exports.BiometryError = BiometryError;
exports.getBiometryName = getBiometryName;
exports.kPluginName = kPluginName;

@@ -1,4 +0,9 @@

var capacitorBiometricAuth = (function (exports, core, tslib, capacitorNativeDecorator, app) {
var capacitorBiometricAuth = (function (exports, core, app) {
'use strict';
var info = {
name: "@aparajita/capacitor-biometric-auth",
version: "3.1.0"
};
exports.BiometryType = void 0;

@@ -60,9 +65,3 @@ (function (BiometryType) {

}
const kPluginName = 'BiometricAuth';
var info = {
name: "@aparajita/capacitor-biometric-auth",
version: "3.0.2"
};
const kBiometryTypeNameMap = {

@@ -76,3 +75,41 @@ [exports.BiometryType.none]: '',

};
class BiometricAuth extends core.WebPlugin {
/**
* Return a human-readable name for a BiometryType.
*/
// eslint-disable-next-line import/prefer-default-export
function getBiometryName(type) {
return kBiometryTypeNameMap[type] || '';
}
console.log(`loaded ${info.name} v${info.version}`);
const proxy = core.registerPlugin('BiometricAuthNative', {
web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb(proxy)),
ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
});
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthBase extends core.WebPlugin {
constructor(plugin) {
super();
this._plugin = plugin;
}
addResumeListener(listener) {
return app.App.addListener('appStateChange', ({ isActive }) => {
if (isActive) {
this._plugin
.checkBiometry()
.then((info) => {
listener(info);
})
.catch((error) => {
console.error(error.message);
});
}
});
}
}
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthWeb extends BiometricAuthBase {
constructor() {

@@ -82,20 +119,2 @@ super(...arguments);

}
getRegisteredPluginName() {
return kPluginName;
}
setBiometryType(type) {
if (typeof type === 'undefined') {
return;
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (exports.BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = exports.BiometryType[type];
}
}
else {
this.biometryType = type;
}
}
async checkBiometry() {

@@ -114,3 +133,3 @@ return Promise.resolve({

confirm((options === null || options === void 0 ? void 0 : options.reason) ||
`Authenticate with ${kBiometryTypeNameMap[biometryType]}?`)) {
`Authenticate with ${getBiometryName(biometryType)}?`)) {
return;

@@ -123,47 +142,53 @@ }

}
addResumeListener(listener) {
return app.App.addListener('appStateChange', ({ isActive }) => {
if (isActive) {
this.checkBiometry()
.then((info) => {
listener(info);
})
.catch((error) => {
console.error(error.message);
});
async setBiometryType(type) {
if (typeof type === 'undefined') {
return Promise.resolve();
}
if (typeof type === 'string') {
// eslint-disable-next-line no-prototype-builtins
if (exports.BiometryType.hasOwnProperty(type)) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
this.biometryType = exports.BiometryType[type];
}
}
else {
this.biometryType = type;
}
return Promise.resolve();
}
}
var web = /*#__PURE__*/Object.freeze({
__proto__: null,
BiometricAuthWeb: BiometricAuthWeb
});
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthNative extends BiometricAuthBase {
async checkBiometry() {
// Never used, satisfy the compiler
return Promise.resolve({
isAvailable: true,
biometryType: exports.BiometryType.none,
reason: ''
});
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
async authenticate(options) { }
// 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');
}
}
tslib.__decorate([
capacitorNativeDecorator.native()
], BiometricAuth.prototype, "checkBiometry", null);
tslib.__decorate([
capacitorNativeDecorator.native()
], BiometricAuth.prototype, "authenticate", null);
/**
* Return a human-readable name for a BiometryType.
*
* @param {BiometryType} type
* @returns {string}
*/
function getBiometryName(type) {
return kBiometryTypeNameMap[type] || '';
}
console.log(`loaded ${info.name} v${info.version}`);
// Because we are using @aparajita/capacitor-native-decorator,
// we have one version of the TS code to rule them all, and there
// is no need to lazy load. 😁
const plugin = new BiometricAuth();
core.registerPlugin(kPluginName, {
web: plugin,
ios: plugin,
android: plugin
var native = /*#__PURE__*/Object.freeze({
__proto__: null,
BiometricAuthNative: BiometricAuthNative
});
exports.BiometricAuth = plugin;
exports.BiometricAuth = proxy;
exports.BiometryError = BiometryError;
exports.getBiometryName = getBiometryName;
exports.kPluginName = kPluginName;

@@ -174,2 +199,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

})({}, capacitorExports, tslib, capacitorNativeDecorator, app);
})({}, capacitorExports, app);
{
"name": "@aparajita/capacitor-biometric-auth",
"version": "3.0.2",
"version": "3.1.0",
"description": "Provides access to the native biometric auth APIs for Capacitor apps",

@@ -24,10 +24,5 @@ "author": "Aparajita Fishman",

"scripts": {
"postbump": "pnpm -s builder"
"postbump": "pnpm builder"
}
},
"ultra": {
"concurrent": [
"verify"
]
},
"keywords": [

@@ -70,5 +65,5 @@ "capacitor",

"@rollup/plugin-json": "^4.1.0",
"@types/node": "^18.6.3",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"@types/node": "^18.6.5",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"commit-and-tag-version": "^10.0.1",

@@ -90,7 +85,5 @@ "eslint": "^8.21.0",

"swiftlint": "^1.0.1",
"typescript": "~4.7.4",
"ultra-runner": "^3.10.5"
"typescript": "~4.7.4"
},
"dependencies": {
"@aparajita/capacitor-native-decorator": "^3.0.0",
"@capacitor/android": "^4.0.1",

@@ -108,9 +101,10 @@ "@capacitor/app": "^4.0.1",

"lint.tsc": "tsc --noEmit",
"lint": "pnpm -s extract-info && pnpm -s lint.eslint . && pnpm -s lint.prettier . && pnpm -s lint.tsc",
"tsc": "tsc ${SOURCE_MAP}",
"builder": "pnpm -s extract-info && pnpm -s clean && pnpm -s tsc && rollup -c rollup.config.mjs",
"build": "pnpm -s builder",
"build.dev": "SOURCE_MAP=--sourceMap pnpm -s builder",
"watch": "nodemon --exec 'pnpm -s build.dev'",
"docgen": "docgen --api BiometricAuthPlugin --output-readme README.md && docgen-format && pnpm -s lint.prettier README.md",
"lint": "pnpm lint.eslint . && pnpm lint.prettier . && pnpm lint.tsc",
"prebuilder": "pnpm clean && pnpm extract-info",
"builder": "tsc ${SOURCE_MAP:-} && rollup -c rollup.config.mjs",
"prebuild": "pnpm lint",
"build": "pnpm builder",
"build.dev": "SOURCE_MAP=--sourceMap pnpm build",
"watch": "nodemon --exec 'pnpm build.dev'",
"docgen": "docgen --api BiometricAuthPlugin --output-readme README.md && docgen-format && pnpm lint.prettier README.md",
"open.ios": "open ios/Plugin.xcworkspace",

@@ -121,5 +115,5 @@ "open.android": "open -b com.google.android.studio android",

"verify": "pnpm verify.ios && pnpm verify.android",
"release.pre": "scripts/ensure-clean.sh && pnpm -s lint && pnpm -s docgen && git add README.md",
"release": "pnpm -s release.pre && commit-and-tag-version --commit-all && git push --follow-tags && pnpm publish"
"prerelease": "scripts/ensure-clean.sh && pnpm build && pnpm docgen && git add README.md",
"release": "commit-and-tag-version --commit-all && git push --follow-tags && pnpm publish"
}
}

@@ -93,3 +93,3 @@ <div class="markdown-body">

```typescript
setBiometryType(type: BiometryType | string | undefined) => void
setBiometryType(type: BiometryType | string | undefined) => Promise<void>
```

@@ -96,0 +96,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc