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

Make passkeys server request headers optional #167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions plugins/modularPermission/signers/toWebAuthnPubKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const toWebAuthnPubKey = async ({
passkeyName: string
passkeyServerUrl: string
mode: WebAuthnMode
passkeyServerHeaders: Record<string, string>
passkeyServerHeaders?: Record<string, string>
}): Promise<WebAuthnKey> => {
let pubKey: string | undefined
if (mode === WebAuthnMode.Login) {
Expand All @@ -26,7 +26,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
credentials: "include"
}
Expand All @@ -44,7 +44,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ cred: loginCred }),
credentials: "include"
Expand Down Expand Up @@ -74,7 +74,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ username: passkeyName }),
credentials: "include"
Expand All @@ -99,7 +99,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({
userId: registerOptions.userId,
Expand Down
6 changes: 3 additions & 3 deletions plugins/modularPermission/signers/toWebAuthnSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type WebAuthnModularSignerParams = ModularSignerParams & {
passkeyServerUrl: string
pubKey?: WebAuthnKey
mode?: WebAuthnMode
passkeyServerHeaders: Record<string, string>
passkeyServerHeaders?: Record<string, string>
}

export const toWebAuthnSigner = async <
Expand Down Expand Up @@ -99,7 +99,7 @@ export const toWebAuthnSigner = async <
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ data: formattedMessage, userId }),
credentials: "include"
Expand All @@ -123,7 +123,7 @@ export const toWebAuthnSigner = async <
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ cred, userId }),
credentials: "include"
Expand Down
10 changes: 5 additions & 5 deletions plugins/webauthn-key/toWebAuthnKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type WebAuthnAccountParams = {
webAuthnKey?: WebAuthnKey
mode?: WebAuthnMode
credentials?: RequestCredentials
passkeyServerHeaders: Record<string, string>
passkeyServerHeaders?: Record<string, string>
}

export const encodeWebAuthnPubKey = (pubKey: WebAuthnKey) => {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const toWebAuthnKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
credentials
}
Expand All @@ -71,7 +71,7 @@ export const toWebAuthnKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ cred: loginCred }),
credentials
Expand All @@ -93,7 +93,7 @@ export const toWebAuthnKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ username: passkeyName }),
credentials
Expand All @@ -114,7 +114,7 @@ export const toWebAuthnKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({
userId: registerOptions.userId,
Expand Down
10 changes: 5 additions & 5 deletions plugins/weighted-r1-k1/signers/toWebAuthnPubKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const toWebAuthnPubKey = async ({
passkeyName: string
passkeyServerUrl: string
mode: WebAuthnMode
passkeyServerHeaders: Record<string, string>
passkeyServerHeaders?: Record<string, string>
}): Promise<WebAuthnKey> => {
let pubKey: string | undefined
let authenticatorIdHash: Hex
Expand All @@ -29,7 +29,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
credentials: "include"
}
Expand All @@ -52,7 +52,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ cred: loginCred }),
credentials: "include"
Expand Down Expand Up @@ -82,7 +82,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ username: passkeyName }),
credentials: "include"
Expand Down Expand Up @@ -112,7 +112,7 @@ export const toWebAuthnPubKey = async ({
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({
userId: registerOptions.userId,
Expand Down
6 changes: 3 additions & 3 deletions plugins/weighted-r1-k1/signers/toWebAuthnSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type WebAuthnModularSignerParams = {
passkeyServerUrl: string
pubKey?: WebAuthnKey
mode?: WebAuthnMode
passkeyServerHeaders: Record<string, string>
passkeyServerHeaders?: Record<string, string>
}

export const toWebAuthnSigner = async <
Expand Down Expand Up @@ -101,7 +101,7 @@ export const toWebAuthnSigner = async <
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ data: formattedMessage, userId }),
credentials: "include"
Expand All @@ -126,7 +126,7 @@ export const toWebAuthnSigner = async <
method: "POST",
headers: {
"Content-Type": "application/json",
...passkeyServerHeaders
...(passkeyServerHeaders ?? {})
},
body: JSON.stringify({ cred, userId }),
credentials: "include"
Expand Down
Loading