@enterprisestandard/react 0.0.5-beta.20260115.3 → 0.0.5-beta.20260115.4

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 (77) hide show
  1. package/dist/index.d.ts +2573 -41
  2. package/dist/index.js +3732 -144
  3. package/dist/index.js.map +1 -0
  4. package/package.json +3 -1
  5. package/dist/group-store.d.ts +0 -164
  6. package/dist/group-store.d.ts.map +0 -1
  7. package/dist/group-store.js +0 -127
  8. package/dist/iam.d.ts +0 -206
  9. package/dist/iam.d.ts.map +0 -1
  10. package/dist/iam.js +0 -680
  11. package/dist/index.d.ts.map +0 -1
  12. package/dist/session-store.d.ts +0 -179
  13. package/dist/session-store.d.ts.map +0 -1
  14. package/dist/session-store.js +0 -105
  15. package/dist/sso-server.d.ts +0 -13
  16. package/dist/sso-server.d.ts.map +0 -1
  17. package/dist/sso-server.js +0 -46
  18. package/dist/sso.d.ts +0 -104
  19. package/dist/sso.d.ts.map +0 -1
  20. package/dist/sso.js +0 -820
  21. package/dist/tenant-server.d.ts +0 -8
  22. package/dist/tenant-server.d.ts.map +0 -1
  23. package/dist/tenant-server.js +0 -6
  24. package/dist/tenant.d.ts +0 -280
  25. package/dist/tenant.d.ts.map +0 -1
  26. package/dist/tenant.js +0 -324
  27. package/dist/types/base-user.d.ts +0 -27
  28. package/dist/types/base-user.d.ts.map +0 -1
  29. package/dist/types/base-user.js +0 -1
  30. package/dist/types/enterprise-user.d.ts +0 -158
  31. package/dist/types/enterprise-user.d.ts.map +0 -1
  32. package/dist/types/enterprise-user.js +0 -1
  33. package/dist/types/oidc-schema.d.ts +0 -86
  34. package/dist/types/oidc-schema.d.ts.map +0 -1
  35. package/dist/types/oidc-schema.js +0 -328
  36. package/dist/types/scim-schema.d.ts +0 -419
  37. package/dist/types/scim-schema.d.ts.map +0 -1
  38. package/dist/types/scim-schema.js +0 -519
  39. package/dist/types/standard-schema.d.ts +0 -56
  40. package/dist/types/standard-schema.d.ts.map +0 -1
  41. package/dist/types/standard-schema.js +0 -1
  42. package/dist/types/user.d.ts +0 -41
  43. package/dist/types/user.d.ts.map +0 -1
  44. package/dist/types/user.js +0 -1
  45. package/dist/types/workload-schema.d.ts +0 -106
  46. package/dist/types/workload-schema.d.ts.map +0 -1
  47. package/dist/types/workload-schema.js +0 -208
  48. package/dist/ui/sign-in-loading.d.ts +0 -5
  49. package/dist/ui/sign-in-loading.d.ts.map +0 -1
  50. package/dist/ui/sign-in-loading.js +0 -8
  51. package/dist/ui/signed-in.d.ts +0 -3
  52. package/dist/ui/signed-in.d.ts.map +0 -1
  53. package/dist/ui/signed-in.js +0 -8
  54. package/dist/ui/signed-out.d.ts +0 -3
  55. package/dist/ui/signed-out.d.ts.map +0 -1
  56. package/dist/ui/signed-out.js +0 -8
  57. package/dist/ui/sso-provider.d.ts +0 -35
  58. package/dist/ui/sso-provider.d.ts.map +0 -1
  59. package/dist/ui/sso-provider.js +0 -275
  60. package/dist/user-store.d.ts +0 -161
  61. package/dist/user-store.d.ts.map +0 -1
  62. package/dist/user-store.js +0 -114
  63. package/dist/utils.d.ts +0 -9
  64. package/dist/utils.d.ts.map +0 -1
  65. package/dist/utils.js +0 -23
  66. package/dist/vault.d.ts +0 -18
  67. package/dist/vault.d.ts.map +0 -1
  68. package/dist/vault.js +0 -22
  69. package/dist/workload-server.d.ts +0 -127
  70. package/dist/workload-server.d.ts.map +0 -1
  71. package/dist/workload-server.js +0 -167
  72. package/dist/workload-token-store.d.ts +0 -187
  73. package/dist/workload-token-store.d.ts.map +0 -1
  74. package/dist/workload-token-store.js +0 -95
  75. package/dist/workload.d.ts +0 -227
  76. package/dist/workload.d.ts.map +0 -1
  77. package/dist/workload.js +0 -691
