UMIS SDK
    Preparing search index...

    Module @umis/transports

    @umis/transports

    This package carries UMIS frames between a verifier and a wallet over Bluetooth Low Energy or any link like it. You need it when a verifier and a wallet exchange frames over BLE, and in tests that run both sides in one program.

    It provides the UMIS-BLE v1 framing and sessions, and an in-memory link. The layers above see only whole frames, as the bytes of encodeFrameBytes in @umis/core. This package cuts them to the size a link allows and puts them back together. It runs in browsers, React Native and Node.

    npm install @umis/transports @umis/core
    
    Export What it does
    PresentationTransport the interface of a link with send(frame), onFrame(cb) and close(), for whole frames only
    requestOverTransport(t, request, { timeoutMs }) the verifier’s side of a session, which sends a request frame and resolves with the answer
    serveOverTransport(t, onRequest) the wallet’s side, which hands the first request to onRequest and sends back the frame it returns
    chunkFrame(frame, mtu, msgId), createReassembler() the chunking of one frame into writes of at most mtu bytes, and its reassembly
    createMemoryTransportPair({ mtu, dropChunk }) two ends of one in-memory link, for tests and for running both sides in one program
    UMIS_BLE_V1 the service and characteristic UUIDs

    The verifier sends one request frame and decides on the answer. The wallet answers the first request that arrives. In this example both sides run in one program over the in-memory link, at the smallest BLE MTU.

    import { createMemoryTransportPair, requestOverTransport, serveOverTransport } from '@umis/transports';
    import { createRequestFrame, verifyResponseQr } from '@umis/verifier';
    import { createResponseFrame, parseRequestQr } from '@umis/wallet';

    const [verifierSide, walletSide] = createMemoryTransportPair({ mtu: 23 });

    // the wallet
    serveOverTransport(walletSide, async (request) => {
    const parsed = await parseRequestQr(request, { verifierKeys: [verifierDevice.publicJwk], now });
    return createResponseFrame({ request: parsed, sdJwtVc, disclose: parsed.claims, signer: holder, now });
    });

    // the verifier
    const { frame, pending } = await createRequestFrame({
    deviceSigner: verifierDevice,
    audience: 'urn:umis:verifier:lumera-door',
    claims: ['org', 'role', 'authority'],
    now,
    });
    const answer = await requestOverTransport(verifierSide, frame, { timeoutMs: 10_000 });
    const result = await verifyResponseQr(answer, pending, context); // result.channel is 'ble'

    A BLE adapter implements PresentationTransport and nothing else.

    1. send(frame) cuts the frame with chunkFrame(frame, mtu, msgId) and puts the chunks on the link in order. Give each frame its own msgId. The ids count up and wrap at 256. The verifier notifies the chunks on the request characteristic. The wallet writes them to response. send(frame) rejects when the link is closed or a write fails.
    2. Incoming chunks go into one createReassembler() per direction. push(chunk) returns the frame when its last chunk arrives. The onFrame callbacks then receive it. For a chunk that does not fit, push(chunk) throws MALFORMED and drops the unfinished message. A chunk does not fit when it belongs to another message, skips or repeats an index, or makes the message too large.
    3. close() ends the link. After that, the link sends and delivers nothing.

    Every chunk carries a 3-byte header [msgId, index, total]. A frame is therefore at most 255 chunks of mtu − 3 bytes. The largest frame a link carries is the smaller of that size and 16 384 bytes. At the BLE minimum MTU of 23, the limit is 5 100 bytes. From an MTU of 68 up, the cap of 16 384 bytes applies. The in-memory link defaults to an MTU of 185, which gives 46 410 bytes before the cap. Negotiate the largest MTU the phones allow.

    For tests, createMemoryTransportPair({ mtu, dropChunk }) behaves like a link. It chunks frames at mtu, which is 185 by default. It delivers them asynchronously. It asks dropChunk(n) about every chunk, counted from 0 over both directions, so a test can lose any chunk it likes. A frame that loses a chunk never arrives.

    A session carries one request and one answer. The onRequest handler given to serveOverTransport may reject because the holder declined or because the request could not be answered. The serving side then sends nothing back. The session ends without an answer. When its timeout is over, the asker’s requestOverTransport fails with NETWORK and the message no answer within <timeoutMs> ms. The timeout is 10 seconds unless timeoutMs says otherwise.

    To the asker, a refused request and a lost link look the same. Choose timeoutMs to match how long the member at the checkpoint can wait. Report the failure as "no answer", not as a refusal.

    test/transports.test.ts runs the real wallet and verifier functions against each other. It takes the S-1 decision from frames that crossed the in-memory link at MTU 23. It also runs an OpenID4VP login from the request link to the verdict. The verifier and wallet packages cannot import each other. This file therefore holds the only wallet-to-verifier contract test of OpenID4VP in the repository.

    See also the UMIS SDK, the frames section of the profile and the API reference.

    Copyright 2026 Ishtvan Komonii. Licensed under the Apache License 2.0.

    PresentationTransport
    UMIS_BLE_V1
    chunkFrame
    createMemoryTransportPair
    createReassembler
    requestOverTransport
    serveOverTransport