Fix formatting and trailing whitespace
This commit is contained in:
parent
da59efa23a
commit
f784e45d86
@ -5,7 +5,7 @@
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import { fromBase64 } from "../lib/Base64.mjs"
|
||||
import { fromBase64 } from "../lib/Base64.mjs";
|
||||
|
||||
/**
|
||||
* Flask Session Decode operation
|
||||
|
||||
@ -69,7 +69,7 @@ class FlaskSessionSign extends Operation {
|
||||
const view = new DataView(buffer);
|
||||
view.setInt32(0, currentTimeStamp, false);
|
||||
const bytes = new Uint8Array(buffer);
|
||||
let binary = '';
|
||||
let binary = "";
|
||||
bytes.forEach(b => binary += String.fromCharCode(b));
|
||||
const timeB64 = toBase64(Utils.strToByteArray(binary));
|
||||
const time = timeB64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
||||
|
||||
@ -91,7 +91,7 @@ class FlaskSessionVerify extends Operation {
|
||||
const signB64 = toBase64(sign.finalize());
|
||||
const sign64 = signB64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
||||
|
||||
if (sign64 !== parts[2]){
|
||||
if (sign64 !== parts[2]) {
|
||||
throw new OperationError("Invalid signature!");
|
||||
}
|
||||
|
||||
|
||||
@ -13,12 +13,12 @@ const validKey = "mysecretkey";
|
||||
const outputObject = {
|
||||
user: "admin",
|
||||
role: "superuser",
|
||||
}
|
||||
};
|
||||
|
||||
const outputVerify = {
|
||||
valid: true,
|
||||
payload: outputObject,
|
||||
}
|
||||
};
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
@ -53,4 +53,4 @@ TestRegister.addTests([
|
||||
}
|
||||
]
|
||||
},
|
||||
])
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user