Class AuthenticatedKeyManagementSdk
java.lang.Object
co.ankatech.ankasecure.keymanagement.AuthenticatedKeyManagementSdk
- All Implemented Interfaces:
AutoCloseable
An authenticated Key Management SDK instance: one administrative workload's DPoP-bound session in
its tenant. Created by
AnkaSecureKeyManagementSdk.authenticateWorkload(WorkloadCredential).
The operations are grouped by resource, one accessor per group:
keys(): keys, their import and export, metadata and lifecycle;materials(): a key's material versions;rotation(): rotation, its admissibility, the automatic-rotation schedule and its history;destruction(): destruction requests for keys and versions, which always wait for people to approve them, and their cancellation;quorumRequests(): the workload's own quorum requests (read and withdraw);exchangeContexts(),exchanges(),capabilityGrants(),constraintPolicies()andinternalCryptoUseCases();directory(): read-only lookups of applications, actors and counterparty types.
Every operation acts in tenantId(), the tenant the workload's token names; no method takes
a tenant. A platform (ROOT) workload's session is bound to no tenant: tenantId() is empty and
every group accessor fails fast with a TenantBindingRequiredException, sending nothing. The instance is immutable and thread-safe; close() wipes the access token, and
every later call fails.
try (AuthenticatedKeyManagementSdk sdk = factory.authenticateWorkload(credential)) {
AdminKeyResponse key = sdk.keys().get("payments-signing-key");
RotationAdmissibilityResponse verdict = sdk.rotation().admissibility(key.getKid());
}
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Wipes the access token; every later call fails with "SDK instance is closed".booleanisClosed()booleanWhether the token held now is past its expiry, read from the token's ownexpclaim.keys()rotation()tenantId()The tenant every operation of this instance acts in: the tenant the workload's token names.Summarises the session by parsing the token's claims locally: no request is sent and the token is never logged or returned.
-
Method Details
-
keys
- Returns:
- the keys of the tenant
-
materials
- Returns:
- the material versions of the tenant's keys
-
rotation
- Returns:
- the rotation of the tenant's keys
-
destruction
- Returns:
- destruction requests for the tenant's keys and versions
-
quorumRequests
- Returns:
- the workload's own quorum requests
-
exchangeContexts
- Returns:
- the tenant's exchange contexts
-
exchanges
- Returns:
- the tenant's cryptographic exchanges
-
capabilityGrants
- Returns:
- the tenant's capability grants
-
constraintPolicies
- Returns:
- the tenant's constraint policies
-
internalCryptoUseCases
- Returns:
- the tenant's internal cryptographic use cases
-
directory
- Returns:
- read-only lookups of the tenant's applications, actors and counterparty types
-
tenantId
The tenant every operation of this instance acts in: the tenant the workload's token names.- Returns:
- the bound tenant, or empty for a platform (ROOT) session, which addresses no tenant
-
close
public void close()Wipes the access token; every later call fails with "SDK instance is closed". Idempotent.- Specified by:
closein interfaceAutoCloseable
-
isClosed
public boolean isClosed()- Returns:
trueonceclose()has been called
-
isTokenExpired
public boolean isTokenExpired()Whether the token held now is past its expiry, read from the token's ownexpclaim. The next request renews it; this reports the token held at this moment.- Returns:
trueif the token is expired, carries noexp, cannot be parsed, or the instance is closed;falseif it is still valid
-
viewSession
Summarises the session by parsing the token's claims locally: no request is sent and the token is never logged or returned. Readssub(the workload id),client_id,expand thescopesarray (RFC 8693).- Returns:
- a token-free summary of the workload, its expiry and its scopes
- Throws:
KeyManagementSdkException- if the instance is closed or the token cannot be parsed
-