1.5.0 • Published 11 months ago

maskedemail v1.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

FastMail maskedemail JS SDK

JavaScript wrapper / SDK for interacting with FastMail's MaskedEmail service

This is based off my maskedemail-cli

Install

yarn add maskedemail

-- or -- 

node i maskedemail

Notes before using

Instead of implementing the API in JavaScript, this package compiles maskedemail-cli to WASM, then executes that. The WASM is pretty unoptimized and rocks a whopping 7MB+ in file size :D

Why?? Because I wanted to play around with WASM, and didn't want to duplicate the code again.

There is a gopherjs fallback if WebAssembly is not available. Both gopherjs and wasm builds are pretty chunky in file size so probably not a good idea to use this on the browser.

Usage

Follow the "authentication" steps over at https://github.com/dvcrn/maskedemail-cli#authentication

import { list, create } from "maskedemail";

const token = "fastmailToken";
const accID = "fastmailAccID";

(async () => {
  const pr = await list(token, accID);
  console.log(pr);

  console.log("creating new");

  const created = await create(token, accID, "test.com");
  console.log(created);
})().catch((err) => {
  console.error(err);
});

Using gopherjs mode instead

import { init, list, create } from "maskedemail";

const token = "fastmailToken";
const accID = "fastmailAccID";

(async () => {
  await init('gopherjs');
  const sess = await session(token);
  console.log(sess);
})().catch((err) => {
  console.error(err);
});

Building

Requirements:

Make sure to run yarn to install all the dependencies

Run make build to build both wasm and gopherjs variants, and bundle with rollup

License

MIT

1.5.0

11 months ago

1.4.0

12 months ago

1.2.0

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago