Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

2.7 KB
Raw Blame
//
// Copyright 2020 Signal Messenger, LLC.
// SPDX-License-Identifier: AGPL-3.0-only
//
// Modified for WhatsApp by Macro: the Kyber, post-quantum ratchet, pre-key
// timestamp, message key seed and sender key version fields are gone (their
// numbers are reserved), since WhatsApp sessions are version 3 only. Records
// stay readable by libsignal's own storage.proto. See NOTICE.

syntax = "proto3";

package signal.proto.storage;

message SessionStructure {
  message Chain {
    bytes sender_ratchet_key         = 1;
    bytes sender_ratchet_key_private = 2;

    message ChainKey {
      uint32 index = 1;
      bytes  key   = 2;
    }

    ChainKey chain_key = 3;

    message MessageKey {
      uint32 index      = 1;
      bytes  cipher_key = 2;
      bytes  mac_key    = 3;
      bytes  iv         = 4;
      reserved 5; // seed
    }

    repeated MessageKey message_keys = 4;
  }

  message PendingPreKey {
    optional uint32 pre_key_id        = 1;
             int32  signed_pre_key_id = 3;
             bytes  base_key          = 2;
    reserved 4; // timestamp
  }

  uint32         session_version           = 1;
  bytes          local_identity_public     = 2;
  bytes          remote_identity_public    = 3;

  bytes          root_key                  = 4;
  uint32         previous_counter          = 5;

  Chain          sender_chain              = 6;
  // The order is significant; keys at the end are "older" and will get trimmed.
  repeated Chain receiver_chains           = 7;

  reserved 8; // pending key exchange, never used by WhatsApp
  PendingPreKey  pending_pre_key           = 9;

  uint32         remote_registration_id    = 10;
  uint32         local_registration_id     = 11;

  reserved 12; // no longer used
  bytes          alice_base_key            = 13;
  reserved 14, 15; // pending Kyber pre-key, post-quantum ratchet state
}

message RecordStructure {
  SessionStructure current_session = 1;
  // The order is significant; sessions at the end are "older" and will get trimmed.
  repeated /*SessionStructure*/ bytes previous_sessions = 2;
}

message SenderKeyStateStructure {
  message SenderChainKey {
    uint32 iteration = 1;
    bytes  seed      = 2;
  }

  message SenderMessageKey {
    uint32 iteration = 1;
    bytes  seed      = 2;
  }

  message SenderSigningKey {
    bytes public  = 1;
    bytes private = 2;
  }

  reserved 5; // message version, always 3
  uint32                    chain_id            = 1;
  SenderChainKey            sender_chain_key    = 2;
  SenderSigningKey          sender_signing_key  = 3;
  repeated SenderMessageKey sender_message_keys = 4;
}

message SenderKeyRecordStructure {
  repeated SenderKeyStateStructure sender_key_states = 1;
}