@@ -1,106 +0,0 @@
1
- import type { StandardSchemaV1 } from './standard-schema';
2
- /**
3
- * JWT Assertion Claims for OAuth2 JWT Bearer Grant (RFC 7523) and OAuth2 Access Tokens
4
- * @see https://datatracker.ietf.org/doc/html/rfc7523
5
- * @see https://datatracker.ietf.org/doc/html/rfc9068
6
- */
7
- export interface JWTAssertionClaims {
8
- /**
9
- * REQUIRED. Issuer - the workload identity (e.g., SPIFFE ID) or authorization server
10
- */
11
- iss: string;
12
- /**
13
- * REQUIRED. Subject - the workload identity or service account
14
- */
15
- sub: string;
16
- /**
17
- * OPTIONAL. Audience - may be a string or array of strings
18
- * Note: Required for JWT assertions, but may be absent in OAuth2 access tokens
19
- */
20
- aud?: string | string[];
21
- /**
22
- * REQUIRED. Expiration time (Unix timestamp)
23
- */
24
- exp: number;
25
- /**
26
- * REQUIRED. Issued at time (Unix timestamp)
27
- */
28
- iat: number;
29
- /**
30
- * OPTIONAL. JWT ID - unique identifier for this token
31
- * Note: Required for JWT assertions, optional for access tokens
32
- */
33
- jti?: string;
34
- /**
35
- * OPTIONAL. Requested OAuth scopes (space-delimited)
36
- */
37
- scope?: string;
38
- /**
39
- * Allow additional claims for extensibility
40
- */
41
- [key: string]: unknown;
42
- }
43
- /**
44
- * Creates a StandardSchemaV1 for validating JWT Assertion Claims.
45
- * @param vendor - The name of the vendor creating this schema
46
- * @returns A StandardSchemaV1 instance for JWT Assertion Claims validation
47
- */
48
- export declare function jwtAssertionClaimsSchema(vendor: string): StandardSchemaV1<Record<string, unknown>, JWTAssertionClaims>;
49
- /**
50
- * Workload Token Response from OAuth2 token endpoint
51
- * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
52
- */
53
- export interface WorkloadTokenResponse {
54
- /**
55
- * REQUIRED. The access token issued by the authorization server.
56
- */
57
- access_token: string;
58
- /**
59
- * REQUIRED. The type of the token (typically "Bearer").
60
- */
61
- token_type: string;
62
- /**
63
- * RECOMMENDED. The lifetime in seconds of the access token.
64
- */
65
- expires_in?: number;
66
- /**
67
- * OPTIONAL. The scope of the access token.
68
- */
69
- scope?: string;
70
- /**
71
- * OPTIONAL. The refresh token (rarely used for workload identities).
72
- */
73
- refresh_token?: string;
74
- /**
75
- * OPTIONAL. The expiration time as an ISO 8601 string.
76
- */
77
- expires?: string;
78
- }
79
- /**
80
- * Creates a StandardSchemaV1 for validating Workload Token Responses.
81
- * @param vendor - The name of the vendor creating this schema
82
- * @returns A StandardSchemaV1 instance for Workload Token Response validation
83
- */
84
- export declare function workloadTokenResponseSchema(vendor: string): StandardSchemaV1<Record<string, unknown>, WorkloadTokenResponse>;
85
- /**
86
- * Token Validation Result
87
- */
88
- export interface TokenValidationResult {
89
- /**
90
- * Whether the token is valid
91
- */
92
- valid: boolean;
93
- /**
94
- * The decoded and validated claims (if valid)
95
- */
96
- claims?: JWTAssertionClaims;
97
- /**
98
- * Error message (if invalid)
99
- */
100
- error?: string;
101
- /**
102
- * Token expiration time (if valid)
103
- */
104
- expiresAt?: Date;
105
- }
106
- //# sourceMappingURL=workload-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workload-schema.d.ts","sourceRoot":"","sources":["../../src/types/workload-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,GACb,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC,CA6F/D;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,GACb,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,CAAC,CA4GlE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
@@ -1,208 +0,0 @@
1
- /**
2
- * Creates a StandardSchemaV1 for validating JWT Assertion Claims.
3
- * @param vendor - The name of the vendor creating this schema
4
- * @returns A StandardSchemaV1 instance for JWT Assertion Claims validation
5
- */
6
- export function jwtAssertionClaimsSchema(vendor) {
7
- return {
8
- '~standard': {
9
- version: 1,
10
- vendor,
11
- validate: (value) => {
12
- if (typeof value !== 'object' || value === null) {
13
- return {
14
- issues: [
15
- {
16
- message: 'Expected an object',
17
- },
18
- ],
19
- };
20
- }
21
- const claims = value;
22
- const issues = [];
23
- const result = { ...claims };
24
- // Validate required string fields
25
- const requiredStringFields = ['iss', 'sub'];
26
- for (const field of requiredStringFields) {
27
- if (field in claims) {
28
- if (typeof claims[field] !== 'string') {
29
- issues.push({
30
- message: `${field} must be a string`,
31
- path: [field],
32
- });
33
- }
34
- }
35
- else {
36
- issues.push({
37
- message: `${field} is required`,
38
- path: [field],
39
- });
40
- }
41
- }
42
- // Validate optional aud field (can be string or array of strings)
43
- if ('aud' in claims && claims.aud !== undefined) {
44
- const aud = claims.aud;
45
- if (typeof aud !== 'string' && !Array.isArray(aud)) {
46
- issues.push({
47
- message: 'aud must be a string or array of strings',
48
- path: ['aud'],
49
- });
50
- }
51
- else if (Array.isArray(aud) && !aud.every((a) => typeof a === 'string')) {
52
- issues.push({
53
- message: 'aud array must contain only strings',
54
- path: ['aud'],
55
- });
56
- }
57
- }
58
- // Validate optional string fields
59
- const optionalStringFields = ['jti', 'scope'];
60
- for (const field of optionalStringFields) {
61
- if (field in claims && claims[field] !== undefined) {
62
- if (typeof claims[field] !== 'string') {
63
- issues.push({
64
- message: `${field} must be a string`,
65
- path: [field],
66
- });
67
- }
68
- }
69
- }
70
- // Validate required number fields
71
- const requiredNumberFields = ['exp', 'iat'];
72
- for (const field of requiredNumberFields) {
73
- if (field in claims) {
74
- if (typeof claims[field] !== 'number') {
75
- issues.push({
76
- message: `${field} must be a number`,
77
- path: [field],
78
- });
79
- }
80
- }
81
- else {
82
- issues.push({
83
- message: `${field} is required`,
84
- path: [field],
85
- });
86
- }
87
- }
88
- if (issues.length > 0) {
89
- return { issues };
90
- }
91
- return { value: result };
92
- },
93
- },
94
- };
95
- }
96
- /**
97
- * Creates a StandardSchemaV1 for validating Workload Token Responses.
98
- * @param vendor - The name of the vendor creating this schema
99
- * @returns A StandardSchemaV1 instance for Workload Token Response validation
100
- */
101
- export function workloadTokenResponseSchema(vendor) {
102
- return {
103
- '~standard': {
104
- version: 1,
105
- vendor,
106
- validate: (value) => {
107
- if (typeof value !== 'object' || value === null) {
108
- return {
109
- issues: [
110
- {
111
- message: 'Expected an object',
112
- },
113
- ],
114
- };
115
- }
116
- const response = value;
117
- const issues = [];
118
- const result = {};
119
- // Check required 'access_token' parameter
120
- if ('access_token' in response) {
121
- if (typeof response.access_token === 'string') {
122
- result.access_token = response.access_token;
123
- }
124
- else {
125
- issues.push({
126
- message: 'access_token must be a string',
127
- path: ['access_token'],
128
- });
129
- }
130
- }
131
- else {
132
- issues.push({
133
- message: 'access_token is required',
134
- path: ['access_token'],
135
- });
136
- }
137
- // Check required 'token_type' parameter
138
- if ('token_type' in response) {
139
- if (typeof response.token_type === 'string') {
140
- result.token_type = response.token_type;
141
- }
142
- else {
143
- issues.push({
144
- message: 'token_type must be a string',
145
- path: ['token_type'],
146
- });
147
- }
148
- }
149
- else {
150
- issues.push({
151
- message: 'token_type is required',
152
- path: ['token_type'],
153
- });
154
- }
155
- // Optional string fields
156
- if ('scope' in response) {
157
- if (typeof response.scope === 'string' || response.scope === undefined) {
158
- result.scope = response.scope;
159
- }
160
- else {
161
- issues.push({
162
- message: 'scope must be a string',
163
- path: ['scope'],
164
- });
165
- }
166
- }
167
- if ('refresh_token' in response) {
168
- if (typeof response.refresh_token === 'string' || response.refresh_token === undefined) {
169
- result.refresh_token = response.refresh_token;
170
- }
171
- else {
172
- issues.push({
173
- message: 'refresh_token must be a string',
174
- path: ['refresh_token'],
175
- });
176
- }
177
- }
178
- if ('expires' in response) {
179
- if (typeof response.expires === 'string' || response.expires === undefined) {
180
- result.expires = response.expires;
181
- }
182
- else {
183
- issues.push({
184
- message: 'expires must be a string',
185
- path: ['expires'],
186
- });
187
- }
188
- }
189
- // Optional number field
190
- if ('expires_in' in response) {
191
- if (typeof response.expires_in === 'number' || response.expires_in === undefined) {
192
- result.expires_in = response.expires_in;
193
- }
194
- else {
195
- issues.push({
196
- message: 'expires_in must be a number',
197
- path: ['expires_in'],
198
- });
199
- }
200
- }
201
- if (issues.length > 0) {
202
- return { issues };
203
- }
204
- return { value: result };
205
- },
206
- },
207
- };
208
- }
@@ -1,5 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- export declare function SignInLoading({ complete, children }: {
3
- complete?: boolean;
4
- } & PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
5
- //# sourceMappingURL=sign-in-loading.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign-in-loading.d.ts","sourceRoot":"","sources":["../../src/ui/sign-in-loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,wBAAgB,aAAa,CAAC,EAAE,QAAgB,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,iBAAiB,kDAKvG"}
@@ -1,8 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useUser } from '..';
3
- export function SignInLoading({ complete = false, children }) {
4
- const { isLoading } = useUser();
5
- if (isLoading && !complete)
6
- return _jsx(_Fragment, { children: children });
7
- return null;
8
- }
@@ -1,3 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- export declare function SignedIn({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
3
- //# sourceMappingURL=signed-in.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signed-in.d.ts","sourceRoot":"","sources":["../../src/ui/signed-in.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,kDAKvD"}
@@ -1,8 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useUser } from '..';
3
- export function SignedIn({ children }) {
4
- const { user } = useUser();
5
- if (user)
6
- return _jsx(_Fragment, { children: children });
7
- return null;
8
- }
@@ -1,3 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- export declare function SignedOut({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element | null;
3
- //# sourceMappingURL=signed-out.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signed-out.d.ts","sourceRoot":"","sources":["../../src/ui/signed-out.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,kDAKxD"}
@@ -1,8 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useUser } from '..';
3
- export function SignedOut({ children }) {
4
- const { user, isLoading } = useUser();
5
- if (user || isLoading)
6
- return null;
7
- return _jsx(_Fragment, { children: children });
8
- }
@@ -1,35 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { User } from '../types/user';
3
- type StorageType = 'local' | 'session' | 'memory';
4
- interface SSOProviderProps {
5
- tenantId?: string;
6
- storage?: StorageType;
7
- storageKey?: string;
8
- userUrl?: string;
9
- tokenUrl?: string;
10
- refreshUrl?: string;
11
- disableListener?: boolean;
12
- children: ReactNode;
13
- }
14
- interface SSOContext {
15
- user: User | null;
16
- setUser: (user: User | null) => void;
17
- isLoading: boolean;
18
- tokenUrl?: string;
19
- refreshUrl?: string;
20
- }
21
- export declare function SSOProvider({ tenantId, storage, storageKey, userUrl, tokenUrl, refreshUrl, disableListener, children, }: SSOProviderProps): import("react/jsx-runtime").JSX.Element;
22
- export declare function useUser(): SSOContext;
23
- interface UseTokenReturn {
24
- token: string | null;
25
- isLoading: boolean;
26
- error: Error | null;
27
- refresh: () => Promise<void>;
28
- }
29
- export declare function useToken(): UseTokenReturn;
30
- export declare function logout(logoutUrl: string): Promise<{
31
- success: boolean;
32
- error?: string;
33
- }>;
34
- export {};
35
- //# sourceMappingURL=sso-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sso-provider.d.ts","sourceRoot":"","sources":["../../src/ui/sso-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAgD,MAAM,OAAO,CAAC;AACpG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAWD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAkB,EAClB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,eAAuB,EACvB,QAAQ,GACT,EAAE,gBAAgB,2CA8JlB;AAED,wBAAgB,OAAO,IAAI,UAAU,CAMpC;AAOD,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,wBAAgB,QAAQ,IAAI,cAAc,CAiGzC;AAED,wBAAsB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6C7F"}