From b98dd65f988bcf64af097ba8696c8b1fd557d5d8 Mon Sep 17 00:00:00 2001 From: Devin Ivy Date: Fri, 29 Dec 2023 18:43:11 -0500 Subject: [PATCH] remove bsky auth for testing purposes --- packages/bsky/src/auth.ts | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/bsky/src/auth.ts b/packages/bsky/src/auth.ts index ba58638d4f9..36dedb31e0c 100644 --- a/packages/bsky/src/auth.ts +++ b/packages/bsky/src/auth.ts @@ -7,28 +7,17 @@ import { ServerConfig } from './config' const BASIC = 'Basic ' const BEARER = 'Bearer ' +// @NOTE this is not safe for production! it has been modified for testing purposes to sidestep jwt auth, allow providing a did directly. export const authVerifier = ( - idResolver: IdResolver, + _idResolver: IdResolver, opts: { aud: string | null }, ) => { - const getSigningKey = async ( - did: string, - forceRefresh: boolean, - ): Promise => { - const atprotoData = await idResolver.did.resolveAtprotoData( - did, - forceRefresh, - ) - return atprotoData.signingKey - } - return async (reqCtx: { req: express.Request; res: express.Response }) => { - const jwtStr = getJwtStrFromReq(reqCtx.req) - if (!jwtStr) { + const did = getJwtStrFromReq(reqCtx.req) + if (!did) { throw new AuthRequiredError('missing jwt', 'MissingJwt') } - const payload = await verifyJwt(jwtStr, opts.aud, getSigningKey) - return { credentials: { did: payload.iss }, artifacts: { aud: opts.aud } } + return { credentials: { did }, artifacts: { aud: opts.aud } } } }