clavarium 0.2.83-next.1 → 0.2.85-next.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.83-next.1",
3
+ "version": "0.2.85-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.83-next.1",
9
+ "version": "0.2.85-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -14,7 +14,7 @@
14
14
  "clavarium-binder": "0.1.8-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.11-next.1",
17
- "clavarium-tether": "0.1.0-next.14",
17
+ "clavarium-tether": "0.1.0-next.16",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
20
20
  "pdfjs-dist": "6.4.299",
@@ -755,9 +755,9 @@
755
755
  }
756
756
  },
757
757
  "node_modules/clavarium-tether": {
758
- "version": "0.1.0-next.14",
759
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.14.tgz",
760
- "integrity": "sha512-QNa5FmgxVi1b2jW0MCMY0hkkqAIl8QDF1qHluwW8j2QbA+h5kwJ1bRW5haT2GomHlX3xxcbah0uYpuSoSZd6dw==",
758
+ "version": "0.1.0-next.16",
759
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.16.tgz",
760
+ "integrity": "sha512-OluUIv32Ot5oh+PbrcDBT/MnklJ8+kUjQQbtvbhQuEnBO1tnXWaBNIA2TLpEyWysu7hFe2jCehm19ljsZrvy7w==",
761
761
  "license": "MIT",
762
762
  "bin": {
763
763
  "tether": "bin/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.83-next.1",
3
+ "version": "0.2.85-next.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.",
@@ -47,7 +47,7 @@
47
47
  "clavarium-binder": "0.1.8-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.11-next.1",
50
- "clavarium-tether": "0.1.0-next.14",
50
+ "clavarium-tether": "0.1.0-next.16",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
53
53
  "pdfjs-dist": "6.4.299",
@@ -12,10 +12,9 @@
12
12
  *
13
13
  * ONE ACCOUNT, ONE TOKEN, SEVERAL TARGETS. A consent for mail+calendar+contacts
14
14
  * yields a single refresh token; this makes one host-only secret and a Tether
15
- * target per kind, each naming that secret. Both providers borrow an open-source
16
- * desktop client verified for all three: Google uses GNOME Online Accounts' over
17
- * IMAP + CalDAV/CardDAV, Microsoft uses its Graph client (mail, calendar and
18
- * contacts all over Microsoft Graph).
15
+ * target per kind, each naming that secret. Both providers borrow Thunderbird's
16
+ * own open-source desktop client, verified for all three: Google over IMAP +
17
+ * CalDAV/CardDAV, Microsoft over Microsoft Graph (mail, calendar and contacts).
19
18
  *
20
19
  * A CREATED TARGET IS GIVEN TO NO ONE. The person grants it per conversation, at
21
20
  * its own level, from the page (Assets > Access) -- like git: one mailbox, many
@@ -28,13 +27,11 @@ import { consentUrl, exchangeCode, extractCode, thunderbird, scopeFor, pkcePair,
28
27
  /* The loopback the provider sends the code back to; nothing listens there. The
29
28
  person's browser lands on a page that will not load, and they copy the whole
30
29
  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. */
30
+ trades the code, so it must match what the borrowed client registered. Both
31
+ borrowed Thunderbird clients (one for Google, one for Microsoft) registered the
32
+ loopback on any 127.0.0.1 port, so one address serves both. */
36
33
  const REDIRECT = 'http://127.0.0.1:47813/';
37
- const redirectFor = (provider) => (provider === 'microsoft' ? `goa-oauth2://localhost/${thunderbird('microsoft').clientId}` : REDIRECT);
34
+ const redirectFor = () => REDIRECT;
38
35
  const PENDING_MS = 10 * 60_000;
39
36
  const PENDING_MAX = 20;
40
37
 
@@ -118,7 +115,11 @@ export class Accounts {
118
115
  const made = [];
119
116
  for (const k of p.kinds) {
120
117
  const spec = KIND[k];
121
- const config = { provider: p.provider };
118
+ /* Pin the client that minted the token onto the target, so the keeper
119
+ refreshes with the same one -- a refresh token is bound to its client,
120
+ and this keeps a target working even if the built-in default later
121
+ moves (the connector prefers config.clientId over its own default). */
122
+ const config = { provider: p.provider, clientId };
122
123
  if (spec.needsUser) config.user = p.user;
123
124
  const target = this.#targets.put({
124
125
  id: targetId(k, p.provider, p.user),
package/server/oauth.mjs CHANGED
@@ -37,14 +37,14 @@ 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). We borrow THUNDERBIRD's own client for BOTH providers: each registered
41
+ the loopback 127.0.0.1 redirect on any port, so the person always lands on the
42
+ same copy-pastable http://127.0.0.1 address, and each is cleared for the three
43
+ kinds -- Google's client carries the mail + CalDAV + CardDAV scopes; Microsoft's
44
+ takes mail, calendar and contacts over Graph (a multitenant public client, by
45
+ dynamic consent). `consentExtra` is what a provider needs on the consent URL to
46
+ return a refresh token; `offlineScope` is the same thing when it is a scope
47
+ rather than a parameter (Microsoft). */
48
48
  export const PROVIDERS = {
49
49
  google: {
50
50
  label: 'Google',
@@ -58,12 +58,16 @@ export const PROVIDERS = {
58
58
  calendar: 'https://www.googleapis.com/auth/calendar',
59
59
  contacts: 'https://www.googleapis.com/auth/carddav',
60
60
  },
61
- /* GNOME Online Accounts' built-in client (open source, embedded secret
62
- sanctioned by Google for an installed app). Verified for mail,
63
- calendar and contacts -- unlike Thunderbird's, which carries mail only. */
61
+ /* Thunderbird's own built-in Google client (open source, embedded secret
62
+ sanctioned by Google for an installed app; comm-central
63
+ OAuth2Providers.sys.mjs). Its GOOGLE_SCOPES carry mail AND CalDAV AND
64
+ CardDAV, so one consent gives all three -- the same loopback 127.0.0.1
65
+ redirect as before. Using Thunderbird for Google too means one borrowed
66
+ identity for both providers. (GNOME Online Accounts' client
67
+ 44438659992-... worked as well; we unified on Thunderbird.) */
64
68
  thunderbird: {
65
- clientId: '44438659992-7kgjeitenc16ssihbtdjbgguch7ju55s.apps.googleusercontent.com',
66
- clientSecret: '-gMLuQyDiI0XrQS_vx_mhuYF',
69
+ clientId: '406964657835-aq8lmia8j95dhl1a2bvharmfk3t1hgqj.apps.googleusercontent.com',
70
+ clientSecret: 'kSmqreRr0qwBWJgbf5Y-PjSU',
67
71
  },
68
72
  },
69
73
  microsoft: {
@@ -73,17 +77,23 @@ export const PROVIDERS = {
73
77
  pkce: true,
74
78
  consentExtra: {},
75
79
  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. */
80
+ /* Microsoft over Graph: mail, calendar and contacts all go through
81
+ graph.microsoft.com (the mail connector uses its Graph path for
82
+ Microsoft). mail.send is needed to send. Thunderbird's public client
83
+ takes these delegated scopes by dynamic consent. */
80
84
  scopes: {
81
85
  mail: 'mail.readwrite mail.send',
82
86
  calendar: 'calendars.readwrite',
83
87
  contacts: 'contacts.readwrite',
84
88
  },
89
+ /* Thunderbird's built-in Microsoft client (open source, public, no secret;
90
+ comm-central OAuth2Providers.sys.mjs). It registered the loopback
91
+ 127.0.0.1 redirect on ANY port, so we reuse the same http://127.0.0.1
92
+ address as Google -- the person copies it from the bar. (GNOME Online
93
+ Accounts' Graph client, b155a604-..., registered only a custom-scheme
94
+ goa-oauth2:// redirect a browser cannot surface, so we left it.) */
85
95
  thunderbird: {
86
- clientId: 'b155a604-3c31-4079-93b0-6bb6aa9d5464',
96
+ clientId: '9e5f94bc-e8a4-4e73-b8be-63364c29d753',
87
97
  clientSecret: null,
88
98
  },
89
99
  },
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;
@@ -6192,8 +6193,8 @@
6192
6193
  const who = MAILBOX_PROVIDER[provider];
6193
6194
  const all = kinds.includes('calendar') && kinds.includes('contacts');
6194
6195
  $('connexion-notice').textContent = provider === 'google'
6195
- ? `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.`;
6196
+ ? `Clavarium signs in with Thunderbird's app — that is what Google sees.${all ? ' Mail, calendar and contacts can be connected together.' : ''}`
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));