Git Product home page Git Product logo

vcxagencynode's Introduction

Decommission notice

This project has been decommissioned. No further updates or maintenance shall be expected.

Node VCX Agency

  • Implementation of AriesVCX compatible Mediator Agency.

  • Mediator Agency can service many users, providing them endpoint where 3rd parties can deliver encrypted messages. Assuming the sending party has properly end2end encrypted the message for recipient, according to Aries connection
    protocol, the agency itself can't decrypt content of received messages.

  • VCX Agency implements 2 notification mechanisms.

    1. Webhooks - The agency calls a specified url when an agent receives a message. This is useful when using AriesVcx on a server.
    2. Longpolls - Agent owners can poll agency to check whether any new messages have arrived. This is implemented via longpoll mechanism - the server returns response only if a new message has arrived, or certain amount of time has passed since the query request was received. This is to prevent overloading agency with client requests. In the future, longpoll mechanism might be replaced by websockets.

Repository structure

The agency implementation is in directory vcxagency-node.

Repository structure details:

/
├── dev/               # Monorepo management scripts
├── vcxagency-node /   # AriesVCX mediator agency implementation in NodeJS 
├── vcxagency-client/  # AriesVCX mediator agency client in NodeJS 
├── easy-indysdk/      # NodeJS idiomatic wrapper around basic IndySDK wrapper
└-- vcx-tester/        # AriesVCX integration tests using AriesVCX
  • Rust client for agency can be found here.

Note

  • Project is using yarn instead of npm to install dependencies in all modules. The reason is that npm has issues handling monorepo projects with file: style dependencies. See more info here npm/npm#13528

Copyright 2020 ABSA Group Limited

you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

vcxagencynode's People

Contributors

ingee avatar kukgini avatar marekprague avatar mirgee avatar patrik-stas 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vcxagencynode's Issues

Migrate db schema from previous version 0.1.2

I am trying to migrate version 0.1.2 to 0.3.0. I noticed that the database schema has changed. I can't find any indication to be able to update my current database schema with that of version 0.3.0. Do you have any suggestions on this?

DB schema generation doesn't work

I'm still using the v0.3.0, and found the issue when starting the application.
If I use the DB account other than the 'postgres' user, it doesn't work.

