refactor(services): use named imports from utils

This commit is contained in:
Panagiotis Papadopoulos
2025-01-02 13:47:44 +01:00
parent 3814621e1c
commit 7fe23c7ac2
34 changed files with 122 additions and 122 deletions

View File

@@ -1,5 +1,5 @@
import becca from "../becca/becca.js";
import utils from "./utils.js";
import { fromBase64, randomSecureToken } from "./utils.js";
import BEtapiToken from "../becca/entities/betapi_token.js";
import crypto from "crypto";
@@ -12,7 +12,7 @@ function getTokenHash(token: crypto.BinaryLike) {
}
function createToken(tokenName: string) {
const token = utils.randomSecureToken(32);
const token = randomSecureToken(32);
const tokenHash = getTokenHash(token);
const etapiToken = new BEtapiToken({
@@ -34,7 +34,7 @@ function parseAuthToken(auth: string | undefined) {
// allow also basic auth format for systems which allow this type of authentication
// expect ETAPI token in the password field, require "etapi" username
// https://github.com/zadam/trilium/issues/3181
const basicAuthStr = utils.fromBase64(auth.substring(6)).toString("utf-8");
const basicAuthStr = fromBase64(auth.substring(6)).toString("utf-8");
const basicAuthChunks = basicAuthStr.split(":");
if (basicAuthChunks.length !== 2) {