Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ export const api = {
// the platform stack's single-use enrollment and install links but never
// acknowledge or reissue one — which is most of finishing the stack.
adminReissueDidsEnroll: (id: string) =>
req<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string }>('POST', `/api/v1/admin/setup-sessions/${encodeURIComponent(id)}/dids/reissue-enroll`),
req<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string; dids_admin_did: string }>('POST', `/api/v1/admin/setup-sessions/${encodeURIComponent(id)}/dids/reissue-enroll`),
adminAckDidsEnroll: (id: string) =>
req<{ dids_enroll_used: boolean }>('POST', `/api/v1/admin/setup-sessions/${encodeURIComponent(id)}/dids/enroll-ack`),
adminReissueVtcInstall: (id: string) =>
Expand Down Expand Up @@ -1516,7 +1516,7 @@ export const api = {
req<SessionUpgrade>('POST', `/api/v1/setup/${id}/upgrade`, { components }),
getSessionUpgrade: (id: string) => req<SessionUpgrade | null>('GET', `/api/v1/setup/${id}/upgrade`),
reissueDidsEnroll: (id: string) =>
req<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string }>('POST', `/api/v1/setup/${id}/dids/reissue-enroll`),
req<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string; dids_admin_did: string }>('POST', `/api/v1/setup/${id}/dids/reissue-enroll`),
ackDidsEnroll: (id: string) =>
req<{ dids_enroll_used: boolean }>('POST', `/api/v1/setup/${id}/dids/enroll-ack`),
reissueVtcInstall: (id: string) =>
Expand Down
17 changes: 10 additions & 7 deletions src/pages/portal/FullStackOutputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function SecretRow({

// Single-use DID-hosting admin enrollment link and its required second-channel
// claim code. Reissuing lives in the Configuration card.
export function DidsEnrollAlert({ enrollUrl, claimCode, used, justReissued, handleOpen }: DidsEnrollState) {
export function DidsEnrollAlert({ enrollUrl, claimCode, subjectDid, used, justReissued, handleOpen }: DidsEnrollState) {
const { copiedKey, copy } = useCopyState()
const [claimCopied, setClaimCopied] = useState(false)
const [openWarning, setOpenWarning] = useState(false)
Expand Down Expand Up @@ -137,10 +137,15 @@ export function DidsEnrollAlert({ enrollUrl, claimCode, used, justReissued, hand
Copy the claim code, then open the link.
{justReissued && (
<span style={{ display: 'block', marginTop: 4 }}>
After reissuing, wait 10 seconds before opening the new link.
A separate backup administrator invite was created. Wait 10 seconds before opening the new link.
</span>
)}
</p>
{subjectDid && (
<div className="p-mono text-xs" style={{ marginTop: 8, overflowWrap: 'anywhere' }}>
{subjectDid}
</div>
)}
<div className="p-row gap-8 center" style={{ marginTop: 8 }}>
<span className="p-muted text-xs" style={{ letterSpacing: '.06em', textTransform: 'uppercase', fontFamily: 'var(--font-mono)' }}>
Claim code
Expand Down Expand Up @@ -175,7 +180,7 @@ export function DidsEnrollAlert({ enrollUrl, claimCode, used, justReissued, hand
// Reissue control for the DID-hosting admin enrollment link — lives in the
// Configuration card, and only appears once the original link has been
// opened (before that, the top banner's "Open enrollment" is the action).
export function DidsEnrollConfigRow({ used, reissuing, reissueError, justReissued, handleReissue }: DidsEnrollState) {
export function DidsEnrollConfigRow({ used, reissuing, reissueError, handleReissue }: DidsEnrollState) {
if (!used) return null

return (
Expand All @@ -185,14 +190,12 @@ export function DidsEnrollConfigRow({ used, reissuing, reissueError, justReissue
<div className="p-col" style={{ minWidth: 0 }}>
<span className="p-muted text-sm">DID hosting enrollment</span>
<span className="field-hint" style={{ marginTop: 4 }}>
{justReissued
? 'After reissuing, wait 10 seconds before opening the new link.'
: 'Link already opened. Reissue a new one to register a passkey.'}
The original enrollment was opened. Create an invite for a separate backup administrator.
</span>
{reissueError && <span style={{ color: 'var(--destructive)', display: 'block', marginTop: 4 }} className="field-hint">{reissueError}</span>}
</div>
<button className="btn btn-outline btn-sm" style={{ flexShrink: 0 }} onClick={handleReissue} disabled={reissuing}>
{reissuing ? 'Reissuing…' : 'Reissue link'}
{reissuing ? 'Creating invite…' : 'Create admin invite'}
</button>
</div>
</>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/portal/fullStackHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { userSessionActions, type SessionActionApi } from './sessionActions'
export function useDidsEnroll(session: SetupSession | null, actions: SessionActionApi = userSessionActions) {
const [enrollUrl, setEnrollUrl] = useState('')
const [claimCode, setClaimCode] = useState('')
const [subjectDid, setSubjectDid] = useState('')
const [used, setUsed] = useState(false)
const [reissuing, setReissuing] = useState(false)
const [reissueError, setReissueError] = useState('')
Expand Down Expand Up @@ -46,6 +47,7 @@ export function useDidsEnroll(session: SetupSession | null, actions: SessionActi
const r = await actions.reissueDidsEnroll(session.id)
setEnrollUrl(r.dids_admin_enroll_url)
setClaimCode(r.dids_admin_enroll_claim_code)
setSubjectDid(r.dids_admin_did)
setUsed(false)
setJustReissued(true)
} catch (err) {
Expand All @@ -55,7 +57,7 @@ export function useDidsEnroll(session: SetupSession | null, actions: SessionActi
}
}

return { enrollUrl, claimCode, used, reissuing, reissueError, justReissued, handleOpen, handleReissue }
return { enrollUrl, claimCode, subjectDid, used, reissuing, reissueError, justReissued, handleOpen, handleReissue }
}

export type DidsEnrollState = ReturnType<typeof useDidsEnroll>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/portal/sessionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { api } from '@/lib/api'
*/
export interface SessionActionApi {
ackDidsEnroll: (id: string) => Promise<unknown>
reissueDidsEnroll: (id: string) => Promise<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string }>
reissueDidsEnroll: (id: string) => Promise<{ dids_admin_enroll_url: string; dids_admin_enroll_claim_code: string; dids_admin_did: string }>
ackVtcInstall: (id: string) => Promise<unknown>
reissueVtcInstall: (id: string) => Promise<{ install_url: string; claim_code: string }>
}
Expand Down