summaryrefslogtreecommitdiff
path: root/src/lib/pgp/trust.ts
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
commit79fd506d30eef3d113f4a8e3ab9ebd9004f1e8cc (patch)
tree96ff57c92e897c3cc3331e23043d20f1665c7d0a /src/lib/pgp/trust.ts
parenta1eac976b20e39f86d5944fbec68e2a0f8ffb746 (diff)
feat: index page
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/lib/pgp/trust.ts')
-rw-r--r--src/lib/pgp/trust.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/pgp/trust.ts b/src/lib/pgp/trust.ts
index cf022b4..34d454b 100644
--- a/src/lib/pgp/trust.ts
+++ b/src/lib/pgp/trust.ts
@@ -1,19 +1,20 @@
import type { Key } from "npm:openpgp@^6.1.1";
-import { TRUSTED_KEYS_DIR } from "../../consts.ts";
import { createKeysFromDir } from "./create.ts";
import type { AsyncYieldType } from "../../utils/iterator.ts";
import { equal, getCall } from "../../utils/anonymous.ts";
+import { env } from "../env.ts";
let trusted:
| Iterable<AsyncYieldType<ReturnType<typeof createKeysFromDir>>>
| undefined = undefined;
const fingerprints = () =>
+ // deno-lint-ignore no-undef
Iterator.from(trusted ?? []).map(getCall("getFingerprint"));
export async function keyTrust(key: Key): Promise<number> {
if (trusted === undefined) {
- trusted = await Array.fromAsync(createKeysFromDir(TRUSTED_KEYS_DIR));
+ trusted = await Array.fromAsync(createKeysFromDir(env.TRUSTED_KEYS_DIR));
}
return fingerprints().some(equal(key.getFingerprint())) ? 255 : 0;
}