pups-client 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +163 -2
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +4 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/file-store.d.ts +21 -0
- package/dist/cli/file-store.d.ts.map +1 -0
- package/dist/cli/file-store.js +59 -0
- package/dist/cli/file-store.js.map +1 -0
- package/dist/cli/loopback.d.ts +28 -0
- package/dist/cli/loopback.d.ts.map +1 -0
- package/dist/cli/loopback.js +82 -0
- package/dist/cli/loopback.js.map +1 -0
- package/dist/cli/main.d.ts +16 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +337 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/client.d.ts +151 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +427 -0
- package/dist/client.js.map +1 -0
- package/dist/discovery.d.ts +58 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +138 -0
- package/dist/discovery.js.map +1 -0
- package/dist/errors.d.ts +77 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/feed.d.ts +314 -0
- package/dist/feed.d.ts.map +1 -0
- package/dist/feed.js +805 -0
- package/dist/feed.js.map +1 -0
- package/dist/file-types.d.ts +30 -0
- package/dist/file-types.d.ts.map +1 -0
- package/dist/file-types.js +67 -0
- package/dist/file-types.js.map +1 -0
- package/dist/host-meta.d.ts +71 -0
- package/dist/host-meta.d.ts.map +1 -0
- package/dist/host-meta.js +122 -0
- package/dist/host-meta.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth.d.ts +54 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +124 -0
- package/dist/oauth.js.map +1 -0
- package/dist/paths.d.ts +32 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +91 -0
- package/dist/paths.js.map +1 -0
- package/dist/scopes.d.ts +28 -0
- package/dist/scopes.d.ts.map +1 -0
- package/dist/scopes.js +56 -0
- package/dist/scopes.js.map +1 -0
- package/dist/session.d.ts +194 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +317 -0
- package/dist/session.js.map +1 -0
- package/dist/store/indexeddb-store.d.ts +23 -0
- package/dist/store/indexeddb-store.d.ts.map +1 -0
- package/dist/store/indexeddb-store.js +116 -0
- package/dist/store/indexeddb-store.js.map +1 -0
- package/dist/store/memory-store.d.ts +13 -0
- package/dist/store/memory-store.d.ts.map +1 -0
- package/dist/store/memory-store.js +22 -0
- package/dist/store/memory-store.js.map +1 -0
- package/dist/store/token-store.d.ts +35 -0
- package/dist/store/token-store.d.ts.map +1 -0
- package/dist/store/token-store.js +2 -0
- package/dist/store/token-store.js.map +1 -0
- package/dist/tabs.d.ts +29 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +51 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tokens.d.ts +59 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +200 -0
- package/dist/tokens.js.map +1 -0
- package/dist/util.d.ts +23 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +109 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +55 -4
- package/src/cli/bin.ts +4 -0
- package/src/cli/file-store.ts +66 -0
- package/src/cli/loopback.ts +103 -0
- package/src/cli/main.ts +329 -0
- package/src/client.ts +496 -0
- package/src/discovery.ts +178 -0
- package/src/errors.ts +136 -0
- package/src/feed.ts +1007 -0
- package/src/file-types.ts +80 -0
- package/src/host-meta.ts +148 -0
- package/src/index.ts +49 -0
- package/src/oauth.ts +163 -0
- package/src/paths.ts +92 -0
- package/src/scopes.ts +68 -0
- package/src/session.ts +396 -0
- package/src/store/indexeddb-store.ts +140 -0
- package/src/store/memory-store.ts +28 -0
- package/src/store/token-store.ts +36 -0
- package/src/tabs.ts +61 -0
- package/src/tokens.ts +208 -0
- package/src/util.ts +118 -0
- package/src/version.ts +1 -0
package/dist/cli/main.js
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { basename, join } from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import { PupsClient } from '../client.js';
|
|
6
|
+
import { normalizeDomain } from '../discovery.js';
|
|
7
|
+
import { isPupsError, PupsError } from '../errors.js';
|
|
8
|
+
import { VERSION } from '../version.js';
|
|
9
|
+
import { FileTokenStore } from './file-store.js';
|
|
10
|
+
import { CALLBACK_PATH, loopbackLogin, openInBrowser } from './loopback.js';
|
|
11
|
+
/** Where the client metadata document lives when only the client's domain is given. */
|
|
12
|
+
export const DEFAULT_CLIENT_DOCUMENT = 'pups-cli.json';
|
|
13
|
+
const help = `pups ${VERSION}: upload files to your own domain with a Personal Upload Server (PUPS).
|
|
14
|
+
|
|
15
|
+
Usage: pups <command> [options]
|
|
16
|
+
|
|
17
|
+
Getting started:
|
|
18
|
+
pups client-metadata <client> Print the client metadata document to publish on <client>
|
|
19
|
+
pups check-client <client> Check the published client metadata document
|
|
20
|
+
pups login <domain> -c <client> Sign in at the PUPS server of <domain> as its owner
|
|
21
|
+
|
|
22
|
+
Working with files (paths without leading "/" are in the app's own directory):
|
|
23
|
+
pups whoami Show the signed-in identity and the granted scopes
|
|
24
|
+
pups put <file>... [--to <path>] Upload files ("-" reads stdin; needs --to)
|
|
25
|
+
pups get <path> [-o <file>] Download a file (to stdout by default)
|
|
26
|
+
pups rm <path>... Delete files
|
|
27
|
+
pups url <path> Print the public URL of a path
|
|
28
|
+
pups link add|remove <rel> <path> Add or remove a host-meta.json link to one of your files
|
|
29
|
+
pups property set <uri> <value> Set a host-meta.json property
|
|
30
|
+
pups logout [--keep-grant] Forget the credentials and revoke the grant
|
|
31
|
+
pups sessions List stored sessions
|
|
32
|
+
|
|
33
|
+
Options:
|
|
34
|
+
-c, --client <domain|url> The client app: its domain (document at https://<domain>/${DEFAULT_CLIENT_DOCUMENT})
|
|
35
|
+
or the URL of its client metadata document. Env: PUPS_CLIENT
|
|
36
|
+
-d, --domain <domain> Which signed-in domain to use. Default: the most recent. Env: PUPS_DOMAIN
|
|
37
|
+
-s, --scope <scope> login: scope to request, repeatable: appdata (default), identify,
|
|
38
|
+
write:/<well-known path>
|
|
39
|
+
--no-browser login: print the URL instead of opening the browser
|
|
40
|
+
--skip-check login: don't check the client metadata document first
|
|
41
|
+
--to <path> put: target path, or directory ending in "/". Default: the file name
|
|
42
|
+
--create put: fail if the file already exists
|
|
43
|
+
--if-match <etag> put, rm: only if the file is unchanged since this ETag
|
|
44
|
+
--content-type <type> put: upload type, if not the default for the extension
|
|
45
|
+
-o, --output <file> get: write to a file
|
|
46
|
+
--type <media type> link add: the link's type
|
|
47
|
+
--keep-grant logout: only forget the credentials on this computer
|
|
48
|
+
--json Machine-readable output (whoami, put, sessions)
|
|
49
|
+
-h, --help Show this help
|
|
50
|
+
--version Show the version
|
|
51
|
+
|
|
52
|
+
Credentials are stored in ${storeFile().replace(homedir(), '~')} (readable only by you).
|
|
53
|
+
Don't run two pups commands for the same domain at the same time.`;
|
|
54
|
+
class UsageError extends Error {
|
|
55
|
+
}
|
|
56
|
+
function storeFile() {
|
|
57
|
+
const base = process.env.PUPS_CONFIG_DIR ?? join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'pups');
|
|
58
|
+
return join(base, 'sessions.json');
|
|
59
|
+
}
|
|
60
|
+
/** `tim.example.app` → `https://tim.example.app/pups-cli.json`; a full URL stays as it is. */
|
|
61
|
+
export function clientIdFor(client) {
|
|
62
|
+
if (/^https?:\/\//i.test(client))
|
|
63
|
+
return client;
|
|
64
|
+
return normalizeDomain(client) + DEFAULT_CLIENT_DOCUMENT;
|
|
65
|
+
}
|
|
66
|
+
/** The client metadata document the CLI needs, for publishing at `clientId`. */
|
|
67
|
+
export function cliClientMetadata(clientId) {
|
|
68
|
+
const url = new URL(clientId);
|
|
69
|
+
return {
|
|
70
|
+
client_id: clientId,
|
|
71
|
+
client_name: `PUPS command line (${url.hostname})`,
|
|
72
|
+
client_uri: `${url.origin}/`,
|
|
73
|
+
redirect_uris: [`http://127.0.0.1${CALLBACK_PATH}`, `http://[::1]${CALLBACK_PATH}`],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const parseScope = (scope) => {
|
|
77
|
+
if (scope == 'identify' || scope == 'appdata' || scope.startsWith('write:/'))
|
|
78
|
+
return scope;
|
|
79
|
+
throw new UsageError(`Unknown scope "${scope}". Use appdata, identify or write:/<path>.`);
|
|
80
|
+
};
|
|
81
|
+
const out = (text) => process.stdout.write(text + '\n');
|
|
82
|
+
const info = (text) => process.stderr.write(text + '\n');
|
|
83
|
+
/** Runs the CLI with `argv` (without `node` and the script) and returns the exit code: 0 ok, 1 error, 2 usage. */
|
|
84
|
+
export function main(argv) {
|
|
85
|
+
return run(argv).catch(reportError);
|
|
86
|
+
}
|
|
87
|
+
async function run(argv) {
|
|
88
|
+
const { values: opts, positionals } = parseArgs({
|
|
89
|
+
args: argv,
|
|
90
|
+
allowPositionals: true,
|
|
91
|
+
options: {
|
|
92
|
+
client: { type: 'string', short: 'c' },
|
|
93
|
+
domain: { type: 'string', short: 'd' },
|
|
94
|
+
scope: { type: 'string', short: 's', multiple: true },
|
|
95
|
+
'no-browser': { type: 'boolean' },
|
|
96
|
+
'skip-check': { type: 'boolean' },
|
|
97
|
+
to: { type: 'string' },
|
|
98
|
+
create: { type: 'boolean' },
|
|
99
|
+
'if-match': { type: 'string' },
|
|
100
|
+
'content-type': { type: 'string' },
|
|
101
|
+
output: { type: 'string', short: 'o' },
|
|
102
|
+
type: { type: 'string' },
|
|
103
|
+
'keep-grant': { type: 'boolean' },
|
|
104
|
+
json: { type: 'boolean' },
|
|
105
|
+
help: { type: 'boolean', short: 'h' },
|
|
106
|
+
version: { type: 'boolean' },
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
if (opts.version) {
|
|
110
|
+
out(VERSION);
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
const [command, ...args] = positionals;
|
|
114
|
+
if (opts.help || !command) {
|
|
115
|
+
out(help);
|
|
116
|
+
return opts.help ? 0 : 2;
|
|
117
|
+
}
|
|
118
|
+
const store = new FileTokenStore(storeFile());
|
|
119
|
+
const client = opts.client ?? process.env.PUPS_CLIENT;
|
|
120
|
+
const domain = opts.domain ?? process.env.PUPS_DOMAIN;
|
|
121
|
+
const requireArgs = (count, usage) => {
|
|
122
|
+
if (args.length < count)
|
|
123
|
+
throw new UsageError(`Usage: pups ${usage}`);
|
|
124
|
+
};
|
|
125
|
+
/** The stored session to use: filtered by --client and --domain, the most recently used one. */
|
|
126
|
+
const openSession = async () => {
|
|
127
|
+
let records = await store.listAll();
|
|
128
|
+
if (client)
|
|
129
|
+
records = records.filter(r => r.clientId == clientIdFor(client));
|
|
130
|
+
if (domain)
|
|
131
|
+
records = records.filter(r => r.me == normalizeDomain(domain));
|
|
132
|
+
const record = records.sort((a, b) => b.lastUsedAt - a.lastUsedAt)[0];
|
|
133
|
+
if (!record)
|
|
134
|
+
throw new UsageError(`Not signed in${domain ? ` at ${domain}` : ''}. Run: pups login <domain> --client <client-domain>`);
|
|
135
|
+
const pups = new PupsClient({ clientId: record.clientId, redirectUri: `http://127.0.0.1${CALLBACK_PATH}`, store });
|
|
136
|
+
return (await pups.restore(record.me));
|
|
137
|
+
};
|
|
138
|
+
switch (command) {
|
|
139
|
+
case 'client-metadata': {
|
|
140
|
+
const clientArg = args[0] ?? client;
|
|
141
|
+
if (!clientArg)
|
|
142
|
+
throw new UsageError('Usage: pups client-metadata <client-domain>');
|
|
143
|
+
const clientId = clientIdFor(clientArg);
|
|
144
|
+
out(JSON.stringify(cliClientMetadata(clientId), null, 2));
|
|
145
|
+
info(`\nPublish this document at ${clientId}, served over HTTPS as application/json.`);
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
case 'check-client': {
|
|
149
|
+
const clientArg = args[0] ?? client;
|
|
150
|
+
if (!clientArg)
|
|
151
|
+
throw new UsageError('Usage: pups check-client <client-domain>');
|
|
152
|
+
const problems = await checkClient(clientIdFor(clientArg));
|
|
153
|
+
if (!problems.length) {
|
|
154
|
+
out(`${clientIdFor(clientArg)} is fine.`);
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
for (const problem of problems)
|
|
158
|
+
info(`- ${problem}`);
|
|
159
|
+
return 1;
|
|
160
|
+
}
|
|
161
|
+
case 'login': {
|
|
162
|
+
requireArgs(1, 'login <domain> --client <client-domain>');
|
|
163
|
+
if (!client)
|
|
164
|
+
throw new UsageError('Which app is signing in? Pass --client <client-domain> or set PUPS_CLIENT.');
|
|
165
|
+
const clientId = clientIdFor(client);
|
|
166
|
+
if (!opts['skip-check']) {
|
|
167
|
+
const problems = await checkClient(clientId);
|
|
168
|
+
if (problems.length) {
|
|
169
|
+
info(`The client metadata document at ${clientId} has problems; the server would reject the login:`);
|
|
170
|
+
for (const problem of problems)
|
|
171
|
+
info(`- ${problem}`);
|
|
172
|
+
info(`Print a valid document with: pups client-metadata ${client}`);
|
|
173
|
+
return 1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const scopes = (opts.scope ?? ['appdata']).map(parseScope);
|
|
177
|
+
const session = await loopbackLogin({
|
|
178
|
+
clientId,
|
|
179
|
+
domain: args[0],
|
|
180
|
+
scopes,
|
|
181
|
+
store,
|
|
182
|
+
onUrl: url => info(opts['no-browser']
|
|
183
|
+
? `Open this URL in a browser to sign in:\n\n ${url}\n`
|
|
184
|
+
: `Opening the browser to sign in. If it doesn't open, visit:\n\n ${url}\n`),
|
|
185
|
+
openBrowser: opts['no-browser'] ? () => { } : openInBrowser,
|
|
186
|
+
});
|
|
187
|
+
out(`Signed in as ${session.me}`);
|
|
188
|
+
info(`Granted: ${session.scopes.join(' ')}`);
|
|
189
|
+
const requested = scopes.map(s => s == 'appdata' ? `write:${session.appDataPath}` : s);
|
|
190
|
+
const dropped = requested.filter(s => !session.scopes.includes(s));
|
|
191
|
+
if (dropped.length)
|
|
192
|
+
info(`Not granted: ${dropped.join(' ')}`);
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
case 'whoami': {
|
|
196
|
+
const session = await openSession();
|
|
197
|
+
const data = {
|
|
198
|
+
me: session.me,
|
|
199
|
+
client: session.clientId,
|
|
200
|
+
issuer: session.issuer,
|
|
201
|
+
scopes: session.scopes,
|
|
202
|
+
appData: session.appDataPath,
|
|
203
|
+
publicBase: session.server.publicBase,
|
|
204
|
+
};
|
|
205
|
+
if (opts.json)
|
|
206
|
+
out(JSON.stringify(data, null, 2));
|
|
207
|
+
else
|
|
208
|
+
for (const [key, value] of Object.entries(data))
|
|
209
|
+
out(`${key.padEnd(10)} ${Array.isArray(value) ? value.join(' ') : value}`);
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
212
|
+
case 'put': {
|
|
213
|
+
requireArgs(1, 'put <file>... [--to <path>]');
|
|
214
|
+
const to = opts.to;
|
|
215
|
+
if (args.length > 1 && to && !to.endsWith('/'))
|
|
216
|
+
throw new UsageError('--to must be a directory ending in "/" when uploading several files.');
|
|
217
|
+
if (args.includes('-') && (!to || to.endsWith('/')))
|
|
218
|
+
throw new UsageError('Reading from stdin ("-") needs --to <path>.');
|
|
219
|
+
const session = await openSession();
|
|
220
|
+
const results = [];
|
|
221
|
+
for (const file of args) {
|
|
222
|
+
const target = to ? to.endsWith('/') ? to + basename(file) : to : basename(file);
|
|
223
|
+
const data = file == '-' ? await readStdin() : await readFile(file);
|
|
224
|
+
const options = opts['content-type'] ? { contentType: opts['content-type'] } : {};
|
|
225
|
+
const result = opts.create ? await session.create(target, data, options)
|
|
226
|
+
: opts['if-match'] ? await session.replace(target, data, opts['if-match'], options)
|
|
227
|
+
: await session.put(target, data, options);
|
|
228
|
+
results.push(result);
|
|
229
|
+
if (!opts.json) {
|
|
230
|
+
out(result.url);
|
|
231
|
+
info(` ${result.created ? 'created' : 'replaced'} ${result.path} (ETag ${result.etag})`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (opts.json)
|
|
235
|
+
out(JSON.stringify(results, null, 2));
|
|
236
|
+
return 0;
|
|
237
|
+
}
|
|
238
|
+
case 'get': {
|
|
239
|
+
requireArgs(1, 'get <path> [-o <file>]');
|
|
240
|
+
const session = await openSession();
|
|
241
|
+
const file = await session.get(args[0]);
|
|
242
|
+
if (!file)
|
|
243
|
+
throw new PupsError('not_found', `${session.resolve(args[0])} doesn't exist.`);
|
|
244
|
+
const bytes = new Uint8Array(await (await file.blob()).arrayBuffer());
|
|
245
|
+
if (opts.output) {
|
|
246
|
+
await writeFile(opts.output, bytes);
|
|
247
|
+
info(`Saved ${file.path} to ${opts.output} (ETag ${file.etag})`);
|
|
248
|
+
}
|
|
249
|
+
else
|
|
250
|
+
process.stdout.write(bytes);
|
|
251
|
+
return 0;
|
|
252
|
+
}
|
|
253
|
+
case 'rm': {
|
|
254
|
+
requireArgs(1, 'rm <path>...');
|
|
255
|
+
const session = await openSession();
|
|
256
|
+
for (const path of args) {
|
|
257
|
+
await session.delete(path, opts['if-match'] ? { ifMatch: opts['if-match'] } : {});
|
|
258
|
+
info(`Deleted ${session.resolve(path)}`);
|
|
259
|
+
}
|
|
260
|
+
return 0;
|
|
261
|
+
}
|
|
262
|
+
case 'url': {
|
|
263
|
+
requireArgs(1, 'url <path>');
|
|
264
|
+
const session = await openSession();
|
|
265
|
+
for (const path of args)
|
|
266
|
+
out(session.publicUrl(path));
|
|
267
|
+
return 0;
|
|
268
|
+
}
|
|
269
|
+
case 'link': {
|
|
270
|
+
const [action, rel, path] = args;
|
|
271
|
+
if ((action != 'add' && action != 'remove') || !rel || !path)
|
|
272
|
+
throw new UsageError('Usage: pups link add|remove <rel> <path> [--type <media type>]');
|
|
273
|
+
const session = await openSession();
|
|
274
|
+
if (action == 'add')
|
|
275
|
+
await session.hostMeta.addLink({ rel, href: path, ...opts.type ? { type: opts.type } : {} });
|
|
276
|
+
else
|
|
277
|
+
await session.hostMeta.removeLink({ rel, href: path });
|
|
278
|
+
info(`${action == 'add' ? 'Added' : 'Removed'} ${rel} → ${session.publicUrl(path)}`);
|
|
279
|
+
return 0;
|
|
280
|
+
}
|
|
281
|
+
case 'property': {
|
|
282
|
+
const [action, uri, value] = args;
|
|
283
|
+
if (action != 'set' || !uri || value === undefined)
|
|
284
|
+
throw new UsageError('Usage: pups property set <uri> <value>');
|
|
285
|
+
const session = await openSession();
|
|
286
|
+
await session.hostMeta.setProperty(uri, value);
|
|
287
|
+
info(`Set ${uri}`);
|
|
288
|
+
return 0;
|
|
289
|
+
}
|
|
290
|
+
case 'logout': {
|
|
291
|
+
const session = await openSession();
|
|
292
|
+
const { revoked } = await session.logout({ revoke: !opts['keep-grant'] });
|
|
293
|
+
out(`Signed out of ${session.me}`);
|
|
294
|
+
if (!opts['keep-grant'])
|
|
295
|
+
info(revoked ? 'The grant was revoked.' : 'The server did not confirm the revocation; remove the app on its apps page if needed.');
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
case 'sessions': {
|
|
299
|
+
const records = (await store.listAll()).sort((a, b) => b.lastUsedAt - a.lastUsedAt);
|
|
300
|
+
const data = records.map(r => ({ me: r.me, client: r.clientId, scopes: r.scopes, lastUsed: new Date(r.lastUsedAt).toISOString() }));
|
|
301
|
+
if (opts.json)
|
|
302
|
+
out(JSON.stringify(data, null, 2));
|
|
303
|
+
else if (!data.length)
|
|
304
|
+
info('No sessions. Run: pups login <domain> --client <client-domain>');
|
|
305
|
+
else
|
|
306
|
+
for (const s of data)
|
|
307
|
+
out(`${s.me} via ${s.client} [${s.scopes.join(' ')}] last used ${s.lastUsed}`);
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
default:
|
|
311
|
+
throw new UsageError(`Unknown command "${command}". Run pups --help.`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async function checkClient(clientId) {
|
|
315
|
+
const pups = new PupsClient({ clientId, redirectUri: `http://127.0.0.1${CALLBACK_PATH}` });
|
|
316
|
+
return (await pups.checkClientMetadata()).problems;
|
|
317
|
+
}
|
|
318
|
+
async function readStdin() {
|
|
319
|
+
const chunks = [];
|
|
320
|
+
for await (const chunk of process.stdin)
|
|
321
|
+
chunks.push(chunk);
|
|
322
|
+
return Buffer.concat(chunks);
|
|
323
|
+
}
|
|
324
|
+
/** Prints an error the way a user can act on it, and returns the exit code. */
|
|
325
|
+
export function reportError(e) {
|
|
326
|
+
const usage = e instanceof UsageError || !!e?.code?.startsWith('ERR_PARSE_ARGS');
|
|
327
|
+
if (usage)
|
|
328
|
+
info(`${e.message}${e instanceof UsageError ? '' : '. Run pups --help.'}`);
|
|
329
|
+
else if (isPupsError(e, 'session_expired', 'invalid_token'))
|
|
330
|
+
info(`${e.message}\nRun: pups login <domain> --client <client-domain>`);
|
|
331
|
+
else if (e instanceof PupsError)
|
|
332
|
+
info(`Error (${e.code}): ${e.message}`);
|
|
333
|
+
else
|
|
334
|
+
info(`Error: ${e?.message ?? e}`);
|
|
335
|
+
return usage ? 2 : 1;
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,Q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CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACtB,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { type PupsServer } from './discovery.js';
|
|
2
|
+
import { type Scope } from './scopes.js';
|
|
3
|
+
import { PupsSession, type SessionChangeEvent } from './session.js';
|
|
4
|
+
import type { TokenStore } from './store/token-store.js';
|
|
5
|
+
export interface PupsClientOptions {
|
|
6
|
+
/** The app's `client_id`: the HTTPS URL of its client metadata document, on the app's own domain. */
|
|
7
|
+
clientId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Where the server sends the authorization response. Must be listed in the client metadata document, exactly.
|
|
10
|
+
* HTTPS, or `http://127.0.0.1` / `http://[::1]` with any port for native apps and local development.
|
|
11
|
+
*/
|
|
12
|
+
redirectUri: string;
|
|
13
|
+
/** Where sessions are kept. Default: {@link IndexedDbTokenStore} in browsers, {@link MemoryTokenStore} elsewhere. */
|
|
14
|
+
store?: TokenStore;
|
|
15
|
+
/** The `fetch` to use, for tests and instrumentation. Default: the global `fetch`. */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
export interface LoginOptions {
|
|
19
|
+
/** The scopes to request. Default: `['appdata']`. The owner may grant fewer; check `session.scopes`. */
|
|
20
|
+
scopes?: Scope[];
|
|
21
|
+
/** Any JSON-serializable value, returned by `handleRedirect()` after the redirect, e.g. the page to return to. */
|
|
22
|
+
appState?: unknown;
|
|
23
|
+
/** Whether to store the session. Default true; false keeps it in this tab's memory only. */
|
|
24
|
+
persist?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface PopupLoginOptions extends LoginOptions {
|
|
27
|
+
/** How long to wait for the owner. Default: 5 minutes. */
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A started authorization, for {@link PupsClient.completeAuthorization}. Contains the PKCE verifier: keep it in
|
|
33
|
+
* memory or `sessionStorage`, never send it anywhere but to your own backend.
|
|
34
|
+
*/
|
|
35
|
+
export interface PendingAuthorization {
|
|
36
|
+
/** Open this URL in the browser. */
|
|
37
|
+
url: string;
|
|
38
|
+
state: string;
|
|
39
|
+
codeVerifier: string;
|
|
40
|
+
server: PupsServer;
|
|
41
|
+
/** The requested scopes, expanded. */
|
|
42
|
+
scopes: string[];
|
|
43
|
+
redirectUri: string;
|
|
44
|
+
appState?: unknown;
|
|
45
|
+
persist: boolean;
|
|
46
|
+
createdAt: number;
|
|
47
|
+
}
|
|
48
|
+
/** An authorization code for the app's backend to redeem (see "Sign-in through the app's backend"). */
|
|
49
|
+
export interface AuthorizationCode {
|
|
50
|
+
code: string;
|
|
51
|
+
codeVerifier: string;
|
|
52
|
+
redirectUri: string;
|
|
53
|
+
clientId: string;
|
|
54
|
+
issuer: string;
|
|
55
|
+
tokenEndpoint: string;
|
|
56
|
+
/** `me` in the token response must name one of these hosts, or lead to the same issuer by discovery. */
|
|
57
|
+
identityHosts: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface RedirectResult {
|
|
60
|
+
/** The new session. Absent with `redeem: false`, and in the popup window. */
|
|
61
|
+
session?: PupsSession;
|
|
62
|
+
appState?: unknown;
|
|
63
|
+
/** Only with `redeem: false`. */
|
|
64
|
+
code?: AuthorizationCode;
|
|
65
|
+
}
|
|
66
|
+
export interface ClientMetadataReport {
|
|
67
|
+
ok: boolean;
|
|
68
|
+
/** Everything a PUPS server would reject, in plain words. */
|
|
69
|
+
problems: string[];
|
|
70
|
+
document?: unknown;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The entry point of pups-client. Create one per app and reuse it.
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* const pups = new PupsClient({ clientId: 'https://app.example/oauth/client.json', redirectUri: 'https://app.example/callback' })
|
|
77
|
+
* const session = await pups.init() ?? await pups.login('tim.example.com', { scopes: ['appdata'] })
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare class PupsClient {
|
|
81
|
+
#private;
|
|
82
|
+
readonly clientId: string;
|
|
83
|
+
readonly redirectUri: string;
|
|
84
|
+
constructor(options: PupsClientOptions);
|
|
85
|
+
/** Finds the PUPS server of a domain. Use it to check what a server offers before asking for scopes. */
|
|
86
|
+
discover(domain: string, options?: {
|
|
87
|
+
signal?: AbortSignal;
|
|
88
|
+
}): Promise<PupsServer>;
|
|
89
|
+
/**
|
|
90
|
+
* Starts authorization with a full-page redirect. The promise never resolves: the page navigates away, and the
|
|
91
|
+
* session arrives through `init()` or `handleRedirect()` on the redirect URI page.
|
|
92
|
+
*/
|
|
93
|
+
login(domain: string | PupsServer, options?: LoginOptions): Promise<never>;
|
|
94
|
+
/**
|
|
95
|
+
* Starts authorization in a popup and resolves with the session. Call it directly in a click handler, before any
|
|
96
|
+
* `await`, or the browser blocks the popup.
|
|
97
|
+
* @throws {PupsError} `popup_blocked` (fall back to `login()`), `popup_timeout`, `aborted`, and the errors of `handleRedirect()`.
|
|
98
|
+
*/
|
|
99
|
+
loginWithPopup(domain: string | PupsServer, options?: PopupLoginOptions): Promise<PupsSession>;
|
|
100
|
+
/**
|
|
101
|
+
* Completes authorization on the redirect URI page. Returns undefined if the URL is not an authorization
|
|
102
|
+
* response, so it is safe to call on every page load. In the login popup, it hands the response to the opening
|
|
103
|
+
* tab and closes the window.
|
|
104
|
+
*
|
|
105
|
+
* With `redeem: false` the code is returned instead of redeemed, for the app's backend to redeem.
|
|
106
|
+
* @throws {PupsError} `access_denied`, `state_mismatch`, `issuer_mismatch`, `identity_mismatch`, `authorization_failed`
|
|
107
|
+
*/
|
|
108
|
+
handleRedirect(options?: {
|
|
109
|
+
url?: string;
|
|
110
|
+
redeem?: boolean;
|
|
111
|
+
}): Promise<RedirectResult | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* `handleRedirect()` if the URL is an authorization response, otherwise `restore()`. The usual call on page load.
|
|
114
|
+
*/
|
|
115
|
+
init(): Promise<PupsSession | undefined>;
|
|
116
|
+
/**
|
|
117
|
+
* Starts an authorization without navigating anywhere: discovers the server if needed, checks the scopes, and
|
|
118
|
+
* creates the authorization URL. For native apps (open `url` in the system browser, receive the redirect on a
|
|
119
|
+
* loopback port) and custom flows. Finish with {@link completeAuthorization}.
|
|
120
|
+
*/
|
|
121
|
+
createAuthorization(domain: string | PupsServer, options?: LoginOptions & {
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
}): Promise<PendingAuthorization>;
|
|
124
|
+
/**
|
|
125
|
+
* Finishes an authorization started with {@link createAuthorization}: checks `state` and `iss`, redeems the code,
|
|
126
|
+
* verifies `me`, and stores the session.
|
|
127
|
+
* @param callbackUrl The URL the server redirected to, with `code`, `state` and `iss`.
|
|
128
|
+
*/
|
|
129
|
+
completeAuthorization(callbackUrl: string, pending: PendingAuthorization, options?: {
|
|
130
|
+
redeem?: boolean;
|
|
131
|
+
}): Promise<RedirectResult>;
|
|
132
|
+
/** The stored session for `me`, or the most recently used one. */
|
|
133
|
+
restore(me?: string): Promise<PupsSession | undefined>;
|
|
134
|
+
/** All stored sessions of this client, one per connected domain. */
|
|
135
|
+
sessions(): Promise<PupsSession[]>;
|
|
136
|
+
/**
|
|
137
|
+
* Calls `listener` on login, logout and expiry, also when they happen in another tab.
|
|
138
|
+
* @returns a function that unsubscribes.
|
|
139
|
+
*/
|
|
140
|
+
onSessionChange(listener: (event: SessionChangeEvent) => void): () => void;
|
|
141
|
+
/**
|
|
142
|
+
* Development helper: fetches the client metadata document and reports what a PUPS server would reject.
|
|
143
|
+
* In browsers this needs CORS on the document; a failed fetch is reported as a problem.
|
|
144
|
+
*/
|
|
145
|
+
checkClientMetadata(): Promise<ClientMetadataReport>;
|
|
146
|
+
/** Closes the channel to other tabs. Only needed where a client is created and discarded, e.g. in tests or a CLI. */
|
|
147
|
+
close(): void;
|
|
148
|
+
}
|
|
149
|
+
/** The problems a PUPS server would find in a client metadata document. */
|
|
150
|
+
export declare function clientMetadataProblems(document: unknown, clientId: string, redirectUri: string): string[];
|
|
151
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG3E,OAAO,EAAgC,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGnE,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAKvE,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,qHAAqH;IACrH,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,wGAAwG;IACxG,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,kHAAkH;IAClH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,UAAU,CAAA;IAClB,sCAAsC;IACtC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE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