Class InternalCryptoUseCaseOperations

java.lang.Object
co.ankatech.ankasecure.keymanagement.InternalCryptoUseCaseOperations

public final class InternalCryptoUseCaseOperations extends Object
The tenant's internal cryptographic use cases: a runtime identity (an actor and its credential), the grants and constraints it uses, provisioned and governed as one unit. Obtained from AuthenticatedKeyManagementSdk.internalCryptoUseCases().

 CreateInternalCryptoUseCaseRequest request = new CreateInternalCryptoUseCaseRequest()
         .applicationId(applicationId)
         .name("invoice-signing")
         .keyKid("invoice-signing-key");
 try (InternalCryptoUseCaseProvisioning provisioned = sdk.internalCryptoUseCases().create(request)) {
     // store provisioned.clientSecret() now: it is never returned again
 }
 
  • Method Details

    • list

      Lists the tenant's use cases (GET /tenants/{t}/internal-crypto-use-cases).
      Parameters:
      query - the status filter and page; must not be null
      Returns:
      one page of use cases
      Throws:
      KeyManagementSdkException - when the call is refused
    • create

      Provisions a use case (POST /tenants/{t}/internal-crypto-use-cases) and returns its actor credential's client secret once, in a zeroizable holder.
      Parameters:
      request - the use case; must not be null
      Returns:
      the created use case, its secret moved out of the response into the holder
      Throws:
      KeyManagementSdkException - when the call is refused
    • get

      public InternalCryptoUseCaseResponse get(UUID useCaseId)
      Reads one use case (GET /tenants/{t}/internal-crypto-use-cases/{id}).
      Parameters:
      useCaseId - the use case; must not be null
      Returns:
      the use case (never with its secret)
      Throws:
      KeyManagementSdkException - when the call is refused
    • revoke

      public void revoke(UUID useCaseId, RevokeInternalCryptoUseCaseRequest request)
      Revokes a use case and the identity, grants and credential it provisioned (POST /tenants/{t}/internal-crypto-use-cases/{id}/revoke). A revoked use case is never restored.
      Parameters:
      useCaseId - the use case; must not be null
      request - the audited reason for the revocation, required; must not be null
      Throws:
      KeyManagementSdkException - when the call is refused
    • renew

      public InternalCryptoUseCaseResponse renew(UUID useCaseId)
      Renews a use case's validity window (POST /tenants/{t}/internal-crypto-use-cases/{id}/renew): validUntil becomes one year after the later of now and its current value, so renewing early never shortens what is left. An expired use case becomes active again with the same actor and credential; a suspended one stays suspended with the longer window.
      Parameters:
      useCaseId - the use case; must not be null
      Returns:
      the renewed use case
      Throws:
      KeyManagementSdkException - when the call is refused (409 for a revoked use case)
    • suspend

      Suspends a use case (PATCH /tenants/{t}/internal-crypto-use-cases/{id}/suspend).
      Parameters:
      useCaseId - the use case; must not be null
      request - the suspension reason; must not be null
      Returns:
      the suspended use case
      Throws:
      KeyManagementSdkException - when the call is refused
    • resume

      public InternalCryptoUseCaseResponse resume(UUID useCaseId)
      Resumes a suspended use case (PATCH /tenants/{t}/internal-crypto-use-cases/{id}/resume).
      Parameters:
      useCaseId - the use case; must not be null
      Returns:
      the resumed use case
      Throws:
      KeyManagementSdkException - when the call is refused