@asturiu/v0-sdk 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +82 -2
- package/contract/assertion-vectors.json +90 -0
- package/contract/schemas/branding.schema.json +46 -0
- package/contract/schemas/definitions.schema.json +376 -0
- package/contract/schemas/portal.schema.json +56 -0
- package/contract/tenant-api-routes.json +165 -0
- package/dist/branding.d.ts +131 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/branding.js +206 -0
- package/dist/branding.js.map +1 -0
- package/dist/changesets.d.ts +58 -0
- package/dist/changesets.d.ts.map +1 -0
- package/dist/changesets.js +18 -0
- package/dist/changesets.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +12 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/changesets.d.ts +14 -0
- package/dist/cli/changesets.d.ts.map +1 -0
- package/dist/cli/changesets.js +252 -0
- package/dist/cli/changesets.js.map +1 -0
- package/dist/cli/cli.d.ts +37 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +415 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/context.d.ts +147 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +258 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/engine.d.ts +59 -0
- package/dist/cli/engine.d.ts.map +1 -0
- package/dist/cli/engine.js +85 -0
- package/dist/cli/engine.js.map +1 -0
- package/dist/cli/feedback.d.ts +40 -0
- package/dist/cli/feedback.d.ts.map +1 -0
- package/dist/cli/feedback.js +420 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/files.d.ts +83 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +389 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/overview.d.ts +6 -0
- package/dist/cli/overview.d.ts.map +1 -0
- package/dist/cli/overview.js +379 -0
- package/dist/cli/overview.js.map +1 -0
- package/dist/cli/parts.d.ts +5 -0
- package/dist/cli/parts.d.ts.map +1 -0
- package/dist/cli/parts.js +414 -0
- package/dist/cli/parts.js.map +1 -0
- package/dist/cli/sources.d.ts +37 -0
- package/dist/cli/sources.d.ts.map +1 -0
- package/dist/cli/sources.js +91 -0
- package/dist/cli/sources.js.map +1 -0
- package/dist/cli/terminal.d.ts +135 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +353 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/ui-page.d.ts +8 -0
- package/dist/cli/ui-page.d.ts.map +1 -0
- package/dist/cli/ui-page.js +216 -0
- package/dist/cli/ui-page.js.map +1 -0
- package/dist/cli/ui.d.ts +54 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +251 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/client.d.ts +88 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +165 -0
- package/dist/client.js.map +1 -0
- package/dist/contacts.d.ts +43 -0
- package/dist/contacts.d.ts.map +1 -0
- package/dist/contacts.js +46 -0
- package/dist/contacts.js.map +1 -0
- package/dist/definition-set.d.ts +731 -0
- package/dist/definition-set.d.ts.map +1 -0
- package/dist/definition-set.js +659 -0
- package/dist/definition-set.js.map +1 -0
- package/dist/definitions.d.ts +42 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +154 -0
- package/dist/definitions.js.map +1 -0
- package/dist/enrolment.d.ts +9 -0
- package/dist/enrolment.d.ts.map +1 -0
- package/dist/enrolment.js +8 -0
- package/dist/enrolment.js.map +1 -0
- package/dist/fill.d.ts +73 -0
- package/dist/fill.d.ts.map +1 -0
- package/dist/fill.js +46 -0
- package/dist/fill.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications.d.ts +33 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +36 -0
- package/dist/notifications.js.map +1 -0
- package/dist/oidc.d.ts +122 -0
- package/dist/oidc.d.ts.map +1 -0
- package/dist/oidc.js +150 -0
- package/dist/oidc.js.map +1 -0
- package/dist/overlay.d.ts +109 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +58 -0
- package/dist/overlay.js.map +1 -0
- package/dist/passes.d.ts +95 -0
- package/dist/passes.d.ts.map +1 -0
- package/dist/passes.js +140 -0
- package/dist/passes.js.map +1 -0
- package/dist/portal-options.d.ts +65 -0
- package/dist/portal-options.d.ts.map +1 -0
- package/dist/portal-options.js +120 -0
- package/dist/portal-options.js.map +1 -0
- package/dist/reads.d.ts +41 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +44 -0
- package/dist/reads.js.map +1 -0
- package/dist/recovery-words.d.ts +8 -0
- package/dist/recovery-words.d.ts.map +1 -0
- package/dist/recovery-words.js +136 -0
- package/dist/recovery-words.js.map +1 -0
- package/dist/recovery.d.ts +198 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +112 -0
- package/dist/recovery.js.map +1 -0
- package/dist/reveal.d.ts +35 -0
- package/dist/reveal.d.ts.map +1 -0
- package/dist/reveal.js +66 -0
- package/dist/reveal.js.map +1 -0
- package/dist/seal.d.ts +15 -0
- package/dist/seal.d.ts.map +1 -0
- package/dist/seal.js +0 -0
- package/dist/seal.js.map +1 -0
- package/dist/session.d.ts +66 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +61 -0
- package/dist/session.js.map +1 -0
- package/dist/signing-in-mark.d.ts +14 -0
- package/dist/signing-in-mark.d.ts.map +1 -0
- package/dist/signing-in-mark.js +24 -0
- package/dist/signing-in-mark.js.map +1 -0
- package/dist/signing-in.d.ts +22 -0
- package/dist/signing-in.d.ts.map +1 -0
- package/dist/signing-in.js +203 -0
- package/dist/signing-in.js.map +1 -0
- package/dist/tags.d.ts +96 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +88 -0
- package/dist/tags.js.map +1 -0
- package/dist/tenant-subscription.d.ts +47 -0
- package/dist/tenant-subscription.d.ts.map +1 -0
- package/dist/tenant-subscription.js +7 -0
- package/dist/tenant-subscription.js.map +1 -0
- package/dist/testing/index.d.ts +125 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +320 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/theme.d.ts +237 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +504 -0
- package/dist/theme.js.map +1 -0
- package/dist/tickets.d.ts +152 -0
- package/dist/tickets.d.ts.map +1 -0
- package/dist/tickets.js +65 -0
- package/dist/tickets.js.map +1 -0
- package/dist/tiers.d.ts +168 -0
- package/dist/tiers.d.ts.map +1 -0
- package/dist/tiers.js +341 -0
- package/dist/tiers.js.map +1 -0
- package/dist/types.d.ts +885 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/urlid.d.ts +50 -0
- package/dist/urlid.d.ts.map +1 -0
- package/dist/urlid.js +78 -0
- package/dist/urlid.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/make/asturiu.mk +43 -0
- package/package.json +63 -4
- package/src/branding.ts +221 -0
- package/src/changesets.ts +61 -0
- package/src/cli/bin.ts +12 -0
- package/src/cli/changesets.ts +233 -0
- package/src/cli/cli.ts +425 -0
- package/src/cli/context.ts +299 -0
- package/src/cli/engine.ts +112 -0
- package/src/cli/feedback.ts +406 -0
- package/src/cli/files.ts +371 -0
- package/src/cli/index.ts +7 -0
- package/src/cli/overview.ts +343 -0
- package/src/cli/parts.ts +371 -0
- package/src/cli/sources.ts +111 -0
- package/src/cli/terminal.ts +384 -0
- package/src/cli/ui-page.ts +215 -0
- package/src/cli/ui.ts +266 -0
- package/src/client.ts +202 -0
- package/src/contacts.ts +61 -0
- package/src/definition-set.ts +965 -0
- package/src/definitions.ts +156 -0
- package/src/enrolment.ts +10 -0
- package/src/fill.ts +83 -0
- package/src/index.ts +38 -0
- package/src/notifications.ts +55 -0
- package/src/oidc.ts +199 -0
- package/src/overlay.ts +137 -0
- package/src/passes.ts +168 -0
- package/src/portal-options.ts +125 -0
- package/src/reads.ts +71 -0
- package/src/recovery-words.ts +137 -0
- package/src/recovery.ts +269 -0
- package/src/reveal.ts +72 -0
- package/src/seal.ts +0 -0
- package/src/session.ts +93 -0
- package/src/signing-in-mark.ts +23 -0
- package/src/signing-in.ts +213 -0
- package/src/tags.ts +146 -0
- package/src/tenant-subscription.ts +44 -0
- package/src/testing/index.ts +337 -0
- package/src/theme.ts +628 -0
- package/src/tickets.ts +195 -0
- package/src/tiers.ts +397 -0
- package/src/types.ts +847 -0
- package/src/urlid.ts +77 -0
- package/src/version.ts +15 -0
- package/templates/asturiu/branding.json +4 -0
- package/templates/asturiu/definitions.json +23 -0
- package/templates/asturiu/portal.json +16 -0
package/src/overlay.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet overlays (ADR-028): a Customer's renames, layout and custom fields
|
|
3
|
+
* for one Wallet. Shared by the Engine (validation, the reveal gate) and every
|
|
4
|
+
* frontend (forms, labels): pure and dependency-free so the Frontend kit can
|
|
5
|
+
* carry it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { REVEAL_LEVELS, type RevealLevel } from "./reveal.js";
|
|
9
|
+
import type { EntryDefinitionDetail, EntryDefinitionField, FieldValueType } from "./types.js";
|
|
10
|
+
import type { FillMode, LocatorRule } from "./fill.js";
|
|
11
|
+
|
|
12
|
+
/** The key of a custom field: `x_` and a ULID, generated by the Engine. */
|
|
13
|
+
export const CUSTOM_FIELD_ID = /^x_[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
14
|
+
|
|
15
|
+
export function isCustomFieldId(value: unknown): value is string {
|
|
16
|
+
return typeof value === "string" && CUSTOM_FIELD_ID.test(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** How strict a reveal level is: a higher rank asks more of the person. `null` (a plain field) ranks lowest. */
|
|
20
|
+
export function revealRank(level: RevealLevel | null | undefined): number {
|
|
21
|
+
return level ? REVEAL_LEVELS.indexOf(level) : -1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** One custom field of a Wallet overlay. */
|
|
25
|
+
export interface CustomFieldSpec {
|
|
26
|
+
id: string;
|
|
27
|
+
/** The Entry type it applies to (`edf` ARID). */
|
|
28
|
+
entry_definition: string;
|
|
29
|
+
label: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
value_type: FieldValueType;
|
|
32
|
+
validation?: { pattern?: string; min?: number; max?: number; min_length?: number; max_length?: number; enum?: (string | number | boolean)[] };
|
|
33
|
+
/** Required on Entries created after it was added, and wherever it holds a value. */
|
|
34
|
+
required: boolean;
|
|
35
|
+
secret: boolean;
|
|
36
|
+
/** Only with `secret`; `click` when absent. Never below the Entry type's `secret_reveal_min`. */
|
|
37
|
+
reveal?: RevealLevel;
|
|
38
|
+
searchable: boolean;
|
|
39
|
+
/** ADR-046, as on a FieldDefinition: the modes allowed (absent: what the Entry type's `custom_filled_by` allows), what an internal reference may point at, the locator rule. */
|
|
40
|
+
filled_by?: FillMode[];
|
|
41
|
+
targets?: string[];
|
|
42
|
+
target_definitions?: string[];
|
|
43
|
+
locator?: LocatorRule;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Order and hidden Tenant fields for one Entry type. `order` lists field keys: `fdf` ARIDs and `x_` ids. */
|
|
47
|
+
export interface OverlayLayout {
|
|
48
|
+
order?: string[];
|
|
49
|
+
hidden?: string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The document `PUT /v0/wallets/{arid}/overlay` takes. A new custom field omits `id`. */
|
|
53
|
+
export interface WalletOverlayInput {
|
|
54
|
+
renames?: Record<string, string>;
|
|
55
|
+
layout?: Record<string, OverlayLayout>;
|
|
56
|
+
fields?: (Omit<CustomFieldSpec, "id" | "required" | "secret" | "searchable"> & { id?: string; required?: boolean; secret?: boolean; searchable?: boolean })[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** What the Wallet owner's subscription level allows, and what the overlay uses of it. */
|
|
60
|
+
export interface OverlayAllowance {
|
|
61
|
+
level: string;
|
|
62
|
+
rename: boolean;
|
|
63
|
+
arrange: boolean;
|
|
64
|
+
secret_fields: boolean;
|
|
65
|
+
extra_fields: { max: number; used: number };
|
|
66
|
+
searchable_fields: { max: number; used: number };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** `GET /v0/wallets/{arid}/overlay`. `arid` and `version` are `null` until the Wallet is first customised. */
|
|
70
|
+
export interface WalletOverlay {
|
|
71
|
+
wallet: string;
|
|
72
|
+
arid: string | null;
|
|
73
|
+
version: number | null;
|
|
74
|
+
renames: Record<string, string>;
|
|
75
|
+
layout: Record<string, OverlayLayout>;
|
|
76
|
+
fields: CustomFieldSpec[];
|
|
77
|
+
allowance: OverlayAllowance;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** One field of a form or a view, Tenant or custom, as the overlay presents it. */
|
|
81
|
+
export interface FormField {
|
|
82
|
+
/** `fdf` ARID for a Tenant field, `x_` id for a custom one. */
|
|
83
|
+
key: string;
|
|
84
|
+
custom: boolean;
|
|
85
|
+
label: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
value_type?: FieldValueType;
|
|
88
|
+
secret: boolean;
|
|
89
|
+
reveal?: RevealLevel;
|
|
90
|
+
searchable: boolean;
|
|
91
|
+
required: boolean;
|
|
92
|
+
hidden: boolean;
|
|
93
|
+
/** The Tenant's declaration, for a Tenant field. */
|
|
94
|
+
definition?: EntryDefinitionField;
|
|
95
|
+
/** The overlay's spec, for a custom field. */
|
|
96
|
+
spec?: CustomFieldSpec;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The fields of an Entry type in the order and with the names this Wallet's
|
|
101
|
+
* overlay gives them: the overlay's `order` first, then the remaining Tenant
|
|
102
|
+
* fields in the Tenant's order, then the remaining custom fields. Hidden
|
|
103
|
+
* fields are included and marked; leaving them out is the frontend's choice.
|
|
104
|
+
*/
|
|
105
|
+
export function orderedFormFields(def: Pick<EntryDefinitionDetail, "arid" | "fields">, overlay: Pick<WalletOverlay, "renames" | "layout" | "fields"> | null | undefined): FormField[] {
|
|
106
|
+
const tenant = def.fields
|
|
107
|
+
.map((f, i) => ({ f, i }))
|
|
108
|
+
.sort((a, b) => (a.f.order ?? a.i) - (b.f.order ?? b.i) || a.i - b.i)
|
|
109
|
+
.map(({ f }): FormField => ({
|
|
110
|
+
key: f.definition.arid,
|
|
111
|
+
custom: false,
|
|
112
|
+
label: overlay?.renames?.[f.definition.arid] ?? f.label ?? f.name ?? f.definition.arid,
|
|
113
|
+
value_type: f.value_type,
|
|
114
|
+
secret: !!f.secret,
|
|
115
|
+
reveal: f.reveal,
|
|
116
|
+
searchable: !!f.searchable,
|
|
117
|
+
required: f.required,
|
|
118
|
+
hidden: false,
|
|
119
|
+
definition: f,
|
|
120
|
+
}));
|
|
121
|
+
const custom = (overlay?.fields ?? [])
|
|
122
|
+
.filter((s) => s.entry_definition === def.arid)
|
|
123
|
+
.map((s): FormField => ({ key: s.id, custom: true, label: s.label, description: s.description, value_type: s.value_type, secret: s.secret, reveal: s.secret ? s.reveal ?? "click" : undefined, searchable: s.searchable, required: s.required, hidden: false, spec: s }));
|
|
124
|
+
const layout = overlay?.layout?.[def.arid];
|
|
125
|
+
const hidden = new Set(layout?.hidden ?? []);
|
|
126
|
+
const byKey = new Map([...tenant, ...custom].map((f) => [f.key, f]));
|
|
127
|
+
const out: FormField[] = [];
|
|
128
|
+
for (const k of layout?.order ?? []) {
|
|
129
|
+
const f = byKey.get(k);
|
|
130
|
+
if (f) {
|
|
131
|
+
out.push(f);
|
|
132
|
+
byKey.delete(k);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const f of [...tenant, ...custom]) if (byKey.has(f.key)) out.push(f);
|
|
136
|
+
return out.map((f) => ({ ...f, hidden: !f.custom && !f.required && hidden.has(f.key) }));
|
|
137
|
+
}
|
package/src/passes.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guest passes (ADR-040): the kinds and states of a pass, the code a person
|
|
3
|
+
* types, and what a Tenant switches on for its customers' passes. Pure and
|
|
4
|
+
* dependency-free: the Engine validates with these lists, the Customer
|
|
5
|
+
* Portal, the Admin UI and a Tenant's app read with them.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** `bearer`: a link for anyone, the token in the link. `email`: a code sent to one address, typed on the pass page. */
|
|
9
|
+
export const PASS_KINDS = ["bearer", "email"] as const;
|
|
10
|
+
export type PassKind = (typeof PASS_KINDS)[number];
|
|
11
|
+
|
|
12
|
+
/** What is stored; `ended`, `expired` and `exhausted` are derived when read (`passState`). */
|
|
13
|
+
export const PASS_STORED_STATES = ["active", "locked", "revoked"] as const;
|
|
14
|
+
export type PassStoredState = (typeof PASS_STORED_STATES)[number];
|
|
15
|
+
|
|
16
|
+
export const PASS_STATES = ["active", "locked", "revoked", "ended", "expired", "exhausted"] as const;
|
|
17
|
+
export type PassState = (typeof PASS_STATES)[number];
|
|
18
|
+
|
|
19
|
+
/** A link for anyone opens at once or behind a captcha; an e-mail pass always asks for its code. */
|
|
20
|
+
export const PASS_GATES = ["none", "captcha", "code"] as const;
|
|
21
|
+
export type PassGate = (typeof PASS_GATES)[number];
|
|
22
|
+
|
|
23
|
+
/** Where an e-mail pass is opened: the Customer Portal's pass page, or the Tenant's own app. */
|
|
24
|
+
export const PASS_PAGES = ["portal", "app"] as const;
|
|
25
|
+
export type PassPage = (typeof PASS_PAGES)[number];
|
|
26
|
+
|
|
27
|
+
export const PASS_LIMITS = {
|
|
28
|
+
label: 120,
|
|
29
|
+
message: 1000,
|
|
30
|
+
appUrl: 2000,
|
|
31
|
+
codeFailuresMin: 3,
|
|
32
|
+
codeFailuresMax: 20,
|
|
33
|
+
sessionsMax: 50,
|
|
34
|
+
lifetimeDaysMax: 3650,
|
|
35
|
+
passesPerLevelMax: 1000,
|
|
36
|
+
opensMax: 100000,
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The derived state of a pass. Terminal states come first, so a pass that is
|
|
41
|
+
* both expired and locked reads `expired`: only an `active` pass opens.
|
|
42
|
+
*/
|
|
43
|
+
export function passState(p: { stored: PassStoredState; not_after?: string | Date | null; opens: number; max_opens?: number | null; bound?: boolean }, now: number = Date.now()): PassState {
|
|
44
|
+
if (p.stored === "revoked") return "revoked";
|
|
45
|
+
if (p.bound) return "ended";
|
|
46
|
+
if (p.not_after && new Date(p.not_after).getTime() <= now) return "expired";
|
|
47
|
+
if (p.max_opens != null && p.opens >= p.max_opens) return "exhausted";
|
|
48
|
+
if (p.stored === "locked") return "locked";
|
|
49
|
+
return "active";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ------------------------------------------------------------------ the code
|
|
53
|
+
|
|
54
|
+
/** 32 capital letters and digits without 0, 1, I and O, so a code read aloud or typed again is not mistaken. */
|
|
55
|
+
export const PASS_CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
56
|
+
/** 8 characters from 32: 40 bits, safe only behind the attempt limit (ADR-040 §6). */
|
|
57
|
+
export const PASS_CODE_LENGTH = 8;
|
|
58
|
+
|
|
59
|
+
/** What a person typed, as the Engine compares it: capitals, with spaces, dashes and dots dropped. */
|
|
60
|
+
export function normalizePassCode(input: string): string {
|
|
61
|
+
return input.toUpperCase().replace(/[\s.\-_]+/g, "");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function isPassCode(value: string): boolean {
|
|
65
|
+
if (value.length !== PASS_CODE_LENGTH) return false;
|
|
66
|
+
for (const c of value) if (!PASS_CODE_ALPHABET.includes(c)) return false;
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** `ABCDEFGH` → `ABCD-EFGH`, the way the code is shown in the e-mail. */
|
|
71
|
+
export function formatPassCode(code: string): string {
|
|
72
|
+
const c = normalizePassCode(code);
|
|
73
|
+
return c.length === PASS_CODE_LENGTH ? `${c.slice(0, 4)}-${c.slice(4)}` : c;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ----------------------------------------------------------- Tenant options
|
|
77
|
+
|
|
78
|
+
/** `Tenant.passes` (ADR-040 §10), every key filled. */
|
|
79
|
+
export interface TenantPassOptions {
|
|
80
|
+
bearer: boolean;
|
|
81
|
+
email: boolean;
|
|
82
|
+
page: PassPage;
|
|
83
|
+
/** The Tenant app's pass page: links for anyone, the handover, and `page: app`. */
|
|
84
|
+
app_url: string | null;
|
|
85
|
+
/** The latest end date a pass may have, in days; `null` also allows passes without an end date. */
|
|
86
|
+
max_lifetime_days: number | null;
|
|
87
|
+
code_failure_limit: number;
|
|
88
|
+
/** The ceiling for live guest sessions per pass. */
|
|
89
|
+
max_sessions: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function defaultPassOptions(): TenantPassOptions {
|
|
93
|
+
return { bearer: false, email: false, page: "portal", app_url: null, max_lifetime_days: 30, code_failure_limit: 5, max_sessions: 5 };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** An http(s) URL without credentials, as a pass may point to; null otherwise. */
|
|
97
|
+
export function passAppUrl(v: unknown): string | null {
|
|
98
|
+
if (typeof v !== "string" || !v || v.length > PASS_LIMITS.appUrl) return null;
|
|
99
|
+
try {
|
|
100
|
+
const u = new URL(v);
|
|
101
|
+
return (u.protocol === "https:" || u.protocol === "http:") && !u.username && !u.password && !u.hash ? u.toString() : null;
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The rules a set of pass options must keep beyond its shape: an app address
|
|
109
|
+
* while either kind is on. One entry per problem, with
|
|
110
|
+
* its path under `passes`; the Engine's Tenant schema reports them as `422`.
|
|
111
|
+
*/
|
|
112
|
+
export function passOptionProblems(raw: unknown): { path: (string | number)[]; message: string }[] {
|
|
113
|
+
const out: { path: (string | number)[]; message: string }[] = [];
|
|
114
|
+
if (!raw || typeof raw !== "object") return out;
|
|
115
|
+
const r = raw as Record<string, unknown>;
|
|
116
|
+
const on = r.bearer === true || r.email === true;
|
|
117
|
+
if (r.app_url !== undefined && r.app_url !== null && !passAppUrl(r.app_url)) out.push({ path: ["app_url"], message: "must be an http(s) URL without credentials or a fragment" });
|
|
118
|
+
else if (on && !passAppUrl(r.app_url)) out.push({ path: ["app_url"], message: "passes need the address of the Tenant app's pass page" });
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Stored or presented options as every reader takes them: anything missing or
|
|
124
|
+
* odd back to its default, so an older record or Interface API never breaks a
|
|
125
|
+
* page. Passes stay off unless a kind is on and the app address is good.
|
|
126
|
+
*/
|
|
127
|
+
export function resolvePassOptions(raw: unknown): TenantPassOptions {
|
|
128
|
+
const out = defaultPassOptions();
|
|
129
|
+
if (!raw || typeof raw !== "object") return out;
|
|
130
|
+
const r = raw as Record<string, unknown>;
|
|
131
|
+
out.app_url = passAppUrl(r.app_url);
|
|
132
|
+
out.bearer = r.bearer === true && !!out.app_url;
|
|
133
|
+
out.email = r.email === true && !!out.app_url;
|
|
134
|
+
if (typeof r.page === "string" && (PASS_PAGES as readonly string[]).includes(r.page)) out.page = r.page as PassPage;
|
|
135
|
+
if (r.max_lifetime_days === null) out.max_lifetime_days = null;
|
|
136
|
+
else if (isIntIn(r.max_lifetime_days, 1, PASS_LIMITS.lifetimeDaysMax)) out.max_lifetime_days = r.max_lifetime_days as number;
|
|
137
|
+
if (isIntIn(r.code_failure_limit, PASS_LIMITS.codeFailuresMin, PASS_LIMITS.codeFailuresMax)) out.code_failure_limit = r.code_failure_limit as number;
|
|
138
|
+
if (isIntIn(r.max_sessions, 1, PASS_LIMITS.sessionsMax)) out.max_sessions = r.max_sessions as number;
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** What the portal needs from `Tenant.passes`, on the public presentation. */
|
|
143
|
+
export interface PassPresentation {
|
|
144
|
+
email: boolean;
|
|
145
|
+
page: PassPage;
|
|
146
|
+
app_url: string | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The latest end date a new pass may have, or `null` when passes without an end date are allowed. */
|
|
150
|
+
export function passLatestEnd(options: TenantPassOptions, now: number = Date.now()): Date | null {
|
|
151
|
+
return options.max_lifetime_days === null ? null : new Date(now + options.max_lifetime_days * 86_400_000);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The address a link for anyone carries: the app's pass page with the token in the fragment, never sent to a server. */
|
|
155
|
+
export function bearerPassUrl(appUrl: string, token: string): string {
|
|
156
|
+
return `${appUrl.replace(/#.*$/, "")}#t=${encodeURIComponent(token)}`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** The app's pass page with one query parameter added (`handover`, or `pass` for a handle). */
|
|
160
|
+
export function passAppTarget(appUrl: string, key: "handover" | "pass", value: string): string {
|
|
161
|
+
const u = new URL(appUrl);
|
|
162
|
+
u.searchParams.set(key, value);
|
|
163
|
+
return u.toString();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function isIntIn(v: unknown, min: number, max: number): boolean {
|
|
167
|
+
return typeof v === "number" && Number.isInteger(v) && v >= min && v <= max;
|
|
168
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portal options (ADR-037): which pages and parts of the Customer Portal a
|
|
3
|
+
* Tenant shows, from closed lists. A page can stay in the portal, move to the
|
|
4
|
+
* Tenant's own application (`redirect`) or, where nothing a person depends on
|
|
5
|
+
* goes with it, be switched off. Pure and dependency-free: the Engine
|
|
6
|
+
* validates with these lists, the portal and the Admin UI read with them.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** On/off parts, every one on unless switched off. `account_link` predates the rest (components/15). */
|
|
10
|
+
export const PORTAL_SWITCHES = ["account_link", "open_app", "back_link", "language_menu", "appearance"] as const;
|
|
11
|
+
export type PortalSwitch = (typeof PORTAL_SWITCHES)[number];
|
|
12
|
+
|
|
13
|
+
/** The overview is always there; these are the pages a Tenant may move or switch off. */
|
|
14
|
+
export const PORTAL_PAGES = ["profile", "security", "plan", "privacy", "recovery", "support"] as const;
|
|
15
|
+
export type PortalPage = (typeof PORTAL_PAGES)[number];
|
|
16
|
+
|
|
17
|
+
export const PORTAL_PAGE_MODES = ["portal", "redirect", "off"] as const;
|
|
18
|
+
export type PortalPageMode = (typeof PORTAL_PAGE_MODES)[number];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Move, never remove: keeping an account safe (`security`) and taking one's
|
|
22
|
+
* data or leaving (`privacy`) must stay reachable. `plan` may be off only
|
|
23
|
+
* when the Tenant bills; what the platform bills, the person must be able to
|
|
24
|
+
* change or cancel (`portalOptionProblems`). `recovery` is the owner's
|
|
25
|
+
* vault recovery page (ADR-050 §2): switching it off leaves recoveries
|
|
26
|
+
* already set up working, because the contact, helper and claimant pages
|
|
27
|
+
* are always on the portal.
|
|
28
|
+
*/
|
|
29
|
+
export const PORTAL_PAGE_ALLOWED: Record<PortalPage, readonly PortalPageMode[]> = {
|
|
30
|
+
profile: ["portal", "redirect", "off"],
|
|
31
|
+
security: ["portal", "redirect"],
|
|
32
|
+
plan: ["portal", "redirect", "off"],
|
|
33
|
+
privacy: ["portal", "redirect"],
|
|
34
|
+
recovery: ["portal", "redirect", "off"],
|
|
35
|
+
// Support (ADR-058 §12, build notes): shown by default, but only while the Tenant keeps tickets with its Customers on; the Interface API reports it off otherwise.
|
|
36
|
+
support: ["portal", "redirect", "off"],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Where each page lives in the portal. */
|
|
40
|
+
export const PORTAL_PAGE_PATHS: Record<PortalPage, string> = { profile: "/profile", security: "/security", plan: "/plan", privacy: "/privacy", recovery: "/recovery", support: "/support" };
|
|
41
|
+
|
|
42
|
+
export const PORTAL_REDIRECT_URL_MAX = 2000;
|
|
43
|
+
|
|
44
|
+
export interface PortalPageSetting {
|
|
45
|
+
mode: PortalPageMode;
|
|
46
|
+
/** With `redirect` only: an http(s) URL in the Tenant's application. */
|
|
47
|
+
url?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type PortalOptions = Record<PortalSwitch, boolean> & { pages: Record<PortalPage, PortalPageSetting> };
|
|
51
|
+
|
|
52
|
+
export function defaultPortalOptions(): PortalOptions {
|
|
53
|
+
return {
|
|
54
|
+
account_link: true,
|
|
55
|
+
open_app: true,
|
|
56
|
+
back_link: true,
|
|
57
|
+
language_menu: true,
|
|
58
|
+
appearance: true,
|
|
59
|
+
pages: { profile: { mode: "portal" }, security: { mode: "portal" }, plan: { mode: "portal" }, privacy: { mode: "portal" }, recovery: { mode: "portal" }, support: { mode: "portal" } },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** An http(s) URL a portal may send a person to; null otherwise. */
|
|
64
|
+
export function portalRedirectUrl(v: unknown): string | null {
|
|
65
|
+
if (typeof v !== "string" || !v || v.length > PORTAL_REDIRECT_URL_MAX) return null;
|
|
66
|
+
try {
|
|
67
|
+
const u = new URL(v);
|
|
68
|
+
return (u.protocol === "https:" || u.protocol === "http:") && !u.username && !u.password ? u.toString() : null;
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The rules a stored set of options must keep, beyond its shape: the modes a
|
|
76
|
+
* page allows, a URL with every redirect and only there, and the plan page
|
|
77
|
+
* while the platform bills. One entry per problem, with its path under
|
|
78
|
+
* `portal`. The Engine's Tenant schema reports them as `422`.
|
|
79
|
+
*/
|
|
80
|
+
export function portalOptionProblems(raw: unknown, ctx: { collection?: string } = {}): { path: (string | number)[]; message: string }[] {
|
|
81
|
+
const out: { path: (string | number)[]; message: string }[] = [];
|
|
82
|
+
const pages = raw && typeof raw === "object" ? (raw as { pages?: unknown }).pages : undefined;
|
|
83
|
+
if (!pages || typeof pages !== "object") return out;
|
|
84
|
+
for (const page of PORTAL_PAGES) {
|
|
85
|
+
const s = (pages as Record<string, unknown>)[page];
|
|
86
|
+
if (!s || typeof s !== "object") continue;
|
|
87
|
+
const { mode, url } = s as { mode?: unknown; url?: unknown };
|
|
88
|
+
if (typeof mode === "string" && (PORTAL_PAGE_MODES as readonly string[]).includes(mode) && !PORTAL_PAGE_ALLOWED[page].includes(mode as PortalPageMode))
|
|
89
|
+
out.push({ path: ["pages", page, "mode"], message: `the ${page} page can be moved to the Tenant's application but not switched off` });
|
|
90
|
+
if (mode === "redirect" && !portalRedirectUrl(url)) out.push({ path: ["pages", page, "url"], message: "a redirect needs an http(s) URL" });
|
|
91
|
+
if (mode !== "redirect" && url !== undefined) out.push({ path: ["pages", page, "url"], message: "a URL goes with mode redirect only" });
|
|
92
|
+
if (page === "plan" && mode === "off" && ctx.collection === "connected") out.push({ path: ["pages", "plan", "mode"], message: "while the platform bills, the plan page can be moved but not switched off: a person must be able to change or cancel" });
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Stored or presented options as the portal reads them: every switch and page
|
|
99
|
+
* filled, anything odd or missing back to its default, so an old record, an
|
|
100
|
+
* old Interface API or a value that no longer validates never breaks a page.
|
|
101
|
+
*/
|
|
102
|
+
export function resolvePortalOptions(raw: unknown, ctx: { collection?: string } = {}): PortalOptions {
|
|
103
|
+
const out = defaultPortalOptions();
|
|
104
|
+
if (!raw || typeof raw !== "object") return out;
|
|
105
|
+
const r = raw as Record<string, unknown>;
|
|
106
|
+
for (const k of PORTAL_SWITCHES) if (typeof r[k] === "boolean") out[k] = r[k] as boolean;
|
|
107
|
+
const pages = r.pages && typeof r.pages === "object" ? (r.pages as Record<string, unknown>) : {};
|
|
108
|
+
for (const page of PORTAL_PAGES) {
|
|
109
|
+
const s = pages[page] as { mode?: unknown; url?: unknown } | undefined;
|
|
110
|
+
if (!s || typeof s !== "object" || typeof s.mode !== "string" || !PORTAL_PAGE_ALLOWED[page].includes(s.mode as PortalPageMode)) continue;
|
|
111
|
+
if (s.mode === "redirect") {
|
|
112
|
+
const url = portalRedirectUrl(s.url);
|
|
113
|
+
if (url) out.pages[page] = { mode: "redirect", url };
|
|
114
|
+
} else if (!(page === "plan" && s.mode === "off" && ctx.collection === "connected")) out.pages[page] = { mode: s.mode as PortalPageMode };
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Where a link to a page goes: the portal's own path, the Tenant's URL (`external`), or nowhere when the page is off. */
|
|
120
|
+
export function portalPageTarget(options: PortalOptions, page: PortalPage): { href: string; external: boolean } | null {
|
|
121
|
+
const s = options.pages[page];
|
|
122
|
+
if (s.mode === "off") return null;
|
|
123
|
+
if (s.mode === "redirect" && s.url) return { href: s.url, external: true };
|
|
124
|
+
return { href: PORTAL_PAGE_PATHS[page], external: false };
|
|
125
|
+
}
|
package/src/reads.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading cheaply (Tenant changeset 018). Every Interface API call costs a
|
|
3
|
+
* round trip and its own Postgres, Redis and OpenBao work, so a screen built
|
|
4
|
+
* from fewer calls is faster than one built from fast calls.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** `GET /v0/events?subjects=…` takes at most this many ARIDs; split a longer list into several calls. */
|
|
8
|
+
export const EVENTS_SUBJECTS_MAX = 100;
|
|
9
|
+
|
|
10
|
+
/** `GET /v0/notifications/count`: what a badge needs, without reading a Notification. */
|
|
11
|
+
export interface NotificationCount {
|
|
12
|
+
/** Notifications addressed to the session's Principals. */
|
|
13
|
+
total: number;
|
|
14
|
+
/** Of those, the ones not acknowledged yet (`pending`, `delivered` or `failed`). */
|
|
15
|
+
unacknowledged: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** One backend's share of a request: how many calls and their summed time in milliseconds. */
|
|
19
|
+
export interface ServerTimingEntry {
|
|
20
|
+
count: number;
|
|
21
|
+
ms: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What one Interface API request cost, read from its `Server-Timing` header.
|
|
26
|
+
* The stack sends the header only where it is configured to (the local stack
|
|
27
|
+
* does; production does not). Concurrent calls overlap, so a sum may exceed
|
|
28
|
+
* `app`.
|
|
29
|
+
*/
|
|
30
|
+
export interface ServerTiming {
|
|
31
|
+
/** Postgres queries; the time includes any wait for a free connection. */
|
|
32
|
+
pg: ServerTimingEntry;
|
|
33
|
+
/** OpenBao requests: decryption, HMACs. A batch of many items is one request. */
|
|
34
|
+
bao: ServerTimingEntry;
|
|
35
|
+
/** Redis commands: the session, cached relations, policies and Definitions. */
|
|
36
|
+
redis: ServerTimingEntry;
|
|
37
|
+
/** The whole request inside the Interface API, in milliseconds. */
|
|
38
|
+
app: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Parse a `Server-Timing` header from the Interface API (`res.headers.get("server-timing")`
|
|
43
|
+
* on a kit `Response`). `null` when the header is absent or carries none of its metrics.
|
|
44
|
+
*/
|
|
45
|
+
export function parseServerTiming(header: string | null | undefined): ServerTiming | null {
|
|
46
|
+
if (!header) return null;
|
|
47
|
+
const out: ServerTiming = { pg: { count: 0, ms: 0 }, bao: { count: 0, ms: 0 }, redis: { count: 0, ms: 0 }, app: 0 };
|
|
48
|
+
let seen = false;
|
|
49
|
+
for (const metric of header.split(",")) {
|
|
50
|
+
const [name, ...params] = metric.trim().split(";");
|
|
51
|
+
let dur = 0;
|
|
52
|
+
let desc = "";
|
|
53
|
+
for (const p of params) {
|
|
54
|
+
const eq = p.indexOf("=");
|
|
55
|
+
if (eq < 0) continue;
|
|
56
|
+
const key = p.slice(0, eq).trim();
|
|
57
|
+
const value = p.slice(eq + 1).trim().replace(/^"(.*)"$/, "$1");
|
|
58
|
+
if (key === "dur") dur = Number(value) || 0;
|
|
59
|
+
else if (key === "desc") desc = value;
|
|
60
|
+
}
|
|
61
|
+
const key = name.trim();
|
|
62
|
+
if (key === "app") {
|
|
63
|
+
out.app = dur;
|
|
64
|
+
seen = true;
|
|
65
|
+
} else if (key === "pg" || key === "bao" || key === "redis") {
|
|
66
|
+
out[key] = { count: Number.parseInt(desc, 10) || 0, ms: dur };
|
|
67
|
+
seen = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return seen ? out : null;
|
|
71
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2048 words a recovery card is written in (ADR-050 §4): the BIP-39 English
|
|
3
|
+
* list, unchanged and in its order, so a word's index is its 11-bit value. One
|
|
4
|
+
* list for every language. Source: github.com/bitcoin/bips, bip-0039/english.txt
|
|
5
|
+
* (SHA-256 2f5eed53a4727b4bf8880d8f3f199efc90e58503646d9ff8eff3a2ed3b24dbda).
|
|
6
|
+
*/
|
|
7
|
+
export const RECOVERY_WORDS: readonly string[] = (
|
|
8
|
+
"abandon ability able about above absent absorb abstract absurd abuse access accident account accuse " +
|
|
9
|
+
"achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust " +
|
|
10
|
+
"admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport " +
|
|
11
|
+
"aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always " +
|
|
12
|
+
"amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce " +
|
|
13
|
+
"annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic " +
|
|
14
|
+
"area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask " +
|
|
15
|
+
"aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit " +
|
|
16
|
+
"august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby " +
|
|
17
|
+
"bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel base basic " +
|
|
18
|
+
"basket battle beach bean beauty because become beef before begin behave behind believe below belt bench " +
|
|
19
|
+
"benefit best betray better between beyond bicycle bid bike bind biology bird birth bitter black blade " +
|
|
20
|
+
"blame blanket blast bleak bless blind blood blossom blouse blue blur blush board boat body boil bomb " +
|
|
21
|
+
"bone bonus book boost border boring borrow boss bottom bounce box boy bracket brain brand brass brave " +
|
|
22
|
+
"bread breeze brick bridge brief bright bring brisk broccoli broken bronze broom brother brown brush " +
|
|
23
|
+
"bubble buddy budget buffalo build bulb bulk bullet bundle bunker burden burger burst bus business busy " +
|
|
24
|
+
"butter buyer buzz cabbage cabin cable cactus cage cake call calm camera camp can canal cancel candy " +
|
|
25
|
+
"cannon canoe canvas canyon capable capital captain car carbon card cargo carpet carry cart case cash " +
|
|
26
|
+
"casino castle casual cat catalog catch category cattle caught cause caution cave ceiling celery cement " +
|
|
27
|
+
"census century cereal certain chair chalk champion change chaos chapter charge chase chat cheap check " +
|
|
28
|
+
"cheese chef cherry chest chicken chief child chimney choice choose chronic chuckle chunk churn cigar " +
|
|
29
|
+
"cinnamon circle citizen city civil claim clap clarify claw clay clean clerk clever click client cliff " +
|
|
30
|
+
"climb clinic clip clock clog close cloth cloud clown club clump cluster clutch coach coast coconut code " +
|
|
31
|
+
"coffee coil coin collect color column combine come comfort comic common company concert conduct confirm " +
|
|
32
|
+
"congress connect consider control convince cook cool copper copy coral core corn correct cost cotton " +
|
|
33
|
+
"couch country couple course cousin cover coyote crack cradle craft cram crane crash crater crawl crazy " +
|
|
34
|
+
"cream credit creek crew cricket crime crisp critic crop cross crouch crowd crucial cruel cruise crumble " +
|
|
35
|
+
"crunch crush cry crystal cube culture cup cupboard curious current curtain curve cushion custom cute " +
|
|
36
|
+
"cycle dad damage damp dance danger daring dash daughter dawn day deal debate debris decade december " +
|
|
37
|
+
"decide decline decorate decrease deer defense define defy degree delay deliver demand demise denial " +
|
|
38
|
+
"dentist deny depart depend deposit depth deputy derive describe desert design desk despair destroy " +
|
|
39
|
+
"detail detect develop device devote diagram dial diamond diary dice diesel diet differ digital dignity " +
|
|
40
|
+
"dilemma dinner dinosaur direct dirt disagree discover disease dish dismiss disorder display distance " +
|
|
41
|
+
"divert divide divorce dizzy doctor document dog doll dolphin domain donate donkey donor door dose double " +
|
|
42
|
+
"dove draft dragon drama drastic draw dream dress drift drill drink drip drive drop drum dry duck dumb " +
|
|
43
|
+
"dune during dust dutch duty dwarf dynamic eager eagle early earn earth easily east easy echo ecology " +
|
|
44
|
+
"economy edge edit educate effort egg eight either elbow elder electric elegant element elephant elevator " +
|
|
45
|
+
"elite else embark embody embrace emerge emotion employ empower empty enable enact end endless endorse " +
|
|
46
|
+
"enemy energy enforce engage engine enhance enjoy enlist enough enrich enroll ensure enter entire entry " +
|
|
47
|
+
"envelope episode equal equip era erase erode erosion error erupt escape essay essence estate eternal " +
|
|
48
|
+
"ethics evidence evil evoke evolve exact example excess exchange excite exclude excuse execute exercise " +
|
|
49
|
+
"exhaust exhibit exile exist exit exotic expand expect expire explain expose express extend extra eye " +
|
|
50
|
+
"eyebrow fabric face faculty fade faint faith fall false fame family famous fan fancy fantasy farm " +
|
|
51
|
+
"fashion fat fatal father fatigue fault favorite feature february federal fee feed feel female fence " +
|
|
52
|
+
"festival fetch fever few fiber fiction field figure file film filter final find fine finger finish fire " +
|
|
53
|
+
"firm first fiscal fish fit fitness fix flag flame flash flat flavor flee flight flip float flock floor " +
|
|
54
|
+
"flower fluid flush fly foam focus fog foil fold follow food foot force forest forget fork fortune forum " +
|
|
55
|
+
"forward fossil foster found fox fragile frame frequent fresh friend fringe frog front frost frown frozen " +
|
|
56
|
+
"fruit fuel fun funny furnace fury future gadget gain galaxy gallery game gap garage garbage garden " +
|
|
57
|
+
"garlic garment gas gasp gate gather gauge gaze general genius genre gentle genuine gesture ghost giant " +
|
|
58
|
+
"gift giggle ginger giraffe girl give glad glance glare glass glide glimpse globe gloom glory glove glow " +
|
|
59
|
+
"glue goat goddess gold good goose gorilla gospel gossip govern gown grab grace grain grant grape grass " +
|
|
60
|
+
"gravity great green grid grief grit grocery group grow grunt guard guess guide guilt guitar gun gym " +
|
|
61
|
+
"habit hair half hammer hamster hand happy harbor hard harsh harvest hat have hawk hazard head health " +
|
|
62
|
+
"heart heavy hedgehog height hello helmet help hen hero hidden high hill hint hip hire history hobby " +
|
|
63
|
+
"hockey hold hole holiday hollow home honey hood hope horn horror horse hospital host hotel hour hover " +
|
|
64
|
+
"hub huge human humble humor hundred hungry hunt hurdle hurry hurt husband hybrid ice icon idea identify " +
|
|
65
|
+
"idle ignore ill illegal illness image imitate immense immune impact impose improve impulse inch include " +
|
|
66
|
+
"income increase index indicate indoor industry infant inflict inform inhale inherit initial inject " +
|
|
67
|
+
"injury inmate inner innocent input inquiry insane insect inside inspire install intact interest into " +
|
|
68
|
+
"invest invite involve iron island isolate issue item ivory jacket jaguar jar jazz jealous jeans jelly " +
|
|
69
|
+
"jewel job join joke journey joy judge juice jump jungle junior junk just kangaroo keen keep ketchup key " +
|
|
70
|
+
"kick kid kidney kind kingdom kiss kit kitchen kite kitten kiwi knee knife knock know lab label labor " +
|
|
71
|
+
"ladder lady lake lamp language laptop large later latin laugh laundry lava law lawn lawsuit layer lazy " +
|
|
72
|
+
"leader leaf learn leave lecture left leg legal legend leisure lemon lend length lens leopard lesson " +
|
|
73
|
+
"letter level liar liberty library license life lift light like limb limit link lion liquid list little " +
|
|
74
|
+
"live lizard load loan lobster local lock logic lonely long loop lottery loud lounge love loyal lucky " +
|
|
75
|
+
"luggage lumber lunar lunch luxury lyrics machine mad magic magnet maid mail main major make mammal man " +
|
|
76
|
+
"manage mandate mango mansion manual maple marble march margin marine market marriage mask mass master " +
|
|
77
|
+
"match material math matrix matter maximum maze meadow mean measure meat mechanic medal media melody melt " +
|
|
78
|
+
"member memory mention menu mercy merge merit merry mesh message metal method middle midnight milk " +
|
|
79
|
+
"million mimic mind minimum minor minute miracle mirror misery miss mistake mix mixed mixture mobile " +
|
|
80
|
+
"model modify mom moment monitor monkey monster month moon moral more morning mosquito mother motion " +
|
|
81
|
+
"motor mountain mouse move movie much muffin mule multiply muscle museum mushroom music must mutual " +
|
|
82
|
+
"myself mystery myth naive name napkin narrow nasty nation nature near neck need negative neglect neither " +
|
|
83
|
+
"nephew nerve nest net network neutral never news next nice night noble noise nominee noodle normal north " +
|
|
84
|
+
"nose notable note nothing notice novel now nuclear number nurse nut oak obey object oblige obscure " +
|
|
85
|
+
"observe obtain obvious occur ocean october odor off offer office often oil okay old olive olympic omit " +
|
|
86
|
+
"once one onion online only open opera opinion oppose option orange orbit orchard order ordinary organ " +
|
|
87
|
+
"orient original orphan ostrich other outdoor outer output outside oval oven over own owner oxygen oyster " +
|
|
88
|
+
"ozone pact paddle page pair palace palm panda panel panic panther paper parade parent park parrot party " +
|
|
89
|
+
"pass patch path patient patrol pattern pause pave payment peace peanut pear peasant pelican pen penalty " +
|
|
90
|
+
"pencil people pepper perfect permit person pet phone photo phrase physical piano picnic picture piece " +
|
|
91
|
+
"pig pigeon pill pilot pink pioneer pipe pistol pitch pizza place planet plastic plate play please pledge " +
|
|
92
|
+
"pluck plug plunge poem poet point polar pole police pond pony pool popular portion position possible " +
|
|
93
|
+
"post potato pottery poverty powder power practice praise predict prefer prepare present pretty prevent " +
|
|
94
|
+
"price pride primary print priority prison private prize problem process produce profit program project " +
|
|
95
|
+
"promote proof property prosper protect proud provide public pudding pull pulp pulse pumpkin punch pupil " +
|
|
96
|
+
"puppy purchase purity purpose purse push put puzzle pyramid quality quantum quarter question quick quit " +
|
|
97
|
+
"quiz quote rabbit raccoon race rack radar radio rail rain raise rally ramp ranch random range rapid rare " +
|
|
98
|
+
"rate rather raven raw razor ready real reason rebel rebuild recall receive recipe record recycle reduce " +
|
|
99
|
+
"reflect reform refuse region regret regular reject relax release relief rely remain remember remind " +
|
|
100
|
+
"remove render renew rent reopen repair repeat replace report require rescue resemble resist resource " +
|
|
101
|
+
"response result retire retreat return reunion reveal review reward rhythm rib ribbon rice rich ride " +
|
|
102
|
+
"ridge rifle right rigid ring riot ripple risk ritual rival river road roast robot robust rocket romance " +
|
|
103
|
+
"roof rookie room rose rotate rough round route royal rubber rude rug rule run runway rural sad saddle " +
|
|
104
|
+
"sadness safe sail salad salmon salon salt salute same sample sand satisfy satoshi sauce sausage save say " +
|
|
105
|
+
"scale scan scare scatter scene scheme school science scissors scorpion scout scrap screen script scrub " +
|
|
106
|
+
"sea search season seat second secret section security seed seek segment select sell seminar senior sense " +
|
|
107
|
+
"sentence series service session settle setup seven shadow shaft shallow share shed shell sheriff shield " +
|
|
108
|
+
"shift shine ship shiver shock shoe shoot shop short shoulder shove shrimp shrug shuffle shy sibling sick " +
|
|
109
|
+
"side siege sight sign silent silk silly silver similar simple since sing siren sister situate six size " +
|
|
110
|
+
"skate sketch ski skill skin skirt skull slab slam sleep slender slice slide slight slim slogan slot slow " +
|
|
111
|
+
"slush small smart smile smoke smooth snack snake snap sniff snow soap soccer social sock soda soft solar " +
|
|
112
|
+
"soldier solid solution solve someone song soon sorry sort soul sound soup source south space spare " +
|
|
113
|
+
"spatial spawn speak special speed spell spend sphere spice spider spike spin spirit split spoil sponsor " +
|
|
114
|
+
"spoon sport spot spray spread spring spy square squeeze squirrel stable stadium staff stage stairs stamp " +
|
|
115
|
+
"stand start state stay steak steel stem step stereo stick still sting stock stomach stone stool story " +
|
|
116
|
+
"stove strategy street strike strong struggle student stuff stumble style subject submit subway success " +
|
|
117
|
+
"such sudden suffer sugar suggest suit summer sun sunny sunset super supply supreme sure surface surge " +
|
|
118
|
+
"surprise surround survey suspect sustain swallow swamp swap swarm swear sweet swift swim swing switch " +
|
|
119
|
+
"sword symbol symptom syrup system table tackle tag tail talent talk tank tape target task taste tattoo " +
|
|
120
|
+
"taxi teach team tell ten tenant tennis tent term test text thank that theme then theory there they thing " +
|
|
121
|
+
"this thought three thrive throw thumb thunder ticket tide tiger tilt timber time tiny tip tired tissue " +
|
|
122
|
+
"title toast tobacco today toddler toe together toilet token tomato tomorrow tone tongue tonight tool " +
|
|
123
|
+
"tooth top topic topple torch tornado tortoise toss total tourist toward tower town toy track trade " +
|
|
124
|
+
"traffic tragic train transfer trap trash travel tray treat tree trend trial tribe trick trigger trim " +
|
|
125
|
+
"trip trophy trouble truck true truly trumpet trust truth try tube tuition tumble tuna tunnel turkey turn " +
|
|
126
|
+
"turtle twelve twenty twice twin twist two type typical ugly umbrella unable unaware uncle uncover under " +
|
|
127
|
+
"undo unfair unfold unhappy uniform unique unit universe unknown unlock until unusual unveil update " +
|
|
128
|
+
"upgrade uphold upon upper upset urban urge usage use used useful useless usual utility vacant vacuum " +
|
|
129
|
+
"vague valid valley valve van vanish vapor various vast vault vehicle velvet vendor venture venue verb " +
|
|
130
|
+
"verify version very vessel veteran viable vibrant vicious victory video view village vintage violin " +
|
|
131
|
+
"virtual virus visa visit visual vital vivid vocal voice void volcano volume vote voyage wage wagon wait " +
|
|
132
|
+
"walk wall walnut want warfare warm warrior wash wasp waste water wave way wealth weapon wear weasel " +
|
|
133
|
+
"weather web wedding weekend weird welcome west wet whale what wheat wheel when where whip whisper wide " +
|
|
134
|
+
"width wife wild will win window wine wing wink winner winter wire wisdom wise wish witness wolf woman " +
|
|
135
|
+
"wonder wood wool word work world worry worth wrap wreck wrestle wrist write wrong yard year yellow you " +
|
|
136
|
+
"young youth zebra zero zone zoo"
|
|
137
|
+
).split(" ");
|