Package com.tnsai.identity
Class LocalIdentityProvider
java.lang.Object
com.tnsai.identity.LocalIdentityProvider
- All Implemented Interfaces:
AgentPrincipalProvider
Process-local
AgentPrincipalProvider (TNS-298). UUID-based
identities, no external trust root, no cryptographic attestation.
Suitable for single-tenant deployments where the framework itself
is the trust boundary.
What it produces
AgentPrincipal.id()— UUID v4 minted once perAgentDescriptor(cached, so callingissue(com.tnsai.identity.AgentDescriptor)twice with the same spec returns the same id).AgentPrincipal.version()— SHA-256 of the spec's behaviour-relevant fields (system prompt, tool names, model) hex-truncated to 16 chars; changes when behaviour changes.AgentPrincipal.runtimeFingerprint()— SHA-256 of the spec's full content (including buildHash + metadata) hex-truncated to 16 chars; changes when ANY field changes.AgentPrincipal.attestation()— empty; this provider has no trust root to bind against.
Verification
verify(java.lang.String, byte[]) treats the signature as a HMAC-SHA-256 over the
(id + version + fingerprint) tuple keyed by a process-local secret
(random at construction, not exported). Verifies signatures issued
by the SAME instance only — cross-process verification needs a
shared-secret variant or a real attestation backend.- Since:
- 0.10.0 (TNS-298)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.identity.AgentPrincipalProvider
AgentPrincipalProvider.IdentityIssueException -
Constructor Summary
ConstructorsConstructorDescriptionLocalIdentityProvider(byte[] hmacKey) Test / debug constructor — pin the HMAC key for reproducibility. -
Method Summary
Modifier and TypeMethodDescriptionissue(AgentDescriptor spec) Mint a new identity for an agent described byspec.byte[]sign(AgentPrincipal identity) Sign an identity issued by this provider.Verifysignatureattests toidaccording to this provider's trust root.
-
Constructor Details
-
LocalIdentityProvider
public LocalIdentityProvider() -
LocalIdentityProvider
public LocalIdentityProvider(byte[] hmacKey) Test / debug constructor — pin the HMAC key for reproducibility.
-
-
Method Details
-
issue
Description copied from interface:AgentPrincipalProviderMint a new identity for an agent described byspec. Implementations typically:- Hash
specinto a stable id (or look up an existing id keyed by spec hash, idempotent reissue); - Compute the runtime fingerprint from build hash + config;
- Optionally produce an
Attestationvia the trust root.
- Specified by:
issuein interfaceAgentPrincipalProvider
- Hash
-
verify
Description copied from interface:AgentPrincipalProviderVerifysignatureattests toidaccording to this provider's trust root. Returns the materialisedAgentPrincipalon success, empty on signature mismatch or unknown id.The signature payload is opaque to the framework — providers decide what they sign over (id + version + fingerprint, the full attestation bundle, …). External verifiers re-derive the payload via the same provider's algorithm.
- Specified by:
verifyin interfaceAgentPrincipalProvider
-
sign
Sign an identity issued by this provider. Used by callers that want to attach a signature to anAgentLiabilityRecord.
-