clavarium 0.2.59-beta.1 → 0.2.60-beta.1

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.59-beta.1",
3
+ "version": "0.2.60-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.59-beta.1",
9
+ "version": "0.2.60-beta.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.59-beta.1",
3
+ "version": "0.2.60-beta.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -28,13 +28,11 @@ import { consentUrl, exchangeCode, extractCode, thunderbird, scopeFor, pkcePair,
28
28
  /* The loopback the provider sends the code back to; nothing listens there. The
29
29
  person's browser lands on a page that will not load, and they copy the whole
30
30
  address -- which carries the code -- back into Clavarium. The same address
31
- trades the code, so it must match what the borrowed client registered. Google's
32
- desktop client takes any 127.0.0.1 port. Microsoft's (GNOME Online Accounts')
33
- registered one exact redirect, a custom scheme goa-oauth2://localhost/<id>, so
34
- that is the one to send: after allowing, the browser shows that goa-oauth2://
35
- address (it cannot open it -- that is expected) and the person copies it. */
31
+ trades the code, so it must match what the borrowed client registered. Both
32
+ borrowed clients (Google's GNOME Online Accounts one, Microsoft's Thunderbird
33
+ one) registered the loopback on any 127.0.0.1 port, so one address serves both. */
36
34
  const REDIRECT = 'http://127.0.0.1:47813/';
37
- const redirectFor = (provider) => (provider === 'microsoft' ? `goa-oauth2://localhost/${thunderbird('microsoft').clientId}` : REDIRECT);
35
+ const redirectFor = () => REDIRECT;
38
36
  const PENDING_MS = 10 * 60_000;
39
37
  const PENDING_MAX = 20;
40
38
 
