Meteor-Desktop - Keytar no longer working - how to upgrade?

This is for those who build Electron apps with Meteor, using the Meteor-Desktop app.

I’m having a problem that any API call to Keytar has all of a sudden stopped working for my Windows users. It completely times out (I have a 60 seconds timeout period).

Unfortunately I use Keytar to retrieve important credentials from the respective “secure” storage.

I’m using the following versions:

Meteor 2.5.6
Node 14.19.1
Meteor-Desktop 3.0.1
Electron 10.1.3 (last working version for me)
Electron-builder 23.0.2
Electron-updater 4.3.9

I’ve read that with Electron version 15 they have replaced Keytar with safeStorage (see Replacing Keytar with Electron's safeStorage in Ray - Freek Van der Herten's blog on PHP, Laravel and JavaScript and safeStorage | Electron).

However, it’s a long path to go from Electron 10.1.3 to version 15.

Two questions:

  1. Has anyone else problems with Keytar?

  2. Suggestions on how to go forward with upgrading from the current, last working versions? It’s unclear to me how the other Electron packages (eg @electron/osx-sign, electron-updater, electron-builder, electron-notarize and electron-rebuild are all required to have a specific version to work with a specific version of electron. Meaning to say, if I update electron, which other packages do I need to update as well and to what version?

Sounds very daunting but my Windows users (who are unfortunately the majority) can’t use an important part of my Electron app right now.

Any suggestions, tips are welcome. Thanks in advance!

Does it give an error or just silently fail?

How are you importing keytar?

Are you sure your keytar version matches your Electron version? There are builds on the keytar GitHub for each separate node (and Electron node) version if you need a specific one.

The call to Keytar just times out after 60 seconds (which is the timeout period I’ve set).

import keytar from 'keytar';

in /index.js in the keytar folder

Yes, it’s version 6.0.1 and I didn’t change Electron version (still stuck on the same) nor the Keytar version.

Any idea on the best way to go forward with upgrading Electron and it’s various related packages @efrancis?

I had a similar issue one time and it was because the keytar version wasn’t matching the version of node bundled with Electron. My solution was to instead import the correct pre-built file directly after downloading it from the keytar GitHub releases. Note that the version of node bundled with your Electron is probably not the same version of node that Meteor uses.

For updating packages idk of any really easy way to go about it. You just need to determine which versions go together for any dependencies that you use and update all accordingly.

I think I need to first determine which Electron version I’m aiming for, meaning which new features are important to me that I want to upgrade to that version.

As you write, that will most likely determine dependencies on the other Electron packages, though I’d like to go with the most latest versions possible.

Having said that, Meteor (I can’t upgrade beyond 2.5.8) and my node version will restrict most likely how far I could aim.

But first I have to get the next, big feature out. One step at a time and once that is done and things will run smooth again this might be the next project.

That is unless there’s nothing much out there that is intriguing enough to go through upgrade hell LOL

Just an update on my success so far in updating the Electron packages.

I’ve started with upgrading electron-updater to version 5.0.5 (it was the most recent offered) and also upgrading electron-builder to version 23.1.0 (again, most recent one).

Building the app worked without problems for Windows, macOS and Linux.

Further to my earlier post I’ve successfully updated electron-rebuild to version 3.28 (latest version) and electron package itself to version 11.5.0 (last stable before version 12.0.0).

However, further upgrading to version 12.0.0 or any version above (including up to latest stable version 19.0.8) is giving an error that seems to originate from the cordova.js file.

I’ve added my findings to the existing (raised by @koenlav on 29 March 2021 !): Electron 12 is currently not supported.

Hope that @storyteller can fix this as he promised in April once he’s time for this Meteor community package again.

1 Like

Thanks for exploring this! Every year or so I go through the upgrade process and ik how annoying it can be. I’m still on Electron 9 atm.

Feel free to update as far as I have done, it should be safe, gives you additional security through the patches and bug fixes.

Obviously the real deal is to get Electron further up as they have added a couple new features, eg the new safeStorage feature.

How big of a problem is it to be so far behind you might ask? Well, version 16.x.y is already at the end-of-support:

Screenshot 2022-07-19 at 01.38.39

For more detailed info head over to their blog: Electron's blog | Electron

1 Like