This commit is contained in:
rustdesk 2022-01-19 00:57:57 +08:00
parent 9f42fd534c
commit d7d4b46c46
3 changed files with 13 additions and 0 deletions

View File

@ -11,6 +11,7 @@
"vite": "^2.7.2"
},
"dependencies": {
"fast-sha256": "^1.3.0",
"libsodium": "^0.7.9",
"ogv": "^1.8.6",
"ts-proto": "^1.101.0"

View File

@ -1,5 +1,6 @@
import * as message from "./message.js";
import * as rendezvous from "./rendezvous.js";
import * as sha256 from "fast-sha256";
type Keys = "message" | "open" | "close" | "error";
@ -76,4 +77,10 @@ export default class Websock {
let bytes = new Uint8Array(e.data);
}
}
hash(datas: [Uint8Array]): Uint8Array {
const hasher = new sha256.Hash();
datas.forEach((data) => hasher.update(data));
return hasher.digest();
}
}

View File

@ -190,6 +190,11 @@ esbuild@^0.13.12:
esbuild-windows-64 "0.13.15"
esbuild-windows-arm64 "0.13.15"
fast-sha256@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/fast-sha256/-/fast-sha256-1.3.0.tgz#7916ba2054eeb255982608cccd0f6660c79b7ae6"
integrity sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==
fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"