npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autocrypt

v0.10.0

Published

Autocrypt node.js client

Downloads

31

Readme

autocrypt-js

A minimal Node.js implementation of the Autocrypt specification, that has no dependencies.

npm Travis Test coverage

npm install autocrypt

API

var autocrypt = new Autocrypt(opts)

Options include:

  • storage: the storage to use for internal state. Must implement get and put methods. ({get(fromEmail, cb), put(fromEmail, data, cb)})
  • dir: the directory for storing the internal state.

autocrypt.processHeader(header, fromEmail, dateSent, cb)

Parse the email yourself and pass in the autocrypt header, from email, and date sent.

  • header: String of the text after Autocrypt: or an object with all parsed autocrypt headers.
  • fromEmail: String.
  • dateSent: Date object.

autocrypt.generateAutocryptHeader(fromEmail, cb)

Generate a string Autocrypt header given the email. fromEmail must reference a user that has been added with the addUser method.

autocrypt.recommendation(fromEmail, toEmail, cb)

Generate an autocrypt UI recommendation given the from email and to email. fromEmail must reference a user that has been added with the addUser method.

autocrypt.addUser(fromEmail, key, opts, cb)

Add a user to autocrypt. This should be done for all new accounts. key should be base64 encoding

  • opts:
    • prefer-encrypt: mutual or nopreference. Defaults to nopreference.

autocrypt._put(fromEmail, opts, cb)

Update a user in autocrypt.

autocrypt.getUser(fromEmail, cb)

Get a user who has been added to autocrypt. Returns an error in the callback if no user has been added with that email.

Static Methods

Autocrypt.stringify(header)

Turn an object into an Autocrypt MIME string for use in an email header.

var header = Autocrypt.stringify({
  keydata: <base64-encoded-string>,
  addr: '[email protected]',
  'prefer-encrypt': 'mutual'
})

You can also pass the Autocrypt base-64 encoded keydata directly.

var header = Autocrypt.stringify({
  keydata: 'pYEWY0RSAEER1+gQRtZECyyww67....',
  addr: '[email protected]',
  'prefer-encrypt': 'mutual'
})

A value of type=1 is automatically added to the header if not supplied, since at this time Autocrypt only supports type=1.

Autocrypt.parse(header)

Turn an Autocrypt MIME string into an object. Opposite of Autocrypt.stringify.

var data = Autocrypt.parse('type=1;[email protected];prefer-encrypt=mutual;keydata=Li4u;')

License

MIT