@coreiam/auth 1.0.391 → 1.0.392-beta.0
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/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +14 -0
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -19,6 +19,14 @@ export interface CoreIAMIdentity {
|
|
|
19
19
|
roles?: string[];
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
|
+
export interface DirectoryIdentity {
|
|
23
|
+
sub: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
first_name?: string;
|
|
26
|
+
last_name?: string;
|
|
27
|
+
is_active?: boolean;
|
|
28
|
+
roles: string[];
|
|
29
|
+
}
|
|
22
30
|
/** Accepts a Headers instance, an Express req.headers object, or a raw Cookie string. */
|
|
23
31
|
export type SessionInput = Headers | Record<string, string | string[] | undefined> | string;
|
|
24
32
|
export type SessionFailureReason = 'no_cookie' | 'expired' | 'invalid_claims' | 'invalid_signature' | 'jwks_unavailable';
|
|
@@ -60,6 +68,15 @@ export declare class CoreIAM {
|
|
|
60
68
|
private getJwks;
|
|
61
69
|
/** Optional warm-up: call at boot so the first verification pays no JWKS latency. */
|
|
62
70
|
preloadJwks(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Tenant directory: all identities (with roles) for the tenant scoped to
|
|
73
|
+
* this instance's API key. Server-to-server, read-only.
|
|
74
|
+
* THROWS on failure — an audit must never silently see an empty roster.
|
|
75
|
+
*/
|
|
76
|
+
listIdentities(): Promise<{
|
|
77
|
+
users: DirectoryIdentity[];
|
|
78
|
+
total: number;
|
|
79
|
+
}>;
|
|
63
80
|
private readCookieHeader;
|
|
64
81
|
private readSessionCookie;
|
|
65
82
|
verifySession(input: SessionInput): Promise<SessionResult>;
|
package/dist/core/index.js
CHANGED
|
@@ -67,6 +67,20 @@ class CoreIAM {
|
|
|
67
67
|
/* expected: no matching key — the fetch is the point */
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Tenant directory: all identities (with roles) for the tenant scoped to
|
|
72
|
+
* this instance's API key. Server-to-server, read-only.
|
|
73
|
+
* THROWS on failure — an audit must never silently see an empty roster.
|
|
74
|
+
*/
|
|
75
|
+
async listIdentities() {
|
|
76
|
+
const response = await this.proxy('/api/v1/directory', { method: 'GET' }, new Headers());
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
const body = await response.text().catch(() => '');
|
|
79
|
+
throw new Error(`listIdentities failed: ${response.status} ${body}`);
|
|
80
|
+
}
|
|
81
|
+
const data = await response.json();
|
|
82
|
+
return { users: data.users ?? [], total: data.total ?? 0 };
|
|
83
|
+
}
|
|
70
84
|
readCookieHeader(input) {
|
|
71
85
|
if (typeof input === 'string')
|
|
72
86
|
return input;
|