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.5

Published

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

Downloads

81

Readme

thingy-session-utils

Background

Regarding the Client Service Authentication - we thought we should have the helper functions in it's own pacakge as it does not directly fit on adding to the secret-manager-crypto-utils.

Originally we only needed the authCode function, however because it easily possible we just added a sessionKey function as well.

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

Authentication Codes 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. It should be generated in such a way that it is always different for every session.

The other part is the request - which we may pass as string or as object. Preferrably use an existing string from somewhere. Usually every request has arrived as string and the conversion is quite costly for the performance.

This request is the last processed request or better said the request body - it must be exactly the same for client and service. You may also take it as "last processed authenticated data-chunk" for e.g. in Websockets.

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).

Consider prepending a salt as from secUtl.createRandomLengthSalt() to mitigate known-plaintext attacks.


Further steps

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

All sorts of inputs are welcome, thanks!


License

Unlicense JhonnyJason style