The capstone is a complete tamper-evident record format and local CLI. A record contains version, context, a Base64 message and a lowercase-hex HMAC tag. The payload remains readable.
The CLI’s sign command computes a shared-key MAC; it is not a public-key digital signature. Every holder of the key can create a valid record. The library verifier releases payload bytes only after accepting the format, caller’s intended context and tag.
Authenticate an unambiguous byte frame, not a casual concatenation. The supplied helper prefixes coderigor.record.v1 plus a zero byte, then a uint64 big-endian context length, context bytes, a uint64 message length and message bytes. The bounds make these allocations small and deliberate.
Version 1 is the only accepted version. The expected context comes from the caller’s operation, not merely from the record itself. An attacker must not move a valid record from one purpose into another.
package main
import ("fmt";"encoding/binary")
func main(){
label,message:="ab",[]byte("c");frame:=binary.BigEndian.AppendUint64(nil,uint64(len(label)));frame=append(frame,[]byte(label)...);frame=binary.BigEndian.AppendUint64(frame,uint64(len(message)));frame=append(frame,message...);fmt.Println(len(frame))
}The MAC covers decoded semantic fields under the fixed v1 framing. Reordering JSON keys or whitespace can preserve those fields; duplicate JSON keys are rejected by the local adapter to avoid ambiguous parsing. Message and tag encodings must be canonical before authentication.
The download supplies the working reference, starter, standard-library Go module, random-key command, bounded strict JSON adapter, original records, published primitive vectors and tampering tests. It stores a newly generated key in a newly created private file and refuses overwrite. Tests use public fixture keys or an owned temporary directory; no real account secret is needed.
This artifact does not hide payloads or prevent replay. It does not rotate keys, establish human identity or implement a password store. Those require additional protocol/application boundaries. The AEAD lesson supplies the separate maintained encryption operation, while the final CLI remains an integrity-focused artifact.
package main
import ("fmt";"encoding/base64";"bytes")
func main(){
payload:=[]byte{0,255,1};raw:=base64.StdEncoding.EncodeToString(payload);decoded,_:=base64.StdEncoding.DecodeString(raw);fmt.Println(raw,bytes.Equal(payload,decoded))
}Complete the verifier, download the lab and run its tests and documented keygen/sign/verify sequence in an owned directory. Change the message, tag, context, version or key; verification must fail without outputting accepted payload bytes.
Keep the key private and remove the owned lab key when finished. The visible Boot.dev continuation broadens the cryptographic primitive set; retain these explicit format, context and failure boundaries as you continue.
Download the complete authenticated-record lab: standard-library Go CLI, published vectors, original fixtures, starter, tests and key cleanup instructions.
A checksum can match while the record is rejected.
Choose an original or altered fixture. The replay recomputes an ordinary checksum of the shown payload, then runs the actual record verifier with its key, version and expected-context gates. This uses an intentionally public test key, never an application secret.
amount=99Caller expects lab.notesUnkeyed checksum
ConsistentThe advertised digest was computed from these bytes. This needs no secret and does not establish trusted origin.
264c0e0d03dec862da5298c837428b4e1e5f6940f23234a51f7f371f062c06d6Authenticated record
RejectedThe checksum matches the changed bytes, but the original HMAC no longer authenticates them.
None — verification failedInspect the actual record fields
{
"version": 1,
"context": "lab.notes",
"message": "YW1vdW50PTk5",
"tag": "186780a104a57a54b70ce2db7f88b9e310874ecdd184a071e1af14fabde64b7e"
}The record’s Base64 message remains readable. Acceptance means the complete format/context/MAC contract passed; rejection can occur before MAC comparison. This replay does not claim encryption, unique-sender identity or replay protection.
Download the CLI, published vectors and corruption tests →