On this page:
make-issuance-worker
process-issuance-work!
issuance-result
derive-entitlement-id
derive-credential-id

7 Explicit issuer worker🔗ℹ

 (require commerce/issuer) package: commerce

Server processes explicitly require commerce/issuer. This module imports the published permit/issuer signing surface; the default facade never does. The worker owns no durable state: every decision derives from the claimed outbox row, the pinned catalog, and recorded lineage.

procedure

(make-issuance-worker 
  #:catalog catalog 
  #:issuer issuer 
  #:private-key private-key 
  #:key-id key-id 
  #:trust-store trust-store 
  [#:clock clock 
  #:owner owner 
  #:lease-seconds lease-seconds 
  #:transient-backoff-seconds transient-backoff 
  #:operator-backoff-seconds operator-backoff]) 
 → issuance-worker?
  catalog : permit-policy-catalog?
  issuer : string?
  private-key : any/c
  key-id : string?
  trust-store : any/c
  clock : procedure? = default-clock
  owner : string? = default-owner
  lease-seconds : exact-positive-integer?
   = default-lease-seconds
  transient-backoff : exact-nonnegative-integer?
   = default-transient-backoff
  operator-backoff : exact-nonnegative-integer?
   = default-operator-backoff
Binds one reviewed catalog, issuer identity, Ed25519 private key, trust store key id, and trust store behind one opaque worker value. The private key is never exposed by an accessor. The clock returns two values, an epoch second and its RFC 3339 string; the default reads wall-clock UTC.

procedure

(process-issuance-work! worker storage)

 → (or/c issuance-result? #f)
  worker : issuance-worker?
  storage : commerce-storage?
Claims one due outbox row and drives it: deterministic dead ends are released with their typed commerce code and an operator backoff before any signing; a grant with no lineage signs revision zero and a withdrawal signs an issuance-expiring successor naming the latest revision; the exact recorded bytes are signed outside the claim transaction, and the revision, the signed envelope, and a one-time claim are recorded in one transaction. The result’s claim token is delivered to the caller exactly once for a single customer handoff. Returns #f when nothing is due. Dispositions: 'completed with the storage completion record and claim token, 'released with the typed error code, or 'lease-lost when the lease expired between claim and completion, in which case nothing was written. Permit signing failures release as 'permit-issue-failed with the transient backoff; the same durable work completes after repair.

struct

(struct issuance-result (disposition
    completion
    error-code
    entitlement-id
    revision
    claim-token))
  disposition : symbol?
  completion : (or/c issuance-completion? #f)
  error-code : (or/c symbol? #f)
  entitlement-id : (or/c string? #f)
  revision : (or/c exact-nonnegative-integer? #f)
  claim-token : (or/c string? #f)
One worker turn’s outcome.

procedure

(derive-entitlement-id issuer    
  subject-type    
  subject-id    
  offer-id) → string?
  issuer : string?
  subject-type : string?
  subject-id : string?
  offer-id : string?
Deterministic lineage identifier. Reprocessing never allocates a second lineage or revision; a crash after signing converges because Ed25519 re-signs identical bytes to an identical signature.

procedure

(derive-credential-id entitlement-id    
  revision) → string?
  entitlement-id : string?
  revision : exact-nonnegative-integer?
Deterministic credential identifier for one lineage revision.