@vunexa/lixa 0.1.0 → 0.1.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.
Files changed (34) hide show
  1. package/README.md +3 -93
  2. package/README.template.md +360 -0
  3. package/docs/api/index.md +32 -0
  4. package/docs/api/lixa.iprovider.authorizationendpoint.md +13 -0
  5. package/docs/api/lixa.iprovider.md +100 -0
  6. package/docs/api/lixa.iprovider.tokenendpoint.md +13 -0
  7. package/docs/api/lixa.iprovider.userinfoendpoint.md +13 -0
  8. package/docs/api/lixa.lixa._constructor_.md +50 -0
  9. package/docs/api/lixa.lixa.generaterandomstate.md +23 -0
  10. package/docs/api/lixa.lixa.getauthurl.md +85 -0
  11. package/docs/api/lixa.lixa.handlecallback.md +73 -0
  12. package/docs/api/lixa.lixa.isproviderregistered.md +65 -0
  13. package/docs/api/lixa.lixa.md +164 -0
  14. package/docs/api/lixa.lixa.registerprovider.md +69 -0
  15. package/docs/api/lixa.lixaconfig.md +96 -0
  16. package/docs/api/lixa.lixaconfig.providers.md +13 -0
  17. package/docs/api/lixa.lixaconfig.sessionstrategy.md +13 -0
  18. package/docs/api/lixa.lixaconfig.statedao.md +13 -0
  19. package/docs/api/lixa.md +108 -0
  20. package/docs/api/lixa.providerconfig.clientid.md +13 -0
  21. package/docs/api/lixa.providerconfig.clientsecret.md +13 -0
  22. package/docs/api/lixa.providerconfig.extraconfig.md +13 -0
  23. package/docs/api/lixa.providerconfig.md +134 -0
  24. package/docs/api/lixa.providerconfig.redirecturi.md +13 -0
  25. package/docs/api/lixa.providerconfig.scopes.md +13 -0
  26. package/docs/api/lixa.session.md +77 -0
  27. package/docs/api/lixa.session.raw.md +13 -0
  28. package/docs/api/lixa.session.token.md +13 -0
  29. package/docs/api/lixa.sessionstrategy.createsession.md +56 -0
  30. package/docs/api/lixa.sessionstrategy.md +40 -0
  31. package/docs/images/account-linking.svg +1 -0
  32. package/docs/images/architecture.svg +1 -0
  33. package/docs/images/resource-connection.svg +1 -0
  34. package/package.json +4 -1
