Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion design/architecture/microservices/account-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Manages user accounts and authentication for the platform. It stores profile dat

## Implementation Status

- The current Account source/currentness cut adds local persistence and writer-fencing consequences to the existing Account ownership boundary. Physical CI executed the inspection-lock, TRUNCATE and disclosure-source regressions successfully; its trigger-catalog fixture failed and is corrected. Final optional-inventory settlement and malformed source-vector corrections require replacement physical CI. See the [player-access implementation tracker](../../../project-management/implementation-tracking/player-access-and-session.md#current-status) for exact proof scope and status. This does not activate public JOIN, logout-all authority, hosted-terms workflows, or creator UI; see the [runtime and data status](./runtime-and-data.md#implementation-status).
- Provider-specific external identity linking is target-state only; no provider is advertised until its server-verified authorization, global subject uniqueness, recovery, unlink, and end-to-end login proof are complete.
- The caller-asserted external-link persistence/service scaffold remains unsupported implementation drift, but its REST route is removed and the exact legacy public-edge path is denied. No provider integration is advertised or externally available.
- Credential-bearing gameplay `Authenticate` and its verified-email challenge authenticate global Account identity without a tenant or membership prerequisite. The resulting private delegation token is account-scoped; Game Session retains any bootstrap tenant only as local transport context, and selected-target membership, grant, and entitlement remain separate `JOIN`/`PLAY` checks.
- Account is the target authority for the hosted Creator Party, identified operator and hosted-terms catalog, and acceptance/currentness evidence under [ADR 0180](../../decisions/adr-0180-account-owned-hosted-terms-acceptance-gate.md); changed-term notice, decline, continuity, and lifecycle consequences are separately governed by [ADR 0181](../../decisions/adr-0181-changed-hosted-terms-decline-and-existing-content-continuity.md). These hosted-terms contracts are target-only: no current party/signer registry, terms catalog, acceptance or transfer API/storage, creator UI, or downstream write-gate proof exists, and organization support is not enabled.
- Account is the target authority for the hosted Creator Party, identified operator and hosted-terms catalog, and acceptance/currentness evidence under [ADR 0180](../../decisions/adr-0180-account-owned-hosted-terms-acceptance-gate.md); changed-term notice, decline, continuity, and lifecycle consequences are separately governed by [ADR 0181](../../decisions/adr-0181-changed-hosted-terms-decline-and-existing-content-continuity.md). Current source-only persistence does not register the hosted-terms workflow. The fixed server environment-evidence adapter exists but remains deliberately unregistered and supplies no genuine input delivery; authenticated publication, registry/runtime binding, creator UI, and downstream write-gate proof remain absent. Organization support is not enabled.
- Future managed-creator-commerce financial/provider reconciliation and entitlement authority are a separate target-only boundary under [ADR 0179](../../decisions/adr-0179-firemud-managed-creator-commerce-boundary.md); it does not expand hosted-terms acceptance/currentness authority or enable marketplace commerce, and no marketplace route or payout workflow is enabled.

### Responsibilities
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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);
}
}
Comment thread
benhook1013 marked this conversation as resolved.
Resolved
}
Loading
Loading