@travetto/auth 3.0.0-rc.1 → 3.0.0-rc.10

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <!-- This file was generated by @travetto/doc and should not be modified directly -->
2
- <!-- Please modify https://github.com/travetto/travetto/tree/main/module/auth/doc.ts and execute "npx trv doc" to rebuild -->
2
+ <!-- Please modify https://github.com/travetto/travetto/tree/main/module/auth/DOC.ts and execute "npx trv doc" to rebuild -->
3
3
  # Authentication
4
4
  ## Authentication scaffolding for the travetto framework
5
5
 
@@ -62,6 +62,12 @@ As referenced above, a [Principal Structure](https://github.com/travetto/travett
62
62
  **Code: Authenticator**
63
63
  ```typescript
64
64
  export interface Authenticator<T = unknown, P extends Principal = Principal, C = unknown> {
65
+ /**
66
+ * Allows for the authenticator to be initialized if needed
67
+ * @param ctx
68
+ */
69
+ initialize?(ctx: C): Promise<void>;
70
+
65
71
  /**
66
72
  * Verify the payload, ensuring the payload is correctly identified.
67
73
  *
@@ -110,8 +116,8 @@ The [AuthUtil](https://github.com/travetto/travetto/tree/main/module/auth/src/ut
110
116
 
111
117
  **Code: Auth util structure**
112
118
  ```typescript
113
- import * as crypto from 'crypto';
114
- import * as util from 'util';
119
+ import crypto from 'crypto';
120
+ import util from 'util';
115
121
  import { AppError, Util } from '@travetto/base';
116
122
  const pbkdf2 = util.promisify(crypto.pbkdf2);
117
123
  /**
@@ -145,7 +151,7 @@ export class AuthUtil {
145
151
  }
146
152
  ```
147
153
 
148
- `roleMatcher` is probably the only functionality that needs to be explained. The function extends the core allow/deny matcher functionality from [Base](https://github.com/travetto/travetto/tree/main/module/base#readme "Application phase management, environment config and common utilities for travetto applications.")'s Util class.
154
+ `roleMatcher` is probably the only functionality that needs to be explained. The function extends the core allow/deny matcher functionality from [Base](https://github.com/travetto/travetto/tree/main/module/base#readme "Environment config and common utilities for travetto applications.")'s Util class.
149
155
 
150
156
  An example of role checks could be:
151
157
 
File without changes
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/auth",
3
- "displayName": "Authentication",
4
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0-rc.10",
5
4
  "description": "Authentication scaffolding for the travetto framework",
6
5
  "keywords": [
7
6
  "authentication",
@@ -15,16 +14,19 @@
15
14
  "name": "Travetto Framework"
16
15
  },
17
16
  "files": [
18
- "index.ts",
17
+ "__index__.ts",
19
18
  "src"
20
19
  ],
21
- "main": "index.ts",
20
+ "main": "__index__.ts",
22
21
  "repository": {
23
22
  "url": "https://github.com/travetto/travetto.git",
24
23
  "directory": "module/auth"
25
24
  },
26
25
  "dependencies": {
27
- "@travetto/base": "^3.0.0-rc.1"
26
+ "@travetto/base": "^3.0.0-rc.10"
27
+ },
28
+ "travetto": {
29
+ "displayName": "Authentication"
28
30
  },
29
31
  "private": false,
30
32
  "publishConfig": {
@@ -6,6 +6,12 @@ import { Principal } from './principal';
6
6
  * @concrete ../internal/types:AuthenticatorTarget
7
7
  */
8
8
  export interface Authenticator<T = unknown, P extends Principal = Principal, C = unknown> {
9
+ /**
10
+ * Allows for the authenticator to be initialized if needed
11
+ * @param ctx
12
+ */
13
+ initialize?(ctx: C): Promise<void>;
14
+
9
15
  /**
10
16
  * Verify the payload, ensuring the payload is correctly identified.
11
17
  *
@@ -2,7 +2,7 @@
2
2
  * A user principal, including permissions and details
3
3
  *
4
4
  * @concrete ../internal/types:PrincipalTarget
5
- * @augments `@trv:rest/Context`
5
+ * @augments `@travetto/rest:Context`
6
6
  */
7
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
8
  export interface Principal<D = { [key: string]: any }> {
package/src/util.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as crypto from 'crypto';
2
- import * as util from 'util';
1
+ import crypto from 'crypto';
2
+ import util from 'util';
3
3
 
4
4
  import { AppError, Util } from '@travetto/base';
5
5