DEV Community

David Mohl
David Mohl

Posted on • Updated on • Originally published at david.coffee

Creating Fastmail Masked Emails without 1Password anytime and everywhere

Mirrored from my blog - https://david.coffee/creating-fastmail-masked-emails-without-1password-anytime-and-everywhere

I love Masked Emails, Fastmails take on one-time-use email addresses. I've been doing something similar myself for years now, but it is a bit of a shame that it's so tightly coupled to 1Password. Sure you can create them through the webinterface now, but it's still kind of a pain to use and not very convenient (unless you use 1Password).

You can't even manually trigger creation of one within 1Password, so when the extension doesn't detect an email signup field, you're sorta out of luck.

What I want is something like this:

showcase

Let's get it working.

The first thing I noticed is that the request to create a new masked email (through 1Password) isn't actually coming from the 1Password servers like I first thought, it goes directly from the client to api.fastmail.com, like seen on a reverse-proxy like Proxyman:

Network screenshot

By the way, Fastmail also stated they put this functionality right into their open-source JMAP project in a blogpost.

After a bit of reverse-engineering the request format to the API server and replicating it in Golang:

Requests

I present you: https://github.com/dvcrn/maskedemail-cli

maskedemail-cli -accountid xxxx -token abcdef12345 create facebook.com
Enter fullscreen mode Exit fullscreen mode

... and you get a new masked email for facebook.com, right in your shell!

Glueing the CLI to shortcuts with KeyboardMaestro

I wanted this to be available everywhere whenever I need to. A full extension for a product that isn't mine would have been too much work, and I wanted it to work outside browsers as well. With something like KeyboardMaestro this is trivial to do

Here's the macro from above:

KeyboardMaestro Macro

  1. Insert "..."
  2. Retrieve the URL from the current browser window. I had to use some glue applescript here because Firefox has no scripting interface
  3. Pipe it into the maskedemail-cli
  4. Remove the "..." and paste the newly created email

Other thoughts

I am sure this will become more available in the near future. Fastmail likely has some kind of exclusivity thing with 1Password for now, but it's great to see that we can hack ontop of it so easily. It's also very cool that this is built right into JMAP. I hope we'll see more email providers implementing it!

PS - I just wanted an excuse to write something on dev.to

Top comments (0)