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

jolocom-cli

v1.9.2

Published

CLI interface for a Jolocom Self Sovereign Identity

Downloads

40

Readme

Intro:

Jolocom-cli is a simple tool for interacting with the Jolocom identity infrastructure from the command line. Please note that currently only a subset of the APIs exposed by the Jolocom Library are supported.

The following sections will show how to use the provided tool to anchor a new identity and issue authentication / payment requests. We will also look at a quick example of broadcasting the generated requests to the SmartWallet using deep linking.

Setting up the CLI:

First, install the CLI tool, either locally or globally:

npm install -g jolocom-cli

At this point you can already start using it as described in the next sections. For all request signatures a default identity will be used (not recommended for production obviously, but will work for testing). In case you want to create a custom identity you need to provide a custom 32 byte hex encoded seed using the -i flag, for example:

jolocom-cli <command> -i "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

If you actually try to run a command, you'll most likely get the following error:

current identity is not anchored

This is because the identity was not yet registered on the ledger. To register it, first fuel the key with some Ether to pay for the transaction:

jolocom-cli fuel -i "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

And after the key has been fueled, anchor it:

jolocom-cli create -i "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

At this point you can test if it was anchored correctly using:

jolocom-cli did -i "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

did: did:jolo:6b8e4245e9863a976b475b7a7c1dc70e290c9fbf0de9eec751d821944658b564
created: 2019-04-22T10:09:28.863Z

Creating interaction requests:

Authentication:

The deep link route for authentication on the Smartwallet App is:

jolocomwallet://authenticate/<JWT>

We can generate an authentication request for testing using the CLI tool:

jolocom-cli request auth "https://callback.com"

In the example above, a JWT is created with the specified callback url. The JWT is signed by the staX identity. In order to resolve the staX identity we provide the deployment info (the endpoint of the staX deployment + identity contract address) using the -s flag.

This JWT can be sent to the device on the previously mentioned route, for example by using:

adb shell am start -a android.intent.action.VIEW -d jolocomwallet://authenticate/<JWT>

Further info about the accepted options is available if you run

jolocom-cli request auth --help

#Output:

Usage: jolocom-cli request auth <callbackURL> [description] [options...]

Positionals:
  callbackURL  - url to which the client should send the response        [string] [required]
  description  - additional description to render on the client device   [string]

Options:
  --help          Show help  [boolean]
  --version       Show version number  [boolean]
  --staX, -s      Use custom staX deployment instead of public registry  [string]
  --identity, -i  Provide custom 32 byte seed to generate identity keys  [string]

As you can see, you can also pass an optional description that will be rendered on the SmartWallet, the default text is "Authorize the transaction".

In case you want to use a custom identity, you can specify it using the optional -i flag, for example:

jolocom-cli ... -i "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"

32 hex encoded bytes for the seed are expected. If the -i flag is not present, the default seed of aaa....aaa will be used. Please note that the custom identity has to be registered first as described in the first section.

Payment:

Please note that payment related interactions are experimental and are only to be used for testing purposes.

The deep link route for authentication on the Smartwallet App is:

jolocomwallet://payment/<JWT>

We can generate a payment request for testing using the CLI tool:

jolocom-cli request payment "https://c3378b68.ngrok.io" "Description of provided service" "0.5"

In the example above, a JWT is created with the specified callback url, description, and amount (0.5 Eth in this case). T

For usage info you can again run:

jolocom-cli request payment --help

#Relevant output:

Positionals:
  callbackURL  - url to which the client will send the response                  [string] [required]
  description  - additional description to render on the client device           [string] [required]
  amount       - amount of Eth to transfer                                       [number] [required]
  to           - receiver Ethereum address, defaults to current identity                    [string]

Just like in the previous example, the -i flag can be used to specify a custom identity, although for testing the default one should do.