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

redux-signatures

v0.2.0

Published

Secure cryptographic signing of Redux actions

Downloads

2

Readme

redux-signatures

Signs redux (or flux) actions for you cryptographically.

Designed for use with redux-scuttlebutt

Contributions, suggestions and questions welcome.

signatures

  • Ed25519: "High speed, high security signatures". On my machine, signs in 1ms, verifies in 6ms.
    • Sign actions against a public key
    • Verifies actions against their signature and a public key (author)
    • Secure against modification, but not omission.

use

sign and verify

For import { verifyAction, signAction } from 'redux-signatures',

  • verifyAction(identity, callback, action): calls callback(true) if action is valid, callback(false) otherwise.
    • usually callback is a redux store dispatch
  • signAction(identity, callback, action): calls callback with action, with publicKey and signature added to the meta key
    • publicKey and signature constants are exported as META_PUBLIC_KEY and META_SIGNATURE respectively.

identity

For import { Ed25519 } from 'redux-signatures',

  • identity = new Ed25519(): generates a new Ed25519 identity.

  • identity = new Ed25519(privateKey: string): recreates an existing Ed25519 identity from privateKey.

  • identity.sign(message: string) => signature: string: Returns the signature for a given message.

  • identity.verifyPublic(message: string, signature: string, publicKey:string) => valid: bool: Verifies a given message against the given signature and publicKey.

  • identity.verify(message: string, signature: string) => valid: bool: Verifies a given message against the given signature and this identity.

  • identity.publicKey => hex: string: Returns the identity's publicKey

  • identity.privateKey => hex: string: Returns the identity's privateKey

example

const { Ed25519, signAction, verifyAction } from 'redux-signatures'

// create the identity object with a random key.
const identity = new Ed25519()

// serialise action, calls identity.sign, returns action with signature
signAction(identity, callback, action)

// serialise action, calls identity.verify with the action and its included signature
verifyAction(identity, callback, action)

// maintain identity
const identity = new Ed25519(localStorage['privateKey'])
localStorage['privateKey'] = identity.privateKey

// now the app can render the local identity
const initialState = {
  identity: identity.publicKey,
}

// for use with redux-scuttlebutt
return createStore(rootReducer, initialState, scuttlebutt({
  verifyAsync: verifyAction.bind(undefined, identity),
  signAsync: signAction.bind(undefined, identity),
}))

licence

MIT.