@@ -0,0 +1,23 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md) &gt; [generateRandomState](./lixa.lixa.generaterandomstate.md)
4
+
5
+ ## Lixa.generateRandomState() method
6
+
7
+ Generates a cryptographically secure random state parameter for OAuth flows.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ static generateRandomState(): string;
13
+ ```
14
+ **Returns:**
15
+
16
+ string
17
+
18
+ A 32-character hexadecimal string
19
+
20
+ ## Remarks
21
+
22
+ The state parameter is used to prevent CSRF attacks in OAuth flows.
23
+
@@ -0,0 +1,85 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md) &gt; [getAuthUrl](./lixa.lixa.getauthurl.md)
4
+
5
+ ## Lixa.getAuthUrl() method
6
+
7
+ Generates the authorization URL for the specified provider.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getAuthUrl(provider: string, state: string): string;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ provider
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The provider name (case-insensitive)
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ state
52
+
53
+
54
+ </td><td>
55
+
56
+ string
57
+
58
+
59
+ </td><td>
60
+
61
+ The state parameter for CSRF protection
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ string
70
+
71
+ The complete authorization URL to redirect users to
72
+
73
+ ## Exceptions
74
+
75
+ Error when the provider is not configured
76
+
77
+ ## Example
78
+
79
+
80
+ ```typescript
81
+ const state = Lixa.generateRandomState();
82
+ const authUrl = lixa.getAuthUrl('google', state);
83
+ res.redirect(authUrl);
84
+ ```
85
+
@@ -0,0 +1,73 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md) &gt; [handleCallback](./lixa.lixa.handlecallback.md)
4
+
5
+ ## Lixa.handleCallback() method
6
+
7
+ Handles the OAuth callback and creates a user session.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ handleCallback({ provider, code, state, }: {
13
+ provider: string;
14
+ code: string;
15
+ state?: string;
16
+ }): Promise<Session>;
17
+ ```
18
+
19
+ ## Parameters
20
+
21
+ <table><thead><tr><th>
22
+
23
+ Parameter
24
+
25
+
26
+ </th><th>
27
+
28
+ Type
29
+
30
+
31
+ </th><th>
32
+
33
+ Description
34
+
35
+
36
+ </th></tr></thead>
37
+ <tbody><tr><td>
38
+
39
+ { provider, code, state, }
40
+
41
+
42
+ </td><td>
43
+
44
+ { provider: string; code: string; state?: string; }
45
+
46
+
47
+ </td><td>
48
+
49
+
50
+ </td></tr>
51
+ </tbody></table>
52
+
53
+ **Returns:**
54
+
55
+ Promise&lt;[Session](./lixa.session.md)<!-- -->&gt;
56
+
57
+ A Promise that resolves to a Session object
58
+
59
+ ## Exceptions
60
+
61
+ Error when code or state is missing/invalid, or provider is not configured
62
+
63
+ ## Example
64
+
65
+
66
+ ```typescript
67
+ const session = await lixa.handleCallback({
68
+ provider: 'google',
69
+ code: req.query.code,
70
+ state: req.query.state
71
+ });
72
+ ```
73
+
@@ -0,0 +1,65 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md) &gt; [isProviderRegistered](./lixa.lixa.isproviderregistered.md)
4
+
5
+ ## Lixa.isProviderRegistered() method
6
+
7
+ Checks if a provider is registered and available for use.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ static isProviderRegistered(provider: string): boolean;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ provider
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The provider name to check (case-insensitive)
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ boolean
54
+
55
+ True if the provider is registered, false otherwise
56
+
57
+ ## Example
58
+
59
+
60
+ ```typescript
61
+ if (Lixa.isProviderRegistered('google')) {
62
+ console.log('Google provider is available');
63
+ }
64
+ ```
65
+
@@ -0,0 +1,164 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md)
4
+
5
+ ## Lixa class
6
+
7
+ A flexible, provider-agnostic OAuth 2.0 and OpenID Connect (OIDC) client library.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ declare class Lixa
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ Lixa simplifies multi-provider authentication flows and supports extensible session management.
18
+
19
+ ## Example
20
+
21
+
22
+ ```typescript
23
+ const lixa = new Lixa({
24
+ providers: {
25
+ google: {
26
+ clientId: 'your-client-id',
27
+ clientSecret: 'your-client-secret',
28
+ redirectUri: 'https://yourapp.com/auth/google/callback',
29
+ scopes: ['openid', 'email', 'profile']
30
+ }
31
+ }
32
+ });
33
+ ```
34
+
35
+ ## Constructors
36
+
37
+ <table><thead><tr><th>
38
+
39
+ Constructor
40
+
41
+
42
+ </th><th>
43
+
44
+ Modifiers
45
+
46
+
47
+ </th><th>
48
+
49
+ Description
50
+
51
+
52
+ </th></tr></thead>
53
+ <tbody><tr><td>
54
+
55
+ [(constructor)(config)](./lixa.lixa._constructor_.md)
56
+
57
+
58
+ </td><td>
59
+
60
+
61
+ </td><td>
62
+
63
+ Creates a new Lixa instance with the provided configuration.
64
+
65
+
66
+ </td></tr>
67
+ </tbody></table>
68
+
69
+ ## Methods
70
+
71
+ <table><thead><tr><th>
72
+
73
+ Method
74
+
75
+
76
+ </th><th>
77
+
78
+ Modifiers
79
+
80
+
81
+ </th><th>
82
+
83
+ Description
84
+
85
+
86
+ </th></tr></thead>
87
+ <tbody><tr><td>
88
+
89
+ [generateRandomState()](./lixa.lixa.generaterandomstate.md)
90
+
91
+
92
+ </td><td>
93
+
94
+ `static`
95
+
96
+
97
+ </td><td>
98
+
99
+ Generates a cryptographically secure random state parameter for OAuth flows.
100
+
101
+
102
+ </td></tr>
103
+ <tr><td>
104
+
105
+ [getAuthUrl(provider, state)](./lixa.lixa.getauthurl.md)
106
+
107
+
108
+ </td><td>
109
+
110
+
111
+ </td><td>
112
+
113
+ Generates the authorization URL for the specified provider.
114
+
115
+
116
+ </td></tr>
117
+ <tr><td>
118
+
119
+ [handleCallback({ provider, code, state, })](./lixa.lixa.handlecallback.md)
120
+
121
+
122
+ </td><td>
123
+
124
+
125
+ </td><td>
126
+
127
+ Handles the OAuth callback and creates a user session.
128
+
129
+
130
+ </td></tr>
131
+ <tr><td>
132
+
133
+ [isProviderRegistered(provider)](./lixa.lixa.isproviderregistered.md)
134
+
135
+
136
+ </td><td>
137
+
138
+ `static`
139
+
140
+
141
+ </td><td>
142
+
143
+ Checks if a provider is registered and available for use.
144
+
145
+
146
+ </td></tr>
147
+ <tr><td>
148
+
149
+ [registerProvider(providerMap)](./lixa.lixa.registerprovider.md)
150
+
151
+
152
+ </td><td>
153
+
154
+ `static`
155
+
156
+
157
+ </td><td>
158
+
159
+ Registers custom OAuth providers for use with Lixa.
160
+
161
+
162
+ </td></tr>
163
+ </tbody></table>
164
+
@@ -0,0 +1,69 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [Lixa](./lixa.lixa.md) &gt; [registerProvider](./lixa.lixa.registerprovider.md)
4
+
5
+ ## Lixa.registerProvider() method
6
+
7
+ Registers custom OAuth providers for use with Lixa.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ static registerProvider(providerMap: {
13
+ [key: string]: IProvider;
14
+ }): void;
15
+ ```
16
+
17
+ ## Parameters
18
+
19
+ <table><thead><tr><th>
20
+
21
+ Parameter
22
+
23
+
24
+ </th><th>
25
+
26
+ Type
27
+
28
+
29
+ </th><th>
30
+
31
+ Description
32
+
33
+
34
+ </th></tr></thead>
35
+ <tbody><tr><td>
36
+
37
+ providerMap
38
+
39
+
40
+ </td><td>
41
+
42
+ { \[key: string\]: [IProvider](./lixa.iprovider.md)<!-- -->; }
43
+
44
+
45
+ </td><td>
46
+
47
+ A map of provider names to IProvider implementations
48
+
49
+
50
+ </td></tr>
51
+ </tbody></table>
52
+
53
+ **Returns:**
54
+
55
+ void
56
+
57
+ ## Example
58
+
59
+
60
+ ```typescript
61
+ class CustomProvider implements IProvider {
62
+ authorizationEndpoint = 'https://custom.com/oauth/authorize';
63
+ tokenEndpoint = 'https://custom.com/oauth/token';
64
+ userInfoEndpoint = 'https://custom.com/api/user';
65
+ }
66
+
67
+ Lixa.registerProvider({ custom: new CustomProvider() });
68
+ ```
69
+
@@ -0,0 +1,96 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [LixaConfig](./lixa.lixaconfig.md)
4
+
5
+ ## LixaConfig interface
6
+
7
+ Main configuration object for Lixa.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface LixaConfig
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [providers](./lixa.lixaconfig.providers.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td><td>
47
+
48
+ Record&lt;string, [ProviderConfig](./lixa.providerconfig.md)<!-- -->&gt;
49
+
50
+
51
+ </td><td>
52
+
53
+ Map of provider names to their configurations
54
+
55
+
56
+ </td></tr>
57
+ <tr><td>
58
+
59
+ [sessionStrategy?](./lixa.lixaconfig.sessionstrategy.md)
60
+
61
+
62
+ </td><td>
63
+
64
+
65
+ </td><td>
66
+
67
+ [SessionStrategy](./lixa.sessionstrategy.md)
68
+
69
+
70
+ </td><td>
71
+
72
+ _(Optional)_ Optional custom session creation strategy
73
+
74
+
75
+ </td></tr>
76
+ <tr><td>
77
+
78
+ [stateDao?](./lixa.lixaconfig.statedao.md)
79
+
80
+
81
+ </td><td>
82
+
83
+
84
+ </td><td>
85
+
86
+ StateDao
87
+
88
+
89
+ </td><td>
90
+
91
+ _(Optional)_ Optional custom state storage implementation
92
+
93
+
94
+ </td></tr>
95
+ </tbody></table>
96
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [LixaConfig](./lixa.lixaconfig.md) &gt; [providers](./lixa.lixaconfig.providers.md)
4
+
5
+ ## LixaConfig.providers property
6
+
7
+ Map of provider names to their configurations
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ providers: Record<string, ProviderConfig>;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [LixaConfig](./lixa.lixaconfig.md) &gt; [sessionStrategy](./lixa.lixaconfig.sessionstrategy.md)
4
+
5
+ ## LixaConfig.sessionStrategy property
6
+
7
+ Optional custom session creation strategy
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ sessionStrategy?: SessionStrategy;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@vunexa/lixa](./lixa.md) &gt; [LixaConfig](./lixa.lixaconfig.md) &gt; [stateDao](./lixa.lixaconfig.statedao.md)
4
+
5
+ ## LixaConfig.stateDao property
6
+
7
+ Optional custom state storage implementation
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ stateDao?: StateDao;
13
+ ```