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

email-tokenator

v0.1.36

Published

Tokenator for sending P2P secure email

Downloads

957

Readme

email-tokenator

A Tokenator for P2P Secure Email

Overview

EmailTokenator is a specialized derived class of Tokenator that enables peer-to-peer secure email communication. With EmailTokenator, users can send and receive encrypted emails directly between each other over any PeerServ instance without the need for a central server or third-party intermediary. Mutual authentication is handled by Authrite, and monetization can be configured using PacketPay.

In this example, the message data is encrypted with the recipient as the counterparty and stored on-chain, but it can easily be modified to only store the hash of the message on-chain if so desired.

Developers can easily integrate this secure email functionality into their applications, providing users with a more private and secure way of communicating. EmailTokenator is a perfect example of how Tokenator's base-level class can be extended to build specialized tokens that solve real-world problems.

Example Usage

const EmailTokenator = require('email-tokenator')
const johnSmith = '022600d2ef37d123fdcac7d25d7a464ada7acd3fb65a0daf85412140ee20884311'

const init = async () => {
    // Create a new instance of the EmailTokenator class
    // Optionally configure a custom PeerServ host
    const tokenator = new EmailTokenator({
        peerServHost = 'https://staging-peerserv.babbage.systems'
    })
    // Send an Email token using Babbage
    const sendStatus = await tokenator.sendEmail({
        recipient: johnSmith,
        subject: 'Email Test',
        body: 'Hey John, this is a test of secure P2P email!'
    })

    // Receive incoming emails into your email basket
    const emailsReceived = await tokenator.checkEmail()

    // Decrypt the email stored in your private basket
    const decryptedEmails = await tokenator.readEmail()

    // Example of John reading the email
    console.log(decryptedEmails[0].subject) // --> 'Email Test'
    console.log(decryptedEmails[0].body)   // --> 'Hey John, this...'
}

init()

API

Table of Contents

EmailTokenator

Extends PushDropTokenator

Extends the Tokenator class to enable sending email messages

Parameters

  • obj object All parameters are given in an object. (optional, default {})

    • obj.peerServHost String? The PeerServ host you want to connect to. (optional, default 'https://staging-peerserv.babbage.systems')
    • obj.clientPrivateKey String? A private key to use for mutual authentication with Authrite. (Optional - Defaults to Babbage signing strategy).

sendEmail

Creates a payment token to send in a message to PeerServ

Parameters
  • message Object The email message to send

    • message.recipient String The recipient of this email
    • message.subject String The subject of the email
    • message.body String The body of the email message

checkEmail

Wrapper function that lists incoming emails from PeerServ, and submits them into a private basket

Returns Array of incoming emails from PeerServ

readEmail

Reads email messages from a private basket according to the standard protocol

Parameters
  • obj Object An object containing the messageIds

    • obj.messageIds Array An array of Numbers indicating which email message(s) to read

Returns Array An array of email messages