@clavis.nexus/setup 1.0.2 → 3.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/README.md +87 -23
- package/dist/cli.js +1159 -463
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +114 -13
- package/dist/index.js +847 -370
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +972 -390
- package/dist/mcp.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/** The regions an app accepts new connections from. They are stored in this order. */
|
|
2
|
+
declare const APP_REGIONS: readonly ["JP", "US", "GB", "EEA"];
|
|
3
|
+
type AppRegion = (typeof APP_REGIONS)[number];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Steps that require a human (browser or infrastructure).
|
|
7
|
+
* `terms` is an agreement only the customer can give: the Customer Terms, or the provision of billing data for a card checkout.
|
|
8
|
+
*/
|
|
9
|
+
type NeedsHuman = "passkey" | "payment" | "dns" | "login" | "terms";
|
|
3
10
|
type SetupOrigins = {
|
|
4
11
|
apiOrigin: string;
|
|
5
12
|
idOrigin: string;
|
|
@@ -10,12 +17,16 @@ type DevelopersSession = {
|
|
|
10
17
|
sub?: string;
|
|
11
18
|
expiresAt?: number;
|
|
12
19
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A holder receipt (`receipt@1`): Clavis's countersignature that it accepted a statement signed with
|
|
22
|
+
* a passkey. Pass it as `receipt` in the body of an Org step.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* A holder receipt (`receipt@1`). Carry it as the JSON string Clavis returned and pass it on to where
|
|
26
|
+
* it is consumed, the Org API, without parsing it. To read what it holds, give it to the verifier,
|
|
27
|
+
* `createVerifier` in `@clavis.nexus/app`.
|
|
28
|
+
*/
|
|
29
|
+
type Receipt = string;
|
|
19
30
|
type HumanAction = {
|
|
20
31
|
needs_human: NeedsHuman;
|
|
21
32
|
message: string;
|
|
@@ -29,6 +40,14 @@ type SetupResult<T> = {
|
|
|
29
40
|
error: string;
|
|
30
41
|
human?: HumanAction;
|
|
31
42
|
};
|
|
43
|
+
/** The place of incorporation declared. `terms_current` says whether the declaration binds the current Customer Terms and DPA versions. */
|
|
44
|
+
type OrgCardIncorporation = {
|
|
45
|
+
code: string;
|
|
46
|
+
at: number;
|
|
47
|
+
customer_terms_version: string;
|
|
48
|
+
dpa_version: string;
|
|
49
|
+
terms_current: boolean;
|
|
50
|
+
};
|
|
32
51
|
type SetupStatusReport = {
|
|
33
52
|
logged_in: boolean;
|
|
34
53
|
sub?: string;
|
|
@@ -39,16 +58,66 @@ type SetupStatusReport = {
|
|
|
39
58
|
org_status: string;
|
|
40
59
|
setup_complete: boolean;
|
|
41
60
|
signature_card: "unknown" | "active" | "inactive";
|
|
61
|
+
/** What holds the signature card back, when `signature_card` is `inactive`. */
|
|
62
|
+
signature_card_blockers?: string[];
|
|
63
|
+
/** The place of incorporation. Null means none is declared. It is left out when the card could not be read. */
|
|
64
|
+
incorporation?: {
|
|
65
|
+
code: string;
|
|
66
|
+
terms_current: boolean;
|
|
67
|
+
} | null;
|
|
42
68
|
apps: Array<{
|
|
43
69
|
app_id: string;
|
|
44
70
|
host: string;
|
|
45
71
|
status: string;
|
|
46
72
|
declaration_ok: boolean;
|
|
73
|
+
/** The regions new connections are accepted from. Left out, it is every region Clavis accepts. */
|
|
74
|
+
accepted_regions?: string[];
|
|
47
75
|
}>;
|
|
48
76
|
}>;
|
|
49
77
|
};
|
|
50
78
|
declare const DEFAULT_ORIGINS: SetupOrigins;
|
|
51
79
|
|
|
80
|
+
/** What to pass to checkout for the signature card. */
|
|
81
|
+
type CardCheckoutOptions = {
|
|
82
|
+
/** `meter`, which is metered and the default, or `bundle`, the monthly bundle. */
|
|
83
|
+
offer?: "meter" | "bundle";
|
|
84
|
+
/**
|
|
85
|
+
* Set this true only once the customer has consented to their billing data going to the payment
|
|
86
|
+
* provider in the United States, for payment and billing. Whether to consent is the customer's
|
|
87
|
+
* decision, and the SDK never sets it true by default.
|
|
88
|
+
*/
|
|
89
|
+
consentBillingData?: boolean;
|
|
90
|
+
/** The language the consent statement is shown in, `en` or `ja`, defaulting to `en`. The purchase record is tied to the statement in that language. */
|
|
91
|
+
lang?: "en" | "ja";
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The statement to sign. `type` is the type ID, `<name>@<version>`, and the other fields are the ones
|
|
96
|
+
* that type fixes. Clavis builds the statement it expects from the same material and refuses anything
|
|
97
|
+
* that does not match under JCS (400 `STATEMENT_MISMATCH`). Put the field values in the same form
|
|
98
|
+
* Clavis uses: domains lowercased, regions with no duplicates and in ascending order.
|
|
99
|
+
*/
|
|
100
|
+
type Statement = {
|
|
101
|
+
type: string;
|
|
102
|
+
[field: string]: unknown;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* What the customer declares and agrees to when an Org is created.
|
|
107
|
+
* Pass it to both org-anchor-plan, which is the challenge, and org-verify-anchor. Declaring the place
|
|
108
|
+
* of incorporation again with incorporation-set takes the same thing.
|
|
109
|
+
*/
|
|
110
|
+
type OrgCreationTerms = {
|
|
111
|
+
/** The place of incorporation: `JP`, `GB-EAW`, an EEA country code, or `US-XX`. */
|
|
112
|
+
incorporation?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Set this true only once the customer has agreed to the Customer Terms and the Data Processing
|
|
115
|
+
* Agreement (DPA). Whether to agree is the customer's decision, and the SDK never sets it true by
|
|
116
|
+
* default.
|
|
117
|
+
*/
|
|
118
|
+
acceptCustomerTerms?: boolean;
|
|
119
|
+
};
|
|
120
|
+
|
|
52
121
|
type StoredSetupSession = {
|
|
53
122
|
v: 1;
|
|
54
123
|
origins: SetupOrigins;
|
|
@@ -80,12 +149,15 @@ type SetupClient = {
|
|
|
80
149
|
cleared: true;
|
|
81
150
|
}>>;
|
|
82
151
|
status(): Promise<SetupResult<SetupStatusReport>>;
|
|
83
|
-
|
|
152
|
+
/** terms: the place of incorporation, and the customer's agreement to the Customer Terms. With either missing, or the place closed, it is refused before the passkey. */
|
|
153
|
+
orgAnchorPlan(domain: string, name?: string, terms?: OrgCreationTerms): Promise<SetupResult<{
|
|
84
154
|
domain: string;
|
|
85
155
|
name?: string;
|
|
156
|
+
incorporation: string;
|
|
86
157
|
nonce: string;
|
|
87
158
|
exp: number;
|
|
88
|
-
|
|
159
|
+
/** The statement signed into the published manifest's `receipt` (`org.anchor.publish@1`) */
|
|
160
|
+
statement: Statement;
|
|
89
161
|
well_known_url: string;
|
|
90
162
|
txt_host: string;
|
|
91
163
|
ceremony_url: string;
|
|
@@ -110,7 +182,7 @@ type SetupClient = {
|
|
|
110
182
|
domain: string;
|
|
111
183
|
nonce: string;
|
|
112
184
|
name?: string;
|
|
113
|
-
}): Promise<SetupResult<{
|
|
185
|
+
} & OrgCreationTerms): Promise<SetupResult<{
|
|
114
186
|
org_id: string;
|
|
115
187
|
org_status: string;
|
|
116
188
|
}>>;
|
|
@@ -118,7 +190,23 @@ type SetupClient = {
|
|
|
118
190
|
policy_revision_hash: string;
|
|
119
191
|
already_active: boolean;
|
|
120
192
|
}>>;
|
|
121
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Declare the place of incorporation, with a passkey. The declaration binds the current Customer
|
|
195
|
+
* Terms and DPA versions, so it needs the customer's agreement. After those versions move, declare
|
|
196
|
+
* again before a purchase.
|
|
197
|
+
*/
|
|
198
|
+
incorporationSet(args: {
|
|
199
|
+
orgId: string;
|
|
200
|
+
} & OrgCreationTerms): Promise<SetupResult<{
|
|
201
|
+
incorporation: OrgCardIncorporation | null;
|
|
202
|
+
unchanged?: true;
|
|
203
|
+
}>>;
|
|
204
|
+
/**
|
|
205
|
+
* Open checkout for the signature card. It needs a place of incorporation declared against the
|
|
206
|
+
* current versions, and the customer's consent to provide billing data. After the passkey, a person
|
|
207
|
+
* enters the card in the browser.
|
|
208
|
+
*/
|
|
209
|
+
cardCheckout(orgId: string, opts?: CardCheckoutOptions): Promise<SetupResult<{
|
|
122
210
|
url: string;
|
|
123
211
|
human: HumanAction;
|
|
124
212
|
}>>;
|
|
@@ -158,6 +246,19 @@ type SetupClient = {
|
|
|
158
246
|
}): Promise<SetupResult<{
|
|
159
247
|
declaration: unknown;
|
|
160
248
|
}>>;
|
|
249
|
+
/**
|
|
250
|
+
* Choose the regions the app accepts new connections from, with a passkey. Null goes back to every
|
|
251
|
+
* region Clavis accepts. The choice is limited to the regions Clavis accepts right now. Narrowing
|
|
252
|
+
* the list leaves the people already connected using the app.
|
|
253
|
+
*/
|
|
254
|
+
appRegionsSet(args: {
|
|
255
|
+
orgId: string;
|
|
256
|
+
appId: string;
|
|
257
|
+
regions: readonly string[] | null;
|
|
258
|
+
}): Promise<SetupResult<{
|
|
259
|
+
accepted_regions: AppRegion[] | null;
|
|
260
|
+
unchanged?: true;
|
|
261
|
+
}>>;
|
|
161
262
|
emitEnv(args: {
|
|
162
263
|
appId: string;
|
|
163
264
|
operatePrivateJwkJson?: string;
|
|
@@ -189,4 +290,4 @@ type OperateKeyPair = {
|
|
|
189
290
|
};
|
|
190
291
|
declare function generateOperateKeyPair(): Promise<OperateKeyPair>;
|
|
191
292
|
|
|
192
|
-
export { type CreateSetupClientOptions, DEFAULT_ORIGINS, type DevelopersSession, type HumanAction, type NeedsHuman, SetupApiError, type SetupClient, type SetupOrigins, type SetupResult, type SetupStatusReport,
|
|
293
|
+
export { APP_REGIONS, type AppRegion, type CardCheckoutOptions, type CreateSetupClientOptions, DEFAULT_ORIGINS, type DevelopersSession, type HumanAction, type NeedsHuman, type OrgCreationTerms, type Receipt, SetupApiError, type SetupClient, type SetupOrigins, type SetupResult, type SetupStatusReport, clearSession, createSetupClient, defaultSessionPath, formatEnvExport, generateOperateKeyPair, loadSession, originsFromEnv, saveSession };
|