keepassxc-browser
keepassxc-browser copied to clipboard
Safari support
Please consider providing support for Safari web browser.
Not until Safari supports the Web Extensions API. Please see https://stackoverflow.com/questions/47435082/will-safari-ever-support-webextensions-api
Let's reopen this as Apple just announced that they will support the WebExtension API with the upcoming Safari release. It's unclear if it's only available for the next OS version or for all.
https://hacks.mozilla.org/2020/06/welcoming-safari-to-the-webextensions-community/ - According to this, Mojave, Catalina and Big Sur are the supported macOS versions.
Plus it's confirmed that Native Messaging will be supported: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
...but I haven't been able to test it yet because it needs a beta version of Big Sur and XCode both.
@varjolintu Both Xcode 12 and Safari 14 are now available on macOS Catalina.
xcrun safari-web-extension-converter keepassxc-browser
converted the extension into an xcode project with the following warning:
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
css
browser_action
all_frames
options_ui
applications
contextMenus
storage
scripts
commands
notifications
webRequest
default_locale
tabs
webNavigation
nativeMessaging
clipboardWrite
version
version_name
name
web_accessible_resources
activeTab
run_at
webRequestBlocking
js
matches
manifest_version
icons
description
I can see that some of these might be a problem for normal functioning. Hope you can at least get simple auto fill to work though. All the best.
@vyashole I haven't tried it out yet, but seems strange if nativeMessaging gives a warning because it should be supported.
@varjolintu the warning says it is not supported by the current version of safari i have. Maybe I'm missing something here.
Native messaging is supported according to https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
Anyway it is past midnight where I live. I'll go sleep now. Will check it out tomorrow.
App Name: KeePassXC-Browser
App Bundle Identifier: com.yourCompany.KeePassXC-Browser
Language: Swift
Is this correct? [yes]:
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
notifications
webRequestBlocking
applications
That's what it's outputting for me with Safari (Version 14.0 (15610.1.28.1.9, 15610)) with Xcode Version 12.0 beta 2 (12A6163b) on 10.15.5.
Lets see how this goes. (Haven't tried the custom browser option yet as Safari is not supported in the current KeePassXC release).
EDIT: I need to inspect the sample code later to see if there's any changes needed for KeePassXC or the proxy: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_a_web_extension_s_native_app
See: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
Safari ignores the
application.idparameter and only sends the message to the containing macOS app’s native app extension.
This means the safari extension will have to be bundled with either KeePassXC or a standalone proxy.
See: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension
Safari ignores the
application.idparameter and only sends the message to the containing macOS app’s native app extension.This means the safari extension will have to be bundled with either KeePassXC or a standalone proxy.
True. A proxy would be the correct place for it, and I'm gonna do the implementation soon.
Hi @varjolintu Have you found time to work on this yet? I'm not asking for an ETA, but just letting you know that I am very interested in this feature, and while I can't be very useful in actual coding, I'll be glad to help out by testing, sharing logs, etc. Let me know in case any help is required.
@vyashole I have problems compiling the code (event the example one, Native Messaging Demo Extension). Even when I already have latest Catalina, XCode 12 and Safari 14, the code gives me Cannot find SFExtensionMessageKey in scope error and I have no idea how to solve it.
EDIT: If I create a new project it works, so gotta look this some more. EDIT 2: Succeeded finally building it. EDIT 3: I can already send messages to the extension, but sending from extension to application doesn't work yet.
I've been looking at the possible implementation and it seems the best solution for this is to wrap an own application for macOS that contains the extension + the Safari code. In this way we can provide a new Safari Web Extension version for each release. Otherwise we'd need to release a new KeePassXC version for macOS for each extension update, and that is not gonna work.
They always gotta be special....
They always gotta be special....
Indeed. I almost thought this thing would be easy to do. Basically we have to write an own "proxy" application that works only with Safari.
Basically we have to write an own "proxy" application that works only with Safari.
I am not a developer, but I have reseached this topic a little bit. How I understand it, the extension needs to be distributed as an app. But the app does not necessarily need to contain any functionality. It can be more ore less an empty shell that just contains the extension. But it could also be in included in the main Keepassxx App. Of course if you want to be able to release the extension separately I would also go for the empty shell.
I found a guy who has created a Safari extension that just adds a reload button. He has written about it, maybe that is helpful. https://hypercritical.co/safari-reload-button/
@rennefJ this is a native messaging problem, not an extension problem. We can deploy an extension without blinking, the problem is the proxy application that supports the native messaging back to KeePassXC seems to have to be deployed WITH the extension. No other browser requires that.
Luckily the XCode project loads the extension source files as references so there's no need to copy files around.
hey guys. can I hope to have support keepassxc in safari soon? (at least in big sur)
@OsapBender Cannot promise anything yet. I have some troubles sending messages from extension to the application. And I haven't had time to do or test it any further.
Safari support would be really nice! It will maybe make me move to safari from chrome on macos.
Looking forward for the Safari support as well!
Any news on this topic?
@joconcepts Not yet. But we haven't forgotten this one.
well I need to ask again: any news regarding this integration? :)
@joconcepts No. We are waiting for feedback from Apple for a certain issue.
Actually, it might be a better idea to implement the macOS Autofill function instead in KeePassXC, which was introduced with Big Sur. Strongbox has implemented this already and it works rather well in Safari even without a browser extension, and possibly even in other applications (haven't tested that).