diff --git a/libraries/deno-commons-mod.ts b/libraries/deno-commons-mod.ts index 934f11f..632ea00 100644 --- a/libraries/deno-commons-mod.ts +++ b/libraries/deno-commons-mod.ts @@ -1,23 +1,15 @@ // Reference: // - https://docs.deno.com/runtime/fundamentals/testing/ -import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64"; -import { encodeBase32 } from "jsr:@std/encoding/base32"; -import { dirname, fromFileUrl } from "jsr:@std/path"; -import { toArrayBuffer } from "jsr:@std/streams"; -import { spawn, SpawnOptionsWithoutStdio } from "node:child_process"; -import { - createWriteStream, - mkdir, - readFile, - readFileSync, - rm, - stat, - writeFile, -} from "node:fs"; -import { pipeline } from "node:stream"; -import { promisify } from "node:util"; -import { getRandomValues } from "node:crypto"; +import {decodeBase64, encodeBase64} from "jsr:@std/encoding/base64"; +import {encodeBase32} from "jsr:@std/encoding/base32"; +import {dirname, fromFileUrl} from "jsr:@std/path"; +import {toArrayBuffer} from "jsr:@std/streams"; +import {spawn, SpawnOptionsWithoutStdio} from "node:child_process"; +import {createWriteStream, mkdir, readFile, readFileSync, rm, stat, writeFile,} from "node:fs"; +import {pipeline} from "node:stream"; +import {promisify} from "node:util"; +import {getRandomValues} from "node:crypto"; // reference: https://docs.deno.com/examples/hex_base64_encoding/ // import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64"; @@ -1029,7 +1021,9 @@ async function __getMasterEncryptionKey1(): Promise { async function __getMasterEncryptionKey2(): Promise { if (!__masterEncryptionKey2) { - const filename = "~/.deno-common-mod-master-encryption-key-2"; + const filename = resolveFilename( + "~/.deno-common-mod-master-encryption-key-2", + ); __masterEncryptionKey2 = await readFileToString(filename); if (!__masterEncryptionKey2) { __masterEncryptionKey2 = encodeBase64(random(4096)); @@ -1124,7 +1118,9 @@ export async function readWithLocalCache( throw new Error("Key and read callback function are both required."); } const cacheKeyHash = await sha256AndBase32OfString(cacheKey); - const basePath = options?.basePath ?? "~/.cache/local-cache"; + const basePath = resolveFilename( + options?.basePath ?? "~/.cache/local-cache", + ); const cacheDir = joinPath( basePath, cacheKeyHash.substring(0, 2), diff --git a/script-meta-v2.json b/script-meta-v2.json index 3454994..60b6879 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -118,11 +118,11 @@ "get-secret.ts": { "script_name": "get-secret.ts", "script_length": 739, - "script_sha256": "e036f5411904d53f7525f4830eb51282df3a9f07a3e6f8b23d5385b4f24ec676", + "script_sha256": "0d4123bc38361c42044050eb46296c443168dd9c882db8b1282e858043096e63", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/get-secret.ts", "single_script_file": true, "publish_time": 1775239056991, - "update_time": 1775453129788 + "update_time": 1775487544902 }, "git-check.ts": { "script_name": "git-check.ts", diff --git a/single-scripts/get-secret.ts b/single-scripts/get-secret.ts index a6f50f3..f7d85b9 100755 --- a/single-scripts/get-secret.ts +++ b/single-scripts/get-secret.ts @@ -1,6 +1,6 @@ #!/usr/bin/env -S deno run -A -import {args, exit, getSecretValue,} from "https://script.hatter.ink/@66/deno-commons-mod.ts"; +import {args, exit, getSecretValue,} from "https://script.hatter.ink/@67/deno-commons-mod.ts"; import {parseArgs} from "jsr:@std/cli/parse-args"; const flags = parseArgs(args(), {