Skip to content

Specify the 51Did byte structure and the package surface - #25

Open
jwrosewell wants to merge 2 commits into
mainfrom
did-specification
Open

Specify the 51Did byte structure and the package surface#25
jwrosewell wants to merge 2 commits into
mainfrom
did-specification

Conversation

@jwrosewell

Copy link
Copy Markdown
Contributor

Why

The six 51Did packages (.NET, Java, Node, Python, PHP, Rust) each carry their own table of the payload layout in their own documentation, and there is nowhere to send a reader who asks how a 51Did is actually structured. There is also nowhere for the six to agree, which matters because the removal work raised as pipeline-dotnet 398, pipeline-java 128, pipeline-node 193, pipeline-python 77, pipeline-php-did 15 and rust 39 turns on the six packages exposing the same surface.

This repository already says that code comments should link to fixed URLs here rather than repeat definitions, so the six packages will link to these pages instead of restating the layout.

What was added

  • did-specification/README.md introduces the three levels a 51Did is described at, being the identifier, the Envelope and the Match Key, and links the two pages.
  • did-specification/identifier-layout.md gives the byte structure: the OWID Envelope fields, the payload header, the flags byte bit by bit, the cumulative Usage values, and the identifier types with the Match Key length each one fixes.
  • did-specification/package-surface.md names the accessors every package exposes in all six languages, and records what none of them exposes, being the raw flags byte and the byte offsets, with the reason for each.
  • The repository contents table gains a row for the new section.

How the content was checked

Every value was read from source rather than from memory, on 6 September 2026.

  • Envelope fields, the four byte date as minutes since 2020-01-01 and the 64 byte signature: Owid.Client/Extensions.cs and Owid.Client/Constants.cs in owid-dotnet, and Owid.Client/CryptoExtensions.cs for ECDSA with SHA-256.
  • Payload offsets, the flags bits, the cumulative usage values and the identifier types: FiftyOne.Did/Model/FodId.cs, Usage.cs and IdType.cs in pipeline-dotnet, which is the reference implementation.
  • The per-language accessor names in the surface table: the FodId type in each of the six packages, read on the branch that adds the usage accessor.

Notes

Written with AI assistance on James Rosewell's instruction and needs human review.

…xposes

Six packages read the 51Degrees identifier, one per language, and until now
the only account of what the bytes hold was a table repeated in each
package's own documentation. There was nowhere to point a reader who asks
how a 51Did is actually structured, and nowhere for the six packages to
agree, so the six could drift without anyone noticing.

Identifier layout gives the OWID envelope fields, the payload header, the
flags byte bit by bit, the cumulative usage values and the identifier types,
each read from the reference implementation rather than from memory. It
states the rule that a reader answers with the highest usage granted,
because the values are cumulative and masking for the non-marketing bit
alone reads every marketing identifier as non-marketing.

Package surface names the accessors every package exposes in all six
languages, and records what none of them exposes, being the raw flags byte
and the byte offsets, with the reason in each case.

The packages link here from their own code rather than repeating the
definitions, which is the convention this repository already sets out for
implementers.
The page said the Usage value maps to the cloud's id.usage string, which is
true of Java, Node, Python, PHP and Rust and not of .NET, so as written it
described five packages and claimed six. It now states the mapping as a
requirement, which is what a specification is for, and names the .NET gap
with the issue that tracks it (pipeline-dotnet 399).
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