NAMESPACEconstconst NAMESPACE: "grc-evidence"The namespace every signature is made in: a signature made for something else does not verify here.
The sshsig signer (commons grc 0014-grc-sshsig): a payload signed with an SSH key, in the envelope of DSSE, so that a person signs with the key they already hold (Ed25519, with its passphrase, which only ssh-keygen ever sees) and anyone verifies with the public key alone. Signing is by the system's ssh-keygen -Y sign; verifying is pure, over the SSHSIG format (PROTOCOL.sshsig of OpenSSH) with Web Crypto, so that a machine with no OpenSSH can verify. What is signed is DSSE's pre-authentication encoding of the payload type and the payload, so a signature is bound to what the payload is for. Only Ed25519 keys are verified; any other key type is refused with that said.
import { sshsigSigner, fingerprintOf } from "./mod.ts";
// const signed = await sshsigSigner.sign("application/vnd.example+json", bytes, [{ keyFile: "~/.ssh/id_ed25519" }]);
// const payload = await sshsigSigner.verify(signed.value, "application/vnd.example+json", [{ publicKey: "ssh-ed25519 AAAA..." }]);NAMESPACEconstconst NAMESPACE: "grc-evidence"The namespace every signature is made in: a signature made for something else does not verify here.
SignKeytypeno test imports ittype SignKey = { readonly keyFile: string; readonly agent?: boolean };A key to sign with: the file of the private key (or of the public key where an agent holds the private one, with agent).
VerifyKeytypeno test imports ittype VerifyKey = { readonly publicKey: string };A public key to verify with: its line, ssh-ed25519 AAAA....
paefunctionfunction pae(payloadType: string, payload: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>DSSE's pre-authentication encoding of a payload type and a payload: what is signed.
fingerprintOffunctionfunction fingerprintOf(publicKey: string): Promise<Result<string, string>>The fingerprint of a public key line, SHA256: and the unpadded base64 of the SHA-256 of its blob, as OpenSSH writes it.
sshsigSignerconstconst sshsigSigner: SignerThe sshsig signer. Its custody is file: the key is held in a file (or by an agent) the person controls.