GithubHelp home page GithubHelp logo

phish108 / node-jose-tools Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 5.0 840 KB

Command line tools for node-jose's features

Home Page: https://www.npmjs.com/package/node-jose-tools

License: MIT License

JavaScript 100.00%
command-line jose jwe jwk jws jwt nodejs openid-connect web-token

node-jose-tools's People

Contributors

actions-user avatar dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar phish108 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-jose-tools's Issues

Add Tool to get JWT infos

It would be nice to have an introspection tool that reads a JWT and prints the type and basic header information.

add key tool

in addition to the *key tools, a more mnemonic version of the tools would be nice, so one can call

jose key new -u sig -R -s 2048
jose key add -j keystore
jose key ls -j keystore 
jose key rm -j keystore 
jose key find -j keystore some_kid
jose key export -j keystore --format pem
jose key publish -j keystore

This requires the sanitizer to check more than one arguments.

Maybe it even makes sense to split the tools as such:

unknown tool name

Hi,

Running on MacOS with node v13.8.0 and the latest node-jose-tools, and I get the error "unknown tool name" whenever I run any command.

Setup

I installed it as per the docs:

npm install -g node-jose-tools

Steps to reproduce

The simplest demonstration is this:

jose encrypt

it returns:

unknown tool name

Expected result

As a globally installed node module, I expect to be able to run jose from any working directory.

Workaround

Rather than run the documented jose command, it instead can run as follows:

cd /usr/local/lib/node_modules/node-jose-tools
node index.js encrypt ...

Analysis

Digging into the code, I see that sanitize.js looks for the file .lib/${toolname}.js.

I think the use of . is the root cause. I put console.log(fs.realpathSync('.')) into sanitize.js to debug what . is, and I get the current PWD of my shell, and not the root of the project as it expects.

Help without tools

  • If jose is called without any tool, then the available tools should be listed.

  • If jose --help is called, then a basic usage and the tools should be presented.

Newkey throws error

The tool tries to load support functions from a non existent helpers folder instead from helper.

Release only when non-dev dependencies are updated

Use two values hold and release.

  • hold if only files in .github have changed
  • hold if only files in tests have changed
  • check if only package.json and package-lock.json have changed
    • get dependencies and devDependencies in package.json
    • get change log for package.json
    • hold if only devDependencies have changed.
  • release otherwise

Tokenbuilder for declarative token specifications

All tools are nicely suited for creating simple JWT, but having the configs for multiple recipients on one command line is tricky at best.

What we should have is a token tool that consumes a JSON or YAML file for the different parameters of our token. The tool would have a configuration parameter and accept payload and thats it. This allows one to declare the JWT outcome separately from running the command.

The following example illustrates how a declaration might look like:

jose:
  format: compact
  # global claims and defaults
  iat: now
  exp: 1h
  jwks: my/jwks/default.jwks
  sign:
    - jwks: my/jwks/file.jwks
       kid: mysignkey
       alg: RS256
      # other parameters
      aud: for your eyes only
      claims: 
         # application specific claims
    - kid: mydefaultkeyid
       alg: ES256
  enc:
    recipients:
    - jwks: my/friends.jwks
      kid: freds_key
      alg: RSA-OAEP
      # other parameters
      claims: 
         # application specific claims
    - jwks: my/friends.jwks
      kid: lauras_key
      alg: RSA-OAEP
      # other parameters
      claims: 
         # application specific claims

This will allow users to declare what their token should look like and the tool will create a suitable token.

  • The tool should be able to select appropriate default values if configuration is missing.
  • The tool should override bad statements (like the format in the example above) with suitable one.

The verify tool does not accept a token from the command line

Currently the only way to pass a JWS into the verify tool is either via STDIN or via a file.

It would be handy, if the tool would accept the token string directly from input.

This could be done by using a dedicated parameter -T or --JWT or --JWS to pass the string. In this case the tool must not try to read the token from stdin or a file. This way we do not need to verify whether a string is a token or a filename.

add support for 'crit'-headers

Add basic and extended support via the --crit option

Basic support should accept a comma separated list of header claims.

Extended support should accept Key-value pairs and run crit-header functions to validate an incoming JWT.

Crit header support is necessary for validate and decrypt.

Network traffic generated upon newkey

Hello!

I was curious about the network traffic that is emitted every single time I run newkey with npx.

  1. What is it for?
  2. Is there any way to disable it and make this a 100% offline operation?

Cheers.

testing: Encryption with multiple keys

Multiple keys require key wrapping alg. (Eg not ecdh-es but ecdh-es-...)

  • test for RSA and EC keys
  • test for multiple recipients sane headers
  • Test for multiple recipients with differen headers
  • test for multiple recipients with different key types and headers
  • verify that mixing key types is not allowed.

Add zsh tool expansion support

Zsh allows tools to register their sub commands for auto (tab) expansion.

It would be great to have a shell-install-tool that allows users to register jose tools into the environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.