@aparajita/capacitor-biometric-auth 3.1.0 → 3.1.3

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.
@@ -2,8 +2,6 @@ import { WebPlugin } from '@capacitor/core';
2
2
  import type { PluginListenerHandle } from '@capacitor/core';
3
3
  import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult, ResumeListener, BiometryType } from './definitions';
4
4
  export declare abstract class BiometricAuthBase extends WebPlugin implements BiometricAuthPlugin {
5
- private readonly _plugin;
6
- constructor(plugin: BiometricAuthPlugin);
7
5
  abstract setBiometryType(type: BiometryType | string | undefined): Promise<void>;
8
6
  abstract checkBiometry(): Promise<CheckBiometryResult>;
9
7
  abstract authenticate(options?: AuthenticateOptions): Promise<void>;
package/dist/esm/base.js CHANGED
@@ -2,21 +2,14 @@ import { App } from '@capacitor/app';
2
2
  import { WebPlugin } from '@capacitor/core';
3
3
  // eslint-disable-next-line import/prefer-default-export
4
4
  export class BiometricAuthBase extends WebPlugin {
5
- constructor(plugin) {
6
- super();
7
- this._plugin = plugin;
8
- }
9
5
  addResumeListener(listener) {
10
6
  return App.addListener('appStateChange', ({ isActive }) => {
11
7
  if (isActive) {
12
- this._plugin
13
- .checkBiometry()
8
+ this.checkBiometry()
14
9
  .then((info) => {
15
10
  listener(info);
16
11
  })
17
- .catch((error) => {
18
- console.error(error.message);
19
- });
12
+ .catch(console.error);
20
13
  }
21
14
  });
22
15
  }
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { registerPlugin } from '@capacitor/core';
2
2
  import info from './info.json';
3
3
  console.log(`loaded ${info.name} v${info.version}`);
4
4
  const proxy = registerPlugin('BiometricAuthNative', {
5
- web: async () => import('./web').then((module) => new module.BiometricAuthWeb(proxy)),
5
+ web: async () => import('./web').then((module) => new module.BiometricAuthWeb()),
6
6
  ios: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy)),
7
7
  android: async () => import('./native').then((module) => new module.BiometricAuthNative(proxy))
8
8
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@aparajita/capacitor-biometric-auth",
3
- "version": "3.1.0"
3
+ "version": "3.1.3"
4
4
  }
@@ -1,7 +1,8 @@
1
1
  import { BiometricAuthBase } from './base';
2
- import type { AuthenticateOptions, CheckBiometryResult } from './definitions';
2
+ import type { AuthenticateOptions, BiometricAuthPlugin, CheckBiometryResult } from './definitions';
3
3
  import { BiometryType } from './definitions';
4
4
  export declare class BiometricAuthNative extends BiometricAuthBase {
5
+ constructor(capProxy: BiometricAuthPlugin);
5
6
  checkBiometry(): Promise<CheckBiometryResult>;
6
7
  authenticate(options?: AuthenticateOptions): Promise<void>;
7
8
  setBiometryType(type: BiometryType | string | undefined): Promise<void>;
@@ -2,6 +2,11 @@ import { BiometricAuthBase } from './base';
2
2
  import { BiometryType } from './definitions';
3
3
  // eslint-disable-next-line import/prefer-default-export
4
4
  export class BiometricAuthNative extends BiometricAuthBase {
5
+ constructor(capProxy) {
6
+ super();
7
+ this.checkBiometry = capProxy.checkBiometry;
8
+ this.authenticate = capProxy.authenticate;
9
+ }
5
10
  async checkBiometry() {
6
11
  // Never used, satisfy the compiler
7
12
  return Promise.resolve({
@@ -7,7 +7,7 @@ var app = require('@capacitor/app');
7
7
 
8
8
  var info = {
9
9
  name: "@aparajita/capacitor-biometric-auth",
10
- version: "3.1.0"
10
+ version: "3.1.3"
11
11
  };
12
12
 
13
13
  exports.BiometryType = void 0;
@@ -85,28 +85,21 @@ function getBiometryName(type) {
85
85
 
86
86
  console.log(`loaded ${info.name} v${info.version}`);
87
87
  const proxy = core.registerPlugin('BiometricAuthNative', {
88
- web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb(proxy)),
88
+ web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
89
89
  ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
90
90
  android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
91
91
  });
92
92
 
93
93
  // eslint-disable-next-line import/prefer-default-export
94
94
  class BiometricAuthBase extends core.WebPlugin {
95
- constructor(plugin) {
96
- super();
97
- this._plugin = plugin;
98
- }
99
95
  addResumeListener(listener) {
100
96
  return app.App.addListener('appStateChange', ({ isActive }) => {
101
97
  if (isActive) {
102
- this._plugin
103
- .checkBiometry()
98
+ this.checkBiometry()
104
99
  .then((info) => {
105
100
  listener(info);
106
101
  })
107
- .catch((error) => {
108
- console.error(error.message);
109
- });
102
+ .catch(console.error);
110
103
  }
111
104
  });
112
105
  }
@@ -164,6 +157,11 @@ var web = /*#__PURE__*/Object.freeze({
164
157
 
165
158
  // eslint-disable-next-line import/prefer-default-export
166
159
  class BiometricAuthNative extends BiometricAuthBase {
160
+ constructor(capProxy) {
161
+ super();
162
+ this.checkBiometry = capProxy.checkBiometry;
163
+ this.authenticate = capProxy.authenticate;
164
+ }
167
165
  async checkBiometry() {
168
166
  // Never used, satisfy the compiler
169
167
  return Promise.resolve({
package/dist/plugin.js CHANGED
@@ -3,7 +3,7 @@ var capacitorBiometricAuth = (function (exports, core, app) {
3
3
 
4
4
  var info = {
5
5
  name: "@aparajita/capacitor-biometric-auth",
6
- version: "3.1.0"
6
+ version: "3.1.3"
7
7
  };
8
8
 
9
9
  exports.BiometryType = void 0;
@@ -81,28 +81,21 @@ var capacitorBiometricAuth = (function (exports, core, app) {
81
81
 
82
82
  console.log(`loaded ${info.name} v${info.version}`);
83
83
  const proxy = core.registerPlugin('BiometricAuthNative', {
84
- web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb(proxy)),
84
+ web: async () => Promise.resolve().then(function () { return web; }).then((module) => new module.BiometricAuthWeb()),
85
85
  ios: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy)),
86
86
  android: async () => Promise.resolve().then(function () { return native; }).then((module) => new module.BiometricAuthNative(proxy))
87
87
  });
88
88
 
89
89
  // eslint-disable-next-line import/prefer-default-export
90
90
  class BiometricAuthBase extends core.WebPlugin {
91
- constructor(plugin) {
92
- super();
93
- this._plugin = plugin;
94
- }
95
91
  addResumeListener(listener) {
96
92
  return app.App.addListener('appStateChange', ({ isActive }) => {
97
93
  if (isActive) {
98
- this._plugin
99
- .checkBiometry()
94
+ this.checkBiometry()
100
95
  .then((info) => {
101
96
  listener(info);
102
97
  })
103
- .catch((error) => {
104
- console.error(error.message);
105
- });
98
+ .catch(console.error);
106
99
  }
107
100
  });
108
101
  }
@@ -160,6 +153,11 @@ var capacitorBiometricAuth = (function (exports, core, app) {
160
153
 
161
154
  // eslint-disable-next-line import/prefer-default-export
162
155
  class BiometricAuthNative extends BiometricAuthBase {
156
+ constructor(capProxy) {
157
+ super();
158
+ this.checkBiometry = capProxy.checkBiometry;
159
+ this.authenticate = capProxy.authenticate;
160
+ }
163
161
  async checkBiometry() {
164
162
  // Never used, satisfy the compiler
165
163
  return Promise.resolve({
@@ -22,7 +22,6 @@ public class BiometricAuthNative: CAPPlugin {
22
22
  ]
23
23
 
24
24
  var canEvaluatePolicy = true
25
- var count = 0
26
25
 
27
26
  /**
28
27
  * Check the device's availability and type of biometric authentication.
@@ -61,11 +60,6 @@ public class BiometricAuthNative: CAPPlugin {
61
60
  ])
62
61
  }
63
62
 
64
- @objc func test(_ call: CAPPluginCall) {
65
- call.resolve(["count": count])
66
- count += 1
67
- }
68
-
69
63
  /**
70
64
  * Prompt the user for authentication.
71
65
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aparajita/capacitor-biometric-auth",
3
- "version": "3.1.0",
3
+ "version": "3.1.3",
4
4
  "description": "Provides access to the native biometric auth APIs for Capacitor apps",
5
5
  "author": "Aparajita Fishman",
6
6
  "license": "MIT",
@@ -86,8 +86,7 @@
86
86
  "@capacitor/android": "^4.0.1",
87
87
  "@capacitor/app": "^4.0.1",
88
88
  "@capacitor/core": "^4.0.1",
89
- "@capacitor/ios": "^4.0.1",
90
- "tslib": "^2.4.0"
89
+ "@capacitor/ios": "^4.0.1"
91
90
  },
92
91
  "scripts": {
93
92
  "clean": "rimraf dist",