Skip to content

Push Server Database

Petr Dvorak edited this page Mar 15, 2017 · 15 revisions

PowerAuth 2.0 Push Server requires several new database tables in order to work.

Registered Devices Table

Table name: push_device_registration

Purpose: Stores push tokens specific for a given device.

Columns:

Name Type Info Note
id BIGINT(20) primary key, index, autoincrement Unique device registration ID.
activation_id VARCHAR(37) index Application name, for example "Mobile Banking".
user_id BIGINT(20) index Associated user ID
app_id BIGINT(20) index Associated application ID
platform VARCHAR(30) - Mobile OS Platform ("ios", "android")
push_token VARCHAR(255) - Push token associated with a given device. Type of the token is determined by the platform column.
last_registered DATETIME - Timestamp of the last device registration.
is_active INT(11) - PowerAuth 2.0 activation status (boolean), used as an activation status cache so that communication with PowerAuth 2.0 Server can be minimal.
encryption_key TEXT - Base64 encoded key that is used for deriving per-message end-to-end encryption keys in case the message is encrypted.
encryption_key_index TEXT - Base64 encoded session index (byte[]) used to derive encryption_key from KEY_TRANSPORT key.

Push Service Credentials

Table name: push_app_credentials

Purpose: Stores per-app credentials used for communication with APNs / FCM.

Columns:

Name Type Info Note
id BIGINT(20) primary key, index, autoincrement Unique credential record ID.
app_id BIGINT(20) index Associated application ID
ios_key_id VARCHAR(255) - Key ID used for identifying a private key in APNs service.
ios_private_key BLOB - Binary representation of P8 file with private key used for Apple's APNs service.
ios_team_id VARCHAR(255) - Team ID used for sending push notifications.
ios_bundle VARCHAR(255) - Application bundle ID, used as a APNs "topic".
android_server_key TEXT - Base64 encoded token (SERVER_KEY) used for Google's FCM service.
android_bundle VARCHAR(255) - Application package name, used as a reference to application.

Push Messages Database

Table name: push_message

Purpose: Stores individual messages that were sent by the push server and their sent status.

Columns:

Name Type Info Note
id BIGINT(20) primary key, index, autoincrement Unique message record ID.
device_registration_id INT index Associated device registration (device that is used to receive the message), for the purpose of resend on fail operation.
user_id BIGINT(20) index Associated user ID.
activation_id VARCHAR(37) index PowerAuth 2.0 activation ID.
silent INT - Flag indicating if the message was "silent" (0 = NO, 1 = YES)
personal INT - Flag indicating if the message was "personal" - sent only on active devices (0 = NO, 1 = YES)
encrypted INT - Flag indicating if the message was "encrypted" (0 = NO, 1 = YES)
message_body TEXT - Payload of the message in a unified server format. This format is later translated in a platform specific payload.
timestamp_created DATETIME - Date and time when the record was created.
status INT - Value indicating message send status. (-1 = FAILED, 0 = PENDING, 1 = SENT)