quantum-box 0.1.0

Reference implementation of an anonymous sealed box with a post-quantum hybrid KEM (ML-KEM + X25519)
Documentation
name: CI

# Unless we are on the main branch, stop and yield to a new run if new code is pushed.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }}
  cancel-in-progress: ${{ github.ref != 'main' }}

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

permissions:
  contents: read

jobs:
  lint:
    name: Format, Clippy & Build
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 (https://github.com/actions/checkout/releases/tag/v6.0.2)
        with:
          persist-credentials: false

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable branch HEAD as of 2026-05-20 (https://github.com/dtolnay/rust-toolchain/tree/stable)
        with:
          toolchain: stable
          components: clippy,rustfmt

      - name: Check code formatting
        run: cargo fmt -- --check

      - name: Run clippy
        run: cargo clippy

  test:
    name: Tests
    runs-on: ubuntu-latest
    permissions:
      contents: read

    strategy:
      matrix:
        rust:
          - stable
          - nightly
          - 1.85.0 # MSRV

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 (https://github.com/actions/checkout/releases/tag/v6.0.2)
        with:
          persist-credentials: false

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable branch HEAD as of 2026-05-20 (https://github.com/dtolnay/rust-toolchain/tree/stable)
        with:
          toolchain: ${{ matrix.rust }}

      - name: Run tests
        run: |
          cargo test

      - name: Build non-default features
        run: |
          cargo build

  cross:
    name: Cross-compile (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    permissions:
      contents: read

    strategy:
      fail-fast: false
      matrix:
        include:
          - target: wasm32-unknown-unknown
            os: ubuntu-latest
            feature_flags: 'wasm_js'
          - target: aarch64-apple-ios
            os: macos-latest
          - target: aarch64-linux-android
            os: ubuntu-latest
          - target: armv7-linux-androideabi
            os: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 (https://github.com/actions/checkout/releases/tag/v6.0.2)
        with:
          persist-credentials: false

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable branch HEAD as of 2026-05-20 (https://github.com/dtolnay/rust-toolchain/tree/stable)
        with:
          toolchain: stable
          targets: ${{ matrix.target }}

      - name: Build
        run: cargo build --lib --target ${{ matrix.target }} ${{ matrix.feature_flags && format('--features "{0}"', matrix.feature_flags) || '' }}

  deny:
    name: Cargo deny
    runs-on: ubuntu-latest
    permissions:
      contents: read
    strategy:
      matrix:
        checks:
          - advisories
          - bans licenses sources

    continue-on-error: ${{ matrix.checks == 'advisories' }}

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 (https://github.com/actions/checkout/releases/tag/v6.0.2)
        with:
          persist-credentials: false

      - uses: EmbarkStudios/cargo-deny-action@6c8f9facfa5047ec02d8485b6bf52b587b7777d1 # v2.0.18 (https://github.com/EmbarkStudios/cargo-deny-action/releases/tag/v2.0.18)
        with:
          command: check ${{ matrix.checks }}
          rust-version: 1.94

  fuzz:
    name: Fuzz
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 (https://github.com/actions/checkout/releases/tag/v6.0.2)
        with:
          persist-credentials: false

      - name: Set up Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable branch HEAD as of 2026-05-20 (https://github.com/dtolnay/rust-toolchain/tree/stable)
        with:
          toolchain: nightly

      - name: Install cargo-fuzz
        run: cargo install cargo-fuzz --locked --version 0.13.2

      - name: Build fuzz targets
        run: cargo fuzz build

      # A short campaign per target guards against regressions
      - name: Smoke-run fuzz targets
        run: |
          cargo fuzz run unseal -- -dict=fuzz/holocron.dict -max_total_time=30
          cargo fuzz run public_key -- -max_total_time=30
          cargo fuzz run roundtrip -- -max_total_time=30