hyperledger / aries-askar

Secure storage designed for Hyperledger Aries agents.
Apache License 2.0
58 stars 44 forks source link

Running a Multi-tenanted agent with MultiWalletSingleTable #225

Closed icc-garciaju closed 6 months ago

icc-garciaju commented 6 months ago

I'm trying to run a multi-tenanted where all wallets are stored on a single database, but I got a new database each time I create a wallet on the multitenancy/wallet endpoint.

My config is:

url http://localhost:3001/status/config|jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4866  100  4866    0     0  1021k      0 --:--:-- --:--:-- --:--:-- 1187k
{
  "config": {
    "admin.admin_insecure_mode": true,
    "admin.enabled": true,
    "admin.host": "0.0.0.0",
    "admin.port": "3001",
    "admin.webhook_urls": [],
    "admin.admin_client_max_request_size": 1,
    "default_endpoint": "http://agency:3000",
    "additional_endpoints": [],
    "revocation.anoncreds_legacy_support": "accept",
    "ledger.genesis_url": "XXXXREDACTEDXXX",
    "ledger.keepalive": 5,
    "log.level": "debug",
    "trace.target": "log",
    "trace.tag": "",
    "trace.label": "Agency",
    "preserve_exchange_records": true,
    "emit_new_didcomm_prefix": true,
    "emit_new_didcomm_mime_type": true,
    "auto_provision": true,
    "transport.inbound_configs": [
      [
        "http",
        "0.0.0.0",
        "3000"
      ]
    ],
    "transport.outbound_configs": [
      "http"
    ],
    "transport.enable_undelivered_queue": false,
    "default_label": "Agency",
    "transport.max_message_size": 2097152,
    "transport.max_outbound_retry": 4,
    "transport.ws.heartbeat_interval": 3,
    "transport.ws.timeout_interval": 15,
    "wallet.allow_insecure_seed": true,
    "wallet.name": "agency",
    "wallet.storage_type": "postgres_storage",
    "wallet.type": "askar",
    "wallet.storage_config": "{\"url\":\"db:5432\",\"wallet_scheme\":\"MultiWalletSingleTable\"}",
    "multitenant.enabled": true,
    "multitenant.admin_enabled": true,
    "endorser.author": false,
    "endorser.endorser": false,
    "endorser.auto_endorse": false,
    "endorser.auto_write": false,
    "endorser.auto_create_rev_reg": false,
    "endorser.auto_promote_author_did": false,
    "ledger.read_only": false,
    "ledger.genesis_transactions": "XXXXREDACTEDXXXX",
    "upgrade.from_version": "v0.7.5"
  }
}

And an wallet creation call:

  'http://localhost:3001/multitenancy/wallet' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "extra_settings": {
    "ACAPY_AUTO_ACCEPT_INVITES": true,
    "ACAPY_AUTO_ACCEPT_REQUESTS": true,
    "ACAPY_AUTO_RESPOND_MESSAGES": true,
    "ACAPY_AUTO_RESPOND_CREDENTIAL_OFFER": true,
    "ACAPY_AUTO_RESPOND_CREDENTIAL_REQUEST": true,
    "ACAPY_AUTO_VERIFY_PRESENTATION": true,
    "ACAPY_NOTIFY_REVOCATION": true
  },
  "key_management_mode": "managed",
  "label": "Bob",
  "wallet_dispatch_type": "default",
  "wallet_key": "MySecretKey123",
  "wallet_name": "bob",
  "wallet_type": "askar",
  "wallet_webhook_urls": [
    "http://localhost:8022/webhooks"
  ]
}'|jq

Can you help me?

swcurran commented 6 months ago

@andrewwhitehead — any guidance?

icc-garciaju commented 6 months ago

It looks like I found what was the problem: I didn't add --multitenancy-config wallet_type=askar-profile to the agent start command.

Now I only have one database for the base wallet and a multitenant_sub_wallet database for the sub wallets.

It would be nice if this database name were configurable, but my issue is solved now.