cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
typings/digest-fetch/index.d.ts
33lines · modecode
| 1 | declare module 'digest-fetch'; |
| 2 | |
| 3 | import type { RequestInfo, RequestInit, Response } from 'node-fetch'; |
| 4 | |
| 5 | type Algorithm = 'MD5' | 'MD5-sess'; |
| 6 | |
| 7 | type Options = { |
| 8 | algorithm?: Algorithm; |
| 9 | statusCode?: number; |
| 10 | cnonceSize?: number; |
| 11 | basic?: boolean; |
| 12 | precomputeHash?: boolean; |
| 13 | logger?: typeof console; |
| 14 | }; |
| 15 | |
| 16 | class DigestClient { |
| 17 | user: string; |
| 18 | password: string; |
| 19 | |
| 20 | private nonceRaw: string; |
| 21 | private logger?: typeof console; |
| 22 | private precomputedHash?: boolean; |
| 23 | private statusCode?: number; |
| 24 | private basic: boolean; |
| 25 | private cnonceSize: number; |
| 26 | private hasAuth: boolean; |
| 27 | private digest: { nc: number; algorithm: Algorithm; realm: string }; |
| 28 | |
| 29 | constructor(user: string, password: string, options: Options = {}); |
| 30 | async fetch(url: RequestInfo, options: RequestInit = {}): Promise<Response>; |
| 31 | } |
| 32 | |
| 33 | export default DigestClient; |
| 34 | |