changed passwordHash object

goal was do prevent fingerprint change to destroy decryption
This commit is contained in:
maru21 2023-09-17 18:07:16 +02:00
parent ce8e56290f
commit 798ab52dcb
16 changed files with 28 additions and 7 deletions

View File

@ -16,7 +16,7 @@
<link rel="stylesheet" href="css/font-awesome/css/all.min.css" />
<link rel="stylesheet" href="css/styles.css" />
<script type="module" src="js/9.4/main.js"></script>
<script type="module" src="js/9.5/main.js"></script>
<body>

View File

@ -5,24 +5,45 @@ import getBrowserFingerprint from "./identify.js"
export const passwordHash = {
name: "anae3Iegbai1ahLu",
fp: getBrowserFingerprint( { hardwareOnly: true } ),
toString: () => {
let fp = getBrowserFingerprint( { hardwareOnly: true } );
let data;
try {
data = window.sessionStorage.getItem(sha256(fp));
data = window.sessionStorage.getItem(sha256(passwordHash.name));
} catch (e) {
return "none";
}
if (data === null) return "none";
return XORCipher.decode(fp, data);
return XORCipher.decode(passwordHash.name, data);
},
getId: () => {
return passwordHash.fp;
},
set: (pw) => {
let fp = getBrowserFingerprint( { hardwareOnly: true } );
window.sessionStorage.setItem(sha256(fp), XORCipher.encode(fp, pw));
window.sessionStorage.setItem(sha256(passwordHash.name), XORCipher.encode(passwordHash.name, pw));
}
}
//export const passwordHash = {
// toString: () => {
// let fp = getBrowserFingerprint( { hardwareOnly: true } );
// let data;
// try {
// data = window.sessionStorage.getItem(sha256(fp));
// } catch (e) {
// return "none";
// }
// if (data === null) return "none";
// return XORCipher.decode(fp, data);
// },
//
// set: (pw) => {
// let fp = getBrowserFingerprint( { hardwareOnly: true } );
// window.sessionStorage.setItem(sha256(fp), XORCipher.encode(fp, pw));
// }
//}
function setPassword() {