@@ -118,7 +116,11 @@ export class Accounts {
118
116
  const made = [];
119
117
  for (const k of p.kinds) {
120
118
  const spec = KIND[k];
121
- const config = { provider: p.provider };
119
+ /* Pin the client that minted the token onto the target, so the keeper
120
+ refreshes with the same one -- a refresh token is bound to its client,
121
+ and this keeps a target working even if the built-in default later
122
+ moves (the connector prefers config.clientId over its own default). */
123
+ const config = { provider: p.provider, clientId };
122
124
  if (spec.needsUser) config.user = p.user;
123
125
  const target = this.#targets.put({
124
126
  id: targetId(k, p.provider, p.user),
package/server/oauth.mjs CHANGED
@@ -37,14 +37,16 @@ const b64url = (buf) => Buffer.from(buf).toString('base64url');
37
37
 
38
38
  /* Per-provider endpoints, the scopes we may ask for by kind, and a built-in,
39
39
  already-verified open-source desktop client as the default (the `thunderbird`
40
- field, kept by that name for its callers). WHICH client matters: a client is
41
- only granted the scopes its app was verified for. For GOOGLE we borrow GNOME
42
- Online Accounts' client, verified for mail AND calendar AND contacts, so one
43
- consent gives all three. For MICROSOFT we use Thunderbird's client, verified
44
- for mail (IMAP) only; Microsoft calendar/contacts go over Graph and need a
45
- Graph-verified client -- see card #110. `consentExtra` is what a provider
46
- needs on the consent URL to return a refresh token; `offlineScope` is the same
47
- thing when it is a scope rather than a parameter (Microsoft). */
40
+ field, kept by that name for its callers). WHICH client matters -- not for the
41
+ scopes (both are multitenant public clients that take any delegated scope the
42
+ person consents to), but for the REDIRECT it registered, since we reach it
43
+ through a loopback address the person copies. For GOOGLE we borrow GNOME Online
44
+ Accounts' client (any 127.0.0.1 port). For MICROSOFT we use Thunderbird's own
45
+ client, which likewise registered the loopback 127.0.0.1 (any port) -- so both
46
+ land the person on the same copy-pastable http://127.0.0.1 address, and mail,
47
+ calendar and contacts all go over Graph. `consentExtra` is what a provider needs
48
+ on the consent URL to return a refresh token; `offlineScope` is the same thing
49
+ when it is a scope rather than a parameter (Microsoft). */
48
50
  export const PROVIDERS = {
49
51
  google: {
50
52
  label: 'Google',
@@ -73,17 +75,23 @@ export const PROVIDERS = {
73
75
  pkce: true,
74
76
  consentExtra: {},
75
77
  offlineScope: 'offline_access',
76
- /* Microsoft over Graph: GNOME Online Accounts' client is a Graph client,
77
- so mail, calendar and contacts all go through graph.microsoft.com (the
78
- mail connector uses its Graph path for Microsoft). mail.send is needed
79
- to send. GOA's client is verified for all of these. */
78
+ /* Microsoft over Graph: mail, calendar and contacts all go through
79
+ graph.microsoft.com (the mail connector uses its Graph path for
80
+ Microsoft). mail.send is needed to send. Thunderbird's public client
81
+ takes these delegated scopes by dynamic consent. */
80
82
  scopes: {
81
83
  mail: 'mail.readwrite mail.send',
82
84
  calendar: 'calendars.readwrite',
83
85
  contacts: 'contacts.readwrite',
84
86
  },
87
+ /* Thunderbird's built-in Microsoft client (open source, public, no secret;
88
+ comm-central OAuth2Providers.sys.mjs). It registered the loopback
89
+ 127.0.0.1 redirect on ANY port, so we reuse the same http://127.0.0.1
90
+ address as Google -- the person copies it from the bar. (GNOME Online
91
+ Accounts' Graph client, b155a604-..., registered only a custom-scheme
92
+ goa-oauth2:// redirect a browser cannot surface, so we left it.) */
85
93
  thunderbird: {
86
- clientId: 'b155a604-3c31-4079-93b0-6bb6aa9d5464',
94
+ clientId: '9e5f94bc-e8a4-4e73-b8be-63364c29d753',
87
95
  clientSecret: null,
88
96
  },
89
97
  },
package/web/app.js CHANGED
@@ -6180,7 +6180,8 @@
6180
6180
  $('mailbox-to-connexion').addEventListener('click', () => { assetsAdding = 'connexion'; void paintAssets(); });
6181
6181
  /* CONNECT AN ACCOUNT (Connexions): a live link through Tether. The person signs
6182
6182
  in in their own browser; the token is kept on the server, never in a machine.
6183
- Google covers mail+calendar+contacts in one go; Microsoft, mail only here. */
6183
+ Both cover mail+calendar+contacts in one go, each landing on the same
6184
+ copy-pastable http://127.0.0.1 address. */
6184
6185
  const setConnexionProvider = (provider) => {
6185
6186
  const form = $('connexion-new');
6186
6187
  form.dataset.provider = provider;
@@ -6193,7 +6194,7 @@
6193
6194
  const all = kinds.includes('calendar') && kinds.includes('contacts');
6194
6195
  $('connexion-notice').textContent = provider === 'google'
6195
6196
  ? `Clavarium signs in with GNOME Online Accounts' app — that is what Google sees.${all ? ' Mail, calendar and contacts can be connected together.' : ''}`
6196
- : `Clavarium signs in with GNOME Online Accounts' app — that is what Microsoft sees.${all ? ' Mail, calendar and contacts together, over Microsoft Graph.' : ''} After you allow, the browser shows a goa-oauth2://… address it cannot open — copy that one and paste it below.`;
6197
+ : `Clavarium signs in with Thunderbird's app — that is what Microsoft sees.${all ? ' Mail, calendar and contacts together, over Microsoft Graph.' : ''}`;
6197
6198
  $('connexion-open').textContent = `Open the ${who} sign-in page`;
6198
6199
  };
6199
6200
  for (const b of $('connexion-provider').querySelectorAll('button')) b.addEventListener('click', () => setConnexionProvider(b.dataset.provider));