authflow-cli 0.1.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/LICENSE +201 -0
- package/README.md +260 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +33 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/connect.d.ts +7 -0
- package/dist/commands/connect.js +84 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +16 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.js +182 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +24 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/mint-header.d.ts +2 -0
- package/dist/commands/mint-header.js +69 -0
- package/dist/commands/mint-header.js.map +1 -0
- package/dist/commands/probe.d.ts +2 -0
- package/dist/commands/probe.js +49 -0
- package/dist/commands/probe.js.map +1 -0
- package/dist/commands/register.d.ts +2 -0
- package/dist/commands/register.js +78 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/scaffold.d.ts +2 -0
- package/dist/commands/scaffold.js +72 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/set-origin.d.ts +6 -0
- package/dist/commands/set-origin.js +38 -0
- package/dist/commands/set-origin.js.map +1 -0
- package/dist/commands/signup.d.ts +2 -0
- package/dist/commands/signup.js +53 -0
- package/dist/commands/signup.js.map +1 -0
- package/dist/config.d.ts +47 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +13 -0
- package/dist/constants.js.map +1 -0
- package/dist/doctor.d.ts +24 -0
- package/dist/doctor.js +230 -0
- package/dist/doctor.js.map +1 -0
- package/dist/integration.d.ts +44 -0
- package/dist/integration.js +247 -0
- package/dist/integration.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +362 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/rail.d.ts +80 -0
- package/dist/rail.js +115 -0
- package/dist/rail.js.map +1 -0
- package/dist/secrets.d.ts +28 -0
- package/dist/secrets.js +117 -0
- package/dist/secrets.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Authflow LLC
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Authflow CLI
|
|
2
|
+
|
|
3
|
+
License: Apache-2.0. See [LICENSE](LICENSE).
|
|
4
|
+
|
|
5
|
+
Minimal TypeScript CLI for Authflow Rail onboarding. Wraps the public admin and Origin Protocol surfaces so a tenant can register a resource, connect Stripe, mint a local identity header, run the conformance probe, and scaffold the origin sidecar — without reading rail source.
|
|
6
|
+
|
|
7
|
+
`authflow mcp` exposes the same operations as an MCP server, so a coding agent can onboard a server against the codebase it already has open. The tenant-facing walkthrough is [Onboard with your agent](../../docs/onboarding/agent.md). Command reference: [`authflow mcp`](#authflow-mcp).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Published on npm as [`authflow-cli`](https://www.npmjs.com/package/authflow-cli). No repo checkout is required:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx -y authflow-cli --help
|
|
15
|
+
npx -y authflow-cli init --slug video --price 900 --credits 12
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or install globally: `npm install -g authflow-cli`.
|
|
19
|
+
|
|
20
|
+
## From this repo (development)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd sdk/cli
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
npx authflow --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
During development (no build step):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx tsx src/cli.ts --help
|
|
33
|
+
npm run authflow -- --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Config
|
|
37
|
+
|
|
38
|
+
| Env | Flag | Used by |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| `AUTHFLOW_ISSUER` | `--issuer` | all HTTP commands |
|
|
41
|
+
| `AUTHFLOW_ADMIN_API_KEY` | `--admin-key` | `init`, `register`, `connect`, `set-origin` (mint with `authflow signup`) |
|
|
42
|
+
| `AUTHFLOW_ORIGIN_API_KEY` | `--origin-key` | `mint-header`, `probe` |
|
|
43
|
+
| `AUTHFLOW_RESOURCE` / `AUTHFLOW_GATEWAY_URL` | `--gateway-url` / `--receipt` | curl hint on `mint-header` |
|
|
44
|
+
|
|
45
|
+
Issuer is the Origin Protocol issuer origin, with no trailing slash: staging is `https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net`, local is typically `https://localhost:7175`. For an already-registered resource it is the `issuer` field of the receipt. See [tenant quickstart §1](../../docs/onboarding/tenant-quickstart.md#environments-and-hostnames).
|
|
46
|
+
|
|
47
|
+
## Commands
|
|
48
|
+
|
|
49
|
+
### `authflow signup`
|
|
50
|
+
|
|
51
|
+
Mints a per-tenant admin API key. This is how a creator gets `AUTHFLOW_ADMIN_API_KEY` without the rail operator handing them one.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export AUTHFLOW_ISSUER=https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net
|
|
55
|
+
npx -y authflow-cli signup --email you@example.com
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The key (`afa_test_` on staging, `afa_live_` in production) is shown once and written to `.env.local` by default. It can only register and manage slugs created with that key. The operator bearer still exists as a super-admin.
|
|
59
|
+
|
|
60
|
+
### `authflow init`
|
|
61
|
+
|
|
62
|
+
The whole onboarding path in one command: register the resource, put the origin API key in a secret
|
|
63
|
+
store, print the config to paste into your MCP server, and probe the origin if it is already up.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export AUTHFLOW_ISSUER=https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net
|
|
67
|
+
export AUTHFLOW_ADMIN_API_KEY=…
|
|
68
|
+
|
|
69
|
+
authflow init --slug video --price 900 --credits 12
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Neither a Stripe account nor a deployed origin is required. Both are deferrable, in any order, and
|
|
73
|
+
omitting either registers a **draft**: priced and registered, with a receipt you can build against,
|
|
74
|
+
but not routable. That is the normal case — you rarely have a connected Stripe account or an origin
|
|
75
|
+
URL before you have built anything.
|
|
76
|
+
|
|
77
|
+
The receipt's `pending_requirements` lists what is still outstanding:
|
|
78
|
+
|
|
79
|
+
| Requirement | Clear it with |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `origin_base_uri` | `authflow set-origin --slug video --origin-url https://…` |
|
|
82
|
+
| `connected_account_id` | `authflow connect --slug video` |
|
|
83
|
+
| `stripe_onboarding_complete` | finish Stripe's form, then `authflow connect --slug video` again |
|
|
84
|
+
|
|
85
|
+
The resource goes live once the list is empty. Add `--connect` to `init` to get the Stripe
|
|
86
|
+
onboarding link from the first command instead of running `connect` separately.
|
|
87
|
+
|
|
88
|
+
Useful flags:
|
|
89
|
+
|
|
90
|
+
| Flag | Default | Meaning |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `--integration <dotnet\|proxy>` | `dotnet` | Which origin config to print |
|
|
93
|
+
| `--write-secrets <target>` | `user-secrets` | `user-secrets`, `env-file`, or `keyvault` |
|
|
94
|
+
| `--secret-destination <value>` | — | Project dir, env-file path, or vault name |
|
|
95
|
+
| `--connected-account <acct>` | — | Attach a Stripe account you already have |
|
|
96
|
+
| `--connect` | — | Start Stripe onboarding and print the hosted link |
|
|
97
|
+
| `--origin-url <url>` | — | Supply the origin now instead of later |
|
|
98
|
+
| `--no-probe` | — | Skip the conformance probe |
|
|
99
|
+
|
|
100
|
+
### `authflow connect`
|
|
101
|
+
|
|
102
|
+
Starts or resumes Stripe Connect Standard onboarding and prints the hosted link the creator opens to
|
|
103
|
+
complete KYC.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
authflow connect --slug video
|
|
107
|
+
authflow connect --slug video --wait # poll until Stripe reports the account can take charges
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Account links are single-use and expire in minutes. Re-running is the expected way to get a fresh
|
|
111
|
+
one: it resumes the same Stripe account rather than creating another, so retrying never leaves
|
|
112
|
+
abandoned accounts behind. Run it again after the form is submitted to confirm `charges_enabled` and
|
|
113
|
+
promote the resource.
|
|
114
|
+
|
|
115
|
+
### `authflow set-origin`
|
|
116
|
+
|
|
117
|
+
Points a draft at its origin, promoting it to live if nothing else is pending.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
authflow set-origin --slug video --origin-url https://video-xyz.azurecontainerapps.io
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Pass the base URI without `/mcp`; the gateway appends it.
|
|
124
|
+
|
|
125
|
+
### `authflow doctor`
|
|
126
|
+
|
|
127
|
+
Preflights a rail deployment before you spend time debugging your own origin.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
authflow doctor --issuer https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net --slug video
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Checks that the issuer is reachable, that the Origin Protocol keys document is served and
|
|
134
|
+
self-consistent (issuer byte-match, protocol version, a usable Ed25519 key, no private key
|
|
135
|
+
material), and — with `--slug` — that the resource's PRM document resolves and the gateway answers
|
|
136
|
+
an unauthenticated connect with a `401` carrying `resource_metadata`.
|
|
137
|
+
|
|
138
|
+
Run this first when anything looks broken. It separates the two failures that are indistinguishable
|
|
139
|
+
from the outside: a hostname that is not bound to the rail returns `404` on every path including
|
|
140
|
+
`/healthz`, which reads exactly like a broken endpoint. Exit code is non-zero on any failure.
|
|
141
|
+
|
|
142
|
+
### `authflow register`
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
export AUTHFLOW_ISSUER=https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net
|
|
146
|
+
export AUTHFLOW_ADMIN_API_KEY=…
|
|
147
|
+
authflow register --file resource.json --out receipt.json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`resource.json` uses the same snake_case fields as `POST /admin/resources` (see [tenant quickstart](../../docs/onboarding/tenant-quickstart.md) §3):
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"slug": "video",
|
|
155
|
+
"origin_base_uri": "https://video-xyz.azurecontainerapps.io",
|
|
156
|
+
"display_name": "Snyder Video",
|
|
157
|
+
"connected_account_id": "acct_…",
|
|
158
|
+
"currency": "usd",
|
|
159
|
+
"price_amount_minor": 900,
|
|
160
|
+
"credits_per_period": 12,
|
|
161
|
+
"price_version": 1
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`origin_base_uri` may be `null` or omitted, which registers a draft — see `authflow set-origin`.
|
|
166
|
+
|
|
167
|
+
Writes the registration receipt to `--out` (default `receipt.json`). By default that file contains
|
|
168
|
+
the one-time `origin_api_key` in plaintext, which is a credential you probably do not want on disk:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
authflow register --file resource.json --write-secrets user-secrets --secret-destination ./src/MyMcpServer
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
That stores the key and redacts it from the receipt. `env-file` writes `.env.local` (and adds it to
|
|
175
|
+
`.gitignore`); `keyvault` calls `az keyvault secret set` and needs `--secret-destination <vault>`.
|
|
176
|
+
|
|
177
|
+
Rotate a key later with the admin API: `POST /admin/resources/{slug}/rotate-origin-key`.
|
|
178
|
+
|
|
179
|
+
### `authflow mint-header`
|
|
180
|
+
|
|
181
|
+
Dev/staging only (`OriginProtocol:EnableDevEndpoints`). Mints a signed `X-Authflow-Identity` without OAuth.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
export AUTHFLOW_ORIGIN_API_KEY=afo_test_…
|
|
185
|
+
authflow mint-header --tier standard --ttl 90 --grant-credits 3 --receipt receipt.json
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Prints the header and, when a gateway URL is known, a ready-to-paste `curl` against it.
|
|
189
|
+
|
|
190
|
+
### `authflow probe`
|
|
191
|
+
|
|
192
|
+
Asks the rail to probe the registered origin with valid and deliberately broken identity headers.
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
authflow probe
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Renders a pass/fail table. Exit code is non-zero when any check fails or the origin is unreachable.
|
|
199
|
+
|
|
200
|
+
### `authflow scaffold`
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
authflow scaffold --receipt receipt.json --upstream http://upstream:3000
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Writes:
|
|
207
|
+
|
|
208
|
+
- `.env` — `AUTHFLOW_ISSUER`, `AUTHFLOW_RESOURCE`, `AUTHFLOW_ORIGIN_API_KEY`, `AUTHFLOW_UPSTREAM_BASE_URI`
|
|
209
|
+
- `docker-compose.authflow.yml` — `authflow-origin-proxy` in front of an upstream placeholder
|
|
210
|
+
|
|
211
|
+
See [origin-proxy.md](../../docs/onboarding/origin-proxy.md) for the forwarded-header contract and the
|
|
212
|
+
nonce-cache options.
|
|
213
|
+
|
|
214
|
+
### `authflow mcp`
|
|
215
|
+
|
|
216
|
+
Runs the onboarding operations as an MCP server on stdio, so a coding agent can do the onboarding
|
|
217
|
+
instead of a human running commands. The agent already has the creator's codebase; what it lacks is
|
|
218
|
+
a way to talk to the rail. This supplies exactly that, and nothing more — the server never reads or
|
|
219
|
+
writes source files. It hands back an integration plan and the agent applies it.
|
|
220
|
+
|
|
221
|
+
Add it to Cursor or Claude Desktop:
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"mcpServers": {
|
|
226
|
+
"authflow": {
|
|
227
|
+
"command": "npx",
|
|
228
|
+
"args": ["-y", "authflow-cli", "mcp"],
|
|
229
|
+
"env": {
|
|
230
|
+
"AUTHFLOW_ISSUER": "https://app-rail-railstg-4joi6asiofdcm.azurewebsites.net",
|
|
231
|
+
"AUTHFLOW_ADMIN_API_KEY": "…"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Tools:
|
|
239
|
+
|
|
240
|
+
| Tool | Does |
|
|
241
|
+
| --- | --- |
|
|
242
|
+
| `authflow_signup` | Mint a per-tenant admin API key (no existing credential) |
|
|
243
|
+
| `authflow_doctor` | Preflight the rail; distinguishes a bad hostname from an outage |
|
|
244
|
+
| `authflow_register_resource` | Register and price a resource; optionally store the key in a secret store |
|
|
245
|
+
| `authflow_get_resource` | Current receipt, `status`, and `pending_requirements` |
|
|
246
|
+
| `authflow_integration_plan` | Config, snippets, verification steps, and invariants for `dotnet`, `typescript`, `python`, or `proxy` |
|
|
247
|
+
| `authflow_start_stripe_connect` | Hosted Stripe onboarding link; resumable |
|
|
248
|
+
| `authflow_set_connected_account` | Attach an existing `acct_…` |
|
|
249
|
+
| `authflow_set_origin` | Supply the origin and promote to live |
|
|
250
|
+
| `authflow_probe` | Conformance probe against the origin |
|
|
251
|
+
| `authflow_mint_test_header` | Signed identity header for local verifier testing |
|
|
252
|
+
| `authflow_rotate_origin_key` | Rotate the origin API key (invalidates the old one immediately) |
|
|
253
|
+
|
|
254
|
+
Every tool takes `issuer` and `admin_key` optionally, falling back to the environment, so credentials
|
|
255
|
+
stay in the MCP client config rather than in the conversation. `write_secrets` is available on both
|
|
256
|
+
tools that issue a key; prefer it, because a key returned in a tool result is a credential in a chat
|
|
257
|
+
transcript.
|
|
258
|
+
|
|
259
|
+
Authentication is a per-tenant `afa_` admin API key from `authflow signup` (or `authflow_signup`).
|
|
260
|
+
The operator bearer still works as a super-admin. Per-creator OAuth is not required for onboarding.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { connectCommand } from "./commands/connect.js";
|
|
4
|
+
import { doctorCommand } from "./commands/doctor.js";
|
|
5
|
+
import { initCommand } from "./commands/init.js";
|
|
6
|
+
import { mcpCommand } from "./commands/mcp.js";
|
|
7
|
+
import { signupCommand } from "./commands/signup.js";
|
|
8
|
+
import { registerCommand } from "./commands/register.js";
|
|
9
|
+
import { setOriginCommand } from "./commands/set-origin.js";
|
|
10
|
+
import { mintHeaderCommand } from "./commands/mint-header.js";
|
|
11
|
+
import { probeCommand } from "./commands/probe.js";
|
|
12
|
+
import { scaffoldCommand } from "./commands/scaffold.js";
|
|
13
|
+
const program = new Command();
|
|
14
|
+
program
|
|
15
|
+
.name("authflow")
|
|
16
|
+
.description("Authflow Rail onboarding CLI")
|
|
17
|
+
.version("0.1.0");
|
|
18
|
+
signupCommand(program);
|
|
19
|
+
initCommand(program);
|
|
20
|
+
registerCommand(program);
|
|
21
|
+
connectCommand(program);
|
|
22
|
+
setOriginCommand(program);
|
|
23
|
+
mintHeaderCommand(program);
|
|
24
|
+
probeCommand(program);
|
|
25
|
+
doctorCommand(program);
|
|
26
|
+
scaffoldCommand(program);
|
|
27
|
+
mcpCommand(program);
|
|
28
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
29
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
30
|
+
console.error(message);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AAY,EAAE,EAAE;IACtD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Stripe onboarding, which is the one step of the flow that genuinely cannot be automated: KYC is
|
|
4
|
+
* a hosted form the creator has to fill in themselves. So the command's job is to hand over a link
|
|
5
|
+
* and then confirm the outcome, rather than to pretend the wait is not happening.
|
|
6
|
+
*/
|
|
7
|
+
export declare function connectCommand(program: Command): void;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { requireAdminKey, requireIssuer } from "../config.js";
|
|
2
|
+
import { describePending, startConnect } from "../rail.js";
|
|
3
|
+
/**
|
|
4
|
+
* Stripe onboarding, which is the one step of the flow that genuinely cannot be automated: KYC is
|
|
5
|
+
* a hosted form the creator has to fill in themselves. So the command's job is to hand over a link
|
|
6
|
+
* and then confirm the outcome, rather than to pretend the wait is not happening.
|
|
7
|
+
*/
|
|
8
|
+
export function connectCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command("connect")
|
|
11
|
+
.description("Start or resume Stripe Connect onboarding for a resource")
|
|
12
|
+
.requiredOption("--slug <slug>", "Resource slug")
|
|
13
|
+
.option("--email <email>", "Pre-fill the Stripe onboarding form")
|
|
14
|
+
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
15
|
+
.option("--admin-key <key>", "Admin API key (default: AUTHFLOW_ADMIN_API_KEY)")
|
|
16
|
+
.option("--wait", "Poll until Stripe reports the account can take charges")
|
|
17
|
+
.option("--wait-timeout <seconds>", "How long --wait polls before giving up", "600")
|
|
18
|
+
.action(async (opts) => {
|
|
19
|
+
const auth = {
|
|
20
|
+
issuer: requireIssuer(opts.issuer),
|
|
21
|
+
adminKey: requireAdminKey(opts.adminKey),
|
|
22
|
+
};
|
|
23
|
+
let result = await startConnect(auth, opts.slug, opts.email);
|
|
24
|
+
if (result.charges_enabled) {
|
|
25
|
+
reportReady(result.slug, result.status, result.pending_requirements);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log(`Stripe onboarding for ${result.slug} (${result.connected_account_id}).`);
|
|
29
|
+
console.log("");
|
|
30
|
+
console.log("Open this URL and complete Stripe's form:");
|
|
31
|
+
console.log("");
|
|
32
|
+
console.log(` ${result.onboarding_url}`);
|
|
33
|
+
console.log("");
|
|
34
|
+
if (result.onboarding_url_expires_at) {
|
|
35
|
+
console.log(`The link expires at ${result.onboarding_url_expires_at}.`);
|
|
36
|
+
}
|
|
37
|
+
console.log("Links are single-use. Re-run this command for a fresh one — it resumes the");
|
|
38
|
+
console.log("same Stripe account rather than creating another.");
|
|
39
|
+
if (!opts.wait) {
|
|
40
|
+
console.log("");
|
|
41
|
+
console.log(`When Stripe is done: authflow connect --slug ${opts.slug}`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const timeoutMs = Number(opts.waitTimeout) * 1000;
|
|
45
|
+
const deadline = Date.now() + timeoutMs;
|
|
46
|
+
console.log("");
|
|
47
|
+
process.stdout.write("Waiting for Stripe to report the account is ready");
|
|
48
|
+
while (Date.now() < deadline) {
|
|
49
|
+
await sleep(5000);
|
|
50
|
+
process.stdout.write(".");
|
|
51
|
+
result = await startConnect(auth, opts.slug, opts.email);
|
|
52
|
+
if (result.charges_enabled) {
|
|
53
|
+
console.log("");
|
|
54
|
+
console.log("");
|
|
55
|
+
reportReady(result.slug, result.status, result.pending_requirements);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
console.log("");
|
|
60
|
+
console.log("");
|
|
61
|
+
console.log(`Still waiting on Stripe after ${opts.waitTimeout}s. Onboarding is not lost —`);
|
|
62
|
+
console.log(`finish the form and re-run: authflow connect --slug ${opts.slug}`);
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function reportReady(slug, status, pending) {
|
|
67
|
+
console.log(`Stripe is connected for ${slug} and can take charges.`);
|
|
68
|
+
console.log(`status: ${status}`);
|
|
69
|
+
if (pending.length === 0) {
|
|
70
|
+
console.log("");
|
|
71
|
+
console.log("Nothing else is pending. Verify before real traffic: authflow probe");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
console.log("");
|
|
75
|
+
console.log("Still pending before go-live:");
|
|
76
|
+
for (const requirement of pending) {
|
|
77
|
+
console.log(` ${requirement}`);
|
|
78
|
+
console.log(` ${describePending(requirement, slug)}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function sleep(ms) {
|
|
82
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,0DAA0D,CAAC;SACvE,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC;SAChD,MAAM,CAAC,iBAAiB,EAAE,qCAAqC,CAAC;SAChE,MAAM,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,iDAAiD,CAAC;SAC9E,MAAM,CAAC,QAAQ,EAAE,wDAAwD,CA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AAW,CAAC,IAAY,EAAE,MAAc,EAAE,OAAiB;IAClE,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,wBAAwB,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;IAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;QACnF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC7C,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,EAAE,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { requireIssuer } from "../config.js";
|
|
2
|
+
import { formatDoctorReport, runDoctor } from "../doctor.js";
|
|
3
|
+
export function doctorCommand(program) {
|
|
4
|
+
program
|
|
5
|
+
.command("doctor")
|
|
6
|
+
.description("Check that the rail is reachable and serving a consistent Origin Protocol surface")
|
|
7
|
+
.option("--issuer <url>", "Authflow issuer (default: AUTHFLOW_ISSUER)")
|
|
8
|
+
.option("--slug <slug>", "Also check this resource's PRM document and gateway 401 challenge")
|
|
9
|
+
.option("--json", "Emit the report as JSON")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const report = await runDoctor(requireIssuer(opts.issuer), opts.slug);
|
|
12
|
+
console.log(opts.json ? JSON.stringify(report, null, 2) : formatDoctorReport(report));
|
|
13
|
+
process.exitCode = report.pass ? 0 : 1;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mFAAmF,CAAC;SAChG,MAAM,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SACtE,MAAM,CAAC,eAAe,EAAE,mEAAmE,CAAC;SAC5F,MAAM,CAAC,QAAQ,EAAE,yBAAyB,CAAC;SAC3C,MAAM,CAAC,KAAK,EAAE,IAAwD,EAAE,EAAE;QACzE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* One command from nothing to a registered, configured origin.
|
|
4
|
+
*
|
|
5
|
+
* The individual steps already existed as `register`, `scaffold`, and `probe`. They are wrapped here
|
|
6
|
+
* because the gaps between them were where onboarding actually stalled: neither the origin URL nor a
|
|
7
|
+
* Stripe account is usually available at registration time, and requiring either one forced a stop
|
|
8
|
+
* at the very first command. Both are now deferrable, so a creator can register, price, take the
|
|
9
|
+
* receipt, and build against it before they have a company bank account — and the receipt's
|
|
10
|
+
* `pending_requirements` is what tells them what is still outstanding.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initCommand(program: Command): void;
|