def unmask.when

bend-kit-websocket@0.4.0.0 · websocket.bend:461

import bend-kit-websocket@0.4.0.0/websocket.bend as Websocket
import Base

461# The decoder, over any input S with four operations, giving payloads P:
462# prefix gives at least the first 14 octets as a list; fits tells if hs + len octets are in;
463# cut splits into the payload [hs, hs + len) and the input from hs + len on; unmask XORs a mask key.
464def unmask.when(~P: Type, ~unmask: @+key:U32 -> P -> P, m: Bool, +key: U32, p: P) -> P:
465  match m:
466    case True{}:
467      unmask(key, p)
468    case False{}:
469      p

Uses (2)

Used by (1)