1.0.3 • Published 4 years ago
@ciright/ngx-cyberone v1.0.3
ngx-cyberone
Description
This is a ciright fido card connection library working with Angular 10+.
Installation
Local Installation
For local installation, copy the @ciright
folder in the dist
folder into your angular project's node_modules
as @ciright/ngx-cyberone
.
Note: the path for the library in node_modules after the copy should be node_modules/@ciright/ngx-cyberone
NPM Installation
Install the library into your project via npm
npm i --save @ciright/ngx-cyberone
Usage
- Import NgxFidoModule and provide global config variables
// app.module.ts
import { NgxFidoModule } from '@ciright/ngx-cyberone';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
NgxFidoModule.forRoot({
appId: 'Your App ID',
clientId: 'Your Client ID',
url: 'URL'
})
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {}
- Register Device
- Import the NgxFidoService in your component.
// app.component.ts
import { NgxFidoService } from '@ciright/ngx-cyberone';
@Component({...})
export class YourComponent {
constructor(private fidoService: NgxFidoService) {}
registerUser() {
this.fidoService.registerDevice("email@ciright.com", "https://fido.myciright.com", (err, result) => {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
}
}
- Authenticate Device
- Import the NgxFidoService in your component.
// app.component.ts
import { NgxFidoService } from '@ciright/ngx-cyberone';
@Component({...})
export class YourComponent {
constructor(private fidoService: NgxFidoService) {}
authenticateDevice() {
this.fidoService.authenticateDevice("email@ciright.com", "https://fido.myciright.com", true, true, (err, result) => {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
}
}
- Edit Authenticator
- Import the NgxFidoService in your component.
// app.component.ts
import { NgxFidoService } from '@ciright/ngx-cyberone';
@Component({...})
export class YourComponent {
constructor(private fidoService: NgxFidoService) {}
editAuthenticator() {
this.fidoService.editAuthenticator("email@ciright.com", "https://fido.myciright.com", (err, result) => {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
}
}
- DeRegister Device
- Import the NgxFidoService in your component.
// app.component.ts
import { NgxFidoService } from '@ciright/ngx-cyberone';
@Component({...})
export class YourComponent {
constructor(private fidoService: NgxFidoService) {}
deregisterDevice() {
this.fidoService.deregisterDevice("email@ciright.com", "https://fido.myciright.com", (err, result) => {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
}
}