Skip to content

Commit

Permalink
remove bsky auth for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Dec 29, 2023
1 parent c67e1f1 commit b98dd65
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions packages/bsky/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> => {
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 } }
}
}

Expand Down

0 comments on commit b98dd65

Please sign in to comment.