Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/utils/basic-auth.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/basic-auth.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/utils/basic-auth.js
-
curl -L -o basic-auth.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/basic-auth.js
613 Bytes
| import { decodeBase64 } from "./encode.js"; | |
| //#region src/utils/basic-auth.ts | |
| const CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/; | |
| const USER_PASS_REGEXP = /^([^:]*):(.*)$/; | |
| const utf8Decoder = new TextDecoder(); | |
| const auth = (req) => { | |
| const match = CREDENTIALS_REGEXP.exec(req.headers.get("Authorization") || ""); | |
| if (!match) return; | |
| let userPass = void 0; | |
| try { | |
| userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode(decodeBase64(match[1]))); | |
| } catch {} | |
| if (!userPass) return; | |
| return { | |
| username: userPass[1], | |
| password: userPass[2] | |
| }; | |
| }; | |
| //#endregion | |
| export { auth }; | |