Repository navigation
feat(issuance): optional validUntil on manual and programmatic issuance - #6
Merged
Merged
Conversation
Badges issued by a renewable rule already expire (validUntil in the credential, assertions.valid_until, lifecycle expired), but there was no way to give an expiry to a badge issued by hand or through the programmatic API: event badges, memberships for a year, and the like. The issue request now takes an optional validUntil (ISO timestamp). It flows through the manual JSON API, the admin issue form (as a calendar date, expiring at the end of that day in UTC) and the programmatic API, including the queued job payload. Issuance rejects an expiry that is not later than the issue date (422). A renewable rule keeps its own cycle and ignores the field. The issuance email shows the expiry when there is one. Credentials issued without the field keep expiring never, as before.
…and the LinkedIn link A credential with validUntil was issued with the date in the signed document and in the assertion, but nothing visible carried it: the public badge page only said when it was issued, the PDF had no expiry field, and the Add to LinkedIn link left LinkedIn's expiration date empty for the person to type. The public page now shows "Valid until" under the issue date, the PDF record block lists it next to the credential identifiers (the same spot that shows a revocation), and the LinkedIn profile link sends expirationYear/expirationMonth. Credentials without an expiry render exactly as before.
The public badge page offers "Add to LinkedIn Profile", but the email that tells someone they earned a badge did not: they had to open the page first and find the button. The issuance email now carries the same link as a secondary action, built the same way as on the page: the tenant's LinkedIn organization when one is configured (otherwise the issuer name), the credential identifier the page uses, the issue date and, when the credential has one, the expiration date. Direct issuance and the admin retry read the tenant's LinkedIn setting next to the tenant itself.
Reuse the tracked public LinkedIn sharing route and include expiry in queue replay identity. Reject expired commands before enqueueing, terminate delayed expiry failures without retries, and preserve saved admin receipts after expiry. Measure PDF record fields and grow the page to keep expiry and revocation details visible. Add boundary and Postgres regression coverage and regenerate the programmatic API contract. Validation: lint, formatting, strict TypeScript, and all 2,124 tests passed with UTC Postgres sessions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Badges issued by a renewable rule already carry an expiry (
validUntilin the credential,assertions.valid_until, theexpiredlifecycle state), but a badge issued by hand or through the programmatic API could not be given one — event badges, one-year memberships and the like.This adds an optional
validUntil(ISO 8601 timestamp) to the issue request and threads it through every issuance entry point:POST /v1/tenants/:tenantId/assertions/manual-issue):validUntilin the body.POST /v1/programmatic/issue):validUntilin the body, carried in the queuedissue_badgejob payload.Behaviour:
422 Valid until must be later than the issue date.assertions.valid_untilalready exists (0087).Second commit: the expiry is also visible wherever the credential is presented — the public badge page shows "Valid until" under the issue date, the PDF lists it in the record block (next to the identifiers, where a revocation is shown), and the Add to LinkedIn profile link sends
expirationYear/expirationMonthso the certification's expiration date is prefilled.Third commit: the issuance email now carries the same Add to LinkedIn link as the public badge page (tenant's LinkedIn organization when configured, otherwise the issuer name; the credential identifier the page uses; issue date and, when present, expiration date), so people can add the certification straight from the notification.
Tests
credentials.test.ts:validUntilaccepted on manual and programmatic requests; non-ISO values rejected.manual-issue.test.ts: the issued credential and the stored assertion carryvalidUntil; a past expiry is rejected with 422 and nothing is issued.queue-ingress-programmatic.test.ts: the queued payload carriesvalidUntil.manual-issue-section.test.tsx: the form offers the date field and echoes it back on validation feedback.tenant-operations-admin-routes.test.ts: the calendar-date → end-of-day UTC conversion and its rejections.send-issuance-email.test.ts: the expiry shows up in the email.display-format.test.ts: LinkedIn link carries the expiration date, and omits it without one.public-badge-page.test.ts: the page shows "Valid until" and the profile share link carries the expiration.send-issuance-email.test.ts: the email offers Add to LinkedIn with issuer, credential and dates, and the organization ID when configured.Full suite,
oxfmt --check,oxlint --deny-warningsandtsc --noEmitpass.Context
Follow-up to #2: we run CredTrail self-hosted for community events and needed event badges that expire.