Rename FodId hash to matchKey to match the Model Terms vocabulary - #186
Merged
Merged
Conversation
The stable, comparable part of a 51Did (the payload bytes after the flags and licence id) is called the match key in the Model Terms for Marketing and in the patent, so the reader now uses the same word. The public getter is matchKey, and hash stays as a deprecated getter that forwards to matchKey and returns the same bytes, so existing callers keep working until a future release removes the alias. The internal names that carry the same bytes (the _matchKey field, the matchKey member of the unpacked payload and the matchKeyLength locals in the payload walk and the client length check) move to the match key vocabulary too. HASH_OFFSET and HASH_LENGTH keep their names, because the SHA-256 wording behind them stays true, and their comments now say which field they describe. The declarations are regenerated with tsc -b --force and carry the @deprecated tag on hash.
The terminology section, the payload layout tables, the usage and comparison snippets and the package descriptions now say match key where they said value, and the usage section notes that hash remains as a deprecated alias. The offline example prints and compares the match key.
The tests read matchKey and the envelope helper that builds the canonical bytes is canonicalMatchKey. One new test asserts the deprecated hash getter returns the same bytes as matchKey and hands out a copy, so the old name still cannot reach the stored bytes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stable, comparable part of a 51Did (the payload bytes after the flags and licence id) is called the match key in the Model Terms for Marketing, which will be published later, and in the patent. The Node reader previously exposed those bytes as
FodId.hash, so the code now uses the same word as the documents. This mirrors the .NET rename (51Degrees/pipeline-dotnet#348) and the Rust rename (51Degrees/rust#19), and builds on the parse hardening merged today (#185).What changed
FodId.hashis renamed toFodId.matchKey, returning a defensive copy of the match key bytes (a 32-byte SHA-256 for Probabilistic and HashedEmail identifiers, or 16 GUID bytes for Random).hashstays as a deprecated getter forwarding tomatchKey, marked@deprecatedin the JSDoc and in the regeneratedtypes/fodId.d.ts, so existing callers keep working and get the same bytes. It will be removed in a future release._matchKeyfield, thematchKeymember of the unpacked payload, and thematchKeyLengthlocals in the payload walk infodId.jsand the length check indidClient.js.HASH_OFFSETandHASH_LENGTHkeep their names, because the SHA-256 wording behind them stays true, and gain comments saying they describe the match key field.HashedEmailand SHA-256 wording is unchanged throughout.package.jsonandremote_package.jsondescriptions andexamples/fodIdExample.jsnow say match key. The readme usage section notes the deprecated alias. The creator context web example does not read the match key, so it is unchanged.matchKey, the envelope helper that builds the canonical bytes iscanonicalMatchKey, and one new test asserts the deprecatedhashgetter returns the same bytes asmatchKeyand hands out a copy.types/fodId.d.tsis regenerated withtsc -b --forcein the package. No other declaration file changed in content.Before and after for a caller
Verification
npm testinfiftyone.pipeline.did: 139 passed, 2 skipped (the live cloud tests), 141 total. Main gives 138 passed, so the difference is the new alias test.node examples/fodIdExample.jsruns to completion and prints the match key and the "same match key across reissues" check.ci/setup-environment.ps1over the five changed JavaScript files reports 54 problems on both main and this branch, so the change adds none. The repository lint already fails on main for reasons outside this change (a parsing error on the0b1000_0101numeric separator intests/fodId.test.jsunderecmaVersion2020) and that is left alone here.Commits
FodId.hashtomatchKeywith a deprecatedhashalias (fodId.js,didClient.js,types/fodId.d.ts).matchKeyand cover the deprecatedhashalias.Part of the cross-repository match key vocabulary rename (documentation, website, .NET reader, Rust reader and cloud internals in separate PRs).
Produced with AI assistance under James Rosewell's direction and needs human review.