Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ciright/ngx-fido

sunny1245170.1.3TypeScript support: included

Ciright Logo

readme

ngx-fido

Ciright Logo

Description

This is a ciright fido card connection library working with Angular 10+.

Installation

Install the library into your project via npm

npm i --save @ciright/ngx-fido

Usage

  • Import NgxFidoModule and provide global config variables `javascript // app.module.ts import { NgxFidoModule } from '@ciright/ngx-fido'; import { AppComponent } from './app.component';

@NgModule({ imports: [ BrowserModule, NgxFidoModule.forRoot({ url: 'YOUR_CIRIGHT_ENDPOINT--THIS_IS_OPTIONAL', token: 'YOUR_AUTH_TOKEN' }) ], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule {}


- Register New User
  - Import the **NgxFidoService** in your component.
```javascript
// app.component.ts
import { NgxFidoService } from '@ciright/ngx-fido';

@Component({...})
export class YourComponent {
    constructor(private fidoService: NgxFidoService) {}

    registerUser() {
        this.fidoService.registerUser(this.username, (err, result) => {
            if (err) {
                console.log(err);
            } else {
                console.log(result);
            }
        });
    }
}
  • Authenticate User
    • Import the NgxFidoService in your component. `javascript // app.component.ts import { NgxFidoService } from '@ciright/ngx-fido';

@Component({...}) export class YourComponent { constructor(private fidoService: NgxFidoService) {}

authenticateUser() {
    this.fidoService.authenticateUser(this.username, (err, result) => {
        if (err) {
            console.log(err);
        } else {
            console.log(result);
        }
    });
}

} `