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

@gnarula/aries-framework-javascript

v1.0.26

Published

<p align="center"> <img alt="Hyperledger Aries logo" src="images/aries-logo.png" width="100px" /> <h1 align="center">Aries Framework JavaScript</h1> <p align="center"><font size="+1">Built using TypeScript</font></p> <p align="center"> <img al

Downloads

2

Readme

Aries Framework JavaScript is a framework for building SSI Agents and DIDComm services that aims to be compliant and interoperable with the standards defined in the Aries RFCs.

Table of Contents

Goals

The framework is still in early development. At the moment the goal of this implementation is to run two independent Edge Agents (clients), running on mobile or desktop, which are able to communicate via a Mediator agent. It should at least adhere to the following requirements:

  • Edge Agent is independent on underlying communication layer. It can communicate via either HTTP request-response, WebSockets or Push Notifications.
  • Edge Agent can go offline and still receive its messages when it goes back to online.
  • There should be an option to connect more clients (Edge Agents) to one Routing Agent.
  • Prevent correlation.

See the Roadmap or the Framework Development project board for current progress.

Usage

Prerequisites

Aries Framework JavaScript depends on the indy-sdk which has some manual installation requirements. Before installing dependencies make sure to install libindy and have the right tools installed for the NodeJS wrapper. The NodeJS wrapper link also contains some common troubleshooting steps. The Dockerfile contains everything needed to get started with the framework. See Usage with Docker for more information.

If you're having trouble running this project, please the the troubleshooting section. It contains the most common errors that arise when first installing libindy.

Installing

NOTE: The package is not tested in multiple versions of Node at the moment. If you're having trouble installing dependencies or running the framework know that at least Node v12 DOES WORK and Node v14 DOES NOT WORk.

Currently the framework is working towards the first release of the package, until then the framework won't be available on NPM. However you can use the framework by packaging and adding it as a file to your project.

# Clone the repo
git clone https://github.com/hyperledger/aries-framework-javascript.git
cd aries-framework-javascript

# Install dependencies
yarn install

# Pack the framework
yarn pack

In a project, where you want to use this library as dependency, run:

yarn add file:PATH_TO_REPOSITORY_FOLDER/aries-framework-javascript/aries-framework-javascript-v1.0.0.tgz

Using the framework

While the framework is still in early development the best way to know what API the framework exposes is by looking at the tests, the source code or the samples. As the framework reaches a more mature state, documentation on the usage of the framework will be added.

Logs

If you want the framework to show the logs while running, you can set the DEBUG=aries-framework-javascript debug environment variable. For running the sample agency this means running yarn prod:debug instead of yarn prod:start

Architecture

Agent class has method receiveMessage which unpacks incoming inbound message and then pass it to the dispatch method. This method just tries to find particular handler according to message @type attribute. Handler then process the message, calls services if needed and also creates outbound message to be send by sender, if it's required by protocol.

If handler returns an outbound message then method sendMessage packs the message with defined recipient and routing keys. This method also creates forwardMessage when routing keys are available. The way an outbound message is send depends on the implementation of MessageSender interface. Outbound message just need to contain all information which is needed for given communication (e. g. HTTP endpoint for HTTP protocol).

Development

Setup Ledger

# Build indy pool
docker build -f network/indy-pool.dockerfile -t indy-pool .

# Start indy pool
docker run -d --rm --name indy-pool -p 9701-9708:9701-9708 indy-pool

# Setup CLI. This creates a wallet, connects to the ledger and sets the Transaction Author Agreement
docker exec indy-pool indy-cli-setup

#  DID and Verkey from seed
docker exec indy-pool add-did-from-seed 000000000000000000000000Trustee9

# If you want to register using the DID/Verkey you can use
# docker exec indy-pool add-did "NkGXDEPgpFGjQKMYmz6SyF" "CrSA1WbYYWLJoHm16Xw1VEeWxFvXtWjtsfEzMsjB5vDT"

Running tests

Test are executed using jest. Some test require either the mediator agents or the ledger to be running. When running tests that require a connection to the ledger pool, you need to set the TEST_AGENT_PUBLIC_DID_SEED and GENESIS_TXN_PATH environment variables.

Setting environment variables

  • GENESIS_TXN_PATH: The path to the genesis transaction that allows us to connect to the indy pool.
    • GENESIS_TXN_PATH=network/genesis/local-genesis.txn - default. Works with the ledger setup from the previous step.
    • GENESIS_TXN_PATH=network/genesis/builder-net-genesis.txn - Sovrin BuilderNet genesis.
    • GENESIS_TXN_PATH=/path/to/any/ledger/you/like
  • TEST_AGENT_PUBLIC_DID_SEED: The seed to use for the public DID. This will be used to do public write operations to the ledger. You should use a seed for a DID that is already registered on the ledger.
    • If using the local or default genesis, use the same seed you used for the add-did-from-seed command form the ledger setup in the previous step.
    • If using the BuilderNet genesis, make sure your seed is registered on the BuilderNet using selfserve.sovrin.org and you have read and accepted the associated Transaction Author Agreement. We are not responsible for any unwanted consequences of using the BuilderNet.

Starting mediator agents

To start the mediator agents you need to run two commands. See the Usage with Docker section on how to run the mediators inside docker.

Open terminal and start Alice's agency:

./run.sh agency01

Open new terminal and start Bob's agency:

./run.sh agency02

Only run e2e tests with in memory messaging

You don't have to start mediator agents or the ledger for these tests. Communication is done via RxJS subscriptions.

yarn test -t "agents"

Only run e2e tests with HTTP based routing agencies

Make sure the mediator agents from the Starting mediator agents step are running and then run:

yarn test -t "with agency"

Run all tests

Make sure the mediator agents from Starting mediator agents are running and you pass the correct environment variables from Setting environment variables for connecting to the indy ledger pool.

GENESIS_TXN_PATH=network/genesis/local-genesis.txn TEST_AGENT_PUBLIC_DID_SEED=000000000000000000000000Trustee9 yarn test

Usage with Docker

If you don't want to install the libindy dependencies yourself, or want a clean environment when running the framework or tests you can use docker.

Make sure you followed the local ledger setup to setup a local indy pool inside docker.

# Builds the framework docker image with all dependencies installed
docker build -t aries-framework-javascript .

# Run tests without network
docker run -it --rm aries-framework-javascript  yarn test -t "agents"

# Run test with mediator agents and ledger pool
docker-compose up -d # Run alice-mediator and bob-mediator
docker run --rm --network host --env TEST_AGENT_PUBLIC_DID_SEED=000000000000000000000000Trustee9 --env GENESIS_TXN_PATH=network/genesis/local-genesis.txn --env DEBUG=aries-framework-javascript aries-framework-javascript yarn test

Contributing

Found a bug? Ready to submit a PR? Want to submit a proposal for your grand idea? See our CONTRIBUTING file for more information to get you started!

License

Hyperledger Aries Framework JavaScript is licensed under the Apache License Version 2.0 (Apache-2.0).