purecrypto 0.6.29

A pure-Rust cryptography toolkit with no foreign-code dependencies, from constant-time primitives up to keys, X.509 and TLS.
Documentation
name: Deploy demo site

# Builds the WebAssembly demo site (web/) and publishes it to GitHub Pages.
# The wasm is compiled from the crate's `ffi` feature, so a change to either the
# library or the site triggers a redeploy.
on:
  push:
    branches: [master]
    paths:
      - 'web/**'
      - 'src/**'
      - 'Cargo.toml'
      - '.github/workflows/pages.yml'
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment; newer pushes supersede in-flight ones.
concurrency:
  group: pages
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust (wasm32 target)
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: wasm-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}

      - name: Build purecrypto.wasm (ffi cdylib)
        run: |
          cargo rustc --lib --crate-type cdylib \
            --features ffi --no-default-features \
            --target wasm32-unknown-unknown --release
          cp target/wasm32-unknown-unknown/release/purecrypto.wasm web/public/purecrypto.wasm

      - name: Optimize wasm (binaryen)
        run: |
          sudo apt-get update && sudo apt-get install -y binaryen
          wasm-opt -Oz web/public/purecrypto.wasm -o web/public/purecrypto.wasm
          ls -la web/public/purecrypto.wasm

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
          cache-dependency-path: web/package-lock.json

      - name: Install, validate, build
        working-directory: web
        run: |
          npm ci
          npm run smoke   # asserts the wasm bridge does real crypto
          npm run build

      - uses: actions/configure-pages@v5

      - uses: actions/upload-pages-artifact@v3
        with:
          path: web/dist

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4