This commit is contained in:
Lurkars
2020-11-02 08:29:52 +01:00
commit b7b4e2d032
126 changed files with 18263 additions and 0 deletions
@@ -0,0 +1,52 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AuthService } from './../../services/auth.service';
import { MatchingValidator } from './../../utils/matching.validator';
var openpgp = require('openpgp');
@Component({
selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.scss']
})
export class PasswordComponent implements OnInit {
model: any = {};
public working: boolean;
form: FormGroup;
constructor(private formBuilder: FormBuilder, private authService: AuthService) { }
ngOnInit(): void {
this.form = this.formBuilder.group({
username: ['', Validators.required],
privateKey: ['', Validators.required]
});
}
async passwordReset() {
const { keys: [privateKey] } = await openpgp.key.readArmored(this.model.privateKey);
console.log(privateKey.isPrivate());
const model = {
username: this.model.username
}
/*
const message = await openpgp.message.readArmored(encrypted);
const decrypted = await openpgp.decrypt({
message: message,
privateKeys: [privateKey]
});
console.log(decrypted);
// this.authService.passwordReset(model).subscribe(async response => { })
*/
}
}