Repository navigation
Compare 51Did factor words ignoring case, and name the version of a short payload - #141
Merged
Merged
Conversation
…d names its version redeem_FactorWordsInOtherLetters_ReadAsTheirOutcome sends each factor word in other letters under a Turkish default locale and expects its own outcome. version_ShortPayload_IsRefusedNamingTheVersion gives payloads of one to four bytes whose first byte names version 1, 2 or 3 and expects the version refused and named, and version 0 too short.
…re its length The specification's package surface says the factor words are compared ignoring case, so a language that compares exactly lower-cases the word first. Factor.fromValue now lower-cases it in the root locale. The identifier layout says a reader refuses a payload whose version it does not know, naming the version it found. A payload of one to four bytes was refused as too short before its version was read, so the version is now read from the first byte before the header's length is checked.
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.
Two places where the 51Did package differs from the specification, found by a conformance check of this package against specifications at 706de1f0.
1. Factor words were compared with case
package-surface.md lines 94 to 97 say:
RedeemResult.Factor.fromValuecompared the word exactly, soVerifiedorNotRecordedread as a mismatch, which reports a difference the identifier never claimed. It now lower-cases the word in the root locale before comparing, so a Turkish default locale cannot turn the I ofVERIFIEDinto a dotless i. A word it does not know still reads as a mismatch.The specification states the case rule for the factor words only. The signature and context words (
Signature.fromValueandContext.fromValuein the same file) are still compared exactly, as the specification says nothing about their case.2. A short payload was refused without naming its version
identifier-layout.md lines 260 to 262 say:
FodId.readchecked that the payload held the five byte header before it read the version from the first byte, so a payload of one to four bytes whose Flags byte names version 1, 2 or 3 was refused as too short, without naming the version. The version is now read first, so such a payload is refused asUNSUPPORTED_PAYLOAD_VERSION, and the throwing readers' message names the version. A short payload of version 0 is still too short, and an empty payload is too short as it has no Flags byte.Tests
Tests first, in 59c099f3.
DidClientTests.redeem_FactorWordsInOtherLetters_ReadAsTheirOutcomesets the default locale to tr-TR, has the redeem answer giveVerified,NotRecorded,MISCONFIGURED,VERIFIEDandMismatch, and expects each to read as its own outcome.FodIdParseTests.version_ShortPayload_IsRefusedNamingTheVersiongives signed payloads of one to four bytes, expects version 0 refused as too short, and versions 1, 2 and 3 refused asUNSUPPORTED_PAYLOAD_VERSIONwith that version, no value, and a thrown message naming the version.Red 43614985773 on 59c099f plus a throwaway workflow, Java 17. Exactly the two new tests fail,
DidClientTests1 of 87 with "expected: but was:" andFodIdParseTests1 of 39 with "length 1 version 1 expected:<UNSUPPORTED_PAYLOAD_VERSION> but was:<PAYLOAD_TOO_SHORT>".Green 43614986008 on the fix a200585e plus the same workflow.
DidClientTests87 of 87 andFodIdParseTests39 of 39.Full build
Run 43615412005 built a200585 merged with
rc(b33daa0) on nine configurations, Ubuntu x64 with Java 8, 11, 17 and 21, Ubuntu arm64 with Java 17, and Windows with Java 8, 11, 17 and 21, and every job passed.DidClientTestspassed 87 of 87 andFodIdParseTests39 of 39 in all nine jobs. Each of its tenSetting 'PullRequestSha'lines names a200585, and its Configure job printed "Left out 6 macOS entries".macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
Before you upgrade
VerifiedorNotRecorded, now reads as its own outcome, where it read asMISMATCH. The specification says the server sends the words in lower case, so an application sees a change only when a word reaches it in other letters.UNSUPPORTED_PAYLOAD_VERSION, naming that version, where it was refused asPAYLOAD_TOO_SHORT. Code that looks forPAYLOAD_TOO_SHORTto spot a cut short identifier should also look forUNSUPPORTED_PAYLOAD_VERSION. A short payload of version 0, and an empty one, are stillPAYLOAD_TOO_SHORT.What it releases
pipeline.didchanges, which is in Monday's plan under version per package (#63) already.Base branch
rcat b33daa0. A trial merge of the head withrcat 2eebbff is clean.What remains