mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
refactor(services): use named imports from utils
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user