Skip to content
Open
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
24 changes: 24 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Crypto Runtime Compatibility

The crypto module provides runtime capability checking for crypto primitives.

### checkCapabilities

Checks available crypto capabilities in the current environment.

```ts
function checkCapabilities(throwOnMissing: boolean): Map<CryptoCapability, boolean>;
function createCryptoAdapter(): CryptoAdapter;
import { createCryptoAdapter, checkCapabilities } from "src/services/crypto";

// Check capabilities without throwing
const caps = checkCapabilities(false);
if (!caps.get("globalCrypto")) {
console.warn("Crypto not available!");
}

// Create adapter (throws on missing capabilities)
const adapter = createCryptoAdapter();
const randomBytes = adapter.randomBytes(32);
const encoded = adapter.encode("Hello");
```
7 changes: 1 addition & 6 deletions src/components/mail/PostageDisputePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ import { cn } from "@/lib/utils";
* Pending | Expired | Disputed | Settled | Refunded | Reclaimed
*/
export type PostageDisputeStatus =
| "pending"
| "expired"
| "disputed"
| "settled"
| "refunded"
| "reclaimed";
"pending" | "expired" | "disputed" | "settled" | "refunded" | "reclaimed";

interface PostageDisputePanelProps {
postageStatus: PostageDisputeStatus;
Expand Down
8 changes: 1 addition & 7 deletions src/components/mail/bulk-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ import {
} from "@/features/sender-conversion/types";

export type BulkActionId =
| "archive"
| "star"
| "snooze"
| "mark-read"
| "approve"
| "block"
| "move";
"archive" | "star" | "snooze" | "mark-read" | "approve" | "block" | "move";

export type BulkSnoozeChoice = "later-today" | "tomorrow" | "next-week";

Expand Down
7 changes: 1 addition & 6 deletions src/features/compose/RecipientPolicyBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ interface RecipientPolicyBannerProps {
}

type BannerVariant =
| "trusted"
| "blocked"
| "postage_required"
| "verification_required"
| "loading"
| "error";
"trusted" | "blocked" | "postage_required" | "verification_required" | "loading" | "error";

interface BannerConfig {
variant: BannerVariant;
Expand Down
6 changes: 1 addition & 5 deletions src/features/contacts/import/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/** Where the contacts are coming from. */
export type ImportSource =
| "csv"
| "provider-gmail"
| "provider-outlook"
| "contacts-api"
| "manual";
"csv" | "provider-gmail" | "provider-outlook" | "contacts-api" | "manual";

/** How an imported address resolved against known identities. */
export type MatchType = "exact" | "fuzzy" | "ambiguous" | "none";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
* fake, and safe for public review — no real user data, addresses, or secrets.
*/
export type AdminEmptyStateKind =
| "messages"
| "senders"
| "attachments"
| "events"
| "validation"
| "kpis";
"messages" | "senders" | "attachments" | "events" | "validation" | "kpis";

export interface AdminEmptyStateCopy {
/** Short, friendly heading. */
Expand Down
4 changes: 1 addition & 3 deletions src/features/demo-admin-dashboard/docs/AUDIT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const formattedString = formatAuditEntry(entry);
```tsx
import { AuditLogPanel } from "./components/AuditLogPanel";

const myAuditEntries = [
/* ...array of AuditLogEntry objects... */
];
const myAuditEntries = [/* ...array of AuditLogEntry objects... */];

<AuditLogPanel entries={myAuditEntries} />;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ These pure functions are exported from `components/CalendarEventEditor.tsx`:
import { calendarEventToEditorState, editorStateToCalendarEvent } from "../types/calendarEvent";
import type { DemoCalendarEvent } from "../types/dataset";

const event: DemoCalendarEvent = {
/* ... */
};
const event: DemoCalendarEvent = {/* ... */};
const editorState = calendarEventToEditorState(event);
// ... edit fields ...
const updated: DemoCalendarEvent = editorStateToCalendarEvent(editorState);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { CampaignSnapshot } from "../types/campaignSnapshot";

export type SenderRecoveryRequestStatus =
| "unknown"
| "paid-request"
| "approved"
| "blocked"
| "refund-queued";
"unknown" | "paid-request" | "approved" | "blocked" | "refund-queued";

export interface SenderRecoveryRequestState {
id: string;
Expand Down
22 changes: 10 additions & 12 deletions src/features/demo-admin-dashboard/messageGeneration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ import type { CampaignTemplate, CampaignChecklistItem } from "./types/campaign";
/** Converts campaign templates into a flat list of message templates for testing. */
const getTestTemplates = (campaignTemplates: CampaignTemplate[]): MessageTemplate[] => {
return campaignTemplates.flatMap((t) =>
t.checklist.map(
(c: CampaignChecklistItem): MessageTemplate => ({
id: c.id,
name: c.label,
subject: c.label,
body: c.description,
description: c.description,
category: t.name as TemplateCategory,
recipients: [],
tags: [],
}),
),
t.checklist.map((c: CampaignChecklistItem): MessageTemplate => ({
id: c.id,
name: c.label,
subject: c.label,
body: c.description,
description: c.description,
category: t.name as TemplateCategory,
recipients: [],
tags: [],
})),
);
};

Expand Down
7 changes: 1 addition & 6 deletions src/features/demo-admin-dashboard/mockPublishWorkflow.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
export type MockPublishStatus =
| "idle"
| "preview"
| "publishing"
| "published"
| "failed"
| "rolled-back";
"idle" | "preview" | "publishing" | "published" | "failed" | "rolled-back";

export interface MockPublishStep {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export function isTemplateInserted(dataset: Draft[], template: MessageTemplate):
}

export type InsertResult =
| { ok: true; dataset: Draft[]; draft: Draft }
| { ok: false; reason: string };
{ ok: true; dataset: Draft[]; draft: Draft } | { ok: false; reason: string };

/**
* Insert a template-derived draft into the dataset. Validates against duplicate
Expand Down
7 changes: 1 addition & 6 deletions src/features/demo-admin-dashboard/templates/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
*/

export type TemplateCategory =
| "welcome"
| "transactional"
| "security"
| "event"
| "newsletter"
| "internal";
"welcome" | "transactional" | "security" | "event" | "newsletter" | "internal";

export interface MessageTemplate {
/** Stable, unique identifier. */
Expand Down
6 changes: 1 addition & 5 deletions src/features/demo-admin-dashboard/types/audienceSegment.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export type AudienceSegmentId =
| "investors"
| "founders"
| "events"
| "relay-operators"
| "unknown-senders";
"investors" | "founders" | "events" | "relay-operators" | "unknown-senders";

export interface AudienceSegment {
id: AudienceSegmentId;
Expand Down
7 changes: 1 addition & 6 deletions src/features/demo-admin-dashboard/types/campaignKpi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
export type KpiMetricKind =
| "opens"
| "approvals"
| "replies"
| "refunds"
| "proof_inspections"
| "conversions";
"opens" | "approvals" | "replies" | "refunds" | "proof_inspections" | "conversions";

export type KpiStatus = "on-track" | "at-risk" | "met" | "missed";

Expand Down
7 changes: 1 addition & 6 deletions src/features/demo-admin-dashboard/types/campaignTimeline.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
export type CampaignPhaseKind =
| "planning"
| "warmup"
| "active"
| "cooldown"
| "completed"
| "paused";
"planning" | "warmup" | "active" | "cooldown" | "completed" | "paused";

export type CampaignPhaseStatus = "upcoming" | "active" | "completed" | "skipped";

Expand Down
3 changes: 1 addition & 2 deletions src/features/demo-admin-dashboard/types/datasetImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ export interface DatasetImportIssue {
* On failure, `issues` lists every problem found (the import is rejected whole).
*/
export type DatasetImportResult =
| { ok: true; drafts: Draft[] }
| { ok: false; issues: DatasetImportIssue[] };
{ ok: true; drafts: Draft[] } | { ok: false; issues: DatasetImportIssue[] };
5 changes: 1 addition & 4 deletions src/features/demo-admin-dashboard/types/quickFix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import type { ValidationIssue } from "../validation-types";

/** The kinds of safe, one-click fixes the framework can apply. */
export type QuickFixKind =
| "fill-subject"
| "fill-body"
| "add-recipient"
| "replace-unsafe-recipient";
"fill-subject" | "fill-body" | "add-recipient" | "replace-unsafe-recipient";

/**
* A safe, deterministic repair for a common demo-data validation issue.
Expand Down
8 changes: 1 addition & 7 deletions src/features/design-system/components/trust-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
* Standardizing these here keeps labels and colors identical everywhere.
*/
export type TrustState =
| "verified"
| "allowed"
| "unknown"
| "paid"
| "blocked"
| "bridged"
| "encrypted";
"verified" | "allowed" | "unknown" | "paid" | "blocked" | "bridged" | "encrypted";

export type TrustStateMeta = {
label: string;
Expand Down
6 changes: 1 addition & 5 deletions src/features/settings/mailbox-policy-templates.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { UiPreferences, UnknownSenderPolicy } from "@/features/preferences";

export type MailboxPolicyTemplateId =
| "private"
| "public-paid-inbox"
| "investor-inbox"
| "recruiting-inbox"
| "allowlist-only";
"private" | "public-paid-inbox" | "investor-inbox" | "recruiting-inbox" | "allowlist-only";

export type MailboxPolicyTemplate = {
id: MailboxPolicyTemplateId;
Expand Down
8 changes: 2 additions & 6 deletions src/lib/MOTION_PRESETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,8 @@ export const entrance = {
myNewAnimation: (customParam?: number): Variants => {
const config = getConfig();
return {
initial: {
/* ... */
},
animate: {
/* ... */
},
initial: {/* ... */},
animate: {/* ... */},
transition: {
type: "spring",
stiffness: config.springStiffness,
Expand Down
7 changes: 1 addition & 6 deletions src/server/api/abuse-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ function rateLimited(retryAfterSeconds: number) {

export type AbuseRoute = "postage_submit";
export type AbuseCheck =
| "account"
| "device"
| "ip"
| "proof_failure"
| "relay"
| "sender_recipient";
"account" | "device" | "ip" | "proof_failure" | "relay" | "sender_recipient";
export type AbuseOutagePolicy = "fail_closed" | "fail_open";

export type AbuseDecision = {
Expand Down
3 changes: 1 addition & 2 deletions src/server/api/stealth-coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export class StealthCoordinator extends DurableObjectBase {

async getIdempotencyRecord(key: string): Promise<IdempotencyRecord | null> {
const record = (await this.ctx.storage.get(`idempotency:${key}`)) as
| IdempotencyRecord
| undefined;
IdempotencyRecord | undefined;
return record ?? null;
}

Expand Down
7 changes: 1 addition & 6 deletions src/services/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
export type EventCategory =
| "onboarding"
| "policy"
| "send_outcome"
| "request"
| "proof_failure"
| "retention";
"onboarding" | "policy" | "send_outcome" | "request" | "proof_failure" | "retention";

export type EventPurpose = "activation_measurement" | "reliability_monitoring" | "abuse_prevention";

Expand Down
1 change: 1 addition & 0 deletions src/services/crypto/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./runtime";
Loading
Loading