@flipstream/sdk 0.6.0 → 0.8.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 +63 -0
- package/README.md +260 -43
- package/dist/auth/discovery.d.ts +5 -4
- package/dist/auth/discovery.js +10 -8
- package/dist/auth/discovery.js.map +1 -1
- package/dist/auth/signIn.js +10 -5
- package/dist/auth/signIn.js.map +1 -1
- package/dist/auth/transport.d.ts +20 -2
- package/dist/auth/transport.js +25 -5
- package/dist/auth/transport.js.map +1 -1
- package/dist/core/fetch.d.ts +5 -0
- package/dist/core/fetch.js +8 -1
- package/dist/core/fetch.js.map +1 -1
- package/dist/flipstream.d.ts +8 -0
- package/dist/flipstream.js +4 -3
- package/dist/flipstream.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/node/fileLock.d.ts +21 -0
- package/dist/node/fileLock.js +23 -54
- package/dist/node/fileLock.js.map +1 -1
- package/dist/node/fileStore.d.ts +23 -1
- package/dist/node/fileStore.js +20 -18
- package/dist/node/fileStore.js.map +1 -1
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/keychainChild.js +146 -54
- package/dist/node/keychainChild.js.map +1 -1
- package/dist/node/keychainError.d.ts +53 -0
- package/dist/node/keychainError.js +48 -0
- package/dist/node/keychainError.js.map +1 -0
- package/dist/node/keychainStore.d.ts +20 -9
- package/dist/node/keychainStore.js +207 -58
- package/dist/node/keychainStore.js.map +1 -1
- package/dist/node/loopback.js +1 -1
- package/dist/node/loopback.js.map +1 -1
- package/dist/node/session.d.ts +42 -3
- package/dist/node/session.js +95 -18
- package/dist/node/session.js.map +1 -1
- package/dist/node/store.d.ts +5 -1
- package/dist/node/store.js +12 -4
- package/dist/node/store.js.map +1 -1
- package/dist/query/catalog.d.ts +271 -2
- package/dist/query/catalog.js +93 -5
- package/dist/query/catalog.js.map +1 -1
- package/dist/query/query.d.ts +14 -5
- package/dist/query/query.js +21 -6
- package/dist/query/query.js.map +1 -1
- package/dist/spec/query-planner/index.d.ts +1 -1
- package/dist/spec/query-planner/types.gen.d.ts +35 -4
- package/dist/spec/query-planner/zod.gen.d.ts +257 -64
- package/dist/spec/query-planner/zod.gen.js +31 -5
- package/dist/spec/query-planner/zod.gen.js.map +1 -1
- package/dist/version.gen.js +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { Socket } from 'node:net';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { TIMINGS } from './fileLock.js';
|
|
6
|
+
import { KeychainError, refusalKind } from './keychainError.js';
|
|
5
7
|
import { parse, storeOf } from './store.js';
|
|
6
8
|
/*
|
|
7
|
-
* Through `@napi-rs/keyring` (D481), an optional peer dependency that only this store needs, in
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Through `@napi-rs/keyring` (D481), an optional peer dependency that only this store needs, in one
|
|
10
|
+
* helper process that this process keeps warm for every keychain step (D495), killed at a step's
|
|
11
|
+
* deadline and started again for the next (D485): a keychain call that parks forever (cli#119)
|
|
12
|
+
* can't be ended in this process, not even by exiting it. The tokens go to the helper on its
|
|
13
|
+
* standard input, never as an argument or in its environment.
|
|
11
14
|
*/
|
|
12
15
|
/**
|
|
13
16
|
* The child script beside this module, found when a step runs, never when the module loads: where
|
|
@@ -31,20 +34,39 @@ const MAX_TIMEOUT_MS = 2_147_483_647;
|
|
|
31
34
|
* lower limit, and one limit everywhere means tokens that save on one platform save on all.
|
|
32
35
|
*/
|
|
33
36
|
const LIMIT_BYTES = 2_560;
|
|
37
|
+
/**
|
|
38
|
+
* How long the helper may go on with a save or a delete once this process has gone: less than the
|
|
39
|
+
* soonest `fileLock` passes a dead holder's lock to another process, so a late write can't land over
|
|
40
|
+
* the next holder's. That soonest is 3 s of watching a file whose last touch already looks old (the
|
|
41
|
+
* clock stepped, or the holder's clock was behind), and the last touch may be 1 s before the end:
|
|
42
|
+
* 2 s. A second of that is left for the helper to see its parent go and end.
|
|
43
|
+
*/
|
|
44
|
+
const AFTER_PARENT_MS = TIMINGS.oldWatchMs - TIMINGS.touchMs - 1_000;
|
|
34
45
|
/**
|
|
35
46
|
* The tokens in the system's own credential store, for a CLI or a tool on the person's own machine:
|
|
36
47
|
* the macOS keychain, Windows' Credential Manager, or the Secret Service on Linux (GNOME Keyring,
|
|
37
48
|
* KWallet). One item (`service`, `account`) holds them; a save is one write, seen whole once it has
|
|
38
49
|
* succeeded, or not at all.
|
|
39
50
|
*
|
|
51
|
+
* - **Every failure of the keychain or its helper is a `KeychainError`,** whose `failure.kind` says
|
|
52
|
+
* why: the cause of a session's `store_failed`. The store's own two are not: tokens with no access
|
|
53
|
+
* token (a `TypeError`, before any step) and an item holding something other than tokens.
|
|
40
54
|
* - **It needs `@napi-rs/keyring`** (`npm install @napi-rs/keyring`), which nothing else in the
|
|
41
|
-
* SDK uses. Without it, every step fails as `
|
|
42
|
-
* - **Linux without a Secret Service** (a server, a container) fails as `
|
|
55
|
+
* SDK uses. Without it, every step fails as `missing`, and says so.
|
|
56
|
+
* - **Linux without a Secret Service** (a server, a container) fails as `unavailable`: use
|
|
43
57
|
* `fileStore` there.
|
|
44
|
-
* - **
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
58
|
+
* - **Its steps run in one helper process,** one at a time: started by the first step and kept
|
|
59
|
+
* warm while the app runs, for every keychain store of the process. A step past its `timeoutMs`
|
|
60
|
+
* (30 s) kills it, and the next step starts another. It ignores a terminal Ctrl-C. A step whose
|
|
61
|
+
* helper died before it answered runs once more on a fresh one, within its `timeoutMs`. It never
|
|
62
|
+
* keeps the app running. When the app ends, it ends too: at once when idle or on a read, or once
|
|
63
|
+
* the save or delete it's on is done, within that step's `timeoutMs` and 1 s at most, so a
|
|
64
|
+
* refresh's save isn't lost to a Ctrl-C. 1 s is less than the soonest `fileLock` lets another
|
|
65
|
+
* process take the app's lock. For a helper's first step, the 1 s counts from the helper's own
|
|
66
|
+
* start, so a slow start can't stretch it, and that step may be cut sooner. It is `process.execPath`, so it needs a Node that runs a script: not an Electron
|
|
67
|
+
* app (without `ELECTRON_RUN_AS_NODE`), a Node single-executable application, or a compiled Bun
|
|
68
|
+
* binary.
|
|
69
|
+
* - **Tokens over 2,560 bytes** fail the save as `too-long`, with nothing written.
|
|
48
70
|
*/
|
|
49
71
|
export function keychainStore(options) {
|
|
50
72
|
const { service, account, timeoutMs = TIMEOUT_MS } = options;
|
|
@@ -62,27 +84,39 @@ export function keychainStore(options) {
|
|
|
62
84
|
return;
|
|
63
85
|
}
|
|
64
86
|
const secret = JSON.stringify(tokens);
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
const bytes = Buffer.byteLength(secret, 'utf8');
|
|
88
|
+
if (bytes > LIMIT_BYTES)
|
|
89
|
+
throw new KeychainError(`the tokens are too long for the keychain store (over ${LIMIT_BYTES} bytes): nothing was saved`, { kind: 'too-long', bytes });
|
|
67
90
|
await inChild({ op: 'set', ...item, secret }, timeoutMs);
|
|
68
91
|
});
|
|
69
92
|
}
|
|
70
93
|
const STEP = { get: 'read', set: 'save', delete: 'delete' };
|
|
94
|
+
// `id` is the request's, or null for a request too broken to have one.
|
|
71
95
|
const zAnswer = z.union([
|
|
72
|
-
z.strictObject({ ok: z.literal(true), value: z.string().nullable() }),
|
|
73
|
-
z.strictObject({ ok: z.literal(false), error: z.string(), missing: z.literal(true).exactOptional() }),
|
|
96
|
+
z.strictObject({ id: z.number().nullable(), ok: z.literal(true), value: z.string().nullable() }),
|
|
97
|
+
z.strictObject({ id: z.number().nullable(), ok: z.literal(false), error: z.string(), missing: z.literal(true).exactOptional() }),
|
|
74
98
|
]);
|
|
99
|
+
/** This process's one helper: null until a step needs it, and again once it has died or been killed. */
|
|
100
|
+
let helper = null;
|
|
101
|
+
/** Steps go to the helper one at a time, in the order they were asked for. */
|
|
102
|
+
let queue = Promise.resolve();
|
|
103
|
+
let lastId = 0;
|
|
75
104
|
/**
|
|
76
|
-
* One step in the
|
|
77
|
-
* nothing back. A
|
|
78
|
-
* keychain, so each of those throws: never null, which would read as nobody signed in.
|
|
105
|
+
* One step in the helper: the saved secret (`get`), or null, for none or for a step that saves
|
|
106
|
+
* nothing back. A helper that can't start, dies, or answers anything else has said nothing about the
|
|
107
|
+
* keychain, so each of those throws: never null, which would read as nobody signed in. The step's
|
|
108
|
+
* `timeoutMs` counts from the call, so a step behind a stuck one fails on time too, and is then
|
|
109
|
+
* never sent.
|
|
79
110
|
*/
|
|
80
111
|
function inChild(request, timeoutMs) {
|
|
81
112
|
const script = childScript();
|
|
82
113
|
if (script === undefined)
|
|
83
|
-
return Promise.reject(new
|
|
114
|
+
return Promise.reject(new KeychainError("the keychain store can't find its child script, keychainChild.js: this module's import.meta.url is empty, as a CommonJS bundle may leave it", { kind: 'helper', exit: null }));
|
|
84
115
|
return new Promise((resolve, reject) => {
|
|
116
|
+
const deadline = Date.now() + timeoutMs;
|
|
85
117
|
let settled = false;
|
|
118
|
+
// The helper this step was sent to, once it was: stuck on it if the deadline passes.
|
|
119
|
+
let sentTo = null;
|
|
86
120
|
const settle = (finish) => {
|
|
87
121
|
if (settled)
|
|
88
122
|
return;
|
|
@@ -90,56 +124,171 @@ function inChild(request, timeoutMs) {
|
|
|
90
124
|
clearTimeout(timer);
|
|
91
125
|
finish();
|
|
92
126
|
};
|
|
93
|
-
|
|
94
|
-
const child = spawn(process.execPath, [script], { stdio: ['pipe', 'ignore', 'ignore', 'pipe'], windowsHide: true });
|
|
95
|
-
const [stdin, , , answers] = child.stdio;
|
|
96
|
-
// SIGKILL: a process stuck in the kernel runs no handler.
|
|
97
|
-
const timer = setTimeout(() => {
|
|
98
|
-
child.kill('SIGKILL');
|
|
127
|
+
const late = () => {
|
|
99
128
|
settle(() => {
|
|
100
|
-
reject(new
|
|
129
|
+
reject(new KeychainError(`the keychain didn't answer within ${timeoutMs / 1000} s`, { kind: 'timeout', timeoutMs }));
|
|
101
130
|
});
|
|
131
|
+
};
|
|
132
|
+
const timer = setTimeout(() => {
|
|
133
|
+
if (sentTo !== null)
|
|
134
|
+
stop(sentTo);
|
|
135
|
+
late();
|
|
102
136
|
}, timeoutMs);
|
|
103
|
-
|
|
137
|
+
// Exactly once more, on a fresh helper and within the same deadline, when the first helper
|
|
138
|
+
// closed before it answered: one that crashed, died while idle, or was killed with the app's
|
|
139
|
+
// process group by a signal the app may handle and go on from. Ctrl-C isn't one of those: the
|
|
140
|
+
// helper ignores it (#169). Every step is safe to repeat: a read or a delete changes nothing
|
|
141
|
+
// twice, and a save writes the same tokens again.
|
|
142
|
+
const turn = async () => {
|
|
143
|
+
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
144
|
+
if (settled)
|
|
145
|
+
return;
|
|
146
|
+
// By the clock as well as the timer: a thread blocked past the deadline gives this turn
|
|
147
|
+
// first, before the overdue timer has run, and a step that late is never sent.
|
|
148
|
+
if (Date.now() >= deadline) {
|
|
149
|
+
late();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const current = helper ?? startHelper(script);
|
|
153
|
+
if (current instanceof Error) {
|
|
154
|
+
settle(() => {
|
|
155
|
+
reject(current);
|
|
156
|
+
});
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
helper = current;
|
|
160
|
+
sentTo = current;
|
|
161
|
+
// With its time left, which the helper keeps to if this process ends while it's on the step.
|
|
162
|
+
const answer = await ask(current, { id: ++lastId, msLeft: Math.max(1, deadline - Date.now()), afterParentMs: AFTER_PARENT_MS, parent: process.pid, ...request });
|
|
163
|
+
sentTo = null;
|
|
164
|
+
if (answer instanceof HelperClosed && attempt === 1)
|
|
165
|
+
continue;
|
|
166
|
+
settle(() => {
|
|
167
|
+
if (answer instanceof HelperClosed)
|
|
168
|
+
reject(new KeychainError(answer.message, { kind: 'helper', exit: answer.exit }));
|
|
169
|
+
else if (answer instanceof Error)
|
|
170
|
+
reject(answer);
|
|
171
|
+
else if (answer.ok)
|
|
172
|
+
resolve(answer.value);
|
|
173
|
+
else if (answer.missing === true)
|
|
174
|
+
reject(new KeychainError('the keychain store needs the optional package @napi-rs/keyring, which is not installed: npm install @napi-rs/keyring', { kind: 'missing' }));
|
|
175
|
+
else
|
|
176
|
+
reject(new KeychainError(`the keychain refused the ${STEP[request.op]}: ${answer.error}`, { kind: refusalKind(answer.error) }));
|
|
177
|
+
});
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
// A helper that threw while it was being started, as on a spawn that gave no stdio at all.
|
|
182
|
+
queue = queue.then(turn).catch((error) => {
|
|
104
183
|
settle(() => {
|
|
105
|
-
reject(new
|
|
184
|
+
reject(new KeychainError("the keychain helper couldn't start", { kind: 'helper', exit: null }, { cause: error }));
|
|
106
185
|
});
|
|
107
186
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** Sends one request, and waits for its answer, or for the helper to be gone. */
|
|
190
|
+
function ask(to, request) {
|
|
191
|
+
return new Promise((resolve) => {
|
|
192
|
+
to.waiting = {
|
|
193
|
+
id: request.id,
|
|
194
|
+
settle: (answer) => {
|
|
195
|
+
idle(to);
|
|
196
|
+
resolve(answer);
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
busy(to);
|
|
200
|
+
to.stdin.write(`${JSON.stringify(request)}\n`);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function startHelper(script) {
|
|
204
|
+
// The answers come on a pipe of their own (fd 3), apart from anything else printed to stdout.
|
|
205
|
+
const child = spawn(process.execPath, [script], { stdio: ['pipe', 'ignore', 'ignore', 'pipe'], windowsHide: true });
|
|
206
|
+
// Listened for before anything else: a spawn that fails (EMFILE, ENFILE) leaves no pipes, and
|
|
207
|
+
// emits 'error' on the next tick, which with no listener would end the app.
|
|
208
|
+
let started = null;
|
|
209
|
+
child.on('error', (error) => {
|
|
210
|
+
if (started !== null)
|
|
211
|
+
gone(started, new KeychainError("the keychain helper couldn't start", { kind: 'helper', exit: null }, { cause: error }));
|
|
212
|
+
});
|
|
213
|
+
const [stdin, , , answers] = child.stdio;
|
|
214
|
+
if (!(stdin instanceof Socket) || !(answers instanceof Socket)) {
|
|
215
|
+
child.kill('SIGKILL');
|
|
216
|
+
return new KeychainError("the keychain helper's pipes didn't open", { kind: 'helper', exit: null });
|
|
217
|
+
}
|
|
218
|
+
const ready = { child, stdin, answers, waiting: null, unreadable: false };
|
|
219
|
+
started = ready;
|
|
220
|
+
child.on('close', (code, signal) => {
|
|
221
|
+
gone(ready, new HelperClosed({ code, signal }, ready.unreadable));
|
|
222
|
+
});
|
|
223
|
+
// A helper that died closes the pipe under a write; its close reports it.
|
|
224
|
+
stdin.on('error', () => undefined);
|
|
225
|
+
let buffered = '';
|
|
226
|
+
answers.setEncoding('utf8');
|
|
227
|
+
answers.on('data', (chunk) => {
|
|
228
|
+
buffered += chunk;
|
|
229
|
+
for (let end = buffered.indexOf('\n'); end !== -1; end = buffered.indexOf('\n')) {
|
|
230
|
+
const answer = answerOf(buffered.slice(0, end));
|
|
231
|
+
buffered = buffered.slice(end + 1);
|
|
232
|
+
const waiting = ready.waiting;
|
|
233
|
+
// Anything but the awaited step's answer: the helper can't be trusted with the next step.
|
|
234
|
+
// Its close then settles the step that waits.
|
|
235
|
+
if (answer === undefined || waiting === null || answer.id !== waiting.id) {
|
|
236
|
+
ready.unreadable = true;
|
|
237
|
+
stop(ready);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
ready.waiting = null;
|
|
241
|
+
waiting.settle(answer);
|
|
114
242
|
}
|
|
115
|
-
// A child that died early closes the pipe under the write; the close below reports it.
|
|
116
|
-
stdin.on('error', () => undefined);
|
|
117
|
-
// One line, and the pipe then stays open as the child's heartbeat until it exits.
|
|
118
|
-
stdin.write(`${JSON.stringify(request)}\n`);
|
|
119
|
-
let out = '';
|
|
120
|
-
answers.setEncoding('utf8');
|
|
121
|
-
answers.on('data', (chunk) => {
|
|
122
|
-
out += chunk;
|
|
123
|
-
});
|
|
124
|
-
child.on('close', () => {
|
|
125
|
-
settle(() => {
|
|
126
|
-
const answer = answerOf(out);
|
|
127
|
-
if (answer === undefined)
|
|
128
|
-
reject(new Error('the keychain step gave no readable answer'));
|
|
129
|
-
else if (answer.ok)
|
|
130
|
-
resolve(answer.value);
|
|
131
|
-
else if (answer.missing === true)
|
|
132
|
-
reject(new Error('the keychain store needs the optional package @napi-rs/keyring, which is not installed: npm install @napi-rs/keyring'));
|
|
133
|
-
else
|
|
134
|
-
reject(new Error(`the keychain refused the ${STEP[request.op]}: ${answer.error}`));
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
243
|
});
|
|
244
|
+
idle(ready);
|
|
245
|
+
return ready;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A helper that closed before it answered: the step it was answering may run once more (`inChild`).
|
|
249
|
+
* How it ended goes in the message (#157 item 2), never anything it printed, where a token could be.
|
|
250
|
+
*/
|
|
251
|
+
class HelperClosed extends Error {
|
|
252
|
+
exit;
|
|
253
|
+
constructor(exit, unreadable) {
|
|
254
|
+
const how = exit.signal !== null ? `signal ${exit.signal}` : exit.code !== null ? `exit ${exit.code}` : 'no exit status';
|
|
255
|
+
super(unreadable ? `the keychain step's answer couldn't be read, so its helper was stopped (${how})` : `the keychain step gave no readable answer (${how})`);
|
|
256
|
+
this.name = 'HelperClosed';
|
|
257
|
+
this.exit = exit;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/** A helper that died or couldn't start: the next step starts another, and the step it was answering fails with `reason`. */
|
|
261
|
+
function gone(of, reason) {
|
|
262
|
+
if (helper === of)
|
|
263
|
+
helper = null;
|
|
264
|
+
const waiting = of.waiting;
|
|
265
|
+
of.waiting = null;
|
|
266
|
+
waiting?.settle(reason);
|
|
267
|
+
}
|
|
268
|
+
/** Kills a helper, perhaps stuck in the kernel on a step past its deadline: SIGKILL, which needs no handler. The next step starts another. */
|
|
269
|
+
function stop(stopping) {
|
|
270
|
+
if (helper === stopping)
|
|
271
|
+
helper = null;
|
|
272
|
+
stopping.child.kill('SIGKILL');
|
|
273
|
+
}
|
|
274
|
+
// While a step waits, the helper and its pipes keep this process alive; between steps they don't,
|
|
275
|
+
// so a warm helper never holds up the app's exit. When this process ends, however it ends, the
|
|
276
|
+
// helper's standard input closes, and the helper ends: at once when idle or on a read, or once the
|
|
277
|
+
// save or delete it's on is done or cut off (keychainChild.ts).
|
|
278
|
+
function busy(of) {
|
|
279
|
+
of.child.ref();
|
|
280
|
+
of.stdin.ref();
|
|
281
|
+
of.answers.ref();
|
|
282
|
+
}
|
|
283
|
+
function idle(of) {
|
|
284
|
+
of.child.unref();
|
|
285
|
+
of.stdin.unref();
|
|
286
|
+
of.answers.unref();
|
|
138
287
|
}
|
|
139
|
-
function answerOf(
|
|
288
|
+
function answerOf(line) {
|
|
140
289
|
let parsed;
|
|
141
290
|
try {
|
|
142
|
-
parsed = JSON.parse(
|
|
291
|
+
parsed = JSON.parse(line);
|
|
143
292
|
}
|
|
144
293
|
catch {
|
|
145
294
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keychainStore.js","sourceRoot":"","sources":["../../src/node/keychainStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"keychainStore.js","sourceRoot":"","sources":["../../src/node/keychainStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,CAAC,E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
CHANGED
|
@@ -68,7 +68,7 @@ export async function signInWithLoopback(options) {
|
|
|
68
68
|
// The redirect came in time: the exchange has its own deadline (`finishSignIn`).
|
|
69
69
|
clearTimeout(timer);
|
|
70
70
|
reading.abort();
|
|
71
|
-
return finishSignIn(callbackUrl, pending, { signal, fetch: options.fetch });
|
|
71
|
+
return finishSignIn(callbackUrl, pending, { signal, fetch: options.fetch, allowLocalhostHttp: options.allowLocalhostHttp });
|
|
72
72
|
};
|
|
73
73
|
timer = setTimeout(() => {
|
|
74
74
|
endWait({ kind: 'timeout' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loopback.js","sourceRoot":"","sources":["../../src/node/loopback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0D,MAAM,WAAW,CAAA;AAEhG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwE,MAAM,mBAAmB,CAAA;AAEnI,OAAO,EAAE,mBAAmB,EAAuB,MAAM,eAAe,CAAA;AAyCxE,MAAM,OAAO,GAAG,OAAO,CAAA;AAEvB,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,IAAY,EAAU,EAAE,CACrD,qEAAqE,OAAO,iBAAiB;IAC7F,iGAAiG;IACjG,OAAO,OAAO,WAAW,IAAI,MAAM;IACnC,kFAAkF;IAClF,+FAA+F,CAAA;AACjG,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,gCAAgC,CAAC,EAAE,CAAA;AAE1I,MAAM,OAAO,GAAG,CAAC,KAAc,EAAS,EAAE,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAEtG;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,O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AO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAA;AACzC,CAAC;AAED;;;GAGG;AACH,SAAS,IAAI,CAAC,QAAwB,EAAE,MAAc,EAAE,IAAY;IAClE,IAAI,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,aAAa;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1E,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,0BAA0B,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5H,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC/B,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/node/session.d.ts
CHANGED
|
@@ -44,9 +44,11 @@ export type TokenUpdate =
|
|
|
44
44
|
/**
|
|
45
45
|
* Where the session refreshes and signs out comes from exactly one of `issuer` and `server`:
|
|
46
46
|
* neither or both doesn't compile. From JavaScript, neither, both, or an issuer that is no https
|
|
47
|
-
* URL is a TypeError at creation
|
|
47
|
+
* URL (or, with `allowLocalhostHttp`, no http one on this machine) is a TypeError at creation, and
|
|
48
|
+
* so, with the option, is a server whose endpoints break its issuer's rule: https for an https
|
|
49
|
+
* issuer, its own origin for an http one.
|
|
48
50
|
*/
|
|
49
|
-
export type SessionOptions = Pick<AuthCallOptions, 'fetch'> & ({
|
|
51
|
+
export type SessionOptions = Pick<AuthCallOptions, 'fetch' | 'allowLocalhostHttp'> & ({
|
|
50
52
|
/**
|
|
51
53
|
* The session discovers the server itself (`discover`'s rules), at the first refresh or
|
|
52
54
|
* sign-out that needs it, and keeps it (#130). A token with time left is handed out with
|
|
@@ -68,6 +70,16 @@ export type SessionOptions = Pick<AuthCallOptions, 'fetch'> & ({
|
|
|
68
70
|
* no server text (`finishSignIn`'s rule). Left out, the session is a public client's. Never log it.
|
|
69
71
|
*/
|
|
70
72
|
readonly clientSecret?: string | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* How long a `token()` caller waits for its token in all, the store's read included, before it
|
|
75
|
+
* gets `unavailable`: 15 s when left out (#131, D497). A whole number of ms, from 1 to
|
|
76
|
+
* 2,147,483,647, the timers' own limit, or a TypeError at creation. Give a store that can wait on
|
|
77
|
+
* a person, such as a keychain asking for access, as long as that person may take: the CLI's
|
|
78
|
+
* 120 s when interactive, say. Only this wait changes. A refresh still waits at most 60 s for its
|
|
79
|
+
* lock and its answer, then its re-read and save are waited out, as before; a sign-out answers at
|
|
80
|
+
* its 10 s; and D487's 60 s bounds on a sign-out's lock and store calls stay as they are.
|
|
81
|
+
*/
|
|
82
|
+
readonly waitMs?: number | undefined;
|
|
71
83
|
/**
|
|
72
84
|
* The tokens as the store holds them now, or null when nobody is signed in. Read again before
|
|
73
85
|
* every refresh, so the refresh token sent is the current one, even after another process
|
|
@@ -126,7 +138,7 @@ export type SessionFailure =
|
|
|
126
138
|
{
|
|
127
139
|
readonly kind: 'signed-out';
|
|
128
140
|
}
|
|
129
|
-
/** No token within 15 s, or no answer at all: offline, or the server is down. A refresh goes on, and its answer is still saved. */
|
|
141
|
+
/** No token within the caller's wait (`waitMs`, 15 s by default), or no answer at all: offline, or the server is down. A refresh goes on, and its answer is still saved. */
|
|
130
142
|
| {
|
|
131
143
|
readonly kind: 'unavailable';
|
|
132
144
|
}
|
|
@@ -210,6 +222,11 @@ export interface Session {
|
|
|
210
222
|
* sign-in saved after the turn read the store is kept. The caller waits for the clear within its
|
|
211
223
|
* 10 s.
|
|
212
224
|
*
|
|
225
|
+
* A refresh token the session holds only in memory, because saving it failed (D456), goes too once
|
|
226
|
+
* the store has moved on from the token it replaced: as a refresh token, after the stored session,
|
|
227
|
+
* in the same 10 s. One sign-out sends it, whatever the result, and the session then lets it go
|
|
228
|
+
* (D500). Its send failing is the result when the stored session's went as well as it can.
|
|
229
|
+
*
|
|
213
230
|
* Once the turn reaches the lock, it waits at most 60 s for it, and at most 60 s for each store
|
|
214
231
|
* call; then it gives up, touching nothing more, and later turns run (D487). So after `timeout`
|
|
215
232
|
* or `aborted` the clear may still be on its way: 60 s for the lock and for each of its three
|
|
@@ -220,5 +237,27 @@ export interface Session {
|
|
|
220
237
|
* holding only an access token, until that token expires.
|
|
221
238
|
*/
|
|
222
239
|
revoke(options?: Pick<AuthCallOptions, 'signal'>): Promise<RevokeResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Resolves once nothing is in flight in this session: no refresh, no save, no sign-out, and no
|
|
242
|
+
* `token()` still reading the store before it queues a refresh (#170, D516). Await it before the
|
|
243
|
+
* process exits, on Ctrl-C or after `unavailable`: `token()` answers at its `waitMs` and
|
|
244
|
+
* `revoke()` at its 10 s while their work goes on, and an exit then can cut a refresh after
|
|
245
|
+
* pulse-auth has rotated, losing the new token. Work that starts while it waits is waited for too.
|
|
246
|
+
*
|
|
247
|
+
* It never rejects, and it starts no work. It waits at most as long as the session's own limits
|
|
248
|
+
* (D521): a refresh's 60 s for its lock and its request (D445), and a sign-out's 60 s for the lock
|
|
249
|
+
* and for each store call (D487). What those limits leave out:
|
|
250
|
+
* - a store that never answers a read or a save holds it too: a `token()` call's first read, and a
|
|
251
|
+
* refresh's re-read and save, are waited out, never cut short;
|
|
252
|
+
* - so does a lock that ignores its signal, which holds a turn for as long as it waits;
|
|
253
|
+
* - so do calls that keep coming: stop making them before awaiting this;
|
|
254
|
+
* - a sign-out's store call still running after its 60 s isn't waited for: the turn has given up
|
|
255
|
+
* on it, and so does this.
|
|
256
|
+
* The SDK's own stores answer every call: `fileStore`'s steps don't hang, and `keychainStore`'s
|
|
257
|
+
* each end within its `timeoutMs`, 30 s unless the app sets more. A save or a clear is two of
|
|
258
|
+
* those steps, a read and a write, so a `timeoutMs` over 30 s can run a sign-out's clear past its
|
|
259
|
+
* 60 s.
|
|
260
|
+
*/
|
|
261
|
+
settled(): Promise<void>;
|
|
223
262
|
}
|
|
224
263
|
export declare function createSession(options: SessionOptions): Session;
|