Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Digest authorization #4339

Merged
merged 21 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: digest auth added to new schema
  • Loading branch information
anwarulislam authored and jamesgeorge007 committed Oct 29, 2024
commit 6efa54aa80b68b496a7c92e8959fdbbfd6dbc1c9
1 change: 1 addition & 0 deletions packages/hoppscotch-data/src/rest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export {
HoppRESTHeaders,
HoppRESTParams,
} from "./v/7"
export { HoppRESTAuthDigest } from "./v/8"

export {
ClientCredentialsGrantTypeParams,
Expand Down
15 changes: 15 additions & 0 deletions packages/hoppscotch-data/src/rest/v/8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ export const HoppRESTAuthOAuth2 = z.object({

export type HoppRESTAuthOAuth2 = z.infer<typeof HoppRESTAuthOAuth2>

// in this new version, we add a new auth type for Digest authentication
export const HoppRESTAuthDigest = z.object({
authType: z.literal("digest"),
username: z.string().catch(""),
password: z.string().catch(""),
realm: z.string().catch(""),
nonce: z.string().catch(""),
algorithm: z.enum(["MD5", "MD5-sess"]).catch("MD5"),
qop: z.enum(["auth", "auth-int"]).catch("auth"),
nc: z.string().catch(""),
cnonce: z.string().catch(""),
opaque: z.string().catch(""),
disableRetry: z.boolean().catch(false),
})

export const HoppRESTAuth = z
.discriminatedUnion("authType", [
HoppRESTAuthNone,
Expand Down