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

Developers #34

Merged
merged 3 commits into from
Nov 2, 2020
Merged
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
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,27 @@ This project was generated with [Angular CLI](https://github.com/angular/angular

### Facilities

* Create a card with password and resource information
## Create a card with password and resource information
![Windows app](./pic/create-card-information.png)

* Saving a set of cards to a file
* Loading a set of cards from a file
* Contextual search in a set of cards
* Application versions for different operating systems
* Copying the password to the clipboard by pressing a button
* Opening a web resource by clicking on a link
* Localization
* Popular installers
* Tray app

## Localization
![Windows app](./pic/localization.png)

## Create certificate RSA
![Windows app](./pic/create-certificate.png)
![Windows app](./pic/rsa-list.png)


## Downloads
[![Windows app](./pic/win-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.9/password-generator-installer-1.0.9.exe)
[![Linux app](./pic/linux-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.9/password-generator-1.0.9.AppImage)
[![Mac app](./pic/mac-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.9/password-generator-1.0.9-mac.tar.gz)
[![Windows app](./pic/win-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.10/password-generator-installer-1.0.10.exe)
[![Linux app](./pic/linux-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.10/password-generator-1.0.10.AppImage)
[![Mac app](./pic/mac-dwnl.png)](https://github.com/digital-technology-agency/password-generator/releases/download/1.0.10/password-generator-1.0.10-mac.tar.gz)
1 change: 1 addition & 0 deletions certificates.certs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"","site":"Asd","certData":{"publicKey":{},"privateKey":{}},"publicData":"-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAzCYcStjKIzSAXCJz0PDUnJjdwB40TMH8u+T5163Az1Q66dXI6OA/\nYdtESgwqu0UwAYNsw3pWf+oC3m4/hn7Vs98WJ2/OMCT8OTRsIVVLyYAoN7SwEM0V\n+QFDmGnat0zo0z6YxaK+8qqZS545vTtnSdLaBOixkJSj6eGDeJAohVEpJe59ToFl\nIROVFmk0ymChyIWzXGoBA9NWwPWAFUQgg8S0oQf4g1rgVlrzNuMPPPwrhG5wGF8r\na7l2lbaDrXgKjD/CHqAz1U/kw2aDjsK9VSYr52dPJ8+mdBHEU4uxVie745/lpi/d\nXKbEvOBW2GgP0v2MR1Yyyb7JTUCgvKWznQIDAQAB\n-----END RSA PUBLIC KEY-----\n","privateData":"-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAzCYcStjKIzSAXCJz0PDUnJjdwB40TMH8u+T5163Az1Q66dXI\n6OA/YdtESgwqu0UwAYNsw3pWf+oC3m4/hn7Vs98WJ2/OMCT8OTRsIVVLyYAoN7Sw\nEM0V+QFDmGnat0zo0z6YxaK+8qqZS545vTtnSdLaBOixkJSj6eGDeJAohVEpJe59\nToFlIROVFmk0ymChyIWzXGoBA9NWwPWAFUQgg8S0oQf4g1rgVlrzNuMPPPwrhG5w\nGF8ra7l2lbaDrXgKjD/CHqAz1U/kw2aDjsK9VSYr52dPJ8+mdBHEU4uxVie745/l\npi/dXKbEvOBW2GgP0v2MR1Yyyb7JTUCgvKWznQIDAQABAoIBAAQI48nB55rTBI9t\nmeLhA561sbpEjo2Ozu8quxpdY4BlfoWVFVOu7OnC8uJQw75wQ17gSVPCtPdxuU1K\nmgRPOOuFZvNwFP/kFz0NMW7mN+l7WDAjqNAoMX06nmqievFg+oAETnIngYUbxIxX\nS/ZWuHefzHH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GRjtNd402MOQKoM/6g==\n-----END RSA PRIVATE KEY-----\n"}]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "password-generator",
"version": "1.0.9",
"version": "1.0.10",
"description": "Password save and copied",
"homepage": "https://dta.agency",
"author": {
Expand Down
Binary file added pic/create-card-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pic/create-certificate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic/localization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic/rsa-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/app/@core/local/locals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ export class Local {
Load: 'Load',
Save: 'Save',
Certificates: 'Certificates',
'Public key': 'Public key',
'Private key': 'Private key',
'Create certificate': 'Create certificate',
'Password cards': 'Password cards',
'Password length': 'Password length',
'Digits': 'Digits',
'Special': 'Special',
Comment: 'Comment',
Login: 'Login',
Site: 'Site',
Resource: 'Resource',
}
}

Expand All @@ -45,11 +51,17 @@ export class Local {
Load: 'Загрузить',
Save: 'Сохранить',
Certificates: 'Сертификаты',
'Public key': 'Публичный ключ',
'Private key': 'Приватный ключ',
'Create certificate': 'Создать сертификат',
'Password cards': 'Карточки ресурсов',
'Password length': 'Длинна пароля',
'Digits': 'Цифры',
'Special': 'Спец. символы',
Comment: 'Коментарий',
Login: 'Логин',
Site: 'Сайт',
Resource: 'Ресурс',
}
}
}
30 changes: 30 additions & 0 deletions src/app/@core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,34 @@ export class MakePassword {
result += '!';
return result;
}

static generateWithOptions(options: any) {
var length = options.length;
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var digits = '0123456789';
var specialCharacters = '#!$';
var charactersLength = characters.length;
var specialCharactersLength = Math.floor(length / 3);
var digitsLength = Math.floor(length / 2);
var result = '';
for (var i = 0; i < length; i++) {
if (options.special) {
if (i == specialCharactersLength) {
result += specialCharacters.charAt(Math.floor(Math.random() * specialCharactersLength));
continue;
}
}
if (options.digits) {
if (i == digitsLength) {
result += digits.charAt(Math.floor(Math.random() * digitsLength));
continue;
}
}
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
if (options.special) {
result += '!';
}
return result;
}
}
34 changes: 0 additions & 34 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,3 @@
<a href="#" (click)="openActualVersion()" matTooltip="{{ 'Show actual version' | translate }}"
matTooltipPosition="above">{{footerText}}</a>
</mat-toolbar>

<!--<div class="body-wrapper">
<nav class="navbar navbar-light bg-white fixed-top">
<form class="form-inline">
<a href="#" class="navbar-brand">
<img src="assets/logo.png" width="50" height="50" alt="DTA">
</a>
<input class="btn btn-outline-success my-2 my-sm-0" type="button" value="{{ 'Add' | translate }}"
(click)="addItem()">
<input class="btn btn-outline-primary my-2 my-sm-0" type="button" value="{{ 'Load' | translate }}"
(click)="load()">
<input *ngIf="(cards.length > 0)" class="btn btn-outline-primary" type="button"
value="{{ 'Save' | translate }}"
(click)="save()">
<input class="btn btn-outline-success my-2 my-sm-0" type="button" value="{{ 'Password cards' | translate }}"
routerLink="/password-cards" routerLinkActive="active">
<input class="btn btn-outline-success my-2 my-sm-0" type="button" value="{{ 'Certificates' | translate }}"
routerLink="/certificates" routerLinkActive="active">
</form>
<form class="form-inline">
<input class="form-control mr-sm-2" type="search" placeholder="{{ 'Search' | translate }}"
aria-label="Search"
(search)="searchText = $event.target.value"
(keyup)="searchText = $event.target.value">
</form>
</nav>
<div class="container-fluid">
<router-outlet></router-outlet>
<div class="row">
<app-user-item (deleteClick)="removeItem($event)" [item]="item"
*ngFor="let item of cardItems"></app-user-item>
</div>
</div>
</div>-->
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {UserItemDialogComponent} from './user-item-dialog/user-item-dialog.component';
import {UserItemDialogComponent} from './dialogs/users/user-item-dialog/user-item-dialog.component';
import {MakePassword} from './@core/utils';
import {ElectronService} from './@core/electron.service';
import {TranslateService} from '@ngx-translate/core';
Expand Down
15 changes: 12 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {UserItemComponent} from './user-item/user-item.component';
import {UserItemComponent} from './password-cards/user-item/user-item.component';
import {MAT_DIALOG_DEFAULT_OPTIONS, MatDialogModule} from '@angular/material/dialog';
import {UserItemDialogComponent} from './user-item-dialog/user-item-dialog.component';
import {UserItemDialogComponent} from './dialogs/users/user-item-dialog/user-item-dialog.component';
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
import {FormsModule} from '@angular/forms';
import {MatInputModule} from '@angular/material/input';
Expand All @@ -28,6 +28,10 @@ import {MatMenuModule} from '@angular/material/menu';
import {MatTooltipModule} from '@angular/material/tooltip';
import {NewRsaCertComponent} from './dialogs/certs/new-rsa-cert/new-rsa-cert.component';
import {MatSelectModule} from '@angular/material/select';
import { CertificateItemComponent } from './certificates/certificate-item/certificate-item.component';
import {MatCardModule} from '@angular/material/card';
import {MatSliderModule} from '@angular/material/slider';
import {MatCheckboxModule} from '@angular/material/checkbox';

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
Expand All @@ -48,6 +52,10 @@ const MATERIAL_MODULES = [
MatListModule,
MatMenuModule,
MatTooltipModule,
MatSelectModule,
MatCardModule,
MatSliderModule,
MatCheckboxModule,
];

@NgModule({
Expand All @@ -57,6 +65,7 @@ const MATERIAL_MODULES = [
UserItemComponent,
CertificatesComponent,
PasswordCardsComponent,
CertificateItemComponent,
],
imports: [
BrowserModule,
Expand All @@ -75,7 +84,7 @@ const MATERIAL_MODULES = [
PortalModule,
ScrollingModule,
...MATERIAL_MODULES,
MatSelectModule,

],
exports: [],
providers: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<mat-card>
<mat-card-header>
<mat-card-title>
<mat-icon color="primary">card_membership</mat-icon>
<span>{{item.site}}</span>
</mat-card-title>
<mat-card-subtitle>
{{item.certData.publicKey.asymmetricKeyType | uppercase }}
<span>{{item.certData.publicKey.asymmetricKeySize}}</span>
</mat-card-subtitle>
</mat-card-header>
<!--<mat-card-content></mat-card-content>-->
<!-- <mat-card-actions></mat-card-actions>-->
</mat-card>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Component, Input, OnInit} from '@angular/core';

@Component({
selector: 'app-certificate-item',
templateUrl: './certificate-item.component.html',
styleUrls: ['./certificate-item.component.scss']
})
export class CertificateItemComponent implements OnInit {

@Input() item;

constructor() { }

ngOnInit(): void {
}

}
9 changes: 9 additions & 0 deletions src/app/certificates/certificates.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
<mat-icon color="primary">note_add</mat-icon>
</button>
<span>{{ 'Create certificate' | translate }}</span>
<button *ngIf="certificates.length > 0" mat-icon-button class="example-icon" (click)="save()">
<mat-icon color="primary">save</mat-icon>
</button>
<span *ngIf="certificates.length > 0">{{ 'Save' | translate }}</span>
</mat-toolbar>
<div class="container-fluid">
<div class="row">
<app-certificate-item [item]="item" *ngFor="let item of cardCertificates"></app-certificate-item>
</div>
</div>
10 changes: 10 additions & 0 deletions src/app/certificates/certificates.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
.example-spacer {
flex: 1 1 auto;
}

app-certificate-item {
max-width: 300px;
margin: 10px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

mat-card-header {
font-size: 12px;
}
60 changes: 58 additions & 2 deletions src/app/certificates/certificates.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,28 @@ import {ElectronService} from '../@core/electron.service';
})
export class CertificatesComponent implements OnInit {

certificates: any[] = [];
searchText: any;
fs: any;
fileExtension = '.certs';
electron: any;

constructor(public dialog: MatDialog,
private electron: ElectronService) {
private electronService: ElectronService) {
}

ngOnInit(): void {
this.fs = this.electronService.fs;
this.electron = this.electronService.electron;
}

get cardCertificates() {
if (!this.searchText) {
return this.certificates;
}
console.debug(this.searchText);
return this.certificates.filter(f => f.site.toLowerCase().indexOf(this.searchText.toLowerCase()) > -1
|| f.comment.toLowerCase().indexOf(this.searchText.toLowerCase()) > -1);
}

createRsa() {
Expand All @@ -24,9 +41,48 @@ export class CertificatesComponent implements OnInit {
data: {
title: 'Create certificate',
item: {
certData: this.electron.crypto.generateKeyPairSync("rsa", {modulusLength: 2048}),
name: '',
site: '',
certData: this.electronService.crypto.generateKeyPairSync("rsa", {modulusLength: 2048}),
},
},
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
result.publicData = result.certData.publicKey.export({
type: "pkcs1",
format: "pem",
});
result.privateData = result.certData.privateKey.export({
type: "pkcs1",
format: "pem",
});
this.certificates.push(result);
console.debug('Add cert: ', result);
}
});
}

save() {
this.electron.remote.dialog.showSaveDialog({
properties: ['createDirectory', 'showOverwriteConfirmation'],
filters: [
{name: 'User configuration', extensions: [this.fileExtension]},
{name: 'All Files', extensions: ['*']},
],
defaultPath: `certificates${this.fileExtension}`,
},
).then(file => {
if (!file.canceled) {
this.fs.writeFileSync(file.filePath.toString(), JSON.stringify(this.certificates), (err) => {
if (err) {
console.debug("An error ocurred creating the file " + err.message);
}
console.debug("The file has been succesfully saved");
});
}
}).catch(err => {
console.debug(err);
})
}
}
18 changes: 14 additions & 4 deletions src/app/dialogs/certs/new-rsa-cert/new-rsa-cert.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<div mat-dialog-title>{{data.title | translate }}</div>
<div class="row">
<mat-form-field class="col-md-6" appearance="fill">
<mat-label>Public</mat-label>
<textarea rows="10" matInput [value]="certPublicInfo"></textarea>
<mat-label>{{ 'Resource' | translate }}</mat-label>
<input type="text" matInput [(ngModel)]="data.item.site">
</mat-form-field>
</div>
<div class="row">
<mat-form-field class="col-md-6" appearance="fill">
<mat-label>{{ 'Public key' | translate }}</mat-label>
<textarea style="font-size: 12px;" rows="10" matInput [value]="certPublicInfo"></textarea>
</mat-form-field>
<mat-form-field class="col-md-6" appearance="fill">
<mat-label>Private</mat-label>
<textarea rows="10" matInput [value]="certPrivateInfo"></textarea>
<mat-label>{{ 'Private key' | translate }}</mat-label>
<textarea style="font-size: 12px;" rows="10" matInput [value]="certPrivateInfo"></textarea>
</mat-form-field>
</div>
<mat-dialog-actions align="end">
<button class="btn-success" mat-button [mat-dialog-close]="data.item"
cdkFocusInitial>{{ 'Save' | translate }}</button>
</mat-dialog-actions>
Loading