Skip to content

Commit 5a037e8

Browse files
committed
webext: fix: Use Credential portal for get_credential
1 parent d08573b commit 5a037e8

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

webext/app/credential_manager_shim.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,22 @@ async def get_passkey(interface, options, origin, top_origin):
399399
}
400400

401401
logging.debug("Sending request to D-Bus API")
402-
rsp = await interface.call_get_credential(["", req])
403-
if rsp["type"].value != "public-key":
402+
request_event = create_portal_request_message_handler(interface.bus)
403+
req = {
404+
"handle_token": Variant("s", request_event.token),
405+
"public_key": Variant("s", req_json),
406+
}
407+
if top_origin != origin:
408+
req["top_origin"] = Variant("s", top_origin)
409+
_rsp = await interface.call_get_credential("", origin, req)
410+
result = await request_event.wait()
411+
if result["type"].value != "public-key":
404412
raise Exception(
405-
f"Invalid credential type received: expected 'public-key', received {rsp['type'].value}"
413+
f"Invalid credential type received: expected 'public-key', received {result['type'].value}"
406414
)
407415

408416
response_json = json.loads(
409-
rsp["public_key"].value["authentication_response_json"].value
417+
result["public_key"].value["authentication_response_json"].value
410418
)
411419
return response_json
412420

0 commit comments

Comments
 (0)