animo / animo-mediator Goto Github PK
View Code? Open in Web Editor NEWAn easy to set-up Aries and DIDComm v1 mediator built on Aries Framework JavaScript.
An easy to set-up Aries and DIDComm v1 mediator built on Aries Framework JavaScript.
Hi, I want to know if this is horizontally scalable.
Can I have several instances running and load-balance between them? Is there any special setting I have to turn on?
Thank you in advance.
I struggled a bit to bring up the mediator in a docker container. I had the following error:
2023-06-06 07:22:23.612 INFO [DIDComm Chat WalletApi.initialize] Initializing wallet 'mediator'
{
id: 'mediator',
key: '[*****]',
storage: {
type: 'postgres_storage',
config: {
url: 'postgres://postgres:postgres@postgres:5432/mediator',
wallet_scheme: 'DatabasePerWallet'
},
credentials: '[*****]'
}
}
2023-06-06 07:22:23.619 DEBUG [DIDComm Chat IndySdkWallet._open] Wallet 'mediator' not found
2023-06-06 07:22:23.619 DEBUG [DIDComm Chat IndySdkWallet.createAndOpen] Creating wallet 'mediator' using SQLite storage
2023-06-06 07:22:24.235 ERROR [DIDComm Chat IndySdkWallet.createAndOpen] Error creating wallet 'mediator'
{
error: {
stack: 'IndyError: WalletStorageError\n' +
' at Object.callback (/www/node_modules/indy-sdk/src/wrapIndyCallback.js:15:10)',
name: 'IndyError',
message: 'WalletStorageError',
indyCode: 210,
indyName: 'WalletStorageError',
indyCurrentErrorJson: null
},
errorMessage: 'WalletStorageError'
}
After a bit of research, I endend up in another issue for indy-sdk which pointed to https://github.com/hyperledger/indy-sdk/blob/main/experimental/plugins/postgres_storage/src/postgres_storage.rs#L1085
There the connection url construction is displayed:
fn _admin_postgres_url(config: &PostgresConfig, credentials: &PostgresCredentials) -> String {
let mut url_base = "postgresql://".to_owned();
match credentials.admin_account {
Some(ref account) =>url_base.push_str(&utf8_percent_encode(&account[..], &NON_ALPHANUMERIC).to_string()),
None => ()
}
url_base.push_str(":");
match credentials.admin_password {
Some(ref password) => url_base.push_str(&utf8_percent_encode(&password[..], &NON_ALPHANUMERIC).to_string()),
None => ()
}
url_base.push_str("@");
url_base.push_str(&config.url[..]);
url_base.push_str("/");
url_base.push_str(_POSTGRES_DB);
url_base
}
So the POSTGRESQL_DATABASE_URL should be postgres:5432
as per your docker example.
I can issue a credential locally using the mediator.dev.animo.id
invitation url.
But when I run yarn dev
to get a mediator using this repo, I can't get the new ngrok invitation url to work.
The yarn dev
output looks promising:
me@ME animo-mediator % yarn dev
yarn run v1.22.21
warning ../../../package.json: No license field
$ ts-node dev
Got ngrok url: https://REDACTED.ngrok.app
2023-12-02 18:43:33.907 INFO [DIDComm Chat src/agent.ts:71 createAgent] Using SQlite storage
{
walletId: 'REDACTED'
}
2023-12-02 18:43:33.912 WARN [DIDComm Chat AskarModule.register] The '@aries-framework/askar' module is experimental and could have unexpected breaking changes. When using this module, make sure to use strict versions for all @aries-framework packages.
2023-12-02 18:43:33.915 INFO [DIDComm Chat undefined.constructor] Creating agent with config
{
agentConfig: {
label: 'Animo Mediator',
endpoints: [
'https://REDACTED.ngrok.app',
'wss://REDACTED.ngrok.app'
],
walletConfig: {
id: 'REDACTED',
key: '[*****]',
storage: {}
},
useDidSovPrefixWhereAllowed: true,
logger: 1,
autoUpdateStorageOnStartup: true,
didCommMimeType: 'application/ssi-agent-wire',
agentDependencies: true
}
}
2023-12-02 18:43:33.919 INFO [DIDComm Chat WalletApi.initialize] Initializing wallet 'REDACTED'
{
id: 'REDACTED',
key: '[*****]',
storage: {}
}
2023-12-02 18:43:34.482 DEBUG [DIDComm Chat AskarWallet._open] Wallet 'REDACTED' opened with handle '1'
2023-12-02 18:43:34.484 INFO [DIDComm Chat initialize] Agent storage is up to date.
2023-12-02 18:43:34.486 DEBUG [DIDComm Chat HttpInboundTransport.start] Starting HTTP inbound transport
{
port: 3000
}
2023-12-02 18:43:34.488 DEBUG [DIDComm Chat WsInboundTransport.start] Starting WS inbound transport
{
endpoint: 'wss://REDACTED.ngrok.app'
}
2023-12-02 18:43:34.489 DEBUG [DIDComm Chat HttpOutboundTransport.start] Starting HTTP outbound transport
2023-12-02 18:43:34.489 DEBUG [DIDComm Chat WsOutboundTransport.start] Starting WS outbound transport
2023-12-02 18:43:34.490 DEBUG [DIDComm Chat MediatorApi.initialize] Mediator routing record not loaded yet, retrieving from storage
2023-12-02 18:43:34.492 INFO [DIDComm Chat src/index.ts:7 undefined.<anonymous>] Agent started
2023-12-02 18:43:34.495 INFO [DIDComm Chat src/index.ts:31 undefined.<anonymous>] Out of band invitation url:
https://REDACTED.ngrok.app/invite?oob=VALID_LOOKING_ACCESS_TOKEN
Visiting in my browser: https://REDACTED.ngrok.app/invite?oob=VALID_LOOKING_ACCESS_TOKEN
also looks promising. I get Missing or invalid _oobid
which is the same thing what I see if I visit the mediator.dev.animo.id
invitation url.
After running my issue credential script locally using the new ngrok url, it gets stuck at the start of the mediator connection attempt:
INFO: Agent storage is up to date.
DEBUG: Starting HTTP outbound transport
DEBUG: Starting WS outbound transport
DEBUG: Provision mediation with invitation {
"mediatorInvitationUrl": "https://REDACTED.ngrok.app/invite?oob=VALID_LOOKING_ACCESS_TOKEN"
}
Error
at _super (.../node_modules/rxjs/src/internal/util/createErrorClass.ts:13:22)
at new TimeoutErrorImpl (.../node_modules/rxjs/src/internal/operators/timeout.ts:91:7)
at timeoutErrorFactory (.../node_modules/rxjs/src/internal/operators/timeout.ts:404:9)
at .../node_modules/rxjs/src/internal/operators/timeout.ts:349:15
at AsyncAction.<anonymous> (.../node_modules/rxjs/src/internal/util/executeSchedule.ts:27:5)
at AsyncAction._execute (.../node_modules/rxjs/src/internal/scheduler/AsyncAction.ts:120:12)
at AsyncAction.execute (.../node_modules/rxjs/src/internal/scheduler/AsyncAction.ts:95:24)
at AsyncScheduler.flush (.../node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts:40:27)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7) {
message: 'Timeout has occurred',
info: { meta: null, lastValue: null, seen: 0 }
}
Any advice?
Would be awesome if we could get a CHANGELOG file to keep track of the changes being made
Hello @TimoGlastra @2mau
Could you please help with?
Trying to use DO database, and seems Asker cannot create databases there
openwallet-foundation/credo-ts#1614
2023-10-25 09:03:12.659 INFO [DIDComm Chat WalletApi.initialize] Initializing wallet 'incogme-mediator-beta'
{
id: 'incogme-mediator-beta',
key: '[*****]',
storage: {
type: 'postgres',
config: {
host: 'beta-incogme-db-postgresql-fra1-do-user-13941840-0.c.db.ondigitalocean.com:25060',
connectTimeout: 10
},
credentials: '[*****]'
}
}
2023-10-25 09:03:13.146 DEBUG [DIDComm Chat AskarWallet._open] Wallet 'incogme-mediator-beta' not found
2023-10-25 09:03:13.146 DEBUG [DIDComm Chat AskarWallet.createAndOpen] Creating wallet 'incogme-mediator-beta
2023-10-25 09:03:14.294 ERROR [DIDComm Chat AskarWallet.createAndOpen] Error creating wallet 'incogme-mediator-beta'
{
error: {
stack: 'Error: Backend error\n' +
'Caused by: error returned from database: database "postgres" does not exist\n' +
' at cb (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@hyperledger/aries-askar-nodejs/build/NodeJSAriesAskar.js:44:39)\n' +
' at Object.<anonymous> (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/ffi-napi/lib/callback.js:66:27)',
message: 'Backend error\n' +
'Caused by: error returned from database: database "postgres" does not exist',
code: 1
},
errorMessage: 'Backend error\n' +
'Caused by: error returned from database: database "postgres" does not exist'
}
/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/askar/build/wallet/AskarWallet.js:114
throw new core_1.WalletError(errorMessage, { cause: error });
^
WalletError: Error creating wallet 'incogme-mediator-beta'
at AskarWallet.createAndOpen (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/askar/build/wallet/AskarWallet.js:114:19)
at async WalletApi.createAndOpen (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/core/build/wallet/WalletApi.js:63:9)
at async WalletApi.initialize (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/core/build/wallet/WalletApi.js:54:17)
at async Agent.initialize (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/core/build/agent/BaseAgent.js:89:13)
at async Agent.initialize (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@aries-framework/core/build/agent/Agent.js:124:9)
at async createAgent (/Users/yuriyyakovenko/projects/incogme/mediator/build/agent.js:107:5) {
[cause]: AriesAskarError: Backend error
Caused by: error returned from database: database "postgres" does not exist
at cb (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/@hyperledger/aries-askar-nodejs/build/NodeJSAriesAskar.js:44:39)
at Object.<anonymous> (/Users/yuriyyakovenko/projects/incogme/mediator/node_modules/ffi-napi/lib/callback.js:66:27) {
code: 1,
extra: undefined
}
}
Node.js v18.17.0
error Command failed with exit code 1.
Regards
It could be nice to have a /health enpoint in order to be able to monitor the status of the mediator.
Thanks in avance and thanks for your great work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.