@wtfalch/email 0.4.0 → 0.4.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.
@@ -13,13 +13,32 @@ export interface MailObjectsInput {
13
13
  /**
14
14
  * The project's identity provider, once the mail applications are
15
15
  * registered there (docs/plans/email.md E3, phase-4.md slice 1): tokens
16
- * from `issuerUrl` for `audience` (the ZITADEL project id) sign people in,
17
- * on the domain and as the server's default. Absent, the domain keeps the
18
- * internal directory and people have passwords.
16
+ * from `issuerUrl` for `audience` (the provider's project or resource id)
17
+ * sign people in, on the domain and as the server's default. Absent, the
18
+ * domain keeps the internal directory and people have passwords.
19
19
  */
20
20
  oidc?: {
21
21
  issuerUrl: string;
22
22
  audience: string;
23
+ /**
24
+ * Scopes an access token must carry, on top of the audience check.
25
+ *
26
+ * **Empty by default, and that is the safe default rather than a lax
27
+ * one.** Whether an access token carries a `scope` claim at all is the
28
+ * provider's choice: OIDC Core keeps the `profile` and `email` claims at
29
+ * the userinfo endpoint rather than in the token, and a provider that
30
+ * follows it mints access tokens with no `scope` claim to check. Stalwart
31
+ * reads this against the token's own claims when it validates a JWT
32
+ * offline, so a requirement here refuses *every* token such a provider
33
+ * issues — 401 on a credential that is real, current and for this
34
+ * audience, which is a dead end with nothing on screen to explain it.
35
+ *
36
+ * The audience is what binds a token to this server. Set this only for a
37
+ * provider known to put scopes in the token.
38
+ */
39
+ requireScopes?: Record<string, boolean>;
40
+ /** The claim holding the login name. The OIDC standard one by default. */
41
+ claimUsername?: string;
23
42
  };
24
43
  }
25
44
  /** A value that names an object created earlier in the same plan. */
@@ -19,8 +19,8 @@ export function mailObjects(i) {
19
19
  description: oidcDescription,
20
20
  issuerUrl: i.oidc.issuerUrl,
21
21
  requireAudience: i.oidc.audience,
22
- requireScopes: { openid: true, email: true },
23
- claimUsername: 'preferred_username',
22
+ requireScopes: i.oidc.requireScopes ?? {},
23
+ claimUsername: i.oidc.claimUsername ?? 'preferred_username',
24
24
  usernameDomain: i.apex,
25
25
  claimName: 'name',
26
26
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/email",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "The wtfalch estate: reading a mailbox over JMAP, and administering the Stalwart server it lives on. Two entries with no code in common.",
5
5
  "license": "MIT",
6
6
  "type": "module",