findy-agent-vault

command module
v0.1.165 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

findy-agent-vault

test codecov

Getting Started

Findy Agency is a collection of services (Core, Auth, this service and Web Wallet) that provide full SSI agency along with a web wallet for individuals. To start experimenting with Findy Agency we recommend you to start with the documentation and set up the agency to your localhost environment.

Project

Vault provides both

  1. Data storage service for findy-agency clients
  2. Abstraction/Convenience layer for agency protocol APIs which can be used through GraphQL interface.

Vault provides currently only a GraphQL API but intends to support also GRPC in the future. As a findy-agency client you can use also the findy-agent GRPC APIs directly, but will have to implement possible data storing and indexing capabilities yourself.

Architecture

API

The vault API is currently missing proper documentation, but you can figure out the functionality from the API schema.

Authentication is implemented with agency-wide JWT token. You can generate a JWT token easily for your agent e.g. using the CLI tool or web wallet application.

Easiest is to start playing around with the queries:

Query

  • connections are the existing pairwise connections to other agents
  • messages are sent and received messages through the Aries basic message protocol
  • credentials are the credentials possessed by the holder (agent), received through the Aries issue credential protocol
  • proofs are the proofs sent by the holder (agent), sent through the Aries present proof protocol
  • jobs are differented Aries protocol flows the agent has participated in. Information from unfinished connections, messages, credentials or proofs can be obtained through jobs.

The API pagination is implemented according to GraphQL Cursor Connections Specification.

You can find the full schema diaram here.

It is recommended to study web wallet implementation to understand more about the API features.

Setup development environment

Basic setup
  1. Install golang

  2. Run app

    go run . version
    

    You shoud see something similar to this:

    I0526 14:43:44.750568   50912 config.go:68] Configuration file was not found, using environment/default variables only
    Vault version dev
    
Service configuration

Vault cannot function without a working installation of core agency. Either setup core agency to your local machine or use agency installation in the cloud.

  1. Vault can be configured using configuration file or environment variables. Following settings are required when running vault locally (note "<>" indicates example value, and should be replaced):

    # core agency address
    export FAV_AGENCY_HOST="<agency.example.com>"
    # core agency port
    export FAV_AGENCY_PORT="<50051>"
    # path to agency grpc cert files
    export FAV_AGENCY_CERT_PATH="<scripts/test-cert>"
    # true if this vault is the primary vault for the agency installation
    export FAV_AGENCY_MAIN_SUBSCRIBER=false
    # common agency JWT secret
    export FAV_JWT_KEY="<jwt-secret-common-with-core>"
    # vault database password (any password)
    export FAV_DB_PASSWORD="<password-for-postgres>"
    # vault server port
    export FAV_SERVER_PORT=8085
    # true if graphQL playground should be served in service root
    export FAV_USE_PLAYGROUND=true
    
  2. Vault uses postgres to store its data. You can start postgres in a docker container:

    make db
    
  3. Start vault by running the app with no arguments

    go run .
    

Unit testing

Unit tests assume postgres is running on port 5433.

Launch default postgres container by declaring password for postgres user:

export FAV_DB_PASSWORD="mysecretpassword"

and running

make init-test

You can run all unit tests with command

go test ./...

For linting, you need to install golangci-lint

make check builds, tests and lints the code.

Other documentation

Check docs-folder

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL