Ridge-Lab/moonmls/types does not have a README file

    MlsError

    pub(all) suberror MlsError {
    MlsError(String)
    }

    Recoverable error raised by any RFC 9420 MLS operation.

    AuthenticatedContent

    pub(all) struct AuthenticatedContent {
    wire_format : WireFormat
    content : FramedContent
    auth : FramedContentAuthData
    } derive(Eq,
    Debug
    )

    RFC 9420 §6.1 AuthenticatedContent.

    Capabilities

    pub(all) struct Capabilities {
    versions : Array[UInt]
    ciphersuites : Array[UInt]
    extensions : Array[UInt]
    proposals : Array[UInt]
    credentials : Array[UInt]
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.2 Capabilities.

    Capabilities::default_for

    fn Capabilities::default_for(suite : CipherSuite) -> Capabilities

    CipherSuite

    pub(all) enum CipherSuite {
    MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
    MLS_128_DHKEMP256_AES128GCM_SHA256_P256
    MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519
    MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448
    MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448
    } derive(Eq,
    Debug
    )

    RFC 9420 §17.1 Cipher Suites supported by MoonMLS. CS1..CS4 and CS6 are fully supported in pure MoonBit via cc06b/mooncry.

    CipherSuite::aead_key_len

    fn CipherSuite::aead_key_len(self : CipherSuite) -> Int

    AEAD key length Nk (in bytes) for this ciphersuite.

    CipherSuite::aead_nonce_len

    fn CipherSuite::aead_nonce_len(self : CipherSuite) -> Int

    AEAD nonce length Nn (in bytes) — 12 bytes for all RFC 9420 suites.

    CipherSuite::from_u16

    fn CipherSuite::from_u16(id : UInt) -> CipherSuite raise MlsError

    CipherSuite::hash_len

    fn CipherSuite::hash_len(self : CipherSuite) -> Int

    Hash digest length Nh (in bytes) for this ciphersuite.

    CipherSuite::kem_secret_len

    fn CipherSuite::kem_secret_len(self : CipherSuite) -> Int

    HPKE KEM private/secret seed length Nsecret (in bytes).

    CipherSuite::to_u16

    fn CipherSuite::to_u16(self : CipherSuite) -> UInt

    Commit

    pub(all) struct Commit {
    proposals : Array[ProposalOrRef]
    path : UpdatePath?
    } derive(Eq,
    Debug
    )

    RFC 9420 §12.4 Commit.

    ContentType

    pub(all) enum ContentType {
    Application
    Proposal
    Commit
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 ContentType.

    ContentType::from_u8

    fn ContentType::from_u8(v : Byte) -> ContentType raise MlsError

    ContentType::to_u8

    fn ContentType::to_u8(self : ContentType) -> Byte

    Credential

    pub(all) enum Credential {
    Basic(Bytes)
    X509(Array[Bytes])
    } derive(Eq,
    Debug
    )

    RFC 9420 §5.3 Credential.

    Credential::credential_type

    fn Credential::credential_type(self : Credential) -> UInt

    EncryptedGroupSecrets

    pub(all) struct EncryptedGroupSecrets {
    new_member : Bytes
    encrypted_group_secrets : HPKECiphertext
    } derive(Eq,
    Debug
    )

    Extension

    pub(all) struct Extension {
    extension_type : UInt
    extension_data : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.2 Extension.

    FramedContent

    pub(all) struct FramedContent {
    group_id : Bytes
    epoch : UInt64
    sender : Sender
    authenticated_data : Bytes
    body : FramedContentBody
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 FramedContent.

    FramedContentAuthData

    pub(all) struct FramedContentAuthData {
    signature : Bytes
    confirmation_tag : Bytes?
    } derive(Eq,
    Debug
    )

    RFC 9420 §6.1 FramedContentAuthData.

    FramedContentBody

    pub(all) enum FramedContentBody {
    Application(Bytes)
    Proposal(Proposal)
    Commit(Commit)
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 FramedContentBody.

    FramedContentBody::content_type

    fn FramedContentBody::content_type(self : FramedContentBody) -> ContentType

    GroupContext

    pub(all) struct GroupContext {
    version : UInt
    cipher_suite : UInt
    group_id : Bytes
    epoch : UInt64
    tree_hash : Bytes
    confirmed_transcript_hash : Bytes
    extensions : Array[Extension]
    } derive(Eq,
    Debug
    )

    RFC 9420 §8.1 GroupContext.

    GroupInfo

    pub(all) struct GroupInfo {
    group_context : GroupContext
    extensions : Array[Extension]
    confirmation_tag : Bytes
    signer : UInt
    signature : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §12.4.3.1 GroupInfo, GroupSecrets, EncryptedGroupSecrets, Welcome.

    GroupSecrets

    pub(all) struct GroupSecrets {
    joiner_secret : Bytes
    path_secret : Bytes?
    psks : Array[PreSharedKeyID]
    } derive(Eq,
    Debug
    )

    HPKECiphertext

    pub(all) struct HPKECiphertext {
    kem_output : Bytes
    ciphertext : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §5.1.3 HPKECiphertext.

    KeyPackage

    pub(all) struct KeyPackage {
    version : UInt
    cipher_suite : UInt
    init_key : Bytes
    leaf_node : LeafNode
    extensions : Array[Extension]
    signature : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §10 KeyPackage.

    LeafNode

    pub(all) struct LeafNode {
    encryption_key : Bytes
    signature_key : Bytes
    credential : Credential
    capabilities : Capabilities
    leaf_node_source : LeafNodeSource
    extensions : Array[Extension]
    signature : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.2 LeafNode.

    LeafNodeSource

    pub(all) enum LeafNodeSource {
    KeyPackage(Lifetime)
    Update
    Commit(Bytes)
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.2 LeafNodeSource.

    Lifetime

    pub(all) struct Lifetime {
    not_before : UInt64
    not_after : UInt64
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.2 Lifetime.

    MLSMessage

    pub(all) enum MLSMessage {
    PublicMessage(PublicMessage)
    PrivateMessage(PrivateMessage)
    Welcome(Welcome)
    GroupInfo(GroupInfo)
    KeyPackage(KeyPackage)
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 Top-level MLSMessage envelope.

    MLSMessage::wire_format

    fn MLSMessage::wire_format(self : MLSMessage) -> WireFormat

    ParentNode

    pub(all) struct ParentNode {
    encryption_key : Bytes
    parent_hash : Bytes
    unmerged_leaves : Array[UInt]
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.1 ParentNode.

    PreSharedKeyID

    pub(all) struct PreSharedKeyID {
    psk : PskId
    psk_nonce : Bytes
    } derive(Eq,
    Debug
    )

    PrivateMessage

    pub(all) struct PrivateMessage {
    group_id : Bytes
    epoch : UInt64
    content_type : ContentType
    authenticated_data : Bytes
    encrypted_sender_data : Bytes
    ciphertext : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §6.3 PrivateMessage.

    Proposal

    pub(all) enum Proposal {
    Add(KeyPackage)
    Update(LeafNode)
    Remove(UInt)
    PreSharedKey(PreSharedKeyID)
    ReInit(Bytes, UInt, UInt, Array[Extension])
    ExternalInit(Bytes)
    GroupContextExtensions(Array[Extension])
    Custom(UInt, Bytes)
    } derive(Eq,
    Debug
    )

    RFC 9420 §12.1 Proposal.

    ProposalOrRef

    pub(all) enum ProposalOrRef {
    Proposal(Proposal)
    Reference(Bytes)
    } derive(Eq,
    Debug
    )

    RFC 9420 §12.4 ProposalOrRef.

    PskId

    pub(all) enum PskId {
    External(Bytes)
    Resumption(UInt, Bytes, UInt64)
    } derive(Eq,
    Debug
    )

    RFC 9420 §8.4 PreSharedKeyID.

    PublicMessage

    pub(all) struct PublicMessage {
    content : FramedContent
    auth : FramedContentAuthData
    membership_tag : Bytes?
    } derive(Eq,
    Debug
    )

    RFC 9420 §6.2 PublicMessage.

    Sender

    pub(all) enum Sender {
    Member(UInt)
    External(UInt)
    NewMemberProposal
    NewMemberCommit
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 Sender.

    SenderData

    pub(all) struct SenderData {
    leaf_index : UInt
    generation : UInt
    reuse_guard : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9420 §6.3.2 MLSSenderData.

    TreeNode

    pub(all) enum TreeNode {
    Leaf(LeafNode)
    Parent(ParentNode)
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.1 Node (optional in ratchet_tree).

    UpdatePath

    pub(all) struct UpdatePath {
    leaf_node : LeafNode
    nodes : Array[UpdatePathNode]
    } derive(Eq,
    Debug
    )

    UpdatePathNode

    pub(all) struct UpdatePathNode {
    encryption_key : Bytes
    encrypted_path_secret : Array[HPKECiphertext]
    } derive(Eq,
    Debug
    )

    RFC 9420 §7.6 UpdatePathNode & UpdatePath.

    Welcome

    pub(all) struct Welcome {
    cipher_suite : UInt
    secrets : Array[EncryptedGroupSecrets]
    encrypted_group_info : Bytes
    } derive(Eq,
    Debug
    )

    WireFormat

    pub(all) enum WireFormat {
    PublicMessage
    PrivateMessage
    Welcome
    GroupInfo
    KeyPackage
    } derive(Eq,
    Debug
    )

    RFC 9420 §6 WireFormat.

    WireFormat::from_u16

    fn WireFormat::from_u16(v : UInt) -> WireFormat raise MlsError

    WireFormat::to_u16

    fn WireFormat::to_u16(self : WireFormat) -> UInt

    EXT_APPLICATION_ID

    let EXT_APPLICATION_ID : UInt

    Well-known RFC 9420 §17.3 ExtensionType constants.

    EXT_EXTERNAL_PUB

    let EXT_EXTERNAL_PUB : UInt

    EXT_EXTERNAL_SENDERS

    let EXT_EXTERNAL_SENDERS : UInt

    EXT_RATCHET_TREE

    let EXT_RATCHET_TREE : UInt

    EXT_REQUIRED_CAPABILITIES

    let EXT_REQUIRED_CAPABILITIES : UInt

    PROTOCOL_VERSION_MLS10

    let PROTOCOL_VERSION_MLS10 : UInt

    RFC 9420 §17.1 ProtocolVersion. Only MLS 1.0 (0x0001) is standardized.

    Source Files