1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 21:50:15 +00:00

Add logging

This commit is contained in:
Anders Åberg
2025-01-23 21:07:57 +01:00
parent 1c55b68da4
commit 8d2fd7247e
3 changed files with 79 additions and 41 deletions

View File

@@ -1,69 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17021"
targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"
customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17021"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17021" />
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0" />
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CredentialProviderViewController" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner"
customClass="CredentialProviderViewController" customModuleProvider="target">
<connections>
<outlet property="view" destination="1" id="2"/>
<outlet property="view" destination="1" id="2" />
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder" />
<customObject id="-3" userLabel="Application" customClass="NSObject" />
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="378" height="94"/>
<rect key="frame" x="0.0" y="0.0" width="378" height="94" />
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1uM-r7-H1c">
<rect key="frame" x="177" y="3" width="197" height="32"/>
<buttonCell key="cell" type="push" title="Return Example Password" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2l4-PO-we5">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO"
id="1uM-r7-H1c">
<rect key="frame" x="177" y="3" width="197" height="32" />
<buttonCell key="cell" type="push" title="Return Example Password"
bezelStyle="rounded" alignment="center" borderStyle="border"
imageScaling="proportionallyDown" inset="2" id="2l4-PO-we5">
<behavior key="behavior" pushIn="YES" lightByBackground="YES"
lightByGray="YES" />
<font key="font" metaFont="system" />
<string key="keyEquivalent">D</string>
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
<modifierMask key="keyEquivalentModifierMask" command="YES" />
</buttonCell>
<connections>
<action selector="passwordSelected:" target="-2" id="yic-EC-GGk"/>
<action selector="passwordSelected:" target="-2" id="yic-EC-GGk" />
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NVE-vN-dkz">
<rect key="frame" x="99" y="3" width="82" height="32"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO"
id="NVE-vN-dkz">
<rect key="frame" x="99" y="3" width="82" height="32" />
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="cP1-hK-9ZX"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual"
constant="60" id="cP1-hK-9ZX" />
</constraints>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6Up-t3-mwm">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded"
alignment="center" borderStyle="border" imageScaling="proportionallyDown"
inset="2" id="6Up-t3-mwm">
<behavior key="behavior" pushIn="YES" lightByBackground="YES"
lightByGray="YES" />
<font key="font" metaFont="system" />
<string key="keyEquivalent" base64-UTF8="YES">
Gw
Gw
</string>
</buttonCell>
<connections>
<action selector="cancel:" target="-2" id="Qav-AK-DGt"/>
<action selector="cancel:" target="-2" id="Qav-AK-DGt" />
</connections>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aNc-0i-CWK">
<rect key="frame" x="135" y="63" width="108" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="autofill-extension" id="0xp-rC-2gr">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<textField verticalHuggingPriority="750"
translatesAutoresizingMaskIntoConstraints="NO" id="aNc-0i-CWK">
<rect key="frame" x="135" y="63" width="108" height="16" />
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping"
sendsActionOnEndEditing="YES" alignment="left"
title="autofill-extension hello" id="0xp-rC-2gr">
<font key="font" metaFont="systemBold" />
<color key="textColor" name="controlTextColor" catalog="System"
colorSpace="catalog" />
<color key="backgroundColor" name="controlColor" catalog="System"
colorSpace="catalog" />
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz" secondAttribute="trailing" constant="8" id="1UO-J1-LbJ"/>
<constraint firstItem="NVE-vN-dkz" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="3N9-qo-UfS"/>
<constraint firstAttribute="bottom" secondItem="1uM-r7-H1c" secondAttribute="bottom" constant="10" id="4wH-De-nMF"/>
<constraint firstItem="NVE-vN-dkz" firstAttribute="firstBaseline" secondItem="aNc-0i-CWK" secondAttribute="baseline" constant="50" id="Dpq-cK-cPE"/>
<constraint firstAttribute="bottom" secondItem="NVE-vN-dkz" secondAttribute="bottom" constant="10" id="USG-Gg-of3"/>
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz" secondAttribute="trailing" constant="8" id="a8N-vS-Ew9"/>
<constraint firstAttribute="trailing" secondItem="1uM-r7-H1c" secondAttribute="trailing" constant="10" id="qfT-cw-QQ2"/>
<constraint firstAttribute="centerX" secondItem="aNc-0i-CWK" secondAttribute="centerX" id="uV3-Wn-RA3"/>
<constraint firstItem="aNc-0i-CWK" firstAttribute="top" secondItem="1" secondAttribute="top" constant="15" id="vpR-tf-ebx"/>
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz"
secondAttribute="trailing" constant="8" id="1UO-J1-LbJ" />
<constraint firstItem="NVE-vN-dkz" firstAttribute="leading"
relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading"
constant="20" symbolic="YES" id="3N9-qo-UfS" />
<constraint firstAttribute="bottom" secondItem="1uM-r7-H1c" secondAttribute="bottom"
constant="10" id="4wH-De-nMF" />
<constraint firstItem="NVE-vN-dkz" firstAttribute="firstBaseline"
secondItem="aNc-0i-CWK" secondAttribute="baseline" constant="50" id="Dpq-cK-cPE" />
<constraint firstAttribute="bottom" secondItem="NVE-vN-dkz" secondAttribute="bottom"
constant="10" id="USG-Gg-of3" />
<constraint firstItem="1uM-r7-H1c" firstAttribute="leading" secondItem="NVE-vN-dkz"
secondAttribute="trailing" constant="8" id="a8N-vS-Ew9" />
<constraint firstAttribute="trailing" secondItem="1uM-r7-H1c"
secondAttribute="trailing" constant="10" id="qfT-cw-QQ2" />
<constraint firstAttribute="centerX" secondItem="aNc-0i-CWK"
secondAttribute="centerX" id="uV3-Wn-RA3" />
<constraint firstItem="aNc-0i-CWK" firstAttribute="top" secondItem="1"
secondAttribute="top" constant="15" id="vpR-tf-ebx" />
</constraints>
<point key="canvasLocation" x="162" y="146"/>
<point key="canvasLocation" x="162" y="146" />
</customView>
</objects>
</document>
</document>

