github.com/status-im/status-go@v1.1.0/protocol/encryption/protocol_message.proto (about)

     1  syntax = "proto3";
     2  
     3  option go_package = "./;encryption";
     4  package encryption;
     5  
     6  message SignedPreKey {
     7    bytes signed_pre_key = 1;
     8    uint32 version = 2;
     9    uint32 protocol_version = 3;
    10  }
    11  
    12  // X3DH prekey bundle
    13  message Bundle {
    14    // Identity key
    15    bytes identity = 1;
    16    // Installation id
    17    map<string,SignedPreKey> signed_pre_keys = 2;
    18    // Prekey signature
    19    bytes signature = 4;
    20  
    21    // When the bundle was created locally
    22    int64 timestamp = 5;
    23  }
    24  
    25  message BundleContainer {
    26    reserved 3;
    27    // X3DH prekey bundle
    28    Bundle bundle = 1;
    29    // Private signed prekey
    30    bytes private_signed_pre_key = 2;
    31  }
    32  
    33  message DRHeader {
    34    // Current ratchet public key
    35    bytes key = 1;
    36    // Number of the message in the sending chain
    37    uint32 n = 2;
    38    // Length of the previous sending chain
    39    uint32 pn = 3;
    40    // Bundle ID
    41    bytes id = 4;
    42  }
    43  
    44  message DHHeader {
    45    // Compressed ephemeral public key
    46    bytes key = 1;
    47  }
    48  
    49  message X3DHHeader {
    50    reserved 3;
    51    // Ephemeral key used
    52    bytes key = 1;
    53    // Used bundle's signed prekey
    54    bytes id = 4;
    55  }
    56  
    57  // Hash Ratchet Header
    58  message HRHeader {
    59    // deprecated group key ID
    60    uint32 deprecated_key_id = 1;
    61    // group message number for this key_id
    62    uint32 seq_no = 2;
    63    // group ID
    64    bytes group_id = 3;
    65    // group key ID
    66    bytes key_id = 4;
    67    HRKeys keys = 5;
    68  }
    69  
    70  message RekeyGroup {
    71    uint64 timestamp = 2;
    72  
    73    map<uint32, bytes> keys = 4;
    74  }
    75  
    76  message HRKeys {
    77    repeated HRKey keys = 1;
    78    RekeyGroup rekey_group = 2;
    79  }
    80  
    81  message HRKey {
    82    uint32 deprecated_key_id = 1;
    83    bytes key = 2;
    84    uint64 timestamp = 3;
    85  }
    86  
    87  // Direct message value
    88  message EncryptedMessageProtocol {
    89    X3DHHeader X3DH_header = 1;
    90    DRHeader DR_header = 2;
    91    DHHeader DH_header = 101;
    92    HRHeader HR_header = 102;
    93    // Encrypted payload
    94    bytes payload = 3;
    95  }
    96  
    97  // Top-level protocol message
    98  message ProtocolMessage {
    99    // The device id of the sender
   100    string installation_id = 2;
   101  
   102    // List of bundles
   103    repeated Bundle bundles = 3;
   104  
   105    // One to one message, encrypted, indexed by installation_id
   106    // TODO map here is redundant in case of community messages
   107    map<string,EncryptedMessageProtocol> encrypted_message = 101;
   108  
   109    // Public chats, not encrypted
   110    bytes public_message = 102;
   111  }