mediator-78576444f-bbbd8 mediator   "LOG_LEVEL": "silly",
mediator-78576444f-bbbd8 mediator   "LOG_ENABLE_INDYSDK": "true",
mediator-78576444f-bbbd8 mediator   "LOG_JSON_TO_CONSOLE": "false",
mediator-78576444f-bbbd8 mediator   "SERVER_PORT": 8080,
mediator-78576444f-bbbd8 mediator   "SERVER_MAX_REQUEST_SIZE_KB": 300,
mediator-78576444f-bbbd8 mediator   "SERVER_ENABLE_TLS": "false",
mediator-78576444f-bbbd8 mediator   "AGENCY_WALLET_NAME": "vcxagency-node",
mediator-78576444f-bbbd8 mediator   "AGENCY_DID": "VsKV7grR1BUE29mG2Fm2kX",
mediator-78576444f-bbbd8 mediator   "AGENCY_SEED_SECRET": "0******************************d",
mediator-78576444f-bbbd8 mediator   "AGENCY_WALLET_KEY_SECRET": "0******************9",
mediator-78576444f-bbbd8 mediator   "AGENCY_TYPE": "enterprise",
mediator-78576444f-bbbd8 mediator   "PG_STORE_HOST": "postgres",
mediator-78576444f-bbbd8 mediator   "PG_STORE_PORT": 5432,
mediator-78576444f-bbbd8 mediator   "PG_STORE_ACCOUNT": "mediator",
mediator-78576444f-bbbd8 mediator   "PG_STORE_PASSWORD_SECRET": "a*****g",
mediator-78576444f-bbbd8 mediator   "PG_STORE_DATABASE": "agency-storage",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_ACCOUNT": "mediator",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_PASSWORD_SECRET": "a*****g",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_ADMIN_ACCOUNT": "mediator",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_ADMIN_PASSWORD_SECRET": "a*****g",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_URL": "postgres:5432",
mediator-78576444f-bbbd8 mediator   "PG_WALLET_MAX_CONNECTIONS": 50,
mediator-78576444f-bbbd8 mediator   "PG_WALLET_CONNECTION_TIMEOUT_MINS": 30
mediator-78576444f-bbbd8 mediator }
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.593] [index] [debug] [expressRequestId=undefined]: Going to build application internals.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.601] [app] [info] [expressRequestId=undefined]: Initializing postgres plugin with config: {"url":"postgres:5432","max_connections":50,"min_idle_count":0,"wallet_scheme":"MultiWalletSingleTableSharedPool"}
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.901] [app] [silly] [expressRequestId=undefined]: INDYSDK: prepare_result: >>> Ok(())
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.905] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_set_logger: <<< res: Success
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.907] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_get_logger >>> context_p: 0x4003567bf0, enabled_cb_p: 0x4003567bf8, log_cb_p: 0x4003567c30, flush_cb_p: 0x4003567c00
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.909] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_get_logger: <<< res: Success
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.911] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_register_wallet_type: >>> command_handle: 1, type_: 0x4002004de0, cb: Some(0x40072b2270)
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.913] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_register_wallet_type: params type_: "postgres_storage"
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.915] [app] [silly] [expressRequestId=undefined]: INDYSDK: prepare_result: >>> Ok(())
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.917] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_register_wallet_type: <<< res: Success
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.918] [app] [info] [expressRequestId=undefined]: INDYSDK: Worker thread started
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.920] [app] [debug] [expressRequestId=undefined]: INDYSDK: WalletCommand command received
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.922] [app] [debug] [expressRequestId=undefined]: INDYSDK: RegisterWalletType command received
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.923] [app] [silly] [expressRequestId=undefined]: INDYSDK: _register_type >>> type_: "postgres_storage"
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.925] [app] [silly] [expressRequestId=undefined]: INDYSDK: register_wallet_storage >>> type_: "postgres_storage"
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.926] [app] [silly] [expressRequestId=undefined]: INDYSDK: register_wallet_storage <<<
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.927] [app] [silly] [expressRequestId=undefined]: INDYSDK: _register_type <<< res: ()
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.928] [app] [silly] [expressRequestId=undefined]: INDYSDK: prepare_result: >>> Ok(())
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.930] [app] [silly] [expressRequestId=undefined]: INDYSDK: indy_register_wallet_type: cb command_handle: 1, err: Success
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.931] [app] [debug] [expressRequestId=undefined]: INDYSDK: Initialising postgresql using MultiWalletSingleTableSharedPool strategy.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.933] [app] [debug] [expressRequestId=undefined]: INDYSDK: MultiWalletSingleTableStrategySharedPool open >> building connection pool
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.934] [app] [error] [expressRequestId=undefined]: INDYSDK: Init storage failed: IOError("IO error during storage operation: database error")
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:27.977] [pgstorage-entities] [warn] [expressRequestId=undefined]: Couldn't connect to postgres, will try again after 2000ms.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:30.001] [pgstorage-entities] [warn] [expressRequestId=undefined]: Couldn't connect to postgres, will try again after 2000ms.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:32.014] [pgstorage-entities] [warn] [expressRequestId=undefined]: Couldn't connect to postgres, will try again after 2000ms.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:34.029] [pgstorage-entities] [warn] [expressRequestId=undefined]: Couldn't connect to postgres, will try again after 2000ms.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:36.038] [pgstorage-entities] [warn] [expressRequestId=undefined]: Couldn't connect to postgres, will try again after 2000ms.
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:38.054] [index] [error] [expressRequestId=undefined]: Unhandled error. Application will be terminated. Error: Couldn't connect to postgres after 5 attempts.
mediator-78576444f-bbbd8 mediator     at waitUntilConnectsToPostgres (/home/node/vcxagency-node/src/service/storage/pgstorage-entities.js:46:13)
mediator-78576444f-bbbd8 mediator     at processTicksAndRejections (internal/process/task_queues.js:97:5)
mediator-78576444f-bbbd8 mediator     at async buildApplication (/home/node/vcxagency-node/src/setup/app.js:109:3)
mediator-78576444f-bbbd8 mediator     at async run (/home/node/vcxagency-node/src/index.js:65:25)
mediator-78576444f-bbbd8 mediator [2022-03-17 11:23:38.056] [index] [warn] [expressRequestId=undefined]: Process exiting with code: 255
mediator-78576444f-bbbd8 mediator npm ERR! code ELIFECYCLE
mediator-78576444f-bbbd8 mediator npm ERR! errno 255
mediator-78576444f-bbbd8 mediator npm ERR! [email protected] serve: `NODE_ENV=production node src/index.js`
mediator-78576444f-bbbd8 mediator npm ERR! Exit status 255
mediator-78576444f-bbbd8 mediator npm ERR!
mediator-78576444f-bbbd8 mediator npm ERR! Failed at the [email protected] serve script.
mediator-78576444f-bbbd8 mediator npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
mediator-78576444f-bbbd8 mediator
mediator-78576444f-bbbd8 mediator npm ERR! A complete log of this run can be found in:
mediator-78576444f-bbbd8 mediator npm ERR!     /home/node/.npm/_logs/2022-03-17T02_23_38_190Z-debug.log

Fix database connection fail message

In 1.0.0 release of vcxagency-node, It seems that the default database has changed from postgres to mysql when switching to vdr-tools. However, if the database connection fails, it logs a wrong error message (Couldn't connect to postgres, will try again after ${timeoutMs}ms.). I can make a PR for this simple bug, but I need your opinion on whether the message is better to change from postgres to mysql or to use more ambiguous words (e.g. storage or database) in case mysql is replaced with postgres or a custom plugin.

Handle both legacy and current @type values in forward messages

Currently, agency expects and uses legacy @type attribute for forward messages:

did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/routing/1.0/forward

However, as per aries spec (see here), a different value should be used for the attribute:

https://didcomm.org/routing/1.0/forward

Agency should support both formats for some time in order to remain backwards compatible.

Analogous change was already implemented in aries-vcx (see here).

Add new status update message type

  • Message type MSGTYPE_UPDATE_MSG_STATUS_BY_CONNS has following format
{
    "@type": <MSGTYPE_UPDATE_MSG_STATUS_BY_CONNS>,
    "statusCode": "MS-106",
    "uidsByConns": [{"pairwiseDID":"6FRuB95abcmzz1nURoHyWE","uids":["Br4CoNP4TU"]}, ...]
}
  • In PR #159 we changed behaviour of MSGTYPE_UPDATE_MSG_STATUS_BY_CONNS such that values pairwiseDID are ignored and simply merge of uid is performed, whereas we guarantee on DB level that uids are unique across all agent connections.

We should deprecate MSGTYPE_UPDATE_MSG_STATUS_BY_CONNS and replace it by new message type with simpler argument interface.
Proposal

{
    "@type": <MSGTYPE_UPDATE_MSG_STATUS_BY_UID>,
    "statusCode": "MS-106",
   "uids":["Br4CoNP4TU", ... ] 
}

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.