npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@phemium-costaisa/fingerprint-auth

v1.0.13

Published

Automatic plugin to work with FaceID and TouchID authentication

Downloads

20

Readme

Phemium Fingerprint Auth

Description

Package of component, pipe and service to handle Fingerprint authentication on Angular apps.

Installation

Run npm i -S @phemium-costaisa/fingerprint-auth

Configuration

  1. Add the FingerprintAuthModule.forRoot() to app.module.ts:
import { FingerprintAuthModule } from 'fingerprint-auth';

@NgModule({
  imports: [
    FingerprintAuthModule.forRoot({
      mobile: environment.platform === 'mobile'
    })
  ]
})
export class AppModule {}
  1. Add FingerprintAuthModule.forChild() where the biometricLoginActive needs to be used:
import { FingerprintAuthModule } from 'fingerprint-auth';

@NgModule({
  imports: [
    FingerprintAuthModule.forChild()
  ]
})
export class LoginMobilePageModule {}

Biometric Activator component usage

To use the <app-biometric-activador> just import the BiometricActivator component in the module you need it.

But, if you need to make it as routing page, you must create a Wrapper module for it, like this:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { BiometricActivator } from 'fingerprint-auth';

const routes: Routes = [
  {
    path: '',
    component: BiometricActivator
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class BiometricActivatorPageRoutingModule {}

FingerprintService usage

Just import the FingerprintService wherever you need it:

import { FingerprintService } from 'fingerprint-auth';

@Component()
export class MyComponent {
  constructor(
    private fingerprintService: FingerprintService
  ) { }
}

The FingerprintService is well documented in-code, but I'll give a few examples:

  1. To login
if (await this.fingerprintService.checkIfNeedsBiometric(email)) {
    this.fingerprintService.showBiometricActivator(email, password, 'dashboard');
}
  1. To configure Biometric:
this.fingerprintService.showBiometricPrompt(user).then(result => {
    this.login(result.user, result.password, true);
});
  1. Profile page switches:
biometricFace = new FormControl(false);
biometricTouch = new FormControl(false);

ngOnInit() {
    this.fingerprintService.isBiometricActive(this.userService.user.email, 'face').then(active => this.biometricFace.setValue(active, { emitEvent: false }));
      this.fingerprintService.isBiometricActive(this.userService.user.email, 'touch').then(active => this.biometricTouch.setValue(active, { emitEvent: false }));
      this.fingerprintService.retrieveDeviceBiometrics().then(biometrics => {
        if (biometrics.face || biometrics.touch) {
          this.showBiometric = true;
        }
      })
    }
    this.biometricFace.valueChanges.subscribe(enable => this.biometricChange('face', enable));
    this.biometricTouch.valueChanges.subscribe(enable => this.biometricChange('touch', enable));
}

async biometricChange(biometricType: keyof BiometricsAvailable, enabled: boolean) {
    if (enabled) {
      await this.fingerprintService.clearBiometricData(this.userService.user.email, biometricType);
    } else {
      await this.fingerprintService.disableBiometricData(this.userService.user.email, biometricType);
    }
}