moontls-parser

    TLS ClientHello parser and JA3/JA4-style fingerprint toolkit for MoonBit traffic-audit probes.

    tls
    ja3
    ja4
    fingerprint
    security
    parser
    Download zip
    Author
    Version
    0.1.2
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    50

    #MoonTLS-Parser

    MoonTLS-Parser is a MoonBit library for passive TLS record inspection, handshake parsing (ClientHello, ServerHello, Certificate, Alert), and fingerprint generation (JA3, JA4-a, JA4S-a). It is designed for traffic-audit probes, sidecar policy filters, and Wasm-based gateways that need routing, auditing, and client-classification signals without decrypting payloads.

    This release focuses on the unencrypted TLS handshake surface and features:

    • TLS record parsing and length validation.
    • Streaming parse of fragmented ClientHello records.
    • SNI, ALPN, cipher suite, supported group, EC point format, and signature algorithm extraction from ClientHello.
    • GREASE filtering for JA3-compatible fields.
    • JA3 canonical string and MD5 digest generation.
    • A compact JA4-a style summary for coarse client bucketing.
    • ServerHello Handshake Parsing: negotiated version (supporting TLS 1.3 supported_versions extensions), cipher suite, random, session ID, and selected ALPN.
    • JA4S-a Fingerprinting: server handshake fingerprinting for audit classification.
    • Alert Record Parsing: extract Alert Level and Alert Description with readable string conversion (e.g., handshake_failure, close_notify).
    • Certificate Handshake Parsing: extract DER certificate lengths in the chain for size auditing.
    • JSON Serialization: built-in .to_json() methods for ClientHello, ServerHello, Alerts, and Certificates.

    #Why This Project

    The OSC2026 requirement favors reusable MoonBit ecosystem libraries with clear scope, tests, documentation, and maintainable public APIs. TLS record parsing is a good fit because it is useful in security tooling but still small enough to implement as a focused MoonBit package.

    This repository is an original MoonBit implementation. It references public TLS, JA3, and JA4 behavior, but it does not copy code from any upstream parser.

    #Install

    Add moontls-parser directly to your MoonBit project using moon add:

    moon add yhsrtty/moontls-parser

    Or manually declare the dependency in your moon.mod:

    import { "yhsrtty/moontls-parser@0.1.2", }

    Or in JSON format (moon.mod.json):

    { "deps": { "yhsrtty/moontls-parser": "0.1.2" } }

    #Option 2: Local Development & Building from Source

    To build, test, and run locally:

    git clone https://github.com/yhsrtty/MoonTLS-Parser.git cd MoonTLS-Parser moon check --deny-warn moon test --deny-warn moon run cmd/main

    #Minimal API

    #Parsing TLS Records

    You can parse any TLS record (Handshake, Alert, etc.) using parse_tls_record:

    let parsed = parse_tls_record(packet_bytes)
    match parsed {
    Ok(ClientHelloRecord(hello)) => {
    println(hello.server_name)
    println(hello.ja3_digest())
    println(hello.to_json())
    }
    Ok(ServerHelloRecord(hello)) => {
    println(hello.selected_alpn)
    println(hello.ja4s_a())
    println(hello.to_json())
    }
    Ok(AlertRecord(alert)) => {
    println(alert.description_string())
    }
    Ok(CertificateRecord(cert)) => {
    println(cert.cert_lengths)
    }
    Ok(GenericRecord(ty, payload)) => {
    println("Other TLS Record")
    }
    Err(err) => println(err)
    }

    For incremental capture pipelines, use ClientHelloStream:

    let stream = ClientHelloStream::new()
    let a = stream.push(first_fragment)
    let b = stream.push(second_fragment)

    NeedMore means the record header or record body is incomplete. Parsed returns a ClientHello. Rejected means the buffered bytes are not a valid TLS ClientHello record.

    #Current Scope

    Implemented:

    • TLS record content types handshake (0x16) and alert (0x15).
    • TLS 1.0 through TLS 1.3 record-version range.
    • Handshake types client_hello (1), server_hello (2), and certificate (11).
    • Extensions server_name, application_layer_protocol_negotiation (ALPN), supported_groups, ec_point_formats, signature_algorithms, and supported_versions.
    • Fingerprinting: JA3, JA4-a, and JA4S-a.
    • JSON Serialization for parsed elements.

    Not implemented yet:

    • TCP reassembly beyond a single TLS record.
    • Full DER certificate structure parsing (extracts only certificate lengths).
    • Encrypted ClientHello decryption.
    • Live pcap reading.

    Those are natural extension points rather than hidden behavior.

    #Verification

    The test suite includes hand-built ClientHello, ServerHello, Alert, and Certificate record fixtures.

    moon test --deny-warn moon check --deny-warn moon info

    The repository also includes:

    • .github/workflows/ci.yml for GitHub CI (Windows, Linux, macOS).
    • scripts/verify_acceptance.ps1 for local OSC2026-style checks.
    • docs/source-attribution.md for source and licensing notes.
    • docs/acceptance-checklist.md for the current competition-readiness status.

    #License

    Apache-2.0. See LICENSE.

    BenchmarkReport

    pub struct BenchmarkReport {
    test_name : String
    operations : Int
    total_bytes : Int
    efficiency_rating : String
    } derive(Eq,
    Debug
    )

    CertificateRequest

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

    CertificateVerify

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

    CipherDetails

    pub struct CipherDetails {
    id : UInt16
    name : String
    kex : String
    enc : String
    mac : String
    strength : Int
    is_recommended : Bool
    } derive(Eq,
    Debug
    )

    ClientHello

    pub struct ClientHello {
    legacy_version : UInt16
    record_version : UInt16
    cipher_suites : Array[UInt16]
    compression_methods : Array[Byte]
    extensions : Array[UInt16]
    supported_groups : Array[UInt16]
    ec_point_formats : Array[Byte]
    signature_algorithms : Array[UInt16]
    alpn_protocols : Array[String]
    server_name : String?
    raw_length : Int
    } derive(
    Debug
    )

    ClientHello::ja3_digest

    fn ClientHello::ja3_digest(self : ClientHello) -> String

    ClientHello::ja3_string

    fn ClientHello::ja3_string(self : ClientHello) -> String

    ClientHello::ja4

    fn ClientHello::ja4(self : ClientHello) -> String

    ClientHello::ja4_a

    fn ClientHello::ja4_a(self : ClientHello) -> String

    ClientHello::ja4_a_str

    fn ClientHello::ja4_a_str(self : ClientHello) -> String

    ClientHello::ja4_b_str

    fn ClientHello::ja4_b_str(self : ClientHello) -> String

    ClientHello::ja4_c_str

    fn ClientHello::ja4_c_str(self : ClientHello) -> String

    ClientHello::to_json

    fn ClientHello::to_json(self : ClientHello) -> String

    ClientHelloStream

    pub struct ClientHelloStream {
    buffer : Array[Byte]
    } derive(
    Debug
    )

    ClientHelloStream::new

    ClientHelloStream::push

    fn ClientHelloStream::push(self : ClientHelloStream, chunk : BytesView) -> StreamResult

    ClientHelloStream::reset

    fn ClientHelloStream::reset(self : ClientHelloStream) -> Unit

    ClientKeyExchange

    pub struct ClientKeyExchange {
    raw : Bytes
    } derive(Eq,
    Debug
    )

    EncryptedExtensions

    pub struct EncryptedExtensions {
    extensions : Array[UInt16]
    } derive(Eq,
    Debug
    )

    FingerprintEntry

    pub struct FingerprintEntry {
    fingerprint : String
    client_type : String
    description : String
    } derive(Eq,
    Debug
    )

    Finished

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

    HandshakeEvent

    pub struct HandshakeEvent {
    direction_is_client_to_server : Bool
    label : String
    details : Array[String]
    } derive(Eq,
    Debug
    )

    HelloRequest

    pub struct HelloRequest {
    dummy : Byte
    } derive(Eq,
    Debug
    )

    HelloVerifyRequest

    pub struct HelloVerifyRequest {
    version : UInt16
    cookie : Bytes
    } derive(Eq,
    Debug
    )

    KeyShareClient

    pub struct KeyShareClient {
    client_shares : Array[KeyShareEntry]
    } derive(Eq,
    Debug
    )

    KeyShareEntry

    pub struct KeyShareEntry {
    group : UInt16
    key_exchange : Bytes
    } derive(Eq,
    Debug
    )

    KeyShareServer

    pub struct KeyShareServer {
    server_share : KeyShareEntry
    } derive(Eq,
    Debug
    )

    NewSessionTicket

    pub struct NewSessionTicket {
    lifetime : UInt
    age_add : UInt
    ticket : Bytes
    } derive(Eq,
    Debug
    )

    ParseError

    pub enum ParseError {
    NotTlsHandshake
    IncompleteRecord(expected~ : Int, available~ : Int)
    BadHandshakeType(Int)
    BadLength(field~ : String, offset~ : Int)
    UnsupportedRecordVersion(UInt16)
    InvalidAlertLength
    } derive(Eq,
    Debug
    )

    SecurityFinding

    pub struct SecurityFinding {
    severity : String
    category : String
    finding : String
    suggestion : String
    } derive(Eq,
    Debug
    )

    ServerHello

    pub struct ServerHello {
    version : UInt16
    random : Bytes
    session_id : Bytes
    cipher_suite : UInt16
    compression_method : Byte
    extensions : Array[UInt16]
    selected_alpn : String?
    raw_length : Int
    } derive(
    Debug
    )

    ServerHello::ja4s

    fn ServerHello::ja4s(self : ServerHello) -> String

    ServerHello::ja4s_a

    fn ServerHello::ja4s_a(self : ServerHello) -> String

    ServerHello::ja4s_a_str

    fn ServerHello::ja4s_a_str(self : ServerHello) -> String

    ServerHello::ja4s_b_str

    fn ServerHello::ja4s_b_str(self : ServerHello) -> String

    ServerHello::ja4s_c_str

    fn ServerHello::ja4s_c_str(self : ServerHello) -> String

    ServerHello::to_json

    fn ServerHello::to_json(self : ServerHello) -> String

    ServerKeyExchange

    pub struct ServerKeyExchange {
    raw : Bytes
    } derive(Eq,
    Debug
    )

    ServerNameEntry

    pub struct ServerNameEntry {
    name_type : Byte
    name : String
    } derive(Eq,
    Debug
    )

    ServerNameList

    pub struct ServerNameList {
    names : Array[ServerNameEntry]
    } derive(Eq,
    Debug
    )

    Sha256

    type Sha256

    Sha256::finalize

    fn Sha256::finalize(self : Sha256) -> Bytes

    Sha256::update

    fn Sha256::update(self : Sha256, data : BytesView) -> Unit

    StreamResult

    pub enum StreamResult {
    NeedMore
    Parsed(ClientHello)
    Rejected(ParseError)
    } derive(
    Debug
    )

    SupportedVersionsClient

    pub struct SupportedVersionsClient {
    versions : Array[UInt16]
    } derive(Eq,
    Debug
    )

    TlsAlert

    pub struct TlsAlert {
    level : Byte
    description : Byte
    } derive(Eq,
    Debug
    )

    TlsAlert::description_string

    fn TlsAlert::description_string(self : TlsAlert) -> String

    TlsAlert::level_string

    fn TlsAlert::level_string(self : TlsAlert) -> String

    TlsAlert::to_json

    fn TlsAlert::to_json(self : TlsAlert) -> String

    TlsCertificate

    pub struct TlsCertificate {
    cert_lengths : Array[Int]
    } derive(Eq,
    Debug
    )

    TlsCertificate::to_json

    fn TlsCertificate::to_json(self : TlsCertificate) -> String

    TlsCookie

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

    TlsRecord

    pub enum TlsRecord {
    ClientHelloRecord(ClientHello)
    ServerHelloRecord(ServerHello)
    AlertRecord(TlsAlert)
    CertificateRecord(TlsCertificate)
    ClientKeyExchangeRecord(ClientKeyExchange)
    ServerKeyExchangeRecord(ServerKeyExchange)
    NewSessionTicketRecord(NewSessionTicket)
    EncryptedExtensionsRecord(EncryptedExtensions)
    HelloRequestRecord(HelloRequest)
    HelloVerifyRequestRecord(HelloVerifyRequest)
    CertificateRequestRecord(CertificateRequest)
    CertificateVerifyRecord(CertificateVerify)
    FinishedRecord(Finished)
    GenericRecord(TlsRecordType, Bytes)
    } derive(
    Debug
    )

    TlsRecord::cipher_summary

    fn TlsRecord::cipher_summary(self : TlsRecord) -> String

    TlsRecord::dump_tree

    fn TlsRecord::dump_tree(self : TlsRecord) -> String

    TlsRecord::extension_summary

    fn TlsRecord::extension_summary(self : TlsRecord) -> Array[String]

    TlsRecord::to_event

    fn TlsRecord::to_event(self : TlsRecord, from_client : Bool) -> HandshakeEvent

    TlsRecord::to_json

    fn TlsRecord::to_json(self : TlsRecord) -> String

    TlsRecordType

    pub enum TlsRecordType {
    ChangeCipherSpec
    Handshake
    ApplicationData
    Unknown(Byte)
    } derive(Eq,
    Debug
    )

    CONTENT_TYPE_ALERT

    let CONTENT_TYPE_ALERT : Byte

    CONTENT_TYPE_APPLICATION_DATA

    let CONTENT_TYPE_APPLICATION_DATA : Byte

    CONTENT_TYPE_CHANGE_CIPHER_SPEC

    let CONTENT_TYPE_CHANGE_CIPHER_SPEC : Byte

    TLS Record Content Types (RFC 5246 Section 6.2.1)

    CONTENT_TYPE_HANDSHAKE

    let CONTENT_TYPE_HANDSHAKE : Byte

    GROUP_FFDHE2048

    let GROUP_FFDHE2048 : UInt16

    GROUP_FFDHE3072

    let GROUP_FFDHE3072 : UInt16

    GROUP_FFDHE4096

    let GROUP_FFDHE4096 : UInt16

    GROUP_SECP256R1

    let GROUP_SECP256R1 : UInt16

    Supported Cryptographic Groups (RFC 8446 Section 4.2.7)

    GROUP_SECP384R1

    let GROUP_SECP384R1 : UInt16

    GROUP_SECP521R1

    let GROUP_SECP521R1 : UInt16

    GROUP_X25519

    let GROUP_X25519 : UInt16

    GROUP_X448

    let GROUP_X448 : UInt16

    HANDSHAKE_TYPE_CERTIFICATE

    let HANDSHAKE_TYPE_CERTIFICATE : Byte

    HANDSHAKE_TYPE_CERTIFICATE_REQUEST

    let HANDSHAKE_TYPE_CERTIFICATE_REQUEST : Byte

    HANDSHAKE_TYPE_CERTIFICATE_VERIFY

    let HANDSHAKE_TYPE_CERTIFICATE_VERIFY : Byte

    HANDSHAKE_TYPE_CLIENT_HELLO

    let HANDSHAKE_TYPE_CLIENT_HELLO : Byte

    HANDSHAKE_TYPE_CLIENT_KEY_EXCHANGE

    let HANDSHAKE_TYPE_CLIENT_KEY_EXCHANGE : Byte

    HANDSHAKE_TYPE_ENCRYPTED_EXTENSIONS

    let HANDSHAKE_TYPE_ENCRYPTED_EXTENSIONS : Byte

    HANDSHAKE_TYPE_END_OF_EARLY_DATA

    let HANDSHAKE_TYPE_END_OF_EARLY_DATA : Byte

    HANDSHAKE_TYPE_FINISHED

    let HANDSHAKE_TYPE_FINISHED : Byte

    HANDSHAKE_TYPE_HELLO_REQUEST

    let HANDSHAKE_TYPE_HELLO_REQUEST : Byte

    Handshake Protocol Message Types (RFC 8446 Section 4)

    HANDSHAKE_TYPE_HELLO_VERIFY_REQUEST

    let HANDSHAKE_TYPE_HELLO_VERIFY_REQUEST : Byte

    HANDSHAKE_TYPE_KEY_UPDATE

    let HANDSHAKE_TYPE_KEY_UPDATE : Byte

    HANDSHAKE_TYPE_MESSAGE_HASH

    let HANDSHAKE_TYPE_MESSAGE_HASH : Byte

    HANDSHAKE_TYPE_NEW_SESSION_TICKET

    let HANDSHAKE_TYPE_NEW_SESSION_TICKET : Byte

    HANDSHAKE_TYPE_SERVER_HELLO

    let HANDSHAKE_TYPE_SERVER_HELLO : Byte

    HANDSHAKE_TYPE_SERVER_HELLO_DONE

    let HANDSHAKE_TYPE_SERVER_HELLO_DONE : Byte

    HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE

    let HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE : Byte

    SIG_SCHEME_ECDSA_SHA256_NISTP256

    let SIG_SCHEME_ECDSA_SHA256_NISTP256 : UInt16

    SIG_SCHEME_ECDSA_SHA384_NISTP384

    let SIG_SCHEME_ECDSA_SHA384_NISTP384 : UInt16

    SIG_SCHEME_ECDSA_SHA512_NISTP521

    let SIG_SCHEME_ECDSA_SHA512_NISTP521 : UInt16

    SIG_SCHEME_ED25519

    let SIG_SCHEME_ED25519 : UInt16

    SIG_SCHEME_ED448

    let SIG_SCHEME_ED448 : UInt16

    SIG_SCHEME_RSA_PKCS1_SHA256

    let SIG_SCHEME_RSA_PKCS1_SHA256 : UInt16

    Signature Schemes (RFC 8446 Section 4.2.3)

    SIG_SCHEME_RSA_PKCS1_SHA384

    let SIG_SCHEME_RSA_PKCS1_SHA384 : UInt16

    SIG_SCHEME_RSA_PKCS1_SHA512

    let SIG_SCHEME_RSA_PKCS1_SHA512 : UInt16

    SIG_SCHEME_RSA_PSS_RSAE_SHA256

    let SIG_SCHEME_RSA_PSS_RSAE_SHA256 : UInt16

    SIG_SCHEME_RSA_PSS_RSAE_SHA384

    let SIG_SCHEME_RSA_PSS_RSAE_SHA384 : UInt16

    SIG_SCHEME_RSA_PSS_RSAE_SHA512

    let SIG_SCHEME_RSA_PSS_RSAE_SHA512 : UInt16

    VERSION_SSL_3_0

    let VERSION_SSL_3_0 : UInt16

    TLS Protocol Versions (RFC 8446 Section 4.2.1)

    VERSION_TLS_1_0

    let VERSION_TLS_1_0 : UInt16

    VERSION_TLS_1_1

    let VERSION_TLS_1_1 : UInt16

    VERSION_TLS_1_2

    let VERSION_TLS_1_2 : UInt16

    VERSION_TLS_1_3

    let VERSION_TLS_1_3 : UInt16

    add_custom_client_fingerprint

    fn add_custom_client_fingerprint(fp : String, client_type : String, desc : String) -> Unit

    add_custom_server_fingerprint

    fn add_custom_server_fingerprint(fp : String, server_type : String, desc : String) -> Unit

    alert_description_to_string

    fn alert_description_to_string(desc : Byte) -> String

    alert_level_to_string

    fn alert_level_to_string(level : Byte) -> String

    ascii_bytes

    fn ascii_bytes(text : String) -> Bytes

    audit_client_hello_security

    fn audit_client_hello_security(hello : ClientHello) -> Array[SecurityFinding]

    audit_server_hello_security

    fn audit_server_hello_security(hello : ServerHello) -> Array[SecurityFinding]

    cipher_details_db_size

    fn cipher_details_db_size() -> Int

    cipher_suite_id_to_string

    fn cipher_suite_id_to_string(id : UInt16) -> String

    client_db_size

    fn client_db_size() -> Int

    extension_id_to_string

    fn extension_id_to_string(id : UInt16) -> String

    fixture_client_hello_tls12

    fn fixture_client_hello_tls12() -> Bytes

    fixture_client_key_exchange

    fn fixture_client_key_exchange() -> Bytes

    fixture_encrypted_extensions

    fn fixture_encrypted_extensions() -> Bytes

    fixture_new_session_ticket

    fn fixture_new_session_ticket() -> Bytes

    fixture_server_hello_tls13

    fn fixture_server_hello_tls13() -> Bytes

    fixture_server_key_exchange

    fn fixture_server_key_exchange() -> Bytes

    fixture_tls_alert_fatal

    fn fixture_tls_alert_fatal() -> Bytes

    fixture_tls_certificate

    fn fixture_tls_certificate() -> Bytes

    format_markdown_report

    fn format_markdown_report(reports : Array[BenchmarkReport]) -> String

    generate_mermaid_diagram

    fn generate_mermaid_diagram(records : Array[TlsRecord], directions : Array[Bool]) -> String

    generate_sequence_diagram

    fn generate_sequence_diagram(events : Array[HandshakeEvent]) -> String

    hex_dump

    fn hex_dump(data : BytesView) -> String

    is_aead_cipher_id

    fn is_aead_cipher_id(id : UInt16) -> Bool

    fn is_recommended_cipher_id(id : UInt16) -> Bool

    is_tls_13_cipher_id

    fn is_tls_13_cipher_id(id : UInt16) -> Bool

    is_tls_version_supported

    fn is_tls_version_supported(v : UInt16) -> Bool

    is_weak_cipher_id

    fn is_weak_cipher_id(id : UInt16) -> Bool

    ja3_db_size

    fn ja3_db_size() -> Int

    lookup_cipher_details

    fn lookup_cipher_details(id : UInt16) -> CipherDetails?

    lookup_client_fingerprint

    fn lookup_client_fingerprint(fp : String) -> String?

    lookup_client_fingerprint_ext

    fn lookup_client_fingerprint_ext(fp : String) -> String?

    lookup_fingerprint_info

    fn lookup_fingerprint_info(fp : String) -> String

    lookup_ja3_fingerprint

    fn lookup_ja3_fingerprint(fp : String) -> String?

    lookup_server_fingerprint

    fn lookup_server_fingerprint(fp : String) -> String?

    lookup_server_fingerprint_ext

    fn lookup_server_fingerprint_ext(fp : String) -> String?

    normalize_u16_list

    fn normalize_u16_list(values : ArrayView[UInt16]) -> String

    parse_alert

    fn parse_alert(data : BytesView) -> Result[TlsAlert, ParseError]

    parse_certificate

    fn parse_certificate(data : BytesView) -> Result[TlsCertificate, ParseError]

    parse_certificate_request

    fn parse_certificate_request(data : BytesView) -> Result[CertificateRequest, ParseError]

    parse_certificate_verify

    fn parse_certificate_verify(data : BytesView) -> Result[CertificateVerify, ParseError]

    parse_client_hello

    fn parse_client_hello(data : BytesView) -> Result[ClientHello, ParseError]

    parse_client_key_exchange

    fn parse_client_key_exchange(data : BytesView) -> Result[ClientKeyExchange, ParseError]

    parse_encrypted_extensions

    fn parse_encrypted_extensions(data : BytesView) -> Result[EncryptedExtensions, ParseError]

    parse_finished

    fn parse_finished(data : BytesView) -> Result[Finished, ParseError]

    parse_hello_request

    fn parse_hello_request(data : BytesView) -> Result[HelloRequest, ParseError]

    parse_hello_verify_request

    fn parse_hello_verify_request(data : BytesView) -> Result[HelloVerifyRequest, ParseError]

    parse_key_share_client

    fn parse_key_share_client(data : BytesView) -> Result[KeyShareClient, ParseError]

    parse_key_share_server

    fn parse_key_share_server(data : BytesView) -> Result[KeyShareServer, ParseError]

    parse_new_session_ticket

    fn parse_new_session_ticket(data : BytesView) -> Result[NewSessionTicket, ParseError]

    parse_server_hello

    fn parse_server_hello(data : BytesView) -> Result[ServerHello, ParseError]

    parse_server_key_exchange

    fn parse_server_key_exchange(data : BytesView) -> Result[ServerKeyExchange, ParseError]

    parse_server_name_list

    fn parse_server_name_list(data : BytesView) -> Result[ServerNameList, ParseError]

    parse_supported_versions_client

    fn parse_supported_versions_client(data : BytesView) -> Result[SupportedVersionsClient, ParseError]

    fn parse_tls_cookie(data : BytesView) -> Result[TlsCookie, ParseError]

    parse_tls_record

    fn parse_tls_record(data : BytesView) -> Result[TlsRecord, ParseError]

    fn print_security_audit_report(findings : Array[SecurityFinding]) -> Unit

    run_and_print_performance_audit

    fn run_and_print_performance_audit() -> Unit

    run_detailed_benchmarks

    fn run_detailed_benchmarks() -> Array[BenchmarkReport]

    run_parser_benchmark

    fn run_parser_benchmark(iterations : Int) -> Unit

    server_db_size

    fn server_db_size() -> Int

    sha256_hash

    fn sha256_hash(data : BytesView) -> Bytes

    sha256_hex

    fn sha256_hex(data : BytesView) -> String

    uint16_to_hex4

    fn uint16_to_hex4(value : UInt16) -> String

    visualize_handshake

    fn visualize_handshake(records : Array[TlsRecord], directions : Array[Bool]) -> String