Skip to content

Add a Go signing client - #127

Open
beetlebugorg wants to merge 2 commits into
feat/signing-libraryfrom
feat/go-signing-client
Open

Add a Go signing client#127
beetlebugorg wants to merge 2 commits into
feat/signing-libraryfrom
feat/go-signing-client

Conversation

@beetlebugorg

@beetlebugorg beetlebugorg commented Sep 9, 2026

Copy link
Copy Markdown
Owner

What

Package moddims at clients/moddims signs /dims4/ and /dims5/ URLs and encrypts an image URL into eurl. Go 1.24, and no dependency outside the standard library. Dims5 and Dims4 each have a Sign method and a SignEncrypted method. DeriveKey, Encrypt, and Decrypt do the eurl steps on their own.

clients.yml is a new workflow that runs go vet, go test, and gofmt from clients/moddims on a change under clients/ or test/fixtures/. A job cannot filter on paths, so the clients have a workflow of their own. pr.yml adds clients/** to its paths-ignore, so a change under clients/ runs neither the module build nor the goldens.

docs/docs/clients/go.md states the import path, the prefix, the sentinels, and the tag form.

Why

Stacked on #126, which adds the C library and test/fixtures/signing.tsv.

Issue #124. The signing rules had four copies in this repository and a fifth in go-dims. A Go caller could reach none of them.

The package reads the raw query itself and decodes each part with url.PathUnescape. url.ParseQuery reads a plus in url as a space and reports an error on a semicolon, and the module does neither. url.Values.Encode writes the canonical query, because it sorts by the bytes of the name and keeps the order of the values under one name.

Verify

cd clients/moddims && go vet ./... && go test ./... && gofmt -l .

57 cases pass. fixture_test.go runs all 42 records from test/fixtures/signing.tsv as subtests, so a failure names the case.

Change one character of a signature in that file, and TestFixtures/dims5-plain fails with the two values.

Package moddims at clients/moddims signs /dims4/ and /dims5/ URLs and
encrypts an image URL into eurl. Go 1.24, and no dependency outside the
standard library.

The package reads the raw query itself and decodes each part with
url.PathUnescape. url.ParseQuery reads a plus in url as a space and
reports an error on a semicolon, and the module does neither.
url.Values.Encode writes the canonical query, because it sorts by the
bytes of the name and keeps the order of the values under one name.

fixture_test.go reads test/fixtures/signing.tsv and runs every record as
a subtest. sign_test.go covers what a record cannot: an empty key, the
escape table url.QueryEscape produces, and a fresh IV on every GCM call.
clients.yml runs go vet, go test, and gofmt from clients/moddims on a
change under clients/ or test/fixtures/. A job cannot filter on paths,
so the clients take a workflow of their own. docs-pr.yml has the same
shape.

pr.yml adds clients/** to its paths-ignore, so a change under clients/
runs neither the module build nor the goldens.

docs/docs/clients/go.md states the import path, the prefix, the
sentinels, and the tag form. A Go module in a subdirectory publishes
under clients/moddims/v1.0.0.
@beetlebugorg
beetlebugorg changed the base branch from main to feat/signing-library September 9, 2026 23:45
@beetlebugorg
beetlebugorg added this pull request to stack #129 September 9, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant