CoolrfulDARkness/moonsctp/cookie does not have a README file

    CookieError

    pub suberror CookieError {
    InvalidLength(Int)
    InvalidMac
    Expired(UInt64)
    } derive(Eq,
    Debug
    )

    CookiePayload

    pub(all) struct CookiePayload {
    local_vtag : UInt
    peer_vtag : UInt
    local_tsn : UInt
    peer_tsn : UInt
    out_streams : UInt
    in_streams : UInt
    peer_arwnd : UInt
    created_ms : UInt64
    } derive(Eq,
    Debug
    )

    let COOKIE_WIRE_LEN : Int

    Signed stateless State Cookie payload (RFC 9260 §5.1.3): Wire layout (64 bytes): local_vtag(4) || peer_vtag(4) || local_tsn(4) || peer_tsn(4) ||out_streams(2) || in_streams(2) || peer_arwnd(4) || created_ms(8) ||mac_hmac_sha256(32)

    ct_eq

    fn ct_eq(a : Bytes, b : Bytes) -> Bool

    Constant-time byte comparison for cookie MAC verification.

    hmac_sha256

    fn hmac_sha256(key : Bytes, data : Bytes) -> Bytes

    fn open_cookie(secret : Bytes, cookie : Bytes, now_ms : UInt64, lifetime_ms : UInt64) -> CookiePayload raise CookieError

    Verifies HMAC-SHA256 in constant time and enforces lifetime (now_ms - created_ms <= lifetime_ms).
    fn seal_cookie(secret : Bytes, payload : CookiePayload) -> Bytes

    Seals a stateless cookie with HMAC-SHA256 under secret.

    sha256

    fn sha256(data : Bytes) -> Bytes

    Source Files