Skip to content

Commit 7a7f93a

Browse files
committed
Install web extension
1 parent c05433c commit 7a7f93a

File tree

16 files changed

+172
-33
lines changed

16 files changed

+172
-33
lines changed

contrib/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
install_data(
2+
'xyz.iinuwa.credentialsd.Credentials.xml',
3+
install_dir: datadir / 'credentialsd',
4+
)

meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ version = meson.project_version()
1010

1111
prefix = get_option('prefix')
1212
bindir = prefix / get_option('bindir')
13+
libdir = prefix / get_option('libdir')
1314
localedir = prefix / get_option('localedir')
1415

1516
cargo_home = get_option('cargo_home')
@@ -29,4 +30,6 @@ subdir('credentialsd-common')
2930
subdir('credentialsd')
3031
subdir('credentialsd-ui')
3132
subdir('dbus')
32-
subdir('systemd')
33+
subdir('systemd')
34+
subdir('webext')
35+
subdir('contrib')

systemd/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ configure_file(
2424
install_dir: systemd_user_service_dir,
2525
output: 'xyz.iinuwa.credentialsd.UiControl.service',
2626
configuration: systemd_config,
27-
)
27+
)

webext/README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This requires some setup to make it work:
77

88
# Prerequisites
99

10-
Currently, this web extension relies on the `dbus-next` to interact with D-Bus
11-
services. If you have that package installed in your system Python, this
12-
should work. You can test using the following:
10+
Currently, this web extension relies on the `dbus-next` Python package to
11+
interact with D-Bus services. If you have that package installed in your system
12+
Python, this should work. You can test using the following:
1313

1414
```shell
1515
python3 -c 'import dbus_next; print("dbus-next is installed")'
@@ -35,11 +35,29 @@ couple of options:
3535
pip3 install dbus-next
3636
echo "Change the first line in webext/app/credential_manager_shim.py to:"
3737
echo "#!$(readlink -f ./env/bin/python3)"
38-
# Update the shebang to point to the absolute path to webext/env/bin/python3
3938
```
4039

4140
# Setup Instructions
4241

42+
## For Testing
43+
44+
1. Run the install script for the repository:
45+
```shell
46+
meson setup -Dprofile=default -Dprefix=/usr/local build-release
47+
cd build-release
48+
meson install
49+
mkdir -p ~/.mozilla/native-messaging-hosts/
50+
ln -s /usr/local/lib64/mozilla/native-messaging-hosts/xyz.iinuwa.credentialsd_helper.json ~/.mozilla/native-messaging-hosts/
51+
```
52+
Note that since it is installing to `/usr/local`, Meson will ask you to use `sudo` to elevate privileges to install.
53+
2. Log out and log back in again to restart the D-Bus session bus.
54+
2. Open Firefox and go to `about:debugging`.
55+
3. Click "This Firefox" > Load Temporary Extension. Select `/usr/local/share/credentialsd/credentialsd-firefox-helper.xpi`.
56+
4. Navigate to [https://webauthn.io]().
57+
5. Run through the registration and creation process.
58+
59+
## For Development
60+
4361
(Note: Paths are relative to root of this repository)
4462

4563
1. Copy `webext/app/credential_manager_shim.json` to `~/.mozilla/native-messaging-hosts/credential_manager_shim.json`.

webext/add-on/background.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ function connected(port) {
1212
console.log(contentPort);
1313

1414
// Initialize native port
15-
nativePort = browser.runtime.connectNative("credential_manager_shim");
16-
if (nativePort.error) {
15+
nativePort = browser.runtime.connectNative("xyz.iinuwa.credentialsd_helper");
16+
console.debug(nativePort);
17+
if (nativePort.error !== null) {
1718
console.error(nativePort.error)
1819
throw nativePort.error
1920
}

webext/add-on/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let requestCounter = 0;
22
const pendingRequests = {}
3-
var webauthnPort = browser.runtime.connect({ name: "credential_manager_shim" });
3+
var webauthnPort = browser.runtime.connect({ name: "credentialsd-helper" });
44
console.log("loading content")
55

66
webauthnPort.onMessage.addListener(({ requestId, data, error }) => {

webext/add-on/icons/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.

webext/add-on/icons/logo.svg

Lines changed: 71 additions & 0 deletions
Loading

webext/add-on/icons/message.svg

Lines changed: 0 additions & 8 deletions
This file was deleted.

webext/add-on/manifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"description": "Linux WebAuthn Desktop Portal Shim",
2+
"description": "Helper to integrate credentialsd with the browser",
33
"manifest_version": 3,
4-
"name": "WebAuthn Portal",
5-
"version": "1.0",
4+
"name": "credentialsd-helper",
5+
"version": "0.1.0",
66
"icons": {
7-
"48": "icons/message.svg"
7+
"48": "icons/logo.svg"
88
},
99

1010
"browser_specific_settings": {
1111
"gecko": {
12-
"id": "credential_manager_shim@iinuwa.xyz",
13-
"strict_min_version": "50.0"
12+
"id": "credentialsd-helper@iinuwa.xyz",
13+
"strict_min_version": "140.0"
1414
}
1515
},
1616

@@ -26,7 +26,7 @@
2626
],
2727

2828
"action": {
29-
"default_icon": "icons/message.svg"
29+
"default_icon": "icons/logo.svg"
3030
},
3131

3232
"permissions": ["nativeMessaging"]

0 commit comments

Comments
 (0)