View File

@@ -153,8 +153,12 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
}
override func prepareInterface(forPasskeyRegistration registrationRequest: ASCredentialRequest) {
logger.log("[autofill-extension] prepareInterface")
if let request = registrationRequest as? ASPasskeyCredentialRequest {
if let passkeyIdentity = registrationRequest.credentialIdentity as? ASPasskeyCredentialIdentity {
logger.log("[autofill-extension] prepareInterface(passkey) called \(request)")
class CallbackImpl: PreparePasskeyRegistrationCallback {
let ctx: ASCredentialProviderExtensionContext
required init(_ ctx: ASCredentialProviderExtensionContext) {
@@ -192,11 +196,18 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
userVerification: userVerification,
supportedAlgorithms: request.supportedAlgorithms.map{ Int32($0.rawValue) }
)
logger.log("[autofill-extension] prepareInterface(passkey) calling preparePasskeyRegistration")
// Log details of the request
logger.log("[autofill-extension] rpId: \(req.rpId)")
logger.log("[autofill-extension] rpId: \(req.userName)")
CredentialProviderViewController.client.preparePasskeyRegistration(request: req, callback: CallbackImpl(self.extensionContext))
return
}
}
logger.log("[autofill-extension] We didn't get a passkey")
// If we didn't get a passkey, return an error
self.extensionContext.cancelRequest(withError: BitwardenError.Internal("Invalid registration request"))
}

View File

@@ -79,7 +79,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
rpId,
);
await this.messagingService.send("loadurl", { url: "/passkeys", modal: true });
this.messagingService.send("loadurl", { url: "/passkeys", modal: true });
// Store the passkey on a new cipher to avoid replacing something important
const cipher = new CipherView();