Buckets:
| // src/utils/basic-auth.ts | |
| import { decodeBase64 } from "./encode.js"; | |
| var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/; | |
| var USER_PASS_REGEXP = /^([^:]*):(.*)$/; | |
| var utf8Decoder = new TextDecoder(); | |
| var auth = (req) => { | |
| const match = CREDENTIALS_REGEXP.exec(req.headers.get("Authorization") || ""); | |
| if (!match) { | |
| return void 0; | |
| } | |
| let userPass = void 0; | |
| try { | |
| userPass = USER_PASS_REGEXP.exec(utf8Decoder.decode(decodeBase64(match[1]))); | |
| } catch { | |
| } | |
| if (!userPass) { | |
| return void 0; | |
| } | |
| return { username: userPass[1], password: userPass[2] }; | |
| }; | |
| export { | |
| auth | |
| }; | |
Xet Storage Details
- Size:
- 628 Bytes
- Xet hash:
- 4f749f53d8f816cf34d8657f1af732a19cb7a8338da45f77fe369e80dc347ff1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.