From 7b4572670bab2e29ad86d397a88670733a216a26 Mon Sep 17 00:00:00 2001 From: timonson Date: Tue, 14 May 2024 19:08:47 +0200 Subject: [PATCH] Update --- functions/deps.ts | 2 +- functions/jwt.ts | 11 ----------- middlewares/deps.ts | 3 ++- middlewares/rpc.ts | 4 ++-- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/functions/deps.ts b/functions/deps.ts index 59deda0..fbc6b49 100644 --- a/functions/deps.ts +++ b/functions/deps.ts @@ -43,4 +43,4 @@ export { } from "https://dev.zaubrik.com/sorcery@v0.1.5/type.js"; export { type AuthInput, -} from "https://dev.zaubrik.com/schicksal@v0.1.3/server/response.ts"; +} from "https://dev.zaubrik.com/schicksal@v0.1.4/server/mod.ts"; diff --git a/functions/jwt.ts b/functions/jwt.ts index 9c02463..991f44f 100644 --- a/functions/jwt.ts +++ b/functions/jwt.ts @@ -1,5 +1,4 @@ import { - type AuthInput, create, decodeJwt, isObject, @@ -87,16 +86,6 @@ export async function createJwt( } } -export function ensureVerifyFunction(authInput: AuthInput) { - const verification = authInput.verification; - return { - ...authInput, - verification: typeof verification === "function" - ? verification - : verifyJwt(verification), - }; -} - export function verifyJwt(input: CryptoKeyOrUpdateInput) { const cryptoKeyPromiseOrNull = isUpdateInput(input) ? fetchRsaCryptoKey(input.url, input.algorithm) diff --git a/middlewares/deps.ts b/middlewares/deps.ts index 04c506c..c8cebcf 100644 --- a/middlewares/deps.ts +++ b/middlewares/deps.ts @@ -47,10 +47,11 @@ export { } from "https://dev.zaubrik.com/composium@v0.1.2/mod.ts"; export { type AuthInput, + ensureVerify, type Methods, type Options, respond, -} from "https://dev.zaubrik.com/schicksal@v0.1.3/server/response.ts"; +} from "https://dev.zaubrik.com/schicksal@v0.1.4/server/response.ts"; export { mergeUrl, diff --git a/middlewares/rpc.ts b/middlewares/rpc.ts index 2c867ef..bbaaa6b 100644 --- a/middlewares/rpc.ts +++ b/middlewares/rpc.ts @@ -1,11 +1,11 @@ import { type AuthInput, type Context, + ensureVerify, type Methods, type Options, respond, } from "./deps.ts"; -import { ensureVerifyFunction } from "../functions/jwt.ts"; export function rpcRespond( methods: Methods, @@ -13,7 +13,7 @@ export function rpcRespond( authInput?: AuthInput | AuthInput[], ) { const authInputArray = authInput - ? [authInput].flat().map(ensureVerifyFunction) + ? [authInput].flat().map(ensureVerify) : undefined; return async (ctx: C) => { const rpcMethods = options.methodsUrl