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

thingy-session-utils

v0.0.6

Published

Small utility package for authenticated session between thingies who use the Secret Manager for their accounts.

Downloads

111

Readme

thingy-session-utils

Background

On some time after developing on the Secret Management path the idea to use these same cryptographic primitives (Curve25519 + AES and SHA-2) for all all Client Service Authentication become quite stubborn.

This lead to a few ways on how to build Sessions - this convenience library is their implementation.

Usage

Requirements

  • ESM importability

Installation

Current git version:

npm install git+https://github.com/JhonnyJason/thingy-session-utils-output.git

Npm Registry:

npm install thingy-session-utils

Current Functionality

  • create AuthCodes
  • create SessionKeys
import * as sessUtl from "thingy-session-utils"

## auth code
# sessUtl.createAuthCode is sessUtl.createAuthCodeHex
sessUtl.createAuthCodeHex( seedHex, request ) -> authCodeHex
sessUtl.createAuthCodeHex( StringHex , String || Object ) -> StringHex64

sessUtl.createAuthCodeBytes( seedBytes, request ) -> authCodeHex
sessUtl.createAuthCodeBytes( Uint8Array , String || Object ) -> Uint8Array32

## session key
# sessUtl.createSessionKey is sessUtl.createSessionKeyHex
sessUtl.createSessionKeyHex( seedHex, request ) -> sessionKeyHex
sessUtl.createSessionKeyHex( StringHex, String || Object ) -> StringHex128

sessUtl.createSessionKeyBytes( seedBytes, request ) -> sessionKeyBytes
sessUtl.createSessionKeyBytes( Uint8Array, String || Object ) -> Uint8Array64

AuthCodes

AuthCodes are onetime Codes which are used by a service who which knows the public key of its clients to proof their posession of the private key - thus are strongly as this client on every request.

They are generated from an commonly known seed - usually the shared Secret from the client and services keypairs - hashed with a commonly known context. The seed stays the same for the whole session. The seed shall be generated in such a way that it is unique to every session.

The other part - the request - might be one specifically known request, the last known or the current. It is passed as string or as object.

As the request is unique for every call (containing a timestamp) - the hash value of seed + "request" is always unique and may only be generated by both of the involved parties.

Any man in the middle cannot extract or reuse the AuthCode. It can be regarded as similarily strong as with signature - but is significantly faster.

At best use the Hex version, it even seems to be faster ;-)

SessionKeys

This is for the situation when we want to encrypt our session. Usually unnecessary because we use HTTPS anyways ;-).

Depending how far your knowledge trust goes, and depending on the situation it still makes sense of course.

The session keys are 64bytes = 512bit (from sha512). This way you may directly use it for secUtl.symmetricEncryptHex(content, sessionKey).


Further steps

  • gather more functionality to put in here
  • performance optimizations?
  • ...

All sorts of inputs are welcome, thanks!


License

CC0