|
| 1 | +import "@typespec/rest"; |
| 2 | +import "@typespec/openapi"; |
| 3 | + |
| 4 | +namespace polyproto.mls; |
| 5 | + |
| 6 | +/** |
| 7 | + * Represents a client's capabilities and provides keys for group operations |
| 8 | + */ |
| 9 | +model KeyPackage { |
| 10 | + @doc("Unique identifier for this key package") |
| 11 | + id: string; |
| 12 | + |
| 13 | + @doc("The client's public key") |
| 14 | + publicKey: bytes; |
| 15 | + |
| 16 | + @doc("The client's capabilities and supported ciphersuites") |
| 17 | + capabilities: ClientCapabilities; |
| 18 | + |
| 19 | + @doc("The client's signature over the key package") |
| 20 | + signature: bytes; |
| 21 | +} |
| 22 | + |
| 23 | +/** |
| 24 | + * Client capabilities and supported features |
| 25 | + */ |
| 26 | +model ClientCapabilities { |
| 27 | + @doc("Supported MLS protocol versions") |
| 28 | + versions: string[]; |
| 29 | + |
| 30 | + @doc("Supported ciphersuites") |
| 31 | + ciphersuites: string[]; |
| 32 | + |
| 33 | + @doc("Supported extensions") |
| 34 | + extensions: string[]; |
| 35 | +} |
| 36 | + |
| 37 | +/** |
| 38 | + * Represents a proposed change to the group state |
| 39 | + */ |
| 40 | +model Proposal { |
| 41 | + @doc("Unique identifier for this proposal") |
| 42 | + id: string; |
| 43 | + |
| 44 | + @doc("The type of proposal") |
| 45 | + type: ProposalType; |
| 46 | + |
| 47 | + @doc("The target of the proposal (e.g., member to remove)") |
| 48 | + target?: string; |
| 49 | + |
| 50 | + @doc("The key package for add proposals") |
| 51 | + keyPackage?: KeyPackage; |
| 52 | + |
| 53 | + @doc("The proposal sender's signature") |
| 54 | + signature: bytes; |
| 55 | +} |
| 56 | + |
| 57 | +/** |
| 58 | + * Types of proposals that can be made |
| 59 | + */ |
| 60 | +enum ProposalType { |
| 61 | + Add, |
| 62 | + Remove, |
| 63 | + Update, |
| 64 | + ReInit, |
| 65 | +} |
| 66 | + |
| 67 | +/** |
| 68 | + * Represents a commit message that initiates a new epoch |
| 69 | + */ |
| 70 | +model Commit { |
| 71 | + @doc("Unique identifier for this commit") |
| 72 | + id: string; |
| 73 | + |
| 74 | + @doc("The group ID this commit applies to") |
| 75 | + groupId: string; |
| 76 | + |
| 77 | + @doc("The epoch number this commit creates") |
| 78 | + epoch: int32; |
| 79 | + |
| 80 | + @doc("The proposals being committed") |
| 81 | + proposals: Proposal[]; |
| 82 | + |
| 83 | + @doc("The commit sender's signature") |
| 84 | + signature: bytes; |
| 85 | +} |
| 86 | + |
| 87 | +/** |
| 88 | + * Welcome message for new group members |
| 89 | + */ |
| 90 | +model Welcome { |
| 91 | + @doc("The group ID the new member is being added to") |
| 92 | + groupId: string; |
| 93 | + |
| 94 | + @doc("The epoch number the new member is being added to") |
| 95 | + epoch: int32; |
| 96 | + |
| 97 | + @doc("The key package of the new member") |
| 98 | + keyPackage: KeyPackage; |
| 99 | + |
| 100 | + @doc("Encrypted group state for the new member") |
| 101 | + encryptedGroupState: bytes; |
| 102 | +} |
| 103 | + |
| 104 | +/** |
| 105 | + * Represents a group in MLS |
| 106 | + */ |
| 107 | +model Group { |
| 108 | + @doc("Unique identifier for the group") |
| 109 | + id: string; |
| 110 | + |
| 111 | + @doc("Current epoch number") |
| 112 | + epoch: int32; |
| 113 | + |
| 114 | + @doc("List of current group members") |
| 115 | + members: GroupMember[]; |
| 116 | + |
| 117 | + @doc("Group's public key") |
| 118 | + publicKey: bytes; |
| 119 | +} |
| 120 | + |
| 121 | +/** |
| 122 | + * Represents a member in an MLS group |
| 123 | + */ |
| 124 | +model GroupMember { |
| 125 | + @doc("Unique identifier for the member") |
| 126 | + id: string; |
| 127 | + |
| 128 | + @doc("The member's key package") |
| 129 | + keyPackage: KeyPackage; |
| 130 | + |
| 131 | + @doc("The member's role in the group") |
| 132 | + role: MemberRole; |
| 133 | +} |
| 134 | + |
| 135 | +/** |
| 136 | + * Possible roles for group members |
| 137 | + */ |
| 138 | +enum MemberRole { |
| 139 | + Admin, |
| 140 | + Member, |
| 141 | +} |
0 commit comments