[go: up one dir, main page]

Skip to content

BanditoRmX/epns-mobile-app

 
 

Repository files navigation

EPNS Mobile App

Mobile App of EPNS protocol. The app is built on react native and is used to deliver push notification messages to the user. To know more about EPNS and the general specs, please jump to EPNS General Specs.

Technical Details

Following definitions are used in the rest of the spec to refer to a particular category or service.

Term Description
Device Token These are token ids generated by Apple or Google (and are not crypto tokens) whenever an app registers for push notification, Learn about Apple Device Tokens or Google Device Tokens

Features

The EPNS Mobile App serves to deliver push notification messages to the users that they have subscribed to.

  • App should be able to recieve push notifications
  • App should be able to connect user's wallet (singular at the moment) in a secure manner
  • App Should connect this user wallet to the push notification tokens that are generated by Apple Push Notification Service or Android Push Notification Service
  • App should be able to send this information to the epns server in a secure format
  • App should be able to fetch user notifications (kind of like emails) which were already delivered to them

Tech Spec

Mobile push notifications use device tokens for registration of the device and the push notification server then sends out mass or specific messages using these device tokens. For EPNS to work, we need to register these device tokens as well as the wallet to which they belong to.

For the EPNS Service to work, the following modules needs to be build:

  • Storing User Wallet Private Key (Offline on the User's Device)
  • Mapping user's wallet address to device tokens
  • Communicate with the epns server to verify and store these device tokens (mapped to wallet address)
  • Handling Incoming Push Notifications
  • Fetching Previous Notifications of the User

Storing User Wallet Private Key (Offline on the User's Device)

The app needs to store the user's wallet private key to decrypt the message recieved by the user and to encrypt the token registration process. This ensures that the epns server only maps the verified device tokens to the Wallet of the user.

Furthermore, we need to provide either biometric or passcode based security to the user in the app since the app is storing sensitive user credentials. We will also be storing these user credentials in encrypted format, we will mostly be using React-Native-Keychain for this.

Mapping user's wallet address to device tokens

Once a user have imported the wallet, the device tokens which are generated would be mapped to the wallet of the user.

Communicate with the epns server to verify and store these device tokens (mapped to wallet address)

We will mostly be using Eth-Crypto to handle the secure verification process.

Current proposal is to send the operation code as Register along with the device token, the signature of the user using the above library and the public wallet address. The server will first decrypt the hash to find the public wallet address of the user and will only proceed if the public wallet address sent matches with the decrypted address of the public wallet. This ensure that spoofing can't be done by any users to recieve notifications meant for the intended recipients.

To know more about server and it's architecture, please head to [epns-push-notification-server repo] (https://github.com/ethereum-push-notification-system/epns-push-notification-server).

Handling Incoming Push Notifications

The push notification handling (for when the app is open) will also be built to handle notifications recieved by the users when they are inside the app.

Fetching Previous Notifications of the User

TBA, We are still contemplating storing a cache on the epns server or handle it alternatively.

Payloads

Incoming Notification Payload

Name Type Description In Case of Encryption
title string App Owner Name - Title of message App Owner Name has sent you a message!
body string The intended message Please open EPNS app to view it.
icon url The App Owner Icon Not Applicable
data json The data payload that will be handled by EPNS App Some Parts are encrypted

JSON Payload (data of Incoming Notification Payload)

Name Type Description In Case of Encryption
type string (integer) (1 - Not Encrypted, 2 - Encrypted) Not Applicable
sid string The id associated with the message on the server
epoch string (integer) The timestamp in epoch when retrieved from blockchain (with milliseconds) Not Applicable
app string The name of app owner Not Applicable
icon url The icon of app owner Not Applicable
url url The url of app owner Not Applicable
secret string The secret protected by public key encryption, can't be more than 15 characters Encrypted
asub string (Optional) Subject of message Encrypted
amsg string The intended of message Encrypted
acta url (Optional) The call to action url (if any) Encrypted
aimg url (Optional) The image to display with the message (if any) Encrypted

Note: The entire load is encrypted if notification type is 2 (Encrypted)

Proposed DB (Mobile Device) to Handle Incoming Payloads

Name Type Description
nid string Primary Key Not Null Integer
sid string Id of message stored on the server
app string The name of the app owner
icon string (url) The icon of the app owner
url url The url of app owner
type integer The type of notification (1 is unencrypted, 2 is encrypted)
appbot integer The message is sent from inside the app or from push notification, 0 or 1
secret string The secret which needs to be decrypted and used as seed for AES encrypted fields
asub string (Optional) Subject of message
amsg string The intended of message
acta url (Optional) The call to action url (if any)
aimg url (Optional) The image to display with the message (if any)
hidden integer The message if hidden from device, 0 or 1
epoch integer The timestamp of the message (with milliseconds)

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.7%
  • Objective-C 2.3%
  • Java 1.7%
  • Other 1.3%