Class UploadTrackingToken

java.lang.Object
ai.pipestream.connector.intake.token.UploadTrackingToken

@ApplicationScoped public class UploadTrackingToken extends Object
Mints and verifies the opaque, HMAC-SHA256-signed tracking token returned from every upload. The token is the client's receipt: it presents it to a status lookup, and the service verifies the signature and reads the UploadTokenClaims to resolve which document is being asked about.

Signed, not encrypted: the design goal is integrity and tenant-scoping, not confidentiality. A client cannot forge a token for a doc_id it never uploaded, cannot mutate the account/datasource it is scoped to, and cannot enumerate other documents — any tamper breaks the signature and the token is rejected.

Format: base64url(claimsJson) "." base64url(hmacSha256(key, base64url(claimsJson))).

  • Constructor Details

    • UploadTrackingToken

      @Inject public UploadTrackingToken(String signingKey, com.fasterxml.jackson.databind.ObjectMapper mapper)
  • Method Details

    • issue

      public String issue(String accountId, String datasourceId, String docId)
      Mint a token for an upload — issued on success and on failure once a doc_id is derived, since doc_id is deterministic and the client can poll any outcome (a retry lands on the same row). issuedAt is stamped now.
    • verify

      public UploadTokenClaims verify(String token)
      Verify a token's signature and return its claims.
      Throws:
      HttpIntakeException - (400) if the token is malformed or the signature does not match — never reveals which check failed.