gunk-dev/the-valley

attest.nix

sourcecd00211d0b13main's published tip history
1.9 KiB
1# The attestation helper: its unit tests, the written form as a fixed
2# contract, and the helper driven end to end over scratch repositories.
3{ pkgs, packages, ... }:
4{
5 # The helper's Go tests, run in the package's checkPhase against real
6 # git and ssh-keygen: the written form, the note's key hash and
7 # signatures, and the tree digest and input manifest. The unwrapped
8 # package, because its checkPhase is where the tests run.
9 attest-unit = packages.attest-unwrapped;
10
11 # The written form and the note envelope, held to fixed vectors.
12 # These bytes are an interop contract rather than an
13 # implementation detail: a regenerated or independently written
14 # attest must produce them identically or every signature already
15 # made stops verifying. So the vectors are checked-in files with a
16 # README saying they are the contract (attest/conformance/), and
17 # this check is what holds a second implementation to them.
18 attest-conformance = pkgs.runCommand "valley-attest-conformance" {
19 nativeBuildInputs = [
20 pkgs.cue
21 packages.attest
22 ];
23 vectorDir = ../../attest/conformance;
24 schema = ../../schema/attestation.cue;
25 } (builtins.readFile ./attest-conformance.sh);
26
27 # The helper itself, driven end to end over scratch repositories
28 # and a throwaway key: what it publishes, what it refuses to
29 # publish, and what a verifier makes of both.
30 #
31 # Every check there uses the command runner. The nix runner cannot
32 # be exercised from inside a nix build — there is no daemon in the
33 # sandbox — so what a pure statement looks like is pinned by
34 # attest-schema and by the unit tests over the digest scheme, and
35 # the runner itself is exercised by running the helper outside the
36 # sandbox.
37 attest-e2e = pkgs.runCommand "valley-attest-e2e" {
38 nativeBuildInputs = [
39 pkgs.git
40 pkgs.openssh
41 packages.attest
42 ];
43 } (builtins.readFile ./attest-e2e.sh);
44}