Skip to content

zrt/chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

chat

  • end2end encrypted chat
  • private key never leave memory

Firebase Realtime Database

{
    "users": {
        "user1": {
            "name": "user1",
            "pubkey": "thepubkey",
            "last_seen": 233
        }
    },
    "messages": {
        "user2": {
            "msgid": "encrypted"
        }
    }
}
{
  "rules": {
    	"secrets":{
        ".read": false,
        ".write": false,
      },
    	"users":{
        ".read" : "auth != null",
        "$uid": {
          ".write": "$uid === auth.uid",
          "add": {
            ".validate": "newData.isNumber()"
          },
          "name": {
            ".validate": "newData.isString()"
          },
          "pubkey": {
            ".validate": "newData.isString()"
          },
          "$other": { ".validate": false }
        }
      },
      "messages":{
        ".write": "auth != null",
        "$uid": {
          ".write": "auth != null",
          ".read": "$uid === auth.uid",
          "$key":{
            ".validate": "newData.isString()"
          }
        }
      },
      "world": {
        ".write": "auth != null",
        ".read": "auth != null",
      },
      "$other": { ".validate": false }
  }
}