zrt / chat

Home Page:https://ruotian.io/2022/05/chat/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 }
  }
}

About

https://ruotian.io/2022/05/chat/


Languages

Language:JavaScript 75.2%Language:HTML 24.8%