Service to send push notifications through sygnal matrix API for encrypted device info.
to start use docker-compose file.
docker-compose up -d
SERVER_HOST - public URL to polygon push gateway.
REDIS_URL - URL to Redis instance. Redis is used for temporary cache of schemas.
GATEWAY_HOST - URL to sygnal matrix instance
PRIVATE_KEY - Encryption key.
SERVER_PORT - port to run pgg on. Default: 8085.
LOG_LEVEL - log level. Default debug.
LOG_ENV - log env. Default development.
- Clone this repository.
- Generate private key for encryption/decryption:
openssl genrsa -out keypair.pem 4096
- Put private key to
.envfile:echo "export PRIVATE_KEY='`cat keypair.pem`'" >> .env
- Add required env variables (example):
GATEWAY_HOST - URL to
export GATEWAY_HOST="http://localhost:5000/" export SERVER_HOST="http://localhost:8080" export SERVER_PORT="8085" export REDIS_URL="redis://username:userpassword@localhost:6379/1" export AUTH_MIDDLEWARE_VERIFIER_DID="verifier_did"
sygnalinstance. - Read env variables:
source .env - Create config for
sygnalinstance by path.sygnal/sygnal.yaml:apps - list of apps. You can add more apps.log: setup: version: 1 formatters: normal: format: "%(asctime)s [%(process)d] %(levelname)-5s %(name)s %(message)s" access: x_forwarded_for: false http: bind_addresses: ['0.0.0.0'] port: 5000 apps: polygon.web: type: gcm api_key: "AAAALiwHn80:...Mh1GcuXWF1dNiTMCcB7ccYR-ocu" fcm_options: content_available: true mutable_content: true
apps.polygon.web - is name of app. You can change it to any name.
apps.app_name.type - type of app. You can usegcmorfcmfor android devices.
apps.app_name.api_key - api key for push notifications. You can get it from firebase console.
apps.app_name.fcm_options.content_available - enable/disable content in a notification message.
apps.app_name.fcm_options.mutable_content - enables the service extension on the receiving client to handle the image delivered in the payload. - Run docker compose:
docker-compose up -d
- Run the
send_notification.shscript and pass the device token as the first parameter:./send_notification.sh ccg01-AeoZLwC7a9HtMOc0...S4_5
- Example of success response:
[ { "device": { "ciphertext": "eEvJwHe08uvFqpeU6Ocr2Q5v3+NGjyPCthpIaiJw2/CL7/wAw06yFY0Pn0tLMzVW+ibN/OlH+TzfzEAC8VmzRNWC/98ZYd9t41ihsVwwBD6tYWt/FJE9ZixWhd7TKp7eUC+orTWewbk/JuySMxcOsVtPlKtj+nlqimxBXDc6Vzcgyd35k+EnZ5apQdfwec5cGXCBMV+pRXApACIXlLECl9+dYE7Dv0Zzyas5cC7JUdI9dht13fuElrvoPnacmZtIMefiS4zNxKJI/GvS6tYnoJC76zV3uYex96S5Bdo4ruuQOH7n9SGgqGNtR1H8LpqI0MO02SBfyW5I1CpJOPfeg3HnsZaddOut0A2CmLopUJyJVr9JIFMTNIbD3YoC2VQIbtAKlDcKJLpbqgnz6COBCV7WCtaHUCux7wddA4cvuvdXmUz1dSkBFVJF5ML6iOdC8b50YJpWnEF7h1c1TTJJSfGQge2CrPk5fF14TQQkB+fEjzJBryU9No8quG7FMF1aegeqrScY+C8ELllhubs1lzmJVNzQJnQyIbIB2aPEWa7Uhhdyg1yo/Dfw+Madrkwx9+YYF8LSRrr38Hm6OnwLCPxKlQZ/qDfnJDak7zpfjGAMq9TMkJ3YmIgMO4MljJqskruRFvwWKcRLhOer4NKr3tZv5wxE6KV/U+9SrmHjaR0=", "alg": "RSA-OAEP-512" }, "status": "success", "reason": "" } ] - Mobile/web applications should get a notification from the notification service.