@travetto/auth 5.0.10 → 5.0.11

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/__index__.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './src/util';
2
2
  export * from './src/types/authenticator';
3
3
  export * from './src/types/authorizer';
4
- export * from './src/types/principal';
4
+ export * from './src/types/principal';
5
+ export * from './src/types/error';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/auth",
3
- "version": "5.0.10",
3
+ "version": "5.0.11",
4
4
  "description": "Authentication scaffolding for the Travetto framework",
5
5
  "keywords": [
6
6
  "authentication",
@@ -23,7 +23,7 @@
23
23
  "directory": "module/auth"
24
24
  },
25
25
  "dependencies": {
26
- "@travetto/runtime": "^5.0.10"
26
+ "@travetto/runtime": "^5.0.11"
27
27
  },
28
28
  "travetto": {
29
29
  "displayName": "Authentication"
@@ -0,0 +1,7 @@
1
+ import { AppError, AppErrorOptions } from '@travetto/runtime';
2
+
3
+ export class AuthenticationError<T> extends AppError<T> {
4
+ constructor(message: string, opts?: AppErrorOptions<T>) {
5
+ super(message, { category: 'authentication', ...opts });
6
+ }
7
+ }
package/src/util.ts CHANGED
@@ -33,7 +33,7 @@ export class AuthUtil {
33
33
  */
34
34
  static async generatePassword(password: string, salt: number | string = 32): Promise<{ salt: string, hash: string }> {
35
35
  if (!password) {
36
- throw new AppError('Password is required', 'data');
36
+ throw new AppError('Password is required', { category: 'data' });
37
37
  }
38
38
 
39
39
  salt = typeof salt === 'number' ? Util.uuid(salt) : salt;