Well it turned out, TextEncoder does NOT accept encoding label

This commit is contained in:
NI
2019-09-15 07:42:58 +08:00
parent de8afbb6ce
commit adb6408428
4 changed files with 5 additions and 5 deletions

View File

@@ -116,7 +116,7 @@ function startApp(rootEl) {
return this.authErr.length > 0 || this.loadErr.length > 0;
},
async getSocketAuthKey(privateKey, randomKey) {
const enc = new TextEncoder("utf-8");
const enc = new TextEncoder();
return new Uint8Array(
await cipher.hmac512(enc.encode(privateKey), enc.encode(randomKey))

View File

@@ -752,7 +752,7 @@ class Wizard {
if (config.credential.length > 0) {
sd.send(
CLIENT_CONNECT_RESPOND_CREDENTIAL,
new TextEncoder("utf-8").encode(config.credential)
new TextEncoder().encode(config.credential)
);
return this.stepContinueWaitForEstablishWait();
@@ -782,7 +782,7 @@ class Wizard {
sd.send(
CLIENT_CONNECT_RESPOND_CREDENTIAL,
new TextEncoder("utf-8").encode(vv)
new TextEncoder().encode(vv)
);
newCredential(vv);

View File

@@ -91,7 +91,7 @@ class Control {
return;
}
return this.sender(new TextEncoder("utf-8").encode(data));
return this.sender(new TextEncoder().encode(data));
}
color() {

View File

@@ -97,7 +97,7 @@ class Dial {
*
*/
async buildKeyString() {
const enc = new TextEncoder("utf-8");
const enc = new TextEncoder();
let rTime = Number(Math.trunc(new Date().getTime() / 100000)),
key = await crypt.hmac512(