Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Biometric support #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions angular/src/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
<div class="page centered">

<img class="logo" src="assets/icon-light-128x128.png">
<img class="logo" src="assets/icon-light-128x128.png">

<h1>{{uiState.manifest?.name}}</h1>
<div class="sub-title">{{ 'App.By' | translate }} {{uiState.manifest?.author}}</div>
<!-- <div class="sub-title">Version {{uiState.manifest.version}}</div> -->
<h1>{{uiState.manifest?.name}}</h1>
<div class="sub-title">{{ 'App.By' | translate }} {{uiState.manifest?.author}}</div>
<!-- <div class="sub-title">Version {{uiState.manifest.version}}</div> -->

<h2>{{ 'App.EnterPassordToUnlock' | translate }}</h2>
<h2>{{ 'App.EnterPassordToUnlock' | translate }}</h2>

<p>
<mat-slide-toggle [(ngModel)]="biometrics" color="primary"><span *ngIf="!uiState.iOS">Use Biometrics</span><span *ngIf="uiState.iOS">Use Face ID</span></mat-slide-toggle>
</p>

<div *ngIf="!biometrics">

<mat-form-field appearance="outline" class="input-full-width">
<mat-label>{{ 'App.Password' | translate }}</mat-label>
<input matInput type="password" [(ngModel)]="unlockPassword" (keydown.enter)="unlock()">
<mat-label>{{ 'App.Password' | translate }}</mat-label>
<input matInput type="password" [(ngModel)]="unlockPassword" (keydown.enter)="unlock()">
</mat-form-field>

<div class="error-list">
<mat-chip-list *ngIf="error">
<mat-chip-list *ngIf="error">

<mat-chip *ngIf="error" color="warn" selected (removed)="removeError()">{{error}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
</mat-chip-list>
<mat-chip *ngIf="error" color="warn" selected (removed)="removeError()">{{error}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
</mat-chip-list>
</div>

<button class="wide-button" mat-flat-button color="primary" (click)="unlock()">{{ 'App.Unlock' | translate }}</button>

</div>
</div>
</div>
4 changes: 4 additions & 0 deletions angular/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class HomeComponent implements OnInit, OnDestroy {
wallet: any;
error = '';
sub2: any;
biometrics: boolean;

constructor(public uiState: UIState, private translate: TranslateService, private crypto: CryptoService, private router: Router, private communication: CommunicationService, private secure: SecureStateService, public walletManager: WalletManager, private cd: ChangeDetectorRef) {
console.log('HOME COMPONENT!');
Expand All @@ -38,6 +39,8 @@ export class HomeComponent implements OnInit, OnDestroy {
// this.uiState.title = `Unlock ${this.walletManager.activeWallet.name}`;
this.uiState.title = await this.translate.get('App.UnlockTitle', { value: this.walletManager.activeWallet.name }).toPromise();

this.biometrics = this.walletManager.activeWallet.biometrics

if (this.secure.unlocked(this.walletManager.activeWallet?.id)) {
console.log('Wallet already unlocked!!');

Expand Down Expand Up @@ -66,6 +69,7 @@ export class HomeComponent implements OnInit, OnDestroy {
this.error = null;

if (this.walletManager.activeWallet) {

const unlocked = await this.walletManager.unlockWallet(this.walletManager.activeWallet.id, this.unlockPassword);
// this.manager.unlock(this.uiState.activeWallet.id, this.unlockPassword);

Expand Down
2 changes: 1 addition & 1 deletion angular/src/app/wallet/create/create.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h1>Create a password</h1>
<input matInput type="password" [(ngModel)]="password2" formControlName="password2Ctrl" placeholder="Confirm Password" required />
</mat-form-field>

<!-- <p><mat-slide-toggle color="primary" formControlName="biometricsCtrl"><span *ngIf="!uiState.iOS">Use Biometrics</span><span *ngIf="uiState.iOS">Use Face ID</span></mat-slide-toggle></p> -->
<p><mat-slide-toggle color="primary" formControlName="biometricsCtrl"><span *ngIf="!uiState.iOS">Use Biometrics</span><span *ngIf="uiState.iOS">Use Face ID</span></mat-slide-toggle></p>

<div>
<button class="signup-button" (click)="save()" [disabled]="!passwordValidated" mat-button mat-flat-button color="primary">Save</button>
Expand Down