Account Service
The Account Service is a API gateway service designed to be an entry point for cloud PCM backend.
API Documentation
The API documentation is written in Swagger Swagger Web UI
It can be accessed in local docker-compose environment swagger_ui.
It is generated using swagger generation tool
In case of changes in api definitions, it should be updated. Please run:
go install github.com/swaggo/swag/cmd/swag@latest
swag init --parseDependency
Available Endpoints
- GET /v1/metrics/health
- GET /swagger/*any
- GET /v1/tenants/:tenantId/api/accounts/devices/list
- GET /v1/tenants/:tenantId/api/accounts/devices/link
- DELETE /v1/tenants/:tenantId/api/accounts/devices/:id
- POST /v1/tenants/:tenantId/api/accounts/devices/block/:id
- GET /v1/tenants/:tenantId/api/accounts/history/list
- GET /v1/tenants/:tenantId/api/accounts/kms/keyTypes
- GET /v1/tenants/:tenantId/api/accounts/kms/did/list
- POST /v1/tenants/:tenantId/api/accounts/kms/did/create
- DELETE /v1/tenants/:tenantId/api/accounts/kms/did/:kid
- GET /v1/tenants/:tenantId/api/accounts/settings/ui
- POST /v1/tenants/:tenantId/api/accounts/settings/ui
- GET /v1/tenants/:tenantId/api/accounts/credentials/list
- POST /v1/tenants/:tenantId/api/accounts/credentials/list
- GET /v1/tenants/:tenantId/api/accounts/credentials/history
- DELETE /v1/tenants/:tenantId/api/accounts/credentials/:id
- GET /v1/tenants/:tenantId/api/accounts/credentials/:id/revoke
- GET /v1/tenants/:tenantId/api/accounts/credentials/schemas
- POST /v1/tenants/:tenantId/api/accounts/credentials/issue
- PUT /v1/tenants/:tenantId/api/accounts/credentials/backup/:id/:bid
- GET /v1/tenants/:tenantId/api/accounts/credentials/backup/:id/:bid
- GET /v1/tenants/:tenantId/api/accounts/credentials/backup/link/:mode
- GET /v1/tenants/:tenantId/api/accounts/credentials/backup/all
- GET /v1/tenants/:tenantId/api/accounts/credentials/backup/latest
- DELETE /v1/tenants/:tenantId/api/accounts/credentials/backup/invalid
- DELETE /v1/tenants/:tenantId/api/accounts/credentials/backup/:bid
- PUT /v1/tenants/:tenantId/api/accounts/credentials/offers/create
- GET /v1/tenants/:tenantId/api/accounts/credentials/offers/list
- POST /v1/tenants/:tenantId/api/accounts/credentials/offers/:id/accept
Dependency services
docker-compose
Infrastructure
Microservices
Running the Service
-
Setup
.env file or config.yaml can be used to define environment variables.
-
Build and run service
If necessary, copy to terminal corresponding command from Makefile
make docker-compose-run
Locally
- Setup
Define environment variables in terminal
ACCOUNT_LISTENPORT=8080
ACCOUNT_SERVERMODE=production
ACCOUNT_NATS_WITHNATS=true
ACCOUNT_NATS_TIMEOUTINSEC=10s
ACCOUNT_NATS_URL=nats.nats.svc.cluster.local:4222
ACCOUNT_NATS_QUEUEGROUP=account-service
ACCOUNT_CLOUDEVENTS_TOPICS=didcomm-connector-invitation
ACCOUNT_MESSAGING_PROTOCOL=nats
ACCOUNT_MESSAGING_NATS_WITH_NATS=true
ACCOUNT_MESSAGING_NATS_URL=nats.nats.svc.cluster.local:4222
ACCOUNT_MESSAGING_NATS_TIMEOUTINSEC=10s
ACCOUNT_PROTOCOL=nats
ACCOUNT_DB_WITHDB=true
ACCOUNT_DB_DBTYPE=postgres
ACCOUNT_DB_HOST=testing-db-rw.postgres.svc.cluster.local
ACCOUNT_DB_PORT=5432
ACCOUNT_DB_USER=app
ACCOUNT_DB_PASSWORD=change me
ACCOUNT_DB_DBNAME=app
ACCOUNT_KEYCLOAK_URL=http://keycloak.keycloak.svc.cluster.local
ACCOUNT_KEYCLOAK_REALMNAME=react-keycloak
ACCOUNT_KEYCLOAK_TOKENTTL=250ns
ACCOUNT_KEYCLOAK_EXCLUDEENDPOINTS=/v1/tenants/:tenantId/api/accounts/credentials/backup/:id/:bid
ACCOUNT_STORAGE_URL=http://storage-service.default.svc.cluster.local:8080/v1/tenants/tenant_space/storage
ACCOUNT_STORAGE_WITHAUTH=false
ACCOUNT_BACKUPLINKTTL=300s
ACCOUNT_DIDCOMM_URL=http://didcomm-connector.default.svc.cluster.local:9090
ACCOUNT_SIGNER_URL=http://signer.default.svc.cluster.local:8080
ACCOUNT_CREDENTIALRETRIEVAL_URL=http://credential-retrieval-service.default.svc.cluster.local:8080/v1/tenants/tenant_space
ACCOUNT_CREDENTIALRETRIEVAL_OFFERTOPIC=offering
ACCOUNT_CREDENTIALVERIFIER_URL=http://credential-verification-service.default.svc.cluster.local:8080/v1/tenants/tenant_space/internal
VAULT_ADRESS=http://vault.vault.svc.cluster.local:8200
VAULT_TOKEN=mytoken
- Build plugin
mkdir etc
cd etc
git clone https://gitlab.eclipse.org/eclipse/xfsc/libraries/crypto/engine/plugins/hashicorp-vault-provider.git .
go mod download
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -mod=mod -buildmode=plugin -o /etc/plugins
- Build and run service
go mod download
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /microservice
./microservice
Deploying the service
Deployment is managed using Helm
Charts are defined in ./deployment/helm
From root
cd deployment
helm install account-service ./helm -n <your namespace | default> --kubeconfig <path to kubeconfig of necessary cluster>