@minca/core 0.1.7 → 0.1.8
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/dist/elements/auth-styles.d.ts +1 -1
- package/dist/elements/auth-styles.d.ts.map +1 -1
- package/dist/elements/auth-styles.js +16 -8
- package/dist/elements/auth-styles.js.map +1 -1
- package/dist/elements/minca-auth.d.ts +7 -0
- package/dist/elements/minca-auth.d.ts.map +1 -1
- package/dist/elements/minca-auth.js +107 -49
- package/dist/elements/minca-auth.js.map +1 -1
- package/dist/node/api.d.ts +1 -0
- package/dist/node/api.d.ts.map +1 -1
- package/dist/node/api.js +7 -1
- package/dist/node/api.js.map +1 -1
- package/dist/node/node.d.ts.map +1 -1
- package/dist/node/node.js +135 -57
- package/dist/node/node.js.map +1 -1
- package/dist/node/types.d.ts +8 -0
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/writer-keys.d.ts +4 -1
- package/dist/node/writer-keys.d.ts.map +1 -1
- package/dist/node/writer-keys.js +25 -6
- package/dist/node/writer-keys.js.map +1 -1
- package/dist/node/writers.d.ts.map +1 -1
- package/dist/node/writers.js +10 -3
- package/dist/node/writers.js.map +1 -1
- package/dist/react/minca-auth.d.ts +3 -1
- package/dist/react/minca-auth.d.ts.map +1 -1
- package/dist/react/minca-auth.js +5 -3
- package/dist/react/minca-auth.js.map +1 -1
- package/dist/session/account-hint.d.ts +13 -0
- package/dist/session/account-hint.d.ts.map +1 -0
- package/dist/session/account-hint.js +51 -0
- package/dist/session/account-hint.js.map +1 -0
- package/dist/session/auth.d.ts +51 -3
- package/dist/session/auth.d.ts.map +1 -1
- package/dist/session/auth.js +254 -35
- package/dist/session/auth.js.map +1 -1
- package/dist/session/connect.d.ts.map +1 -1
- package/dist/session/connect.js +6 -2
- package/dist/session/connect.js.map +1 -1
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +1 -0
- package/dist/session/index.js.map +1 -1
- package/dist/session/pairing.d.ts +2 -0
- package/dist/session/pairing.d.ts.map +1 -1
- package/dist/session/pairing.js +8 -0
- package/dist/session/pairing.js.map +1 -1
- package/dist/session/places.d.ts +5 -0
- package/dist/session/places.d.ts.map +1 -1
- package/dist/session/places.js +12 -0
- package/dist/session/places.js.map +1 -1
- package/docs/node.md +24 -2
- package/docs/sign-in.md +123 -24
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"places.js","sourceRoot":"","sources":["../../src/session/places.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAwC,MAAM,mBAAmB,CAAC;AAqBvF,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,yBAAyB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACxF,CAAC;AAED,iCAAiC;AACjC,SAAS,WAAW,CAAC,SAA8B;IACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,OAAO,WAAW,CAAC,MAAM,cAAc,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAU;IAC1C,IAAI,CAAC,GAAG,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC7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AAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IACvG,MAAM,SAAS,GAAG,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACnE,MAAM,OAAO,CAAC,GAAG,CACf,SAAS;SACN,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;SACpB,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACrF,GAAG,CACF,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC5E,CAAC,CAAC,CACL,CACJ,CAAC;AACJ,CAAC;AAED,kGAAkG;AAClG,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,aAAa,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,UAAU,CAAC;AAC7E,CAAC"}
|
package/docs/node.md
CHANGED
|
@@ -210,6 +210,20 @@ node makes a key for this run as it would without a source.
|
|
|
210
210
|
whether its stores are in IndexedDB or a data folder, so signing out
|
|
211
211
|
(`deleteBrowserData`) deletes the keys too. The key never goes in the data
|
|
212
212
|
folder, which other apps and devices share.
|
|
213
|
+
- `forget()` drops the key but keeps its places, which still count while it
|
|
214
|
+
signs this run; the slot's next claim makes a new key and clears them.
|
|
215
|
+
`revokeSelf` forgets the claimed key before it writes a single revoke, so a
|
|
216
|
+
page closed while the revokes wait leaves no revoked key to claim again.
|
|
217
|
+
With a peer connected in any open space, each revoke waits up to
|
|
218
|
+
`waitMs` for one to take it in; with none, none wait. A node that claims a
|
|
219
|
+
key the account registry has revoked anyway (one forgotten by an older
|
|
220
|
+
version, say) forgets it and starts again on a key for this run alone; the
|
|
221
|
+
next start claims a new lasting one.
|
|
222
|
+
- A node never signs at a place behind one it took itself this run: if the
|
|
223
|
+
slot has lost them (site data cleared while the page was open), every
|
|
224
|
+
write fails until the page reloads, since signing on would fork the line
|
|
225
|
+
and withdraw what the key wrote. A slot whose connection the browser
|
|
226
|
+
closed opens again only while it still holds the key.
|
|
213
227
|
- The CLI keeps them in `~/.minca/writers/<account id>/slot-<n>/`: the key as
|
|
214
228
|
JWK in an envelope (spec 01 §9.1) under the account's local key, with label
|
|
215
229
|
`minca/writer-key/v1` and bound `{ did: <account DID>, slot: <n> }`
|
|
@@ -218,7 +232,7 @@ node makes a key for this run as it would without a source.
|
|
|
218
232
|
`heads/`; and a `lock` file naming the process that holds it, taken over
|
|
219
233
|
once that process is gone.
|
|
220
234
|
|
|
221
|
-
_Source: `packages/core/src/node/writer-keys.ts` (`browserWriterKeys`), `packages/core/src/node/stores.ts` (`writerKeysFor`), `packages/core/src/node/worker.ts` (`withWriterKey`), `packages/cli/src/writer-keys.ts` (`fileWriterKeys`), `packages/cli/src/home.ts` (`unlock`, `nodeFor`). Tests: `packages/core/tests/writer-logs.test.ts` ("a writer key that outlives the node"), `packages/cli/tests/writer-keys.test.ts` ("a key file moved to another slot, or to another account, does not open")._
|
|
235
|
+
_Source: `packages/core/src/node/writer-keys.ts` (`browserWriterKeys`), `packages/core/src/node/writers.ts` (`createWriters`), `packages/core/src/node/node.ts` (`createNode`, `revokeSelf`), `packages/core/src/node/stores.ts` (`writerKeysFor`), `packages/core/src/node/worker.ts` (`withWriterKey`), `packages/cli/src/writer-keys.ts` (`fileWriterKeys`), `packages/cli/src/home.ts` (`unlock`, `nodeFor`). Tests: `packages/core/tests/writer-logs.test.ts` ("a writer key that outlives the node"), `packages/cli/tests/writer-keys.test.ts` ("a key file moved to another slot, or to another account, does not open")._
|
|
222
236
|
|
|
223
237
|
Sign-in ([sign-in](sign-in.md)) uses `storesFor(account)`: IndexedDB with prefix
|
|
224
238
|
`minca:<dataPath with : for />` in the browser, or `folderStores(pod,
|
|
@@ -805,7 +819,15 @@ are protocol ([spec 06 §4](https://github.com/leifriksheim/minca/blob/main/spec
|
|
|
805
819
|
the carry space, named `Carried by <name>` (name trimmed to 80, default
|
|
806
820
|
`Carrier`), writes the `sys.carrier` record, fills the carry space, and returns
|
|
807
821
|
`{ space, invite }` for the carrier to join with; for a carrier it already
|
|
808
|
-
has, by `did`, it returns that one's.
|
|
822
|
+
has, by `did`, it returns that one's. If the record can't be written, it
|
|
823
|
+
takes the carry space back out before failing, so a restart never lists it as
|
|
824
|
+
a space the account uses. A node that starts, or hears the registry change,
|
|
825
|
+
refills every carrier's carry space in the background: it opens every space
|
|
826
|
+
the account holds, which from a data folder is slow, and signing in doesn't
|
|
827
|
+
wait for it. Adding an automation doesn't either (adding a carrier writes that
|
|
828
|
+
carrier's passes before it returns):
|
|
829
|
+
`node.carriers.settled(waitMs)` waits up to `waitMs` for the refill under way
|
|
830
|
+
and says whether it finished, for a window about to close. `node.carriers.reached(carrySpace, waitMs)`
|
|
809
831
|
waits up to `waitMs` for the node to be level with the carrier in the carry
|
|
810
832
|
space and then the account registry, and says whether it was: a node about to
|
|
811
833
|
close (the home's window, once it has answered) waits on it, so what it wrote
|
package/docs/sign-in.md
CHANGED
|
@@ -60,26 +60,36 @@ _Source: `packages/core/src/identity/account-store.ts`. Tests: `packages/core/te
|
|
|
60
60
|
|
|
61
61
|
Transitions:
|
|
62
62
|
|
|
63
|
-
| From | Action | To
|
|
64
|
-
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
65
|
-
| `starting` | `start()`, a kept sign-in for an account in the place ([the session a sign-in starts](#the-session-a-sign-in-starts)) | `ready`
|
|
66
|
-
| `starting` | `start()`, a pairing ticket in the URL
|
|
67
|
-
| `starting` | `start()`, otherwise | `signIn` if the place has accounts, else `welcome`
|
|
68
|
-
| `starting` | `start()` fails | `welcome` (with `error`)
|
|
69
|
-
| any | `showWelcome()` / `showExisting()` / `showRestore()` / `showSignIn()` | `welcome` / `existing` / `restore` / `signIn`
|
|
70
|
-
| `existing`, `signIn`
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `pod` | `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `signIn
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `pair` | `
|
|
82
|
-
| `
|
|
63
|
+
| From | Action | To |
|
|
64
|
+
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
65
|
+
| `starting` | `start()`, a kept sign-in for an account in the place ([the session a sign-in starts](#the-session-a-sign-in-starts)) | `ready`, or `pair` (signed in) with a pairing ticket in the URL |
|
|
66
|
+
| `starting` | `start()`, no kept sign-in and a pairing ticket in the URL | `pair` |
|
|
67
|
+
| `starting` | `start()`, otherwise | `signIn` if the place has accounts, else `welcome` |
|
|
68
|
+
| `starting` | `start()` fails | `welcome` (with `error`) |
|
|
69
|
+
| any | `showWelcome()` / `showExisting()` / `showRestore()` / `showSignIn()` | `welcome` / `existing` / `restore` / `signIn` |
|
|
70
|
+
| `welcome`, `existing`, `signIn` | `choosePod()` / `useBrowser()` while signed out | `signIn` or `welcome` |
|
|
71
|
+
| `welcome` | `reopenPod()`, from a click, with `podToReopen` set | `ready` with a kept sign-in for an account there, else `signIn` or `welcome` |
|
|
72
|
+
| `ready` | `choosePod()` while signed in | `ready`, with `podChoice` set; `confirmPod('combine' \| 'switch')` restarts the session in the pod |
|
|
73
|
+
| `pod` | `choosePod()` | `ready`: the new account moves into the pod without asking, and its browser copy is removed |
|
|
74
|
+
| `pod` | `finishSetup()` | `ready` |
|
|
75
|
+
| `welcome`, `existing`, `signIn` | `startCreating()` | `create` |
|
|
76
|
+
| `signIn` | `signInWithPassword` / `signInWithPasskey` succeeds | `ready` |
|
|
77
|
+
| `signIn`, `restore` | `signInWithCode` (or a recovery code given to `signInWithPassword`) succeeds | `ready` if the account has a usable passkey or a password here; else `unlock` with `setup: 'restored'` |
|
|
78
|
+
| `create` | `createAccount(name)` | `recovery`, with `session`, `freshCode` and `setup: 'new'` set |
|
|
79
|
+
| `recovery` | `codeSaved()` | `unlock` |
|
|
80
|
+
| `unlock` | `addPasskey()` / `setPassword(p)` succeeds | `pod` for a new account in a browser that can open folders, unless `offerPod` is false; else `ready` |
|
|
81
|
+
| `pair` | `acceptPairing()` | once the computer confirms the code, `unlock` with `setup: 'paired'` if the account has no way in here, else `ready`; signed in to another, `pair` with `pairingArrival` |
|
|
82
|
+
| `pair` | `answerPairing(true)` / `answerPairing(false)` | as `acceptPairing()` signed out / `ready`, the account signed in kept |
|
|
83
|
+
| `pair` | `dismissPairing()` | `ready` if signed in, else `signIn` / `welcome` |
|
|
84
|
+
| `ready` | `signOut()` | `starting`, then `signIn` / `welcome` |
|
|
85
|
+
|
|
86
|
+
A pod this site used last opens at `start()` only while the browser still
|
|
87
|
+
grants it. Chrome keeps the folder's handle between visits, but not the
|
|
88
|
+
permission, unless the person chose "Allow on every visit". Then `start()`
|
|
89
|
+
sets `podToReopen` to the folder's name and goes on as if there were no pod;
|
|
90
|
+
`<minca-auth>` offers it first on the welcome screen, and `reopenPod()`, from
|
|
91
|
+
that click, asks for the permission and goes on as `start()` would have,
|
|
92
|
+
signed in if the sign-in was kept.
|
|
83
93
|
|
|
84
94
|
A failed action sets `error` (`{ message, hint?, code? }`) and leaves the stage
|
|
85
95
|
as it was. A dismissed passkey or folder prompt sets no error.
|
|
@@ -89,7 +99,7 @@ while it runs, or a carrier given the folder. A page that closes once signed
|
|
|
89
99
|
in, such as an account home's connect page, passes `offerPod: false`, and
|
|
90
100
|
offers the pod where the person comes back instead.
|
|
91
101
|
|
|
92
|
-
_Source: `packages/core/src/session/auth.ts
|
|
102
|
+
_Source: `packages/core/src/session/auth.ts` (`start`, `reopenPod`), `packages/core/src/session/places.ts` (`podToReopen`). Tests: `packages/core/tests/auth.test.ts`, `packages/core/tests/take-up.test.ts` ("a pod the browser wants a click to open again")._
|
|
93
103
|
|
|
94
104
|
## Ways in
|
|
95
105
|
|
|
@@ -130,6 +140,39 @@ waits for `ready` does not see the session during `recovery`, `unlock` or
|
|
|
130
140
|
|
|
131
141
|
_Source: `packages/core/src/session/auth.ts`, `packages/core/src/session/credentials.ts`, `packages/core/src/identity/account-vault.ts` (`CLI_PASSPHRASE_LABEL`). Tests: `packages/core/tests/auth.test.ts`, `packages/core/tests/account-vault.test.ts`._
|
|
132
142
|
|
|
143
|
+
## Proving it is you
|
|
144
|
+
|
|
145
|
+
Being signed in is no proof anyone is there: a page may be left open, and a
|
|
146
|
+
sign-in kept for days. So whatever hands out the whole account, or changes how
|
|
147
|
+
it signs in, asks again. `auth.recoveryCode()` returns the code,
|
|
148
|
+
`auth.offerToPhone()` starts, `setPassword`, `addPasskey` and
|
|
149
|
+
`removeShortcut` work (outside the first setup of an account just made,
|
|
150
|
+
restored or paired, which only landing a session opens), only within five
|
|
151
|
+
minutes of `auth.confirm(proof)` succeeding for the account signed in now
|
|
152
|
+
(`isConfirmed()` says whether it has), where `proof` is
|
|
153
|
+
`{ password }`, `{ passkey: true }` (the passkey's own check that someone is
|
|
154
|
+
there: a fingerprint, a face or a PIN) or `{ code }`, the recovery code itself.
|
|
155
|
+
`confirm` resolves false and sets `error` for a wrong answer, and a passkey
|
|
156
|
+
with no credential behind it is no proof. A new sign-in, or signing out, asks
|
|
157
|
+
again. The recovery code shown once when an account is made needs no confirm.
|
|
158
|
+
|
|
159
|
+
Giving an app or a carrier anything (`auth.grant`, `auth.grantCarry`) takes
|
|
160
|
+
the same proof, or a sign-in with `signInWithPassword`, `signInWithPasskey`
|
|
161
|
+
or `signInWithCode` in the last five minutes: the person just gave it.
|
|
162
|
+
Making the account counts too: whoever made it is there. A passkey sign-in
|
|
163
|
+
counts only when the passkey's own check ran, not for a wrap with no
|
|
164
|
+
credential behind it. `mayGrant()` says whether any of these holds. A
|
|
165
|
+
sign-in kept from an earlier visit is none of them. So the reference home's connect page
|
|
166
|
+
goes as signing in with Google does: choose the account, prove it is you
|
|
167
|
+
(signing in to it, or confirming if it is the one signed in), then allow.
|
|
168
|
+
A suggestion from an app already connected (`auth.propose`) gives nothing
|
|
169
|
+
new, and needs only the sign-in.
|
|
170
|
+
This keeps the seed from someone who only has the open page, not from a
|
|
171
|
+
compromised one: the seed is in the page's memory while it is signed in
|
|
172
|
+
([threat model §4](https://github.com/leifriksheim/minca/blob/main/spec/threat-model.md)).
|
|
173
|
+
|
|
174
|
+
_Source: `packages/core/src/session/auth.ts` (`confirm`, `mayGrant`, `recoveryCode`, `offerToPhone`), `apps/home/src/components/ConfirmItsYou.tsx`, `apps/home/src/components/ConnectPage.tsx` (`ChooseAccount`). Tests: `packages/core/tests/auth.test.ts` ("reading the recovery code or offering the account to a phone takes proof it is you", "changing how the account signs in takes proof it is you, once it is set up", "no call steps back into setup to skip the proof", "proof is for one account, and does not carry over to another"), `packages/core/tests/connect.test.ts` ("an app or a carrier is given access only just after proof it is you")._
|
|
175
|
+
|
|
133
176
|
## Device keys and passkeys
|
|
134
177
|
|
|
135
178
|
A device key ([spec 01 §12](https://github.com/leifriksheim/minca/blob/main/spec/01-identity.md))
|
|
@@ -227,6 +270,11 @@ into the pod, copies every space into it (`copyAccountData`, [stores](node.md#st
|
|
|
227
270
|
restarts the session there. `forgetBrowserCopy()` then deletes the browser's
|
|
228
271
|
copy. Other accounts in the pod are never touched.
|
|
229
272
|
|
|
273
|
+
The page writes to the pod only while it is open. A carrier given the same
|
|
274
|
+
folder, such as the Chrome extension, keeps it up to date while the page is
|
|
275
|
+
closed: it learns of the pod from its grant (`CarryGrant.pod`), so one that
|
|
276
|
+
connected before the move learns of it only by connecting again.
|
|
277
|
+
|
|
230
278
|
_Source: `packages/core/src/session/auth.ts` (`confirmPod`), `packages/core/src/session/places.ts`. Tests: `packages/core/tests/account.test.ts`._
|
|
231
279
|
|
|
232
280
|
## Pairing a phone
|
|
@@ -256,6 +304,32 @@ the person to confirm. Where accounts are already kept here, `<minca-auth>`
|
|
|
256
304
|
warns before going on: a link someone else sent would put the phone in their
|
|
257
305
|
account.
|
|
258
306
|
|
|
307
|
+
A phone that stays signed in still gets the `pair` stage, with the kept
|
|
308
|
+
account's session open, and `<minca-auth>` names it; `dismissPairing()` goes
|
|
309
|
+
back to it. Signed in, `acceptPairing()` stops once the account arrives,
|
|
310
|
+
before taking it, and sets `pairingArrival` to `{ did, account }`: `account`
|
|
311
|
+
is the summary when this place already keeps that account, else null. The
|
|
312
|
+
same account as the one signed in is taken without asking, and only its
|
|
313
|
+
spaces are joined. `answerPairing(true)` adds the account (or, already here,
|
|
314
|
+
switches to it) and the one signed in stays filed, to switch back to;
|
|
315
|
+
`answerPairing(false)` lets it go and goes back to the account signed in.
|
|
316
|
+
`<minca-auth>` asks "Add this account?" or "Switch to <name>?", with the
|
|
317
|
+
account's avatar. Only the tab's session when the account arrives counts: a
|
|
318
|
+
tab that opens with no kept sign-in, or a caller that accepts before
|
|
319
|
+
`start()` has finished, pairs as a signed-out one does. Switching this way
|
|
320
|
+
starts the arriving account's session without signing the other out: its
|
|
321
|
+
session key is left unrevoked, as when a tab closes. `dismissPairing()` stops
|
|
322
|
+
a pairing at any point before the account is taken: the phone leaves the
|
|
323
|
+
exchange, and tells the computer nothing.
|
|
324
|
+
|
|
325
|
+
`pairingTransport` in `createMincaAuth`'s config sets how the two sides of a
|
|
326
|
+
pairing reach each other (default: the relay in the ticket), for tests or a
|
|
327
|
+
host with its own.
|
|
328
|
+
|
|
329
|
+
An account home ignores a pairing link on its connect page, so a popup an app
|
|
330
|
+
opened never shows a pairing screen. It is no defence: any page can open the
|
|
331
|
+
account page with the link instead.
|
|
332
|
+
|
|
259
333
|
The camera opens the link in a new tab, so an app that sent the person to
|
|
260
334
|
sign in is still waiting in another. A flow that is signed out picks up a
|
|
261
335
|
sign-in another tab keeps (`storage` events on the remembered session), as a
|
|
@@ -269,7 +343,30 @@ tab. It keeps the remembered key as it is, and gives up if the kept sign-in
|
|
|
269
343
|
changed meanwhile. When the kept sign-in goes, because the person signed out
|
|
270
344
|
in another tab, a tab that took it up signs out too, revoking its own key.
|
|
271
345
|
|
|
272
|
-
_Source: `packages/core/src/session/pairing.ts` (`offerToPhone`, `receiveFromDesktop`), `packages/core/src/session/auth.ts` (`offerToPhone`, `acceptPairing`), `packages/core/src/elements/minca-auth.ts`. Tests: `packages/core/tests/pairing.test.ts`, `packages/core/tests/take-up.test.ts
|
|
346
|
+
_Source: `packages/core/src/session/pairing.ts` (`offerToPhone`, `receiveFromDesktop`), `packages/core/src/session/auth.ts` (`start`, `offerToPhone`, `acceptPairing`), `packages/core/src/elements/minca-auth.ts`. Tests: `packages/core/tests/pairing.test.ts`, `packages/core/tests/take-up.test.ts` ("a pairing link opened where a sign-in is kept")._
|
|
347
|
+
|
|
348
|
+
## Linking to the account home
|
|
349
|
+
|
|
350
|
+
An app that links to the person's account home (for its settings, say) says
|
|
351
|
+
which account it acts for: `accountHomeLink(home, did, section?)` gives the
|
|
352
|
+
account page beside the home's connect page, with `#account=<did>` in the
|
|
353
|
+
fragment, after the section if there is one (`#notifications&account=…`). The
|
|
354
|
+
fragment never reaches the server that serves the home.
|
|
355
|
+
|
|
356
|
+
The home may be signed in to another account in that browser, or signed out.
|
|
357
|
+
`readAccountHint()` on the home gives the DID, or null when there is none or it
|
|
358
|
+
is not a P-256 `did:key`; `clearAccountHint()` takes it out of the address and
|
|
359
|
+
leaves the section. Any page can open the home with any DID, so a home must
|
|
360
|
+
treat it as a hint: say which account the app uses, pick it on the sign-in
|
|
361
|
+
screen, offer to switch, and never sign out or switch on the hint alone. For
|
|
362
|
+
an account the home doesn't keep, it must not suggest bringing it in: a
|
|
363
|
+
stranger could name their own account, then send a pairing link "to add this
|
|
364
|
+
browser" ([threat model §3.1](https://github.com/leifriksheim/minca/blob/main/spec/threat-model.md)). An
|
|
365
|
+
account the home keeps is named by the name it filed, never one from the
|
|
366
|
+
link; its avatar helps recognise it, but is no proof, since a look-alike
|
|
367
|
+
takes seconds to find.
|
|
368
|
+
|
|
369
|
+
_Source: `packages/core/src/session/account-hint.ts`, `apps/home/src/components/AccountHint.tsx`, `apps/example/src/components/AccountMenu.tsx`, `apps/example/src/notifications.ts`. Tests: `packages/core/tests/account-hint.test.ts`._
|
|
273
370
|
|
|
274
371
|
## The account home's side
|
|
275
372
|
|
|
@@ -324,11 +421,13 @@ disconnects them first, and the programs connected through them, with the
|
|
|
324
421
|
automations they proposed; carriers stay. The node sends nothing once it has
|
|
325
422
|
stopped, so it waits, up to 5 s for them all (`signOutGraceMs` in
|
|
326
423
|
`createMincaAuth`'s config), for a peer to take in each revoke (`spaces.revoke`
|
|
327
|
-
with `waitMs`)
|
|
424
|
+
with `waitMs`). Its own session key's revokes wait only when a peer is connected in some
|
|
425
|
+
open space as signing out starts, so signing out with nobody else online is
|
|
426
|
+
quick; `state.signingOut` is true meanwhile. A node with no network
|
|
328
427
|
configured doesn't wait. With nobody reachable, they leave the next time the account signs in here. A read-only app has no key to revoke: it loses
|
|
329
428
|
access when its time runs out. The account home asks each time, with
|
|
330
429
|
disconnecting ticked, and is not ready to grant anything from the moment
|
|
331
|
-
signing out starts.
|
|
430
|
+
signing out starts. Choosing another account on the connect page signs out
|
|
332
431
|
without disconnecting: switching accounts disconnects nothing.
|
|
333
432
|
|
|
334
433
|
**Proposals.** `auth.propose({ origin, request, kept? })` adds the
|