-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dd6da4
commit fbb2f01
Showing
11 changed files
with
240 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/app/grouped-account-select/backup-seed-dialog/backup-seed-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<div class="dialog"> | ||
<header class="dialog__header"> | ||
<button class="dialog__x" style="top: 0; right: 0" (click)="onCancel()"> | ||
<i-feather name="x" /> | ||
</button> | ||
<h1 class="dialog__title">Backup Recovery Data</h1> | ||
</header> | ||
<div class="dialog__body"> | ||
<div *ngIf="!this.secrets" class="text--center"> | ||
<p class="margin-bottom--small"> | ||
Your seed phrase is the only way to recover your DeSo account. If you | ||
lose your seed phrase, you will lose access to your DeSo account. Store | ||
it in a safe and secure place. | ||
</p> | ||
<p class="margin-bottom--small font-size--large text--neutral-white"> | ||
<strong | ||
>DO NOT share your seed phrase with anyone! DeSo support agents will | ||
never request this.</strong | ||
> | ||
</p> | ||
<footer class="display--flex"> | ||
<button | ||
class="button--medium button--primary margin-right--small" | ||
(click)="onContinue()" | ||
> | ||
Continue | ||
</button> | ||
<button class="button--medium button--secondary" (click)="onCancel()"> | ||
Cancel | ||
</button> | ||
</footer> | ||
</div> | ||
|
||
<ng-container *ngIf="this.secrets"> | ||
<div class="margin-bottom--small"> | ||
<p>Seed Phrase</p> | ||
<recovery-secret [secret]="this.secrets.mnemonic" /> | ||
</div> | ||
<div *ngIf="this.secrets.extraText" class="margin-bottom--small"> | ||
<p>Pass Phrase</p> | ||
<recovery-secret [secret]="this.secrets.extraText" /> | ||
</div> | ||
<div> | ||
<p>Seed Hex</p> | ||
<recovery-secret [secret]="this.secrets.seedHex" /> | ||
</div> | ||
<button | ||
class="button--primary button--medium margin-top--large" | ||
(click)="onDisableExport()" | ||
> | ||
Disable recovery data backup | ||
</button> | ||
<p class="font-size--small text--center margin-top--xsmall"> | ||
Disabling backup is recommended because it makes your account more | ||
secure by preventing anyone from revealing your seed phrase in the | ||
future, even if they've gained access to your device. | ||
<strong>Note that this action is irrevocable;</strong> Only disable | ||
backup once you're sure that you've copied your seed phrase and stored | ||
it in a safe place. | ||
</p> | ||
</ng-container> | ||
</div> | ||
</div> |
Empty file.
44 changes: 44 additions & 0 deletions
44
src/app/grouped-account-select/backup-seed-dialog/backup-seed-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { AccountService } from '../../account.service'; | ||
|
||
@Component({ | ||
selector: 'backup-seed-dialog', | ||
templateUrl: './backup-seed-dialog.component.html', | ||
styleUrls: ['./backup-seed-dialog.component.scss'], | ||
}) | ||
export class BackupSeedDialogComponent { | ||
secrets?: { | ||
mnemonic: string; | ||
extraText: string; | ||
seedHex: string; | ||
}; | ||
|
||
constructor( | ||
public dialogRef: MatDialogRef<BackupSeedDialogComponent>, | ||
@Inject(MAT_DIALOG_DATA) public data: { rootPublicKey: string }, | ||
private accountService: AccountService | ||
) {} | ||
|
||
onCancel(): void { | ||
this.dialogRef.close(); | ||
} | ||
|
||
onContinue() { | ||
if (!this.data.rootPublicKey) { | ||
throw new Error('Root public key is required'); | ||
} | ||
|
||
const { mnemonic, extraText, seedHex } = this.accountService.getAccountInfo( | ||
this.data.rootPublicKey | ||
); | ||
this.secrets = { mnemonic, extraText, seedHex }; | ||
} | ||
|
||
onDisableExport() { | ||
this.accountService.updateAccountInfo(this.data.rootPublicKey, { | ||
exportDisabled: true, | ||
}); | ||
this.dialogRef.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/app/grouped-account-select/recovery-secret/recovery-secret.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div class="input--textarea input--seed margin-bottom--small" style="background-color: black; overflow: hidden;"> | ||
{{ this.isRevealed ? secret : maskSecret(secret) }} | ||
</div> | ||
<div class="margin-left--xsmall display--flex"> | ||
<button | ||
(click)="copySecret()" | ||
class="button--primary button--small margin-left--auto" | ||
style="width: auto" | ||
> | ||
<i-feather [name]="copySuccess ? 'check' : 'copy'" /> | ||
</button> | ||
<button | ||
(click)="toggleRevealSecret()" | ||
class="button--secondary button--small margin-left--small" | ||
style="width: auto" | ||
> | ||
<i-feather [name]="!this.isRevealed ? 'eye' : 'eye-off'" /> | ||
</button> | ||
</div> |
Empty file.
30 changes: 30 additions & 0 deletions
30
src/app/grouped-account-select/recovery-secret/recovery-secret.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'recovery-secret', | ||
templateUrl: './recovery-secret.component.html', | ||
styleUrls: ['./recovery-secret.component.scss'], | ||
}) | ||
export class RecoverySecretComponent { | ||
@Input() secret = ''; | ||
|
||
isRevealed = false; | ||
copySuccess = false; | ||
|
||
maskSecret(secret = '') { | ||
return secret.slice().replace(/\S/g, '*'); | ||
} | ||
|
||
copySecret() { | ||
window.navigator.clipboard.writeText(this.secret).then(() => { | ||
this.copySuccess = true; | ||
setTimeout(() => { | ||
this.copySuccess = false; | ||
}, 1500); | ||
}); | ||
} | ||
|
||
toggleRevealSecret() { | ||
this.isRevealed = !this.isRevealed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters