@ultimat3/auth 22.9.1 → 22.11.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/errors.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/auth",
3
- "version": "22.9.1",
3
+ "version": "22.11.0",
4
4
  "description": "Sessions, passwords, OAuth, MFA and api keys — resolved to one Actor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,8 +31,8 @@
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@ultimat3/core": "22.9.1",
35
- "@ultimat3/db": "22.9.1",
36
- "@ultimat3/schema": "22.9.1"
34
+ "@ultimat3/core": "22.11.0",
35
+ "@ultimat3/db": "22.11.0",
36
+ "@ultimat3/schema": "22.11.0"
37
37
  }
38
38
  }
package/src/errors.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  // every credential path must throw, and nothing else describes *why* a credential failed.
5
5
 
6
6
  import {
7
+ deniedCallerFix,
7
8
  registerErrorCodes,
8
9
  renderCauseValue,
9
10
  renderFixLiteral,
@@ -92,6 +93,8 @@ export class AuthError extends UltimateError {
92
93
  code: AuthThrowCode;
93
94
  cause: string;
94
95
  fix: string;
96
+ /** A remote caller's fix, when `fix` names something only the app's developer can run. */
97
+ callerFix?: string | undefined;
95
98
  meta?: Readonly<Record<string, unknown>> | undefined;
96
99
  }) {
97
100
  // No `docs:`: `UltimateError` fills it from `describeErrorCode(code).docs`. The
@@ -100,6 +103,7 @@ export class AuthError extends UltimateError {
100
103
  code: init.code,
101
104
  cause: init.cause,
102
105
  fix: init.fix,
106
+ callerFix: init.callerFix,
103
107
  meta: init.meta,
104
108
  });
105
109
  }
@@ -123,6 +127,7 @@ export const forbidden = (surface: string, reason: string): AuthError =>
123
127
  code: 'X_FORBIDDEN',
124
128
  cause: `${surface} denied: ${reason}`,
125
129
  fix: 'x policy explain --json # shows which grant the actor is missing',
130
+ callerFix: deniedCallerFix(),
126
131
  });
127
132
 
128
133
  /** `kind` names which clock ran out — the two expiries are evaluated independently. */