Sign in

    moonbit-community/rtc/dtls does not have a README file

    DtlsError

    pub(all) suberror DtlsError {
    InvalidRecord(String)
    InvalidHandshake(String)
    UnsupportedVersion
    UnsupportedCipherSuite(UInt16)
    UnsupportedSrtpProfile(UInt16)
    HandshakeFailed(String)
    FingerprintMismatch
    ReplayRejected
    CryptoUnavailable(String)
    Time(
    TimeError
    )
    Closed
    } derive(Eq,
    Debug
    )

    AlertDescription

    pub(all) enum AlertDescription {
    CloseNotify
    UnexpectedMessage
    BadRecordMac
    HandshakeFailure
    BadCertificate
    IllegalParameter
    DecodeError
    DecryptError
    ProtocolVersionAlert
    InternalError
    UnsupportedExtension
    UnknownAlert(Byte)
    } derive(Eq,
    Debug
    )

    AlertLevel

    pub(all) enum AlertLevel {
    WarningAlert
    FatalAlert
    } derive(Eq,
    Debug
    )

    CertificateIdentity

    CertificateIdentity::certificate_der

    fn CertificateIdentity::certificate_der(self : CertificateIdentity) -> Bytes

    CertificateIdentity::fingerprint

    CertificateIdentity::generate

    CertificateIdentity::key_type

    CertificateKeyType

    pub(all) enum CertificateKeyType {
    EcdsaCertificate
    RsaCertificate
    } derive(Eq,
    Debug
    )

    CertificateMessage

    pub struct CertificateMessage {
    certificates : Array[Bytes]
    } derive(Eq,
    Debug
    )

    CertificateRequestMessage

    pub struct CertificateRequestMessage {
    certificate_types : Array[Byte]
    signature_algorithms : Array[UInt16]
    } derive(Eq,
    Debug
    )

    CertificateVerifyMessage

    pub struct CertificateVerifyMessage {
    signature_algorithm : UInt16
    signature : Bytes
    } derive(Eq,
    Debug
    )

    CipherSuite

    pub(all) enum CipherSuite {
    EcdheEcdsaAes128Ccm
    EcdheEcdsaAes128Ccm8
    EcdheEcdsaAes128GcmSha256
    EcdheRsaAes128GcmSha256
    EcdheEcdsaAes256CbcSha
    EcdheRsaAes256CbcSha
    PskAes128Ccm
    PskAes128Ccm8
    PskAes128GcmSha256
    EcdheRsaChacha20Poly1305Sha256
    EcdheEcdsaChacha20Poly1305Sha256
    } derive(Eq,
    Debug
    )

    CipherSuite::code

    fn CipherSuite::code(self : CipherSuite) -> UInt16

    CipherSuite::from_code

    fn CipherSuite::from_code(code : UInt16) -> CipherSuite raise DtlsError

    CipherSuite::is_psk

    fn CipherSuite::is_psk(self : CipherSuite) -> Bool

    CipherSuite::maximum_record_expansion

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

    CipherSuite::uses_rsa

    fn CipherSuite::uses_rsa(self : CipherSuite) -> Bool

    ClientHelloMessage

    pub struct ClientHelloMessage {
    random : Bytes
    session_id : Bytes
    cookie : Bytes
    cipher_suites : Array[UInt16]
    compression_methods : Array[Byte]
    extensions : HelloExtensions
    } derive(Eq,
    Debug
    )

    ClientHelloMessage::cipher_suites

    fn ClientHelloMessage::cipher_suites(self : ClientHelloMessage) -> Array[UInt16]

    ClientHelloMessage::cookie

    fn ClientHelloMessage::cookie(self : ClientHelloMessage) -> Bytes

    ClientHelloMessage::extensions

    ClientHelloMessage::new

    fn ClientHelloMessage::new(random~ : Bytes, cookie? : Bytes, cipher_suites? : Array[CipherSuite], extensions~ : HelloExtensions) -> ClientHelloMessage raise DtlsError

    ClientHelloMessage::random

    fn ClientHelloMessage::random(self : ClientHelloMessage) -> Bytes

    ClientKeyExchangeMessage

    pub struct ClientKeyExchangeMessage {
    public_key : Bytes
    identity_hint : Bytes?
    } derive(Eq,
    Debug
    )

    Config

    pub struct Config {
    role : Role
    identity : CertificateIdentity
    expected_peer_fingerprint : Fingerprint
    wall_time :
    WallTime

    cipher_suites : Array[CipherSuite]
    psk : Bytes?
    psk_identity : Bytes?
    srtp_profiles : Array[SrtpProtectionProfile]
    flight_interval :
    Duration

    mtu : Int
    replay_window : Int
    verify_peer_fingerprint : Bool
    }

    Config::cipher_suites

    fn Config::cipher_suites(self : Config) -> Array[CipherSuite]

    Config::local_fingerprint

    fn Config::local_fingerprint(self : Config) -> Fingerprint raise DtlsError

    Config::new

    fn Config::new(role~ : Role, identity~ : CertificateIdentity, expected_peer_fingerprint~ : Fingerprint, wall_time~ :
    WallTime
    , cipher_suites? : Array[CipherSuite], psk? : Bytes, psk_identity? : Bytes, srtp_profiles? : Array[SrtpProtectionProfile], flight_interval? :
    Duration
    , mtu? : Int, replay_window? : Int, verify_peer_fingerprint? : Bool) -> Config raise DtlsError

    Config::psk_identity

    fn Config::psk_identity(self : Config) -> Bytes?

    Config::role

    fn Config::role(self : Config) -> Role

    Config::srtp_profiles

    fn Config::srtp_profiles(self : Config) -> Array[SrtpProtectionProfile]

    ContentType

    pub(all) enum ContentType {
    ChangeCipherSpec
    Alert
    Handshake
    ApplicationData
    } derive(Eq,
    Debug
    )

    ContentType::code

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

    DtlsEvent

    pub(all) enum DtlsEvent {
    StateChanged(State)
    ConnectedWithSrtp(SrtpProtectionProfile?)
    ApplicationDataReceived(Bytes)
    AlertReceived(AlertLevel, AlertDescription)
    } derive(Eq,
    Debug
    )

    Endpoint

    pub struct Endpoint {
    config : Config
    provider :
    Provider

    outputs :
    Queue
    [Bytes]
    events :
    Queue
    [DtlsEvent]
    state : State
    phase : HandshakePhase
    fragments : FragmentBuffer
    transcript : Array[Bytes]
    local_handshake_sequence : UInt16
    epoch_zero_sequence : UInt64
    epoch_one_sequence : UInt64
    client_random : Bytes?
    server_random : Bytes?
    initial_client_hello : Bytes?
    cookie : Bytes?
    local_ephemeral :
    PrivateKey
    ?
    peer_ephemeral :
    PublicKey
    ?
    peer_certificate_key :
    PublicKey
    ?
    master_secret :
    Secret
    ?
    cipher : RecordCipher?
    selected_cipher_suite : CipherSuite?
    selected_srtp_profile : SrtpProtectionProfile?
    certificate_requested : Bool
    client_server_stage : Int
    server_client_stage : Int
    peer_changed_cipher_spec : Bool
    last_flight : Array[Bytes]
    retransmit_deadline :
    Instant
    ?
    retransmit_interval_milliseconds : Int64
    retransmissions : Int
    }

    Endpoint::close

    fn Endpoint::close(self : Endpoint) -> Unit raise DtlsError

    Endpoint::export_keying_material

    fn Endpoint::export_keying_material(self : Endpoint, label : String, length : Int) -> Bytes raise DtlsError

    Endpoint::handle_datagram

    fn Endpoint::handle_datagram(self : Endpoint, now :
    Instant
    , datagram : Bytes) -> Unit raise DtlsError

    Endpoint::handle_timeout

    fn Endpoint::handle_timeout(self : Endpoint, now :
    Instant
    ) -> Unit raise DtlsError

    Endpoint::new

    fn Endpoint::new(config : Config) -> Endpoint

    Endpoint::poll_datagram

    fn Endpoint::poll_datagram(self : Endpoint) -> Bytes?

    Endpoint::poll_event

    fn Endpoint::poll_event(self : Endpoint) -> DtlsEvent?

    Endpoint::poll_timeout

    Endpoint::role

    fn Endpoint::role(self : Endpoint) -> Role

    Endpoint::selected_cipher_suite

    fn Endpoint::selected_cipher_suite(self : Endpoint) -> CipherSuite?

    Endpoint::selected_srtp_profile

    fn Endpoint::selected_srtp_profile(self : Endpoint) -> SrtpProtectionProfile?

    Endpoint::send_application_data

    fn Endpoint::send_application_data(self : Endpoint, payload : Bytes) -> Unit raise DtlsError

    Endpoint::start

    Endpoint::state

    fn Endpoint::state(self : Endpoint) -> State

    Fingerprint

    pub struct Fingerprint {
    algorithm : FingerprintAlgorithm
    value : Bytes
    } derive(Eq,
    Debug
    )

    Fingerprint::algorithm

    Fingerprint::new

    fn Fingerprint::new(algorithm~ : FingerprintAlgorithm, value~ : Bytes) -> Fingerprint raise DtlsError

    Fingerprint::value

    fn Fingerprint::value(self : Fingerprint) -> Bytes

    FingerprintAlgorithm

    pub(all) enum FingerprintAlgorithm {
    Sha256
    Sha384
    Sha512
    } derive(Eq,
    Debug
    )

    FinishedMessage

    pub struct FinishedMessage {
    verify_data : Bytes
    } derive(Eq,
    Debug
    )

    FragmentBuffer

    type FragmentBuffer

    HandshakeFragment

    pub struct HandshakeFragment {
    handshake_type : HandshakeType
    total_length : UInt
    message_sequence : UInt16
    fragment_offset : UInt
    body : Bytes
    } derive(Eq,
    Debug
    )

    HandshakeFragment::body

    fn HandshakeFragment::body(self : HandshakeFragment) -> Bytes

    HandshakeFragment::encode

    fn HandshakeFragment::encode(self : HandshakeFragment) -> Bytes raise DtlsError

    HandshakeFragment::fragment_offset

    fn HandshakeFragment::fragment_offset(self : HandshakeFragment) -> UInt

    HandshakeFragment::handshake_type

    fn HandshakeFragment::handshake_type(self : HandshakeFragment) -> HandshakeType

    HandshakeFragment::is_complete

    fn HandshakeFragment::is_complete(self : HandshakeFragment) -> Bool

    HandshakeFragment::message_sequence

    fn HandshakeFragment::message_sequence(self : HandshakeFragment) -> UInt16

    HandshakeFragment::new

    fn HandshakeFragment::new(handshake_type~ : HandshakeType, total_length~ : UInt, message_sequence~ : UInt16, fragment_offset~ : UInt, body~ : Bytes) -> HandshakeFragment raise DtlsError

    HandshakeFragment::total_length

    fn HandshakeFragment::total_length(self : HandshakeFragment) -> UInt

    HandshakeMessage

    pub(all) enum HandshakeMessage {
    ClientHelloHandshake(ClientHelloMessage)
    ServerHelloHandshake(ServerHelloMessage)
    HelloVerifyRequestHandshake(HelloVerifyRequestMessage)
    CertificateHandshake(CertificateMessage)
    ServerKeyExchangeHandshake(ServerKeyExchangeMessage)
    CertificateRequestHandshake(CertificateRequestMessage)
    ServerHelloDoneHandshake
    CertificateVerifyHandshake(CertificateVerifyMessage)
    ClientKeyExchangeHandshake(ClientKeyExchangeMessage)
    FinishedHandshake(FinishedMessage)
    } derive(Eq,
    Debug
    )

    HandshakeMessage::decode

    HandshakeMessage::encode_body

    fn HandshakeMessage::encode_body(self : HandshakeMessage) -> Bytes raise DtlsError

    HandshakeMessage::handshake_type

    fn HandshakeMessage::handshake_type(self : HandshakeMessage) -> HandshakeType

    HandshakeMessage::to_fragment

    fn HandshakeMessage::to_fragment(self : HandshakeMessage, message_sequence : UInt16) -> HandshakeFragment raise DtlsError

    HandshakePhase

    type HandshakePhase derive(Eq,
    Debug
    )

    HandshakeType

    pub(all) enum HandshakeType {
    HelloRequest
    ClientHello
    ServerHello
    HelloVerifyRequest
    Certificate
    ServerKeyExchange
    CertificateRequest
    ServerHelloDone
    CertificateVerify
    ClientKeyExchange
    Finished
    UnknownHandshake(Byte)
    } derive(Eq,
    Debug
    )

    HandshakeType::code

    fn HandshakeType::code(self : HandshakeType) -> Byte

    HelloExtensions

    pub struct HelloExtensions {
    supported_groups : Array[UInt16]
    point_formats : Array[Byte]
    signature_algorithms : Array[UInt16]
    srtp_profiles : Array[UInt16]
    extended_master_secret : Bool
    renegotiation_info : Bool
    unknown : Array[(UInt16, Bytes)]
    } derive(Eq,
    Debug
    )

    HelloExtensions::signature_algorithms

    fn HelloExtensions::signature_algorithms(self : HelloExtensions) -> Array[UInt16]

    HelloExtensions::srtp_profile_codes

    fn HelloExtensions::srtp_profile_codes(self : HelloExtensions) -> Array[UInt16]

    HelloExtensions::supports_group

    fn HelloExtensions::supports_group(self : HelloExtensions, group : UInt16) -> Bool

    HelloExtensions::uses_extended_master_secret

    fn HelloExtensions::uses_extended_master_secret(self : HelloExtensions) -> Bool

    HelloExtensions::webrtc

    HelloVerifyRequestMessage

    pub struct HelloVerifyRequestMessage {
    cookie : Bytes
    } derive(Eq,
    Debug
    )

    ProtocolVersion

    pub(all) enum ProtocolVersion {
    Dtls10
    Dtls12
    } derive(Eq,
    Debug
    )

    ProtocolVersion::major

    fn ProtocolVersion::major(_self : ProtocolVersion) -> Byte

    ProtocolVersion::minor

    fn ProtocolVersion::minor(self : ProtocolVersion) -> Byte

    Record

    pub struct Record {
    header : RecordHeader
    payload : Bytes
    } derive(Eq,
    Debug
    )

    Record::encode

    fn Record::encode(self : Record) -> Bytes raise DtlsError

    Record::header

    fn Record::header(self : Record) -> RecordHeader

    Record::new

    fn Record::new(content_type~ : ContentType, version? : ProtocolVersion, epoch~ : UInt16, sequence_number~ : UInt64, payload~ : Bytes) -> Record raise DtlsError

    Record::payload

    fn Record::payload(self : Record) -> Bytes

    RecordCipher

    type RecordCipher

    RecordHeader

    pub struct RecordHeader {
    content_type : ContentType
    version : ProtocolVersion
    epoch : UInt16
    sequence_number : UInt64
    content_length : UInt16
    } derive(Eq,
    Debug
    )

    RecordHeader::content_length

    fn RecordHeader::content_length(self : RecordHeader) -> UInt16

    RecordHeader::content_type

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

    RecordHeader::epoch

    fn RecordHeader::epoch(self : RecordHeader) -> UInt16

    RecordHeader::new

    fn RecordHeader::new(content_type~ : ContentType, version? : ProtocolVersion, epoch~ : UInt16, sequence_number~ : UInt64, content_length~ : UInt16) -> RecordHeader raise DtlsError

    RecordHeader::sequence_number

    fn RecordHeader::sequence_number(self : RecordHeader) -> UInt64

    RecordHeader::version

    Role

    pub(all) enum Role {
    Auto
    Client
    Server
    } derive(Eq,
    Debug
    )

    ServerHelloMessage

    pub struct ServerHelloMessage {
    random : Bytes
    session_id : Bytes
    cipher_suite : UInt16
    compression_method : Byte
    extensions : HelloExtensions
    } derive(Eq,
    Debug
    )

    ServerHelloMessage::cipher_suite

    fn ServerHelloMessage::cipher_suite(self : ServerHelloMessage) -> UInt16

    ServerHelloMessage::extensions

    ServerHelloMessage::new

    fn ServerHelloMessage::new(random~ : Bytes, cipher_suite? : CipherSuite, selected_srtp_profile? : UInt16) -> ServerHelloMessage raise DtlsError

    ServerHelloMessage::random

    fn ServerHelloMessage::random(self : ServerHelloMessage) -> Bytes

    ServerKeyExchangeMessage

    pub struct ServerKeyExchangeMessage {
    named_curve : UInt16
    public_key : Bytes
    signature_algorithm : UInt16
    signature : Bytes
    identity_hint : Bytes?
    } derive(Eq,
    Debug
    )

    SrtpProtectionProfile

    pub(all) enum SrtpProtectionProfile {
    SrtpAes128CmHmacSha1_80
    SrtpAes128CmHmacSha1_32
    SrtpAeadAes128Gcm
    SrtpAeadAes256Gcm
    } derive(Eq,
    Debug
    )

    SrtpProtectionProfile::aead_aes128_gcm

    SrtpProtectionProfile::aead_aes256_gcm

    SrtpProtectionProfile::aes128_cm_hmac_sha1_32

    fn SrtpProtectionProfile::aes128_cm_hmac_sha1_32() -> SrtpProtectionProfile

    SrtpProtectionProfile::aes128_cm_hmac_sha1_80

    fn SrtpProtectionProfile::aes128_cm_hmac_sha1_80() -> SrtpProtectionProfile

    SrtpProtectionProfile::code

    fn SrtpProtectionProfile::code(self : SrtpProtectionProfile) -> UInt16

    State

    pub(all) enum State {
    New
    Connecting
    Connected
    Closing
    Closed
    Failed
    } derive(Eq,
    Debug
    )

    decode_handshakes

    fn decode_handshakes(payload : Bytes) -> Array[HandshakeFragment] raise DtlsError

    decode_records

    fn decode_records(datagram : Bytes) -> Array[Record] raise DtlsError

    encode_records

    fn encode_records(records : Array[Record]) -> Bytes raise DtlsError