Adding isCompatible():

This commit is contained in:
2020-07-06 13:28:51 +02:00
parent 9a8c414936
commit 9beadebac6
2 changed files with 11 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ export class ScanComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.schema.raw = "op1:pDjJuCq2aT7UoFRT:pnMKwwkTVZ:nF84HZ9zHkEKrm3RJRsBZ6P8+ipin9CNR/1KTlW2oFazK1s+XnhVApxy0g2J57NuX0l5VwpEP9XlGRcCgg3gkwfTJeOBf0wKgj6kEfJcUmoRV9JNPtHNd0riFBbxzb7QsKiT5L2Odr6ETpak76hTDA0naj3n0NfSX9zq2WyA6z8CsU7pUkrDmLqr2WJIw46JZXnj0mFytyf6H4dBSuk6Z0sxHw=="
this.schema.decrypted_raw = "%JtuB4O9M42%Gitea|Nicolas|542superGoOD_pW&|klier.nicolas@protonmail.com|https://nicolasklier.de:3000|($vb)$O4|()What's your favorite series%Rick and morty|(2fa)otpauth://totp/OffPass%20Test?secret=d34gfkki5dkd5knifysrpgndd5xb2c7eddwki7ya4pvoisfa5c3ko5pv&issuer=Nicolas%20Klier" this.schema.decrypted_raw = "%JtuB4O9M42%Gitea|Nicolas|542superGoOD_pW&|klier.nicolas@protonmail.com|https://nicolasklier.de:3000|($vb)$O4|()What's your favorite series%Rick and morty|(2fa)otpauth://totp/OffPass%20Test?secret=d34gfkki5dkd5knifysrpgndd5xb2c7eddwki7ya4pvoisfa5c3ko5pv&issuer=Nicolas%20Klier"
this.schema.parse() this.schema.parse()
} }

View File

@@ -25,6 +25,8 @@ export interface IFormat {
}) })
export class SchemaService { export class SchemaService {
CURRENT_VERSION:number = 1
raw: String = "" raw: String = ""
decrypted_raw: String = "" decrypted_raw: String = ""
@@ -42,22 +44,24 @@ export class SchemaService {
}; };
isCompatible(): boolean { isCompatible(): boolean {
return true; const version = this.raw.split(":")[0]
const version_number = Number(version.substring(2, version.length))
if(version.startsWith("op")){
if(version_number == this.CURRENT_VERSION){
return true
}
}
return false
} }
decrypt() { decrypt() {
if (this.isCompatible) { if (this.isCompatible) {
} }
} }
encrypt() { encrypt() {
} }
parse() { parse() {
const parts = this.decrypted_raw.split('|') const parts = this.decrypted_raw.split('|')