-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
It would be great if we could expose an action that would enable WebAuthn and adds a virtual authenticator. This will allow agents to test authentication that use passkeys.
If you are open to this I can create a pull request for this functionality.
// Example pseudocode
const cdp = await this.getCDPSession();
await cdp.send("WebAuthn.enable")
await cdp.send("WebAuthn.addVirtualAuthenticator", {
options: {
protocol: "ctap2",
transport: "internal",
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})
Current workaround:
async function openBrowser() {
await runAgentBrowser([
"--args",
"--remote-debugging-port=9333",
"open",
"http://localhost:3000/signup",
])
await runAgentBrowser(["wait", "--load", "networkidle"])
const response = await fetch("http://127.0.0.1:9333/json")
const [{ webSocketDebuggerUrl }] = await response.json()
const socket = new WebSocket(webSocketDebuggerUrl)
await new Promise<void>((resolve) => (socket.onopen = () => resolve()))
async function send(method: string, params: object = {}) {
const id = Math.floor(Math.random() * 1e9)
await new Promise<void>((resolve) => {
socket.onmessage = (event) => {
if (JSON.parse(String(event.data)).id === id) {
resolve()
}
}
socket.send(JSON.stringify({ id, method, params }))
})
}
await send("WebAuthn.enable")
await send("WebAuthn.addVirtualAuthenticator", {
options: {
protocol: "ctap2",
transport: "internal",
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})
return socket
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels