Skip to content

FEAT: Add the 51Did (FodId) reader module (pipeline.did)#101

Merged
oleksandrlazarenko-pi merged 4 commits into
mainfrom
feature/51did
Jul 6, 2026
Merged

FEAT: Add the 51Did (FodId) reader module (pipeline.did)#101
oleksandrlazarenko-pi merged 4 commits into
mainfrom
feature/51did

Conversation

@oleksandrlazarenko-pi

Copy link
Copy Markdown
Contributor

Summary

Adds pipeline.did, a strongly typed Java reader for the 51Did (51Degrees
Identifier) value returned by the 51Degrees Cloud service. Mirrors the .NET
FiftyOne.Did package. Also adds an offline developer example.

What it does

  • FodId parses a 51Did from its base64 OWID form and exposes the payload
    fields — getFlags(), getLicenseId() (unsigned little-endian as long),
    getHash() (the stable value, defensive copy), and getType() — plus the
    OWID-level fields via the wrapped envelope.
  • Implements the live Type model (flag bits 6-7: Probabilistic / Random /
    HashedEmail / Reserved) with per-type value length (16 or 32 bytes).
  • Composition over OWID (owid-java's Owid is final). Construction does
    not verify the signature; verify(publicPem) is an explicit, separate
    call.

OWID dependency

Builds on owid-java (com.swancommunity.owid), consumed from the
51Degrees/owid-java fork as a git submodule (owid-java/) whose source is
compiled into the module (mirroring how pipeline-dotnet compiles owid-dotnet
in). The submodule is pinned to the fork's feature/java8-baseline branch,
which lowers the OWID build to Java 8 to match pipeline-java
(owid-java targets Java 21 upstream).

The submodule will be repointed to owid-java main once the fork PR
(51Degrees/owid-java#2) lands;
the upstream change is SWAN-community/owid-java#1.

Build & enforcement

  • New module pipeline.did registered in the aggregator pom.xml; Java 8;
    EUPL-1.2 headers.
  • The HTTP-only Endpoints OWID class is excluded from compilation (not needed
    for offline parse + verify).
  • animal-sniffer is wired to the java18 signature so the build fails on
    any Java 9+ API — this is what guarantees the Java 8 floor (the parent's
    -source/-target 1.8 alone does not catch newer JDK APIs).

Tests & example

  • FodIdTests (JUnit 4): the full ported .NET suite including the Type-model
    cases plus the runbook gap tests — 31 tests, all passing. Verify cases run
    offline (owid-java has offline verify).
  • pipeline.developer-examples.fodid — a self-contained offline example
    (build, parse, compare two 51Dids) with an ExampleTests smoke test.
  • Verified locally: mvn -pl pipeline.did test green, and the full reactor
    mvn -DskipTests install builds all modules including the two new ones.

Notes for reviewers

  • FodId uses static factories (fromBase64 / fromByteArray / fromOwid)
    because owid-java's parse throws the checked OwidException.
  • The from-OWID test asserts payload/signature by value (assertArrayEquals),
    not identity, because owid-java getters return clones.

@Jamesr51d

Copy link
Copy Markdown
Contributor

This Java module copies the OWID source files into itself when it builds rather than just depending on it.
The final pipeline.did.jar will contain:

51Degrees code, licensed EUPL-1.2
OWID code (com.swancommunity.owid.* classes), licensed Apache-2.0

For the Apache-2.0 licence, every copy must come with a copy of the Apache licence text and a credit saying what it is and where it came from. Right now the jar contains the OWID code but not the licence text or credit, so anyone who downloads the jar from maven is receiving Apache-licensed code without the paperwork that Apache-2.0 requires to travel with it.

Comment thread pipeline.did/src/main/java/fiftyone/pipeline/did/FodId.java Outdated
@oleksandrlazarenko-pi oleksandrlazarenko-pi merged commit bda309d into main Jul 6, 2026
5 of 16 checks passed
@oleksandrlazarenko-pi oleksandrlazarenko-pi deleted the feature/51did branch July 6, 2026 13:55
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.

2 participants