@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,227 +0,0 @@
1
- import type { EnterpriseStandard } from '.';
2
- import type { StandardSchemaV1 } from './types/standard-schema';
3
- import type { JWTAssertionClaims, TokenValidationResult, WorkloadTokenResponse } from './types/workload-schema';
4
- import { type WorkloadTokenStore } from './workload-token-store';
5
- /**
6
- * Common fields shared across all workload authentication modes
7
- */
8
- type WorkloadConfigBase = {
9
- /**
10
- * OAuth2 token endpoint URL
11
- * REQUIRED for client role (token acquisition)
12
- */
13
- token_url?: string;
14
- /**
15
- * JWKS endpoint URL for public key retrieval
16
- * REQUIRED for server role (token validation)
17
- */
18
- jwks_uri?: string;
19
- /**
20
- * Expected token issuer URL for validation
21
- * RECOMMENDED for server role (token validation)
22
- */
23
- issuer?: string;
24
- /**
25
- * Target audience for tokens
26
- */
27
- audience?: string;
28
- /**
29
- * Default OAuth2 scopes (space-delimited)
30
- */
31
- scope?: string;
32
- /**
33
- * JWT assertion/token lifetime in seconds
34
- * @default 300 (5 minutes)
35
- */
36
- token_lifetime?: number;
37
- /**
38
- * Refresh threshold in seconds (refresh token this many seconds before expiry)
39
- * @default 60
40
- */
41
- refresh_threshold?: number;
42
- /**
43
- * Optional token store for caching access tokens
44
- */
45
- token_store?: WorkloadTokenStore;
46
- /**
47
- * Automatically refresh tokens before expiration
48
- * @default true
49
- */
50
- auto_refresh?: boolean;
51
- /**
52
- * Optional RFC 7009 token revocation endpoint
53
- */
54
- revocation_endpoint?: string;
55
- /**
56
- * Optional handler defaults (merged with per-call overrides in `handler`)
57
- */
58
- tokenUrl?: string;
59
- validateUrl?: string;
60
- jwksUrl?: string;
61
- refreshUrl?: string;
62
- validation?: {
63
- jwtAssertionClaims?: StandardSchemaV1<unknown, JWTAssertionClaims>;
64
- tokenResponse?: StandardSchemaV1<unknown, WorkloadTokenResponse>;
65
- };
66
- };
67
- /**
68
- * JWT Bearer Grant (RFC 7523) Configuration
69
- *
70
- * Used for SPIFFE-style workload identities where services have their own
71
- * cryptographic identity and sign their own JWT assertions.
72
- *
73
- * @example
74
- * ```json
75
- * {
76
- * "token_url": "https://auth.example.com/oauth/token",
77
- * "jwks_uri": "https://auth.example.com/.well-known/jwks.json",
78
- * "workload_id": "spiffe://trust-domain/ns/service",
79
- * "audience": "https://auth.example.com/oauth/token",
80
- * "private_key": "-----BEGIN PRIVATE KEY-----...",
81
- * "algorithm": "RS256"
82
- * }
83
- * ```
84
- */
85
- export type JwtBearerWorkloadConfig = WorkloadConfigBase & {
86
- /**
87
- * Workload identifier (e.g., SPIFFE ID: spiffe://trust-domain/namespace/service)
88
- * REQUIRED for JWT Bearer Grant mode
89
- */
90
- workload_id?: string;
91
- /**
92
- * PEM-encoded private key for signing JWT assertions
93
- * REQUIRED for client role in JWT Bearer Grant mode
94
- */
95
- private_key?: string;
96
- /**
97
- * Key ID (kid) to include in JWT header for key rotation support
98
- */
99
- key_id?: string;
100
- /**
101
- * JWT signing algorithm
102
- * @default 'RS256'
103
- */
104
- algorithm?: 'RS256' | 'RS384' | 'RS512' | 'ES256' | 'ES384' | 'ES512';
105
- };
106
- /**
107
- * OAuth2 Client Credentials Configuration
108
- *
109
- * Standard OAuth2 Client Credentials Grant (RFC 6749 Section 4.4).
110
- * Used with identity providers like Keycloak for service-to-service authentication.
111
- *
112
- * @example
113
- * ```json
114
- * {
115
- * "token_url": "https://sso.example.com/realms/myrealm/protocol/openid-connect/token",
116
- * "jwks_uri": "https://sso.example.com/realms/myrealm/protocol/openid-connect/certs",
117
- * "client_id": "my-service",
118
- * "client_secret": "secret-from-idp",
119
- * "issuer": "https://sso.example.com/realms/myrealm",
120
- * "scope": "api:read api:write"
121
- * }
122
- * ```
123
- */
124
- export type ClientCredentialsWorkloadConfig = WorkloadConfigBase & {
125
- /**
126
- * OAuth2 client identifier registered with the authorization server
127
- * REQUIRED for Client Credentials mode
128
- */
129
- client_id?: string;
130
- /**
131
- * OAuth2 client secret
132
- * REQUIRED for Client Credentials mode
133
- */
134
- client_secret?: string;
135
- };
136
- /**
137
- * Server-Only Workload Configuration
138
- *
139
- * Used when a service only needs to validate incoming workload tokens,
140
- * not acquire tokens for outbound calls. Requires only jwks_uri for
141
- * public key retrieval.
142
- *
143
- * @example
144
- * ```json
145
- * {
146
- * "jwks_uri": "https://sso.example.com/realms/myrealm/protocol/openid-connect/certs",
147
- * "issuer": "https://sso.example.com/realms/myrealm"
148
- * }
149
- * ```
150
- */
151
- export type ServerOnlyWorkloadConfig = WorkloadConfigBase;
152
- /**
153
- * Workload Identity Authentication Configuration
154
- *
155
- * Union type supporting multiple authentication modes. The mode is automatically
156
- * detected based on which fields are present:
157
- *
158
- * - **JWT Bearer Grant**: Requires `workload_id` + `private_key`
159
- * - **Client Credentials**: Requires `client_id` + `client_secret`
160
- * - **Server-Only**: Only `jwks_uri` (and optionally `issuer`) for token validation
161
- *
162
- * The developer uses the same API regardless of mode - the library handles the details.
163
- */
164
- export type WorkloadConfig = JwtBearerWorkloadConfig | ClientCredentialsWorkloadConfig | ServerOnlyWorkloadConfig;
165
- export type ESConfig = {
166
- es?: EnterpriseStandard;
167
- };
168
- /**
169
- * Workload Identity extracted from validated tokens
170
- */
171
- export type WorkloadIdentity = {
172
- /**
173
- * Workload identifier (for JWT Bearer Grant tokens)
174
- */
175
- workload_id?: string;
176
- /**
177
- * Client identifier (for OAuth2 Client Credentials tokens)
178
- */
179
- client_id?: string;
180
- /**
181
- * Granted scopes
182
- */
183
- scope?: string;
184
- /**
185
- * Full JWT claims from the token
186
- */
187
- claims: JWTAssertionClaims;
188
- };
189
- /**
190
- * Workload Identity Authentication Interface
191
- */
192
- export type Workload = WorkloadConfig & {
193
- getToken: (scope?: string) => Promise<string>;
194
- refreshToken: () => Promise<WorkloadTokenResponse>;
195
- generateJWTAssertion: (scope?: string) => Promise<string>;
196
- revokeToken: (token: string) => Promise<void>;
197
- validateToken: (token: string, validation?: WorkloadConfig['validation']) => Promise<TokenValidationResult>;
198
- getWorkload: (request: Request) => Promise<WorkloadIdentity | undefined>;
199
- parseJWT: (token: string, validation?: WorkloadConfig['validation']) => Promise<JWTAssertionClaims>;
200
- handler: (request: Request) => Promise<Response>;
201
- };
202
- /**
203
- * Create a workload identity authentication instance
204
- *
205
- * @param config - Workload authentication configuration
206
- * @returns Workload authentication interface
207
- *
208
- * @example
209
- * ```typescript
210
- * import { workload } from '@enterprisestandard/react';
211
- *
212
- * const workloadAuth = workload({
213
- * token_url: 'https://auth.example.com/oauth/token',
214
- * jwks_uri: 'https://auth.example.com/.well-known/jwks.json',
215
- * workload_id: 'spiffe://trust-domain/ns/service',
216
- * audience: 'https://auth.example.com/oauth/token',
217
- * private_key: '-----BEGIN PRIVATE KEY-----...',
218
- * algorithm: 'RS256',
219
- * });
220
- *
221
- * // Get access token
222
- * const token = await workloadAuth.getToken('api:read api:write');
223
- * ```
224
- */
225
- export declare function workload(config?: WorkloadConfig): Workload;
226
- export {};
227
- //# sourceMappingURL=workload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workload.d.ts","sourceRoot":"","sources":["../src/workload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhH,OAAO,EAA8B,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE7F;;GAEG;AACH,KAAK,kBAAkB,GAAG;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAEjC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;I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