@tidecloak/js 0.12.46 → 0.13.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.
@@ -1,326 +1,33 @@
1
- export default class TideCloak {
2
- /**
3
- * @param {KeycloakConfig} config
4
- */
5
- constructor(config: KeycloakConfig);
1
+ export function getHumanReadableObject(modelId: any, data: any, expiry: any): any;
2
+ export default TideCloak;
3
+ declare function TideCloak(config: any): void;
4
+ declare class TideCloak {
5
+ constructor(config: any);
6
6
  didInitialize: boolean;
7
- authenticated: boolean;
8
- loginRequired: boolean;
9
- /** @type {KeycloakResponseMode} */
10
- responseMode: KeycloakResponseMode;
11
- /** @type {KeycloakResponseType} */
12
- responseType: KeycloakResponseType;
13
- /** @type {KeycloakFlow} */
14
- flow: KeycloakFlow;
15
- /**
16
- * Matches Keycloak: number | undefined (unset when skew unknown)
17
- * @type {number | undefined}
18
- */
19
- timeSkew: number | undefined;
20
- /** @type {string=} */
21
- redirectUri: string | undefined;
22
- /** @type {string=} */
23
- silentCheckSsoRedirectUri: string | undefined;
24
- /** @type {boolean} */
25
- silentCheckSsoFallback: boolean;
26
- /** @type {KeycloakPkceMethod} */
27
- pkceMethod: KeycloakPkceMethod;
28
- enableLogging: boolean;
29
- /** @type {'GET' | 'POST'} */
30
- logoutMethod: "GET" | "POST";
31
- /** @type {string=} */
32
- scope: string | undefined;
33
- /** @type {string | undefined} */
34
- acrValues: string | undefined;
35
- messageReceiveTimeout: number;
36
- /** @type {string=} */
37
- idToken: string | undefined;
38
- /** @type {KeycloakTokenParsed=} */
39
- idTokenParsed: KeycloakTokenParsed | undefined;
40
- /** @type {string=} */
41
- token: string | undefined;
42
- /** @type {KeycloakTokenParsed=} */
43
- tokenParsed: KeycloakTokenParsed | undefined;
44
- /** @type {string=} */
45
- refreshToken: string | undefined;
46
- /** @type {KeycloakTokenParsed=} */
47
- refreshTokenParsed: KeycloakTokenParsed | undefined;
48
- /** @type {string | undefined} */
49
- doken: string | undefined;
50
- /** @type {KeycloakTokenParsed | undefined} */
51
- dokenParsed: KeycloakTokenParsed | undefined;
52
- /** @type {any} */
53
- requestEnclave: any;
54
- /** @type {any} */
55
- approvalEnclave: any;
56
- /** @type {string=} */
57
- clientId: string | undefined;
58
- /** @type {string=} */
59
- sessionId: string | undefined;
60
- /** @type {string=} */
61
- subject: string | undefined;
62
- /** @type {string=} */
63
- authServerUrl: string | undefined;
64
- /** @type {string=} */
65
- realm: string | undefined;
66
- /** @type {KeycloakRoles=} */
67
- realmAccess: KeycloakRoles | undefined;
68
- /** @type {KeycloakResourceAccess=} */
69
- resourceAccess: KeycloakResourceAccess | undefined;
70
- /** @type {KeycloakProfile=} */
71
- profile: KeycloakProfile | undefined;
72
- /** @type {KeycloakUserInfo | undefined} */
73
- userInfo: KeycloakUserInfo | undefined;
74
- /** @type {Endpoints} */
75
- endpoints: Endpoints;
76
- /** @type {number=} */
77
- tokenTimeoutHandle: number | undefined;
78
- /** @type {() => void=} */
79
- onAuthSuccess: (() => void) | undefined;
80
- /** @type {(errorData?: KeycloakError) => void=} */
81
- onAuthError: ((errorData?: KeycloakError) => void) | undefined;
82
- /** @type {() => void=} */
83
- onAuthRefreshSuccess: (() => void) | undefined;
84
- /** @type {() => void=} */
85
- onAuthRefreshError: (() => void) | undefined;
86
- /** @type {() => void=} */
87
- onTokenExpired: (() => void) | undefined;
88
- /** @type {() => void=} */
89
- onAuthLogout: (() => void) | undefined;
90
- /** @type {(authenticated: boolean) => void=} */
91
- onReady: ((authenticated: boolean) => void) | undefined;
92
- /** @type {(status: 'success' | 'cancelled' | 'error', action: string) => void=} */
93
- onActionUpdate: ((status: "success" | "cancelled" | "error", action: string) => void) | undefined;
94
- /**
95
- * @param {KeycloakInitOptions} initOptions
96
- * @returns {Promise<boolean>}
97
- */
98
- init(initOptions?: KeycloakInitOptions): Promise<boolean>;
99
- /**
100
- * @param {KeycloakLoginOptions} [options]
101
- * @returns {Promise<void>}
102
- */
103
- login(options?: KeycloakLoginOptions): Promise<void>;
104
- /**
105
- * Ensure the access token is valid, refreshing if needed.
106
- * @returns {Promise<void>}
107
- */
108
- ensureTokenReady(): Promise<void>;
109
- /**
110
- * @param {KeycloakLoginOptions} [options]
111
- * @returns {Promise<string>}
112
- */
113
- createLoginUrl(options?: KeycloakLoginOptions): Promise<string>;
114
- /**
115
- * @param {KeycloakLogoutOptions} [options]
116
- * @returns {Promise<void>}
117
- */
118
- logout(options?: KeycloakLogoutOptions): Promise<void>;
119
- /**
120
- * @param {KeycloakLogoutOptions} [options]
121
- * @returns {string}
122
- */
123
- createLogoutUrl(options?: KeycloakLogoutOptions): string;
124
- /**
125
- * @param {KeycloakRegisterOptions} [options]
126
- * @returns {Promise<void>}
127
- */
128
- register(options?: KeycloakRegisterOptions): Promise<void>;
129
- /**
130
- * @param {KeycloakRegisterOptions} [options]
131
- * @returns {Promise<string>}
132
- */
133
- createRegisterUrl(options?: KeycloakRegisterOptions): Promise<string>;
134
- /**
135
- * @param {KeycloakAccountOptions} [options]
136
- * @returns {string}
137
- */
138
- createAccountUrl(options?: KeycloakAccountOptions): string;
139
- /**
140
- * @returns {Promise<void>}
141
- */
142
- accountManagement(): Promise<void>;
143
- /**
144
- * @param {string} role
145
- * @returns {boolean}
146
- */
147
- hasRealmRole(role: string): boolean;
148
- /**
149
- * @param {string} role
150
- * @param {string} [resource]
151
- * @returns {boolean}
152
- */
153
- hasResourceRole(role: string, resource?: string): boolean;
154
- /**
155
- * @returns {Promise<KeycloakProfile>}
156
- */
157
- loadUserProfile(): Promise<KeycloakProfile>;
158
- /**
159
- * @returns {Promise<KeycloakUserInfo>}
160
- */
161
- loadUserInfo(): Promise<KeycloakUserInfo>;
162
- /**
163
- * @param {number} [minValidity]
164
- * @returns {boolean}
165
- */
166
- isTokenExpired(minValidity?: number): boolean;
167
- /**
168
- * Matches Keycloak: minValidity is optional.
169
- * @param {number} [minValidity]
170
- * @returns {Promise<boolean>}
171
- */
172
- updateToken(minValidity?: number): Promise<boolean>;
173
- clearToken(): void;
174
- /**
175
- * Initialize Tide RequestEnclave.
176
- */
177
- initRequestEnclave(): void;
178
- /**
179
- * Initialize Tide ApprovalEnclave.
180
- */
181
- initApprovalEnclave(): void;
182
- /**
183
- * Role-based encryption via Tide RequestEnclave.
184
- * @param {{ data: string | Uint8Array, tags: string[] }[]} toEncrypt
185
- * @returns {Promise<(string | Uint8Array)[]>}
186
- */
187
- encrypt(toEncrypt: {
188
- data: string | Uint8Array;
189
- tags: string[];
190
- }[]): Promise<(string | Uint8Array)[]>;
191
- /**
192
- * Initialize a Tide request that requires operator approvals.
193
- * @param {Uint8Array} encodedRequest
194
- * @returns {Promise<Uint8Array>}
195
- */
196
- createTideRequest(encodedRequest: Uint8Array): Promise<Uint8Array>;
197
- /**
198
- * Request Tide operator approval.
199
- * @param {{id: string, request: Uint8Array}[]} requests
200
- * @returns {Promise<{approved: {id: string, request: Uint8Array}[], denied: {id: string}[], pending: {id: string}[]}>}
201
- */
202
- requestTideOperatorApproval(requests: {
203
- id: string;
204
- request: Uint8Array;
205
- }[]): Promise<{
206
- approved: {
207
- id: string;
208
- request: Uint8Array;
209
- }[];
210
- denied: {
211
- id: string;
212
- }[];
213
- pending: {
214
- id: string;
215
- }[];
216
- }>;
217
- /**
218
- * Execute a Tide Sign Request
219
- * @param {Uint8Array} request
220
- * @returns Array of signatures
221
- */
222
- executeSignRequest(request: Uint8Array): Promise<any>;
223
- /**
224
- * Role-based decryption via Tide RequestEnclave.
225
- * @param {{ encrypted: string | Uint8Array, tags: string[] }[]} toDecrypt
226
- * @returns {Promise<(string | Uint8Array)[]>}
227
- */
228
- decrypt(toDecrypt: {
229
- encrypted: string | Uint8Array;
230
- tags: string[];
231
- }[]): Promise<(string | Uint8Array)[]>;
232
- #private;
7
+ init: (initOptions?: {}) => any;
8
+ login: (options: any) => any;
9
+ ensureTokenReady: () => Promise<void>;
10
+ encrypt: (toEncrypt: any) => Promise<any>;
11
+ initEnclave: () => void;
12
+ decrypt: (toDecrypt: any) => Promise<any>;
13
+ createLoginUrl: (options: any) => Promise<string>;
14
+ logout: (options: any) => any;
15
+ createLogoutUrl: (options: any) => any;
16
+ register: (options: any) => any;
17
+ createRegisterUrl: (options: any) => Promise<string>;
18
+ createAccountUrl: (options: any) => string | undefined;
19
+ accountManagement: () => any;
20
+ hasRealmRole: (role: any) => boolean;
21
+ hasResourceRole: (role: any, resource: any) => boolean;
22
+ loadUserProfile: () => any;
23
+ loadUserInfo: () => any;
24
+ isTokenExpired: (minValidity: any) => boolean;
25
+ updateToken: (minValidity: any) => any;
26
+ clearToken: () => void;
27
+ checkThresholdRule: (key: any, idSubstring: any, ruleSettings: any, draftJson: any) => any;
28
+ createCardanoTxDraft: (txBody: any) => string;
29
+ sign: (signModel: any, authFlow: any, draft: any, authorizers: any, ruleSetting: any, expiry: any) => Promise<any>;
30
+ signCardanoTx: (txBody: any, authorizers: any, ruleSettings: any, expiry: any) => Promise<string>;
31
+ createRuleSettingsDraft: (ruleSettings: any, previousRuleSetting: any, previousRuleSettingCert: any) => string;
233
32
  }
234
- /**
235
- * @typedef {Object} NetworkErrorOptionsProperties
236
- * @property {Response} response
237
- * @typedef {ErrorOptions & NetworkErrorOptionsProperties} NetworkErrorOptions
238
- */
239
- export class NetworkError extends Error {
240
- /**
241
- * @param {string} message
242
- * @param {NetworkErrorOptions} options
243
- */
244
- constructor(message: string, options: NetworkErrorOptions);
245
- /** @type {Response} */
246
- response: Response;
247
- }
248
- /**
249
- * The JSON version of the adapter configuration.
250
- */
251
- export type JsonConfig = {
252
- /**
253
- * The URL of the authentication server.
254
- */
255
- "auth-server-url": string;
256
- /**
257
- * The name of the realm.
258
- */
259
- realm: string;
260
- /**
261
- * The name of the resource, usually the client ID.
262
- */
263
- resource: string;
264
- };
265
- /**
266
- * The successful token response from the authorization server, based on the {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.1 OAuth 2.0 Authorization Framework specification}.
267
- */
268
- export type AccessTokenResponse = {
269
- /**
270
- * The access token issued by the authorization server.
271
- */
272
- access_token: string;
273
- /**
274
- * The type of the token issued by the authorization server.
275
- */
276
- token_type: string;
277
- /**
278
- * The lifetime in seconds of the access token.
279
- */
280
- expires_in?: number | undefined;
281
- /**
282
- * The refresh token issued by the authorization server.
283
- */
284
- refresh_token?: string | undefined;
285
- /**
286
- * The ID token issued by the authorization server, if requested.
287
- */
288
- id_token?: string | undefined;
289
- /**
290
- * The scope of the access token.
291
- */
292
- scope?: string | undefined;
293
- };
294
- export type Endpoints = {
295
- authorize: () => string;
296
- token: () => string;
297
- logout: () => string;
298
- checkSessionIframe: () => string;
299
- thirdPartyCookiesIframe?: (() => string) | undefined;
300
- register: () => string;
301
- userinfo: () => string;
302
- };
303
- export type LoginIframe = {
304
- enable: boolean;
305
- callbackList: ((error: Error | null, value?: boolean) => void)[];
306
- interval: number;
307
- iframe?: HTMLIFrameElement | undefined;
308
- iframeOrigin?: string | undefined;
309
- };
310
- export type CallbackState = {
311
- state: string;
312
- nonce: string;
313
- redirectUri: string;
314
- loginOptions?: KeycloakLoginOptions;
315
- prompt?: KeycloakLoginOptions["prompt"];
316
- pkceCodeVerifier?: string | undefined;
317
- };
318
- export type CallbackStorage = {
319
- get: (state?: string) => CallbackState | null;
320
- add: (state: CallbackState) => void;
321
- };
322
- export type NetworkErrorOptionsProperties = {
323
- response: Response;
324
- };
325
- export type NetworkErrorOptions = ErrorOptions & NetworkErrorOptionsProperties;
326
- export { RequestEnclave, ApprovalEnclave, ApprovalEnclaveNew, TideMemory, BaseTideRequest, PolicySignRequest, Policy, PolicyParameters } from "heimdall-tide";
33
+ export { RequestEnclave, ApprovalEnclave } from "heimdall-tide";
@@ -24,7 +24,7 @@ declare const IAMServiceInstance: IAMService;
24
24
  * ```
25
25
  */
26
26
  declare class IAMService {
27
- _tc: any;
27
+ _tc: TideCloak | null;
28
28
  _config: Object | null;
29
29
  _listeners: {};
30
30
  /**
@@ -103,3 +103,4 @@ declare class IAMService {
103
103
  /** Base URL for Tidecloak realm (no trailing slash) */
104
104
  getBaseUrl(): any;
105
105
  }
106
+ import TideCloak from "../lib/tidecloak";
@@ -1,3 +1,3 @@
1
+ export function getHumanReadableObject(modelId: any, data: any, expiry: any): any;
1
2
  export { default as IAMService } from "./IAMService.js";
2
- export { default as TideCloak, RequestEnclave, ApprovalEnclaveNew } from "../lib/tidecloak.js";
3
- export { TideMemory, BaseTideRequest } from "heimdall-tide";
3
+ export { default as TideCloak, RequestEnclave, ApprovalEnclave } from "../lib/tidecloak.js";
package/package.json CHANGED
@@ -1,37 +1,48 @@
1
1
  {
2
2
  "name": "@tidecloak/js",
3
- "version": "0.12.46",
4
- "type": "module",
3
+ "version": "0.13.1",
4
+ "description": "TideCloak client side JS SDK",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",
7
7
  "types": "dist/types/src/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/types/src/index.d.ts",
11
10
  "import": "./dist/esm/src/index.js",
11
+ "types": "./dist/types/src/index.d.ts",
12
12
  "require": "./dist/cjs/src/index.js"
13
- },
14
- "./policy-react": {
15
- "import": "./dist/esm/src/policy-react.js",
16
- "require": "./dist/cjs/src/policy-react.js"
17
- },
18
- "./policy.css": "./dist/esm/src/policy.css"
13
+ }
19
14
  },
15
+ "files": [
16
+ "dist",
17
+ "scripts/postinstall.js"
18
+ ],
20
19
  "scripts": {
21
- "postinstall": "node ./scripts/postinstall.cjs",
20
+ "postinstall": "node ./scripts/postinstall.js",
22
21
  "build:cjs": "tsc -p tsconfig.cjs.json",
23
22
  "build:esm": "tsc -p tsconfig.esm.json",
24
- "build:types": "tsc -p tsconfig.types.json",
25
- "build:copy-css": "node scripts/copy-css.cjs",
26
- "build": "npm run build:cjs && npm run build:esm && npm run build:types && npm run build:copy-css && cp ./silent-check-sso.html dist/",
23
+ "build": "npm run build:cjs && npm run build:esm && cp ./silent-check-sso.html dist/",
27
24
  "prepare": "npm run build"
28
25
  },
29
- "files": [
30
- "dist",
31
- "scripts/postinstall.cjs",
32
- "silent-check-sso.html"
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/tide-foundation/tidecloak-js.git"
32
+ },
33
+ "author": "Tide",
34
+ "homepage": "https://tide.org",
35
+ "license": "https://tide.org/licenses_tcoc2-0-0-en",
36
+ "keywords": [
37
+ "security",
38
+ "tidecloak",
39
+ "tide",
40
+ "authentication",
41
+ "oidc",
42
+ "oauth2",
43
+ "authorization"
33
44
  ],
34
45
  "dependencies": {
35
- "heimdall-tide": "^0.12.46"
46
+ "heimdall-tide": "^0.13.1"
36
47
  }
37
48
  }
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ const { copyFileSync, existsSync, mkdirSync } = require('fs');
3
+ const { join, dirname, sep } = require('path');
4
+
5
+ // find the nearest package.json upwards, but skip anything inside node_modules
6
+ function findProjectRoot(startDir) {
7
+ let dir = startDir;
8
+ while (dir !== dirname(dir)) {
9
+ // if we're inside node_modules, ignore this level
10
+ if (!dir.split(sep).includes('node_modules') &&
11
+ existsSync(join(dir, 'package.json'))) {
12
+ return dir;
13
+ }
14
+ dir = dirname(dir);
15
+ }
16
+ return null;
17
+ }
18
+
19
+ // where npm/yarn was invoked (if available)
20
+ const initialCwd = process.env.INIT_CWD || process.cwd();
21
+
22
+ // find the first non-node_modules package.json above that
23
+ const projectRoot = findProjectRoot(initialCwd) || process.cwd();
24
+
25
+ // now build paths
26
+ const pkgRoot = join(__dirname, '..');
27
+ const source = join(pkgRoot, 'dist', 'silent-check-sso.html');
28
+ const destDir = join(projectRoot, 'public');
29
+ const destFile = join(destDir, 'silent-check-sso.html');
30
+
31
+ // debug logging—remove in production
32
+ console.log(`[tidecloak-js] initialCwd: ${initialCwd}`);
33
+ console.log(`[tidecloak-js] projectRoot: ${projectRoot}`);
34
+
35
+ // ensure public/ exists
36
+ if (!existsSync(destDir)) {
37
+ mkdirSync(destDir, { recursive: true });
38
+ console.log(`[tidecloak-js] created directory ${destDir}`);
39
+ }
40
+
41
+ // copy the HTML file
42
+ copyFileSync(source, destFile);
43
+ console.log(`[tidecloak-js] copied silent-check-sso.html → ${destDir}/`);
@@ -1,3 +0,0 @@
1
- // Re-export the public React surface from @tidecloak/policy
2
- export * from '@tidecloak/policy/react';
3
- //# sourceMappingURL=policy-react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policy-react.js","sourceRoot":"","sources":["../../../src/policy-react.js"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,cAAc,yBAAyB,CAAC"}
@@ -1 +0,0 @@
1
- @import '@tidecloak/policy/style.css';
@@ -1,3 +0,0 @@
1
- // Re-export the public React surface from @tidecloak/policy
2
- export * from '@tidecloak/policy/react';
3
- //# sourceMappingURL=policy-react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policy-react.js","sourceRoot":"","sources":["../../../src/policy-react.js"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,cAAc,yBAAyB,CAAC"}
@@ -1 +0,0 @@
1
- @import '@tidecloak/policy/style.css';
@@ -1,106 +0,0 @@
1
- export { IAMServiceInstance as IAMService };
2
- export default IAMServiceInstance;
3
- declare const IAMServiceInstance: IAMService;
4
- /**
5
- * Singleton IAMService wrapping the TideCloak client.
6
- *
7
- * Usage A: pass an onReady callback directly
8
- * ```js
9
- * import { IAMService } from 'tidecloak-js';
10
- * import tidecloakConfig from './tidecloakAdapter.json';
11
- *
12
- * IAMService.initIAM(tidecloakConfig, authenticated => {
13
- * if (!authenticated) IAMService.doLogin();
14
- * }).catch(console.error);
15
- * ```
16
- *
17
- * Usage B: attach multiple listeners, then init
18
- * ```js
19
- * IAMService
20
- * .on('ready', auth => console.log('ready', auth))
21
- * .on('authError', err => console.error('Auth failed', err));
22
- *
23
- * await IAMService.initIAM(tidecloakConfig);
24
- * ```
25
- */
26
- declare class IAMService {
27
- _tc: TideCloak;
28
- _config: any;
29
- _listeners: {};
30
- /**
31
- * Register an event listener.
32
- * @param {'ready'|'initError'|'authSuccess'|'authError'|'authRefreshSuccess'|'authRefreshError'|'logout'|'tokenExpired'} event
33
- * @param {Function} handler
34
- * @returns {this}
35
- */
36
- on(event: "ready" | "initError" | "authSuccess" | "authError" | "authRefreshSuccess" | "authRefreshError" | "logout" | "tokenExpired", handler: Function): this;
37
- /**
38
- * Unregister an event listener.
39
- * @param {string} event
40
- * @param {Function} handler
41
- * @returns {this}
42
- */
43
- off(event: string, handler: Function): this;
44
- /** @private */
45
- private _emit;
46
- /**
47
- * Load TideCloak configuration and instantiate the client once.
48
- * @param {Object} config - TideCloak configuration object.
49
- * @returns {Promise<Object|null>} The loaded config, or null on failure.
50
- */
51
- loadConfig(config: any): Promise<any | null>;
52
- /**
53
- * Initialize the TideCloak SSO client with silent SSO check.
54
- * @param {Object} config - TideCloak configuration object.
55
- * @param {Function} [onReady] - Optional callback for the 'ready' event.
56
- * @returns {Promise<boolean>} true if authenticated, else false.
57
- */
58
- initIAM(config: any, onReady?: Function): Promise<boolean>;
59
- /** @private */
60
- private getTideCloakClient;
61
- /** @returns {Object} Loaded config */
62
- getConfig(): any;
63
- /** @returns {boolean} Whether there's a valid token */
64
- isLoggedIn(): boolean;
65
- /** @returns {Promise<string>} Valid token (refreshing if needed) */
66
- getToken(): Promise<string>;
67
- /** Seconds until token expiry */
68
- getTokenExp(): number;
69
- /** @returns {string} ID token */
70
- getIDToken(): string;
71
- /** @returns {string} Username (preferred_username claim) */
72
- getName(): string;
73
- /**
74
- * @param {string} role - the name of the role to check
75
- * @returns {boolean} Whether the user has a given realm role */
76
- hasRealmRole(role: string): boolean;
77
- /**
78
- * @param {string} role - the name of the role to check
79
- * @param {string} [client] - optional client-ID (defaults to the configured adapter resource)
80
- * @returns {boolean} - whether the user has that role
81
- */
82
- hasClientRole(role: string, client?: string): boolean;
83
- /**
84
- * @param {string} key - The name of the claim to retrieve from the Access token's payload.
85
- * @returns {*} Custom claim from access token */
86
- getValueFromToken(key: string): any;
87
- /**
88
- * @param {string} key - The name of the claim to retrieve from the ID token's payload.
89
- * @returns {*} Custom claim from access token */
90
- getValueFromIDToken(key: string): any;
91
- /** Refreshes token if expired or about to expire */
92
- updateIAMToken(): Promise<boolean>;
93
- /** Force immediate refresh (min validity = -1) */
94
- forceUpdateToken(): Promise<boolean>;
95
- /** Start login redirect */
96
- doLogin(): void;
97
- /** Encrypt data via adapter */
98
- doEncrypt(data: any): Promise<(string | Uint8Array<ArrayBufferLike>)[]>;
99
- /** Decrypt data via adapter */
100
- doDecrypt(data: any): Promise<(string | Uint8Array<ArrayBufferLike>)[]>;
101
- /** Logout, clear cookie, then redirect */
102
- doLogout(): void;
103
- /** Base URL for Tidecloak realm (no trailing slash) */
104
- getBaseUrl(): any;
105
- }
106
- import TideCloak from "../lib/tidecloak";
@@ -1,3 +0,0 @@
1
- export { default as IAMService } from "./IAMService.js";
2
- export { default as TideCloak, RequestEnclave, ApprovalEnclaveNew } from "../lib/tidecloak.js";
3
- export { TideMemory, BaseTideRequest } from "heimdall-tide";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- // scripts/postinstall.cjs (CommonJS)
2
- const { copyFileSync, existsSync, mkdirSync } = require('node:fs');
3
- const path = require('node:path');
4
-
5
- // npm sets INIT_CWD to the *consumer* project root that ran `npm i`
6
- const initCwd = process.env.INIT_CWD || process.cwd();
7
- const pkgRoot = __dirname ? path.resolve(__dirname, '..') : process.cwd();
8
-
9
- // where the file should end up in the *consumer* app
10
- const targetDir = path.join(initCwd, 'public');
11
- const targetFile = path.join(targetDir, 'silent-check-sso.html');
12
-
13
- // possible sources inside this package
14
- const distSrc = path.join(pkgRoot, 'dist', 'silent-check-sso.html');
15
- const srcSrc = path.join(pkgRoot, 'silent-check-sso.html');
16
-
17
- // no-op if the consumer doesn't have a public/ folder
18
- if (!existsSync(targetDir)) {
19
- console.log('[tidecloak-js] No public/ directory in consumer, skipping copy.');
20
- process.exit(0);
21
- }
22
-
23
- // find a source file to copy
24
- let source = null;
25
- if (existsSync(distSrc)) source = distSrc;
26
- else if (existsSync(srcSrc)) source = srcSrc;
27
-
28
- if (!source) {
29
- console.log('[tidecloak-js] silent-check-sso.html not found in package, skipping copy.');
30
- process.exit(0);
31
- }
32
-
33
- // ensure target dir exists and copy
34
- mkdirSync(targetDir, { recursive: true });
35
- copyFileSync(source, targetFile);
36
- console.log(`[tidecloak-js] Copied ${path.basename(source)} → ${targetFile}`);
@@ -1 +0,0 @@
1
- <html><body><script>parent.postMessage(location.href, location.origin)</script></body></html>