mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
Fix type of controller.auth_secret
This commit is contained in:
7 files changed
+21
-45
No files matched your search
@@ -261,6 +261,11 @@ export default class Controller {
|
||||
this.users.records.on("update", this.usersUpdated.bind(this));
|
||||
}
|
||||
|
||||
get authSecret() {
|
||||
// Auth secret is never null after startup
|
||||
return Buffer.from(this.config.get("controller.auth_secret")!, "base64");
|
||||
}
|
||||
|
||||
async start(args: ControllerArgs) {
|
||||
if (this._state !== "new") {
|
||||
throw new Error(`Cannot start in state ${this._state}`);
|
||||
@@ -876,10 +881,7 @@ export default class Controller {
|
||||
* @param hostId - ID of host to generate a token for.
|
||||
*/
|
||||
generateHostToken(hostId: number): string {
|
||||
return jwt.sign(
|
||||
{ aud: "host", host: hostId },
|
||||
Buffer.from(this.config.get("controller.auth_secret"), "base64")
|
||||
);
|
||||
return jwt.sign({ aud: "host", host: hostId }, this.authSecret);
|
||||
}
|
||||
|
||||
hostsUpdated(hosts: HostRecord[]) {
|
||||
|
||||
Reference in new issue
Block a user