Repository navigation
Account source-currentness storage and exact writer fencing #3134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
benhook1013
merged 13 commits into
develop
from
codex/gameplay-account-source-currentness-20261010
Oct 10, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
866f537
Bring forward Account source-currentness and exact writer fences
benhook1013 1f5045f
Merge remote-tracking branch 'origin/develop' into codex/gameplay-acc…
benhook1013 7a665c8
Close Account security source writes and prove exact persisted guards
benhook1013 9039637
Restore disclosure journal persistence and correct PostgreSQL fixtures
benhook1013 7703108
Merge remote-tracking branch 'origin/develop' into codex/gameplay-acc…
benhook1013 1f07431
Format disclosure persistence regression
benhook1013 3123c3d
Correct hosted terms PostgreSQL fixture bindings
benhook1013 d6ca011
fix(account): close reviewed source and handoff guard gaps
benhook1013 c69fa36
Fix Account source overlap, immutable storage and strict codec review…
benhook1013 fb6ca4d
Fix Account source-read settlement fixture and precompute reset verifier
benhook1013 f1ed94a
Fix Account inspection lock order and immutable source evidence guards
benhook1013 c0f110d
Merge commit '4e199aeaeb5ceb3f52c605cc535fd60cdaa30044' into codex/ga…
benhook1013 14eaa6c
fix(account): prove optional inventory settlement and complete source…
benhook1013 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
10 changes: 6 additions & 4 deletions
10
design/architecture/microservices/account-service/runtime-and-data.md
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 9 additions & 5 deletions
14
design/project-management/implementation-tracking/player-access-and-session.md
Large diffs are not rendered by default.
Oops, something went wrong.
958 changes: 958 additions & 0 deletions
958
.../net/firedevops/firemud/accountservice/authordraft/DraftAuthorizationFenceRepository.java
Large diffs are not rendered by default.
Oops, something went wrong.
109 changes: 109 additions & 0 deletions
109
...rc/main/java/net/firedevops/firemud/accountservice/creatorparty/CreatorPartyEncoding.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package net.firedevops.firemud.accountservice.creatorparty; | ||
|
|
||
| import java.io.IOException; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.security.MessageDigest; | ||
| import java.security.NoSuchAlgorithmException; | ||
| import java.util.HexFormat; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.UUID; | ||
| import net.firedevops.firemud.accountservice.repository.AccountTenantCreationBootstrapDigest; | ||
| import net.firedevops.firemud.common.json.Rfc8785CanonicalJson; | ||
| import net.firedevops.firemud.common.tenant.FreshTenantCreatorEvidence; | ||
| import tools.jackson.databind.json.JsonMapper; | ||
|
|
||
| /** Closed canonical encodings; every identity, reference and independent version is bound. */ | ||
| public final class CreatorPartyEncoding { | ||
| private static final JsonMapper JSON = JsonMapper.builder().build(); | ||
|
|
||
| private CreatorPartyEncoding() {} | ||
|
|
||
| public static byte[] party(IndividualCreatorPartySource source) { | ||
| Objects.requireNonNull(source); | ||
| Map<String, Object> fields = new LinkedHashMap<>(); | ||
| fields.put("schema", "account-individual-creator-party-source/v1"); | ||
| fields.put("creatorPartyId", source.creatorPartyId().toString()); | ||
| fields.put("accountId", source.accountId().toString()); | ||
| fields.put("verificationStatus", source.verificationStatus().name()); | ||
| fields.put("identityVersion", Long.toString(source.identityVersion())); | ||
| fields.put("policyReference", source.policyReference()); | ||
| fields.put("policyVersion", decimal(source.policyVersion())); | ||
| fields.put("verificationEvidenceReference", source.verificationEvidenceReference()); | ||
| fields.put("verificationEvidenceVersion", decimal(source.verificationEvidenceVersion())); | ||
| fields.put("sourceVersion", Long.toString(source.sourceVersion())); | ||
| return canonical(fields); | ||
| } | ||
|
|
||
| public static byte[] request( | ||
| UUID requestId, FreshTenantCreatorEvidence creation, IndividualCreatorPartySource party) { | ||
| requireUuid(requestId); | ||
| Objects.requireNonNull(creation); | ||
| Objects.requireNonNull(party); | ||
| if (!creation.initiatingAccountId().equals(party.accountId())) { | ||
| throw new IllegalArgumentException("Creator must bind their own individual party"); | ||
| } | ||
| return canonical( | ||
| Map.of( | ||
| "schema", | ||
| "account-fresh-creator-party-association-request/v1", | ||
| "requestId", | ||
| requestId.toString(), | ||
| "creatorEvidence", | ||
| new String(creation(creation), StandardCharsets.UTF_8), | ||
| "individualPartySource", | ||
| new String(party(party), StandardCharsets.UTF_8))); | ||
| } | ||
|
|
||
| public static byte[] result(UUID historyId, byte[] request) { | ||
| requireUuid(historyId); | ||
| Objects.requireNonNull(request); | ||
| if (request.length == 0) { | ||
| throw new IllegalArgumentException("Exact original request is required"); | ||
| } | ||
| return canonical( | ||
| Map.of( | ||
| "schema", | ||
| "account-fresh-creator-party-association-result/v1", | ||
| "historyId", | ||
| historyId.toString(), | ||
| "associationSourceVersion", | ||
| "1", | ||
| "request", | ||
| new String(request, StandardCharsets.UTF_8))); | ||
| } | ||
|
|
||
| public static byte[] creation(FreshTenantCreatorEvidence evidence) { | ||
| return AccountTenantCreationBootstrapDigest.creatorEvidencePayload(evidence); | ||
| } | ||
|
|
||
| public static String digest(byte[] bytes) { | ||
| Objects.requireNonNull(bytes); | ||
| try { | ||
| return "sha256:" | ||
| + HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(bytes)); | ||
| } catch (NoSuchAlgorithmException exception) { | ||
| throw new IllegalStateException("SHA-256 is required", exception); | ||
| } | ||
| } | ||
|
|
||
| static void requireUuid(UUID uuid) { | ||
| if (uuid == null || uuid.equals(new UUID(0, 0))) { | ||
| throw new IllegalArgumentException("Canonical nonnil identity is required"); | ||
| } | ||
| } | ||
|
|
||
| private static String decimal(Long value) { | ||
| return value == null ? null : value.toString(); | ||
| } | ||
|
|
||
| private static byte[] canonical(Map<String, Object> fields) { | ||
| try { | ||
| return Rfc8785CanonicalJson.canonicalizeUtf8(JSON.writeValueAsString(fields)); | ||
| } catch (IOException exception) { | ||
| throw new IllegalArgumentException( | ||
| "Creator-party evidence cannot be canonically encoded", exception); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.