tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MLS.webidl (4178B)


      1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      4 * You can obtain one at http://mozilla.org/MPL/2.0/.
      5 */
      6 
      7 enum MLSObjectType {
      8  "group-epoch",
      9  "group-identifier",
     10  "group-info",
     11  "client-identifier",
     12  "credential-basic",
     13  "key-package",
     14  "proposal",
     15  "commit-output",
     16  "commit-processed",
     17  "welcome",
     18  "exporter-output",
     19  "exporter-label",
     20  "exporter-context",
     21  "application-message-ciphertext",
     22  "application-message-plaintext",
     23 };
     24 
     25 dictionary MLSBytes {
     26  required MLSObjectType type;
     27  required Uint8Array content;
     28 };
     29 
     30 dictionary MLSGroupMember {
     31  required Uint8Array clientId;
     32  required Uint8Array credential;
     33 };
     34 
     35 dictionary MLSGroupDetails {
     36  required MLSObjectType type;
     37  required Uint8Array groupId;
     38  required Uint8Array groupEpoch;
     39  required sequence<MLSGroupMember> members;
     40 };
     41 
     42 dictionary MLSCommitOutput {
     43  required MLSObjectType type;
     44  required Uint8Array groupId;
     45  required Uint8Array commit;
     46  Uint8Array welcome;
     47  Uint8Array groupInfo;
     48  Uint8Array ratchetTree;
     49  Uint8Array clientId;
     50 };
     51 
     52 dictionary MLSExporterOutput {
     53  required MLSObjectType type;
     54  required Uint8Array groupId;
     55  required Uint8Array groupEpoch;
     56  required Uint8Array label;
     57  required Uint8Array context;
     58  required Uint8Array secret;
     59 };
     60 
     61 dictionary MLSReceived {
     62  required MLSObjectType type;
     63  required Uint8Array groupId;
     64  Uint8Array groupEpoch;
     65  Uint8Array content;
     66  MLSCommitOutput commitOutput;
     67 };
     68 
     69 typedef MLSBytes MLSClientId;
     70 typedef MLSBytes MLSGroupId;
     71 typedef MLSBytes MLSGroupEpoch;
     72 typedef MLSBytes MLSCredential;
     73 typedef MLSBytes MLSKeyPackage;
     74 typedef MLSBytes MLSProposal;
     75 typedef (MLSBytes or Uint8Array) MLSBytesOrUint8Array;
     76 typedef (Uint8Array or UTF8String) Uint8ArrayOrUTF8String;
     77 typedef (MLSBytes or Uint8Array or UTF8String) MLSBytesOrUint8ArrayOrUTF8String;
     78 
     79 [Trial="MLS",
     80 SecureContext,
     81 Exposed=(Window,Worker)]
     82 interface MLS {
     83  [Throws]
     84  constructor();
     85  [Throws]
     86  Promise<undefined> deleteState();
     87  [Throws]
     88  Promise<MLSClientId> generateIdentity();
     89  [Throws]
     90  Promise<MLSCredential> generateCredential(MLSBytesOrUint8ArrayOrUTF8String credentialContent);
     91  [Throws]
     92  Promise<MLSKeyPackage> generateKeyPackage(MLSBytesOrUint8Array clientId, MLSBytesOrUint8Array credential);
     93  [Throws]
     94  Promise<MLSGroupView> groupCreate(MLSBytesOrUint8Array clientId, MLSBytesOrUint8Array credential);
     95  [Throws]
     96  Promise<MLSGroupView?> groupGet(MLSBytesOrUint8Array groupId, MLSBytesOrUint8Array clientId);
     97  [Throws]
     98  Promise<MLSGroupView> groupJoin(MLSBytesOrUint8Array clientId, MLSBytesOrUint8Array welcome);
     99  // Utility functions
    100  [Throws]
    101  Promise<MLSGroupId> getGroupIdFromMessage(MLSBytesOrUint8Array message);
    102  [Throws]
    103  Promise<MLSGroupEpoch> getGroupEpochFromMessage(MLSBytesOrUint8Array message);
    104 };
    105 
    106 [Trial="MLS",
    107 SecureContext,
    108 Exposed=(Window,Worker)]
    109 interface MLSGroupView {
    110  [Throws]
    111  readonly attribute Uint8Array groupId;
    112  [Throws]
    113  readonly attribute Uint8Array clientId;
    114  [Throws]
    115  Promise<undefined> deleteState();
    116  [Throws]
    117  Promise<MLSCommitOutput> add(MLSBytesOrUint8Array keyPackage);
    118  [Throws]
    119  Promise<MLSProposal> proposeAdd(MLSBytesOrUint8Array keyPackage);
    120  [Throws]
    121  Promise<MLSCommitOutput> remove(MLSBytesOrUint8Array remClientId);
    122  [Throws]
    123  Promise<MLSProposal> proposeRemove(MLSBytesOrUint8Array remClientId);
    124  [Throws]
    125  Promise<MLSCommitOutput> close();
    126  [Throws]
    127  Promise<MLSGroupDetails> details();
    128  [Throws]
    129  Promise<MLSBytes> send(MLSBytesOrUint8ArrayOrUTF8String message);
    130  [Throws]
    131  Promise<MLSReceived> receive(MLSBytesOrUint8Array message);
    132  [Throws]
    133  Promise<MLSReceived> hasPendingProposals();
    134  [Throws]
    135  Promise<MLSReceived> clearPendingProposals();
    136  [Throws]
    137  Promise<MLSReceived> hasPendingCommit();
    138  [Throws]
    139  Promise<MLSReceived> clearPendingCommit();
    140  [Throws]
    141  Promise<MLSReceived> applyPendingCommit();
    142  [Throws]
    143  Promise<MLSExporterOutput> exportSecret(MLSBytesOrUint8ArrayOrUTF8String label, MLSBytesOrUint8Array context, unsigned long long length);
    144 };