siarashield_workspace 0.0.24 → 0.0.26
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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
## `siarashield_workspace`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular integration for CyberSiara **SiaraShield** captcha.
|
|
4
4
|
|
|
5
5
|
## Angular compatibility
|
|
6
6
|
|
|
@@ -10,17 +10,32 @@ Simple Angular integration for CyberSiara SiaraShield captcha.
|
|
|
10
10
|
- `@angular/core >=16.0.0 <22.0.0`
|
|
11
11
|
- `@angular/common >=16.0.0 <22.0.0`
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm i siarashield_workspace
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Quick setup (6 steps)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Use these steps for a fast Angular setup (function API flow).
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
1. Install package: `npm i siarashield_workspace`.
|
|
24
|
+
2. Add HTML in your form template:
|
|
25
|
+
- `<div class="SiaraShield"></div>`
|
|
26
|
+
- `<button type="submit" class="CaptchaSubmit" (click)="onSubmit()">Submit</button>`
|
|
27
|
+
3. Put public key in Angular environment (never expose private key in frontend).
|
|
28
|
+
4. Initialize captcha in component with `initSiaraShield({ publicKey, cspNonce })`.
|
|
29
|
+
5. On submit, call `checkSiaraShieldCaptcha()` first.
|
|
30
|
+
6. Call your API only when captcha is successful (`result.ok === true`).
|
|
31
|
+
|
|
32
|
+
If you prefer Angular component usage, see **Recommended: use the Angular component (easiest)** below.
|
|
33
|
+
|
|
34
|
+
## Get your keys
|
|
35
|
+
|
|
36
|
+
Get your public and private keys from <a href="https://mycybersiara.com" target="_blank" rel="noopener noreferrer">mycybersiara.com</a>.
|
|
37
|
+
|
|
38
|
+
## Put keys in the right place
|
|
24
39
|
|
|
25
40
|
- **Frontend (Angular):** public key only
|
|
26
41
|
- **Backend (.env):** private key only
|
|
@@ -39,38 +54,94 @@ Backend `.env` example:
|
|
|
39
54
|
SIARASHIELD_PRIVATE_KEY=YOUR-PRIVATE-KEY
|
|
40
55
|
```
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
Never place the private key in Angular environment files, templates, or browser code.
|
|
43
58
|
|
|
44
|
-
##
|
|
59
|
+
## Recommended: use the Angular component (easiest)
|
|
60
|
+
|
|
61
|
+
### 1) Add the component to your template
|
|
45
62
|
|
|
46
63
|
```html
|
|
47
|
-
<
|
|
64
|
+
<siara-shield
|
|
65
|
+
[publicKey]="environment.siaraShieldPublicKey"
|
|
66
|
+
[cspNonce]="cspNonce"
|
|
67
|
+
(token)="onCaptchaToken($event)"
|
|
68
|
+
></siara-shield>
|
|
69
|
+
|
|
70
|
+
<button type="submit" class="CaptchaSubmit" (click)="onSubmit()">Submit</button>
|
|
48
71
|
```
|
|
49
72
|
|
|
50
|
-
|
|
73
|
+
### 2) Copy-paste TypeScript
|
|
51
74
|
|
|
52
|
-
```
|
|
53
|
-
|
|
75
|
+
```ts
|
|
76
|
+
import { Component, ViewChild } from '@angular/core';
|
|
77
|
+
import { environment } from '../environments/environment';
|
|
78
|
+
import { SiaraShieldComponent } from 'siarashield_workspace';
|
|
79
|
+
|
|
80
|
+
@Component({
|
|
81
|
+
selector: 'app-form',
|
|
82
|
+
standalone: true,
|
|
83
|
+
imports: [SiaraShieldComponent],
|
|
84
|
+
templateUrl: './form.component.html',
|
|
85
|
+
})
|
|
86
|
+
export class FormComponent {
|
|
87
|
+
protected readonly environment = environment;
|
|
88
|
+
|
|
89
|
+
// Recommended: set from server (see CSP section)
|
|
90
|
+
protected readonly cspNonce = (window as any).__cspNonce as string | undefined;
|
|
91
|
+
|
|
92
|
+
@ViewChild(SiaraShieldComponent) private readonly captcha?: SiaraShieldComponent;
|
|
93
|
+
|
|
94
|
+
onCaptchaToken(token: string) {
|
|
95
|
+
// Optional: use token immediately if needed
|
|
96
|
+
console.log('SiaraShield token:', token);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async onSubmit() {
|
|
100
|
+
const ok = await this.captcha?.checkCaptchaAsync();
|
|
101
|
+
if (!ok) {
|
|
102
|
+
console.log('Captcha not completed yet');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// When ok=true, token is available in global state and from (token) output.
|
|
107
|
+
alert('Form submitted successfully');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
54
110
|
```
|
|
55
111
|
|
|
56
|
-
|
|
112
|
+
Notes:
|
|
113
|
+
|
|
114
|
+
- If you already load jQuery in your app, set `[loadJQuery]="false"` on the component.
|
|
115
|
+
- Keep `class="CaptchaSubmit"` on your submit button (required by vendor flow).
|
|
116
|
+
- The component renders the required captcha container (`<div class="SiaraShield"></div>`) internally at that position in the template.
|
|
117
|
+
- Vendor debug logs are suppressed by default. Set `[allowVendorConsoleLogs]="true"` only while debugging.
|
|
118
|
+
|
|
119
|
+
## Alternative: function API (when you cannot use the component)
|
|
57
120
|
|
|
58
|
-
|
|
121
|
+
Template for function API:
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<div class="SiaraShield"></div>
|
|
125
|
+
<button type="submit" class="CaptchaSubmit" (click)="onSubmit()">Submit</button>
|
|
126
|
+
```
|
|
59
127
|
|
|
60
128
|
```ts
|
|
61
|
-
import { OnInit } from '@angular/core';
|
|
62
129
|
import { environment } from '../environments/environment';
|
|
63
130
|
import { initSiaraShield, checkSiaraShieldCaptcha } from 'siarashield_workspace';
|
|
64
131
|
|
|
65
|
-
export class FormComponent
|
|
132
|
+
export class FormComponent {
|
|
66
133
|
ngOnInit() {
|
|
67
|
-
|
|
134
|
+
// Angular does not wait for async lifecycle hooks.
|
|
135
|
+
// Use void to run async init without blocking render.
|
|
136
|
+
void this.initializeCaptcha();
|
|
68
137
|
}
|
|
69
138
|
|
|
70
|
-
initializeCaptcha() {
|
|
71
|
-
initSiaraShield({
|
|
139
|
+
private async initializeCaptcha() {
|
|
140
|
+
await initSiaraShield({
|
|
72
141
|
publicKey: environment.siaraShieldPublicKey,
|
|
73
142
|
cspNonce: (window as any).__cspNonce || undefined,
|
|
143
|
+
// Optional: set true only while debugging vendor/runtime internals.
|
|
144
|
+
allowVendorConsoleLogs: false,
|
|
74
145
|
});
|
|
75
146
|
}
|
|
76
147
|
|
|
@@ -88,15 +159,15 @@ export class FormComponent implements OnInit {
|
|
|
88
159
|
}
|
|
89
160
|
```
|
|
90
161
|
|
|
91
|
-
Keep
|
|
162
|
+
Keep submit API logic inside the successful captcha branch.
|
|
92
163
|
|
|
93
|
-
If your frontend reads
|
|
164
|
+
If your frontend reads nonce from the DOM instead of `window`, reuse nonce from an existing script tag:
|
|
94
165
|
|
|
95
166
|
```ts
|
|
96
167
|
const nonce = document.querySelector('script[nonce]')?.getAttribute('nonce') || undefined;
|
|
97
168
|
```
|
|
98
169
|
|
|
99
|
-
The nonce must be generated on the server for each request. The
|
|
170
|
+
The nonce must be generated on the server for each request. The package NEVER generates a nonce in the browser.
|
|
100
171
|
|
|
101
172
|
## CSP Compliance (Important)
|
|
102
173
|
|
|
@@ -105,13 +176,71 @@ Inline scripts are blocked by CSP unless you allow them with a nonce or a hash.
|
|
|
105
176
|
For strict CSP deployments:
|
|
106
177
|
|
|
107
178
|
- Generate the nonce on the server for each request.
|
|
108
|
-
- Use the
|
|
109
|
-
- Use the
|
|
110
|
-
- Use the
|
|
111
|
-
- The
|
|
179
|
+
- Use the same nonce in the `Content-Security-Policy` header.
|
|
180
|
+
- Use the same nonce on the `<script>` tag that loads your Angular app or any direct SiaraShield resource.
|
|
181
|
+
- Use the same nonce in `initSiaraShield({ cspNonce: ... })`.
|
|
182
|
+
- The package NEVER generates a nonce in the browser.
|
|
112
183
|
- If a valid CSP nonce is required but not provided, browsers will block script execution and the captcha will fail to load.
|
|
113
184
|
|
|
114
|
-
|
|
185
|
+
### Production copy-paste policy (recommended for easiest client integration)
|
|
186
|
+
|
|
187
|
+
Use this when you want a client-safe setup that avoids popup close issues with current vendor runtime.
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<meta http-equiv="Content-Security-Policy" content="
|
|
191
|
+
default-src 'self';
|
|
192
|
+
script-src 'self' 'unsafe-inline' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
193
|
+
script-src-elem 'self' 'nonce-SIARASHIELD_NONCE' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
194
|
+
connect-src 'self' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
195
|
+
style-src 'self' https://embed.mycybersiara.com https://mycybersiara.com https://fonts.googleapis.com https://cdnjs.cloudflare.com 'unsafe-inline';
|
|
196
|
+
font-src 'self' https://fonts.gstatic.com https://mycybersiara.com https://cdnjs.cloudflare.com data:;
|
|
197
|
+
img-src 'self' data: https://embed.mycybersiara.com https://embedcdn.mycybersiara.com https://mycybersiara.com;
|
|
198
|
+
">
|
|
199
|
+
|
|
200
|
+
<script nonce="SIARASHIELD_NONCE">
|
|
201
|
+
window.__cspNonce = "SIARASHIELD_NONCE";
|
|
202
|
+
</script>
|
|
203
|
+
<script nonce="SIARASHIELD_NONCE" src="https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js"></script>
|
|
204
|
+
<script nonce="SIARASHIELD_NONCE" src="https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js"></script>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
If your backend uses helper functions, generate compatibility policy like this:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { getSiaraShieldCspPolicy } from 'siarashield_workspace';
|
|
211
|
+
|
|
212
|
+
const csp = getSiaraShieldCspPolicy({
|
|
213
|
+
nonce: 'SIARASHIELD_NONCE',
|
|
214
|
+
includeUnsafeInlineScript: true,
|
|
215
|
+
includeUnsafeInlineStyle: true,
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Strict copy-paste quick test (advanced, static nonce for local verification only)
|
|
220
|
+
|
|
221
|
+
Use this only for local or staging validation. In production, replace `siarashield-example-nonce` with a server-generated nonce per request.
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<script nonce="siarashield-example-nonce">
|
|
225
|
+
window.__cspNonce = "siarashield-example-nonce";
|
|
226
|
+
</script>
|
|
227
|
+
<script nonce="siarashield-example-nonce" src="https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js"></script>
|
|
228
|
+
<script nonce="siarashield-example-nonce" src="https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js"></script>
|
|
229
|
+
|
|
230
|
+
<meta http-equiv="Content-Security-Policy" content="
|
|
231
|
+
default-src 'self';
|
|
232
|
+
script-src 'self' 'nonce-siarashield-example-nonce' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
233
|
+
script-src-elem 'self' 'nonce-siarashield-example-nonce' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
234
|
+
connect-src 'self' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
235
|
+
style-src 'self' https://embed.mycybersiara.com https://mycybersiara.com https://fonts.googleapis.com https://cdnjs.cloudflare.com 'unsafe-inline';
|
|
236
|
+
font-src 'self' https://fonts.gstatic.com https://mycybersiara.com https://cdnjs.cloudflare.com data:;
|
|
237
|
+
img-src 'self' data: https://embed.mycybersiara.com https://embedcdn.mycybersiara.com https://mycybersiara.com;
|
|
238
|
+
">
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Strict production CSP policy (advanced)
|
|
242
|
+
|
|
243
|
+
In production, send CSP as an HTTP response header and inject the same nonce value into script tags and `initSiaraShield({ cspNonce })`.
|
|
115
244
|
|
|
116
245
|
```http
|
|
117
246
|
default-src 'self';
|
|
@@ -123,15 +252,25 @@ font-src 'self' https://fonts.gstatic.com https://mycybersiara.com https://cdnjs
|
|
|
123
252
|
img-src 'self' data: https://embed.mycybersiara.com https://embedcdn.mycybersiara.com https://mycybersiara.com;
|
|
124
253
|
```
|
|
125
254
|
|
|
126
|
-
Example
|
|
255
|
+
Example with the same server-generated nonce in script tags:
|
|
127
256
|
|
|
128
257
|
```html
|
|
129
|
-
<script nonce="
|
|
258
|
+
<script nonce="SIARASHIELD_NONCE">
|
|
259
|
+
window.__cspNonce = "SIARASHIELD_NONCE";
|
|
260
|
+
</script>
|
|
261
|
+
<script nonce="SIARASHIELD_NONCE" src="https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js"></script>
|
|
262
|
+
<script nonce="SIARASHIELD_NONCE" src="https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js"></script>
|
|
130
263
|
```
|
|
131
264
|
|
|
132
|
-
If your Angular app initializes SiaraShield from the main application bundle, that bundle
|
|
265
|
+
If your Angular app initializes SiaraShield from the main application bundle, that bundle `<script>` tag must use the same nonce as the CSP header.
|
|
266
|
+
|
|
267
|
+
`getSiaraShieldCspPolicy()` and `mergeSiaraShieldCspPolicy()` only generate a baseline CSP string. These helpers do not inject a nonce and do not apply headers. The server must inject the nonce and must apply the final `Content-Security-Policy` header.
|
|
133
268
|
|
|
134
|
-
|
|
269
|
+
Notes:
|
|
270
|
+
|
|
271
|
+
- CSP helpers default to strict policy (no `script-src 'unsafe-inline'`).
|
|
272
|
+
- For easiest client integration, use the compatibility policy above (`includeUnsafeInlineScript: true`, `includeUnsafeInlineStyle: true`).
|
|
273
|
+
- Generating a new nonce in the browser (or per function call) does not help. CSP nonce must match the value from server response headers for that page load.
|
|
135
274
|
|
|
136
275
|
The package still works in environments without CSP or with relaxed policies. If your site uses a strict nonce-based CSP, passing the server-generated nonce is required.
|
|
137
276
|
|
|
@@ -143,8 +282,8 @@ The package still works in environments without CSP or with relaxed policies. If
|
|
|
143
282
|
- The package also loads:
|
|
144
283
|
- `https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js`
|
|
145
284
|
- `https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js`
|
|
146
|
-
- jQuery and the captcha bootstrap process may create script elements dynamically.
|
|
147
|
-
- When `cspNonce` is provided,
|
|
285
|
+
- jQuery and the captcha bootstrap process may create script elements dynamically (including via HTML strings / DOM fragments).
|
|
286
|
+
- When `cspNonce` is provided, dynamically inserted `<script>` elements are assigned that nonce (including scripts inserted indirectly through DOM manipulation).
|
|
148
287
|
- This is required for compatibility with strict nonce-based CSP policies.
|
|
149
288
|
- If a valid CSP nonce is required but not passed, browsers will block those script loads and the captcha will fail to initialize.
|
|
150
289
|
- If your app already loads jQuery, set `loadJQuery: false`.
|
|
@@ -152,11 +291,25 @@ The package still works in environments without CSP or with relaxed policies. If
|
|
|
152
291
|
|
|
153
292
|
## Quick troubleshooting
|
|
154
293
|
|
|
155
|
-
- Captcha not visible
|
|
156
|
-
-
|
|
157
|
-
-
|
|
294
|
+
- Captcha not visible:
|
|
295
|
+
- If you use `<siara-shield ...>`, confirm the component is rendered (no `*ngIf` hiding it) and the page has finished loading scripts.
|
|
296
|
+
- If you use the function API, confirm your template contains `<div class="SiaraShield"></div>`.
|
|
297
|
+
- Confirm your submit button has `class="CaptchaSubmit"`.
|
|
298
|
+
- `CheckCaptcha` not available:
|
|
299
|
+
- Ensure initialization completed (for the function API: `await initSiaraShield(...)`).
|
|
300
|
+
- Ensure CSP allows the required hosts and the correct nonce is used.
|
|
301
|
+
- CSP error in console:
|
|
302
|
+
- Confirm the same **server-generated nonce** is present in CSP header, bootstrapping `<script>` tag, and initialization (`cspNonce`).
|
|
158
303
|
- Token empty -> check browser console and network calls after clicking submit.
|
|
159
304
|
|
|
305
|
+
## Final checklist (customer handover)
|
|
306
|
+
|
|
307
|
+
- Public key is in frontend; private key stays only on backend.
|
|
308
|
+
- Submit button includes `class="CaptchaSubmit"`.
|
|
309
|
+
- Captcha container exists (component tag or `<div class="SiaraShield"></div>` for function API).
|
|
310
|
+
- Same nonce value is used in CSP header, script tags, and `initSiaraShield({ cspNonce })`.
|
|
311
|
+
- Captcha check runs before API call.
|
|
312
|
+
|
|
160
313
|
## Build and pack (library maintainers)
|
|
161
314
|
|
|
162
315
|
```bash
|
|
@@ -9,6 +9,50 @@ function getInitCaptchaFn(g) {
|
|
|
9
9
|
return g.initCaptcha ?? g.InitCaptcha;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
const CONSOLE_PATCH_STATE_KEY = '__siaraShieldConsolePatchState__';
|
|
13
|
+
const DEFAULT_SUPPRESS_WINDOW_MS = 2000;
|
|
14
|
+
function getConsolePatchState() {
|
|
15
|
+
const globalState = globalThis;
|
|
16
|
+
if (!globalState[CONSOLE_PATCH_STATE_KEY]) {
|
|
17
|
+
globalState[CONSOLE_PATCH_STATE_KEY] = {
|
|
18
|
+
depth: 0,
|
|
19
|
+
originalLog: console.log.bind(console),
|
|
20
|
+
originalInfo: console.info.bind(console),
|
|
21
|
+
originalWarn: console.warn.bind(console),
|
|
22
|
+
originalDebug: console.debug.bind(console),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return globalState[CONSOLE_PATCH_STATE_KEY];
|
|
26
|
+
}
|
|
27
|
+
function muteConsole() {
|
|
28
|
+
const patchState = getConsolePatchState();
|
|
29
|
+
patchState.depth += 1;
|
|
30
|
+
if (patchState.depth > 1)
|
|
31
|
+
return;
|
|
32
|
+
console.log = () => undefined;
|
|
33
|
+
console.info = () => undefined;
|
|
34
|
+
console.warn = () => undefined;
|
|
35
|
+
console.debug = () => undefined;
|
|
36
|
+
}
|
|
37
|
+
function unmuteConsole() {
|
|
38
|
+
const patchState = getConsolePatchState();
|
|
39
|
+
if (patchState.depth === 0)
|
|
40
|
+
return;
|
|
41
|
+
patchState.depth -= 1;
|
|
42
|
+
if (patchState.depth > 0)
|
|
43
|
+
return;
|
|
44
|
+
console.log = patchState.originalLog;
|
|
45
|
+
console.info = patchState.originalInfo;
|
|
46
|
+
console.warn = patchState.originalWarn;
|
|
47
|
+
console.debug = patchState.originalDebug;
|
|
48
|
+
}
|
|
49
|
+
function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS) {
|
|
50
|
+
muteConsole();
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
unmuteConsole();
|
|
53
|
+
}, windowMs);
|
|
54
|
+
}
|
|
55
|
+
|
|
12
56
|
const SCRIPT_STATUS_BY_DOCUMENT = new WeakMap();
|
|
13
57
|
const SCRIPT_PENDING_BY_DOCUMENT = new WeakMap();
|
|
14
58
|
const DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';
|
|
@@ -33,6 +77,7 @@ function getDynamicScriptNoncePatchState() {
|
|
|
33
77
|
if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {
|
|
34
78
|
globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {
|
|
35
79
|
nonceByDocument: new WeakMap(),
|
|
80
|
+
observerByDocument: new WeakMap(),
|
|
36
81
|
patched: false,
|
|
37
82
|
};
|
|
38
83
|
}
|
|
@@ -64,6 +109,50 @@ function applyTrackedNonce(node) {
|
|
|
64
109
|
const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);
|
|
65
110
|
applyScriptNonce(node, nonce);
|
|
66
111
|
}
|
|
112
|
+
function walkAndApplyNonce(root, nonce) {
|
|
113
|
+
if (!nonce)
|
|
114
|
+
return;
|
|
115
|
+
// Fast path: root itself is a script.
|
|
116
|
+
if (isScriptElement(root)) {
|
|
117
|
+
applyScriptNonce(root, nonce);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Common path for jQuery: append DocumentFragment containing scripts created via HTML parsing.
|
|
121
|
+
if (root instanceof Element || root instanceof DocumentFragment) {
|
|
122
|
+
const scripts = root.querySelectorAll?.('script') ?? [];
|
|
123
|
+
for (const script of scripts) {
|
|
124
|
+
applyScriptNonce(script, nonce);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function ensureNonceMutationObserver(documentRef) {
|
|
129
|
+
const patchState = getDynamicScriptNoncePatchState();
|
|
130
|
+
if (patchState.observerByDocument.get(documentRef)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const observer = new MutationObserver((records) => {
|
|
134
|
+
const nonce = patchState.nonceByDocument.get(documentRef);
|
|
135
|
+
if (!nonce)
|
|
136
|
+
return;
|
|
137
|
+
for (const record of records) {
|
|
138
|
+
for (const node of record.addedNodes) {
|
|
139
|
+
walkAndApplyNonce(node, nonce);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
// Observe the full document because scripts can be injected into body/head by vendor/jQuery.
|
|
144
|
+
const root = documentRef.documentElement ?? documentRef;
|
|
145
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
146
|
+
patchState.observerByDocument.set(documentRef, observer);
|
|
147
|
+
}
|
|
148
|
+
function teardownNonceMutationObserver(documentRef) {
|
|
149
|
+
const patchState = getDynamicScriptNoncePatchState();
|
|
150
|
+
const observer = patchState.observerByDocument.get(documentRef);
|
|
151
|
+
if (!observer)
|
|
152
|
+
return;
|
|
153
|
+
observer.disconnect();
|
|
154
|
+
patchState.observerByDocument.delete(documentRef);
|
|
155
|
+
}
|
|
67
156
|
function patchDynamicScriptInsertion() {
|
|
68
157
|
const patchState = getDynamicScriptNoncePatchState();
|
|
69
158
|
if (patchState.patched) {
|
|
@@ -105,9 +194,11 @@ function prepareScriptNonce(documentRef, explicitNonce) {
|
|
|
105
194
|
patchDynamicScriptInsertion();
|
|
106
195
|
if (resolvedNonce) {
|
|
107
196
|
patchState.nonceByDocument.set(documentRef, resolvedNonce);
|
|
197
|
+
ensureNonceMutationObserver(documentRef);
|
|
108
198
|
}
|
|
109
199
|
else {
|
|
110
200
|
patchState.nonceByDocument.delete(documentRef);
|
|
201
|
+
teardownNonceMutationObserver(documentRef);
|
|
111
202
|
}
|
|
112
203
|
return resolvedNonce;
|
|
113
204
|
}
|
|
@@ -179,6 +270,7 @@ class SiaraShieldComponent {
|
|
|
179
270
|
publicKey;
|
|
180
271
|
loadJQuery = true;
|
|
181
272
|
cspNonce;
|
|
273
|
+
allowVendorConsoleLogs = false;
|
|
182
274
|
/**
|
|
183
275
|
* Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.
|
|
184
276
|
*/
|
|
@@ -189,7 +281,12 @@ class SiaraShieldComponent {
|
|
|
189
281
|
this.loader = loader;
|
|
190
282
|
}
|
|
191
283
|
async ngAfterViewInit() {
|
|
192
|
-
await this.init({
|
|
284
|
+
await this.init({
|
|
285
|
+
publicKey: this.publicKey,
|
|
286
|
+
loadJQuery: this.loadJQuery,
|
|
287
|
+
cspNonce: this.cspNonce,
|
|
288
|
+
allowVendorConsoleLogs: this.allowVendorConsoleLogs,
|
|
289
|
+
});
|
|
193
290
|
}
|
|
194
291
|
async init(options) {
|
|
195
292
|
if (this.initialized)
|
|
@@ -215,6 +312,9 @@ class SiaraShieldComponent {
|
|
|
215
312
|
if (!initCaptchaFn) {
|
|
216
313
|
throw new Error('SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.');
|
|
217
314
|
}
|
|
315
|
+
if (!options.allowVendorConsoleLogs) {
|
|
316
|
+
suppressVendorConsoleWindow();
|
|
317
|
+
}
|
|
218
318
|
initCaptchaFn(options.publicKey);
|
|
219
319
|
await this.waitForCheckCaptchaApi();
|
|
220
320
|
this.initialized = true;
|
|
@@ -262,6 +362,9 @@ class SiaraShieldComponent {
|
|
|
262
362
|
if (!g.CheckCaptcha) {
|
|
263
363
|
throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');
|
|
264
364
|
}
|
|
365
|
+
if (!this.allowVendorConsoleLogs) {
|
|
366
|
+
suppressVendorConsoleWindow();
|
|
367
|
+
}
|
|
265
368
|
const ok = g.CheckCaptcha();
|
|
266
369
|
if (ok && typeof g.CyberSiaraToken === 'string') {
|
|
267
370
|
this.token.emit(g.CyberSiaraToken);
|
|
@@ -288,7 +391,7 @@ class SiaraShieldComponent {
|
|
|
288
391
|
return false;
|
|
289
392
|
}
|
|
290
393
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SiaraShieldComponent, deps: [{ token: i0.ElementRef }, { token: SiaraShieldLoaderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
291
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: SiaraShieldComponent, isStandalone: true, selector: "siara-shield", inputs: { publicKey: "publicKey", loadJQuery: "loadJQuery", cspNonce: "cspNonce" }, outputs: { token: "token" }, ngImport: i0, template: `<div class="SiaraShield"></div>`, isInline: true, encapsulation: i0.ViewEncapsulation.None });
|
|
394
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: SiaraShieldComponent, isStandalone: true, selector: "siara-shield", inputs: { publicKey: "publicKey", loadJQuery: "loadJQuery", cspNonce: "cspNonce", allowVendorConsoleLogs: "allowVendorConsoleLogs" }, outputs: { token: "token" }, ngImport: i0, template: `<div class="SiaraShield"></div>`, isInline: true, encapsulation: i0.ViewEncapsulation.None });
|
|
292
395
|
}
|
|
293
396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SiaraShieldComponent, decorators: [{
|
|
294
397
|
type: Component,
|
|
@@ -305,6 +408,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
305
408
|
type: Input
|
|
306
409
|
}], cspNonce: [{
|
|
307
410
|
type: Input
|
|
411
|
+
}], allowVendorConsoleLogs: [{
|
|
412
|
+
type: Input
|
|
308
413
|
}], token: [{
|
|
309
414
|
type: Output
|
|
310
415
|
}] } });
|
|
@@ -379,6 +484,9 @@ async function initSiaraShield(options) {
|
|
|
379
484
|
if (!initCaptchaFn) {
|
|
380
485
|
throw new Error('SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.');
|
|
381
486
|
}
|
|
487
|
+
if (!options.allowVendorConsoleLogs) {
|
|
488
|
+
suppressVendorConsoleWindow();
|
|
489
|
+
}
|
|
382
490
|
initCaptchaFn(options.publicKey);
|
|
383
491
|
await waitForCheckCaptchaApi();
|
|
384
492
|
initialized = true;
|
|
@@ -394,11 +502,14 @@ async function initSiaraShield(options) {
|
|
|
394
502
|
* Calls global `CheckCaptcha()` and returns its boolean result.
|
|
395
503
|
* If successful, returns `{ ok: true, token?: string }`.
|
|
396
504
|
*/
|
|
397
|
-
function checkSiaraShieldCaptcha() {
|
|
505
|
+
function checkSiaraShieldCaptcha(options) {
|
|
398
506
|
const g = getSiaraShieldGlobals();
|
|
399
507
|
if (!g.CheckCaptcha) {
|
|
400
508
|
throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');
|
|
401
509
|
}
|
|
510
|
+
if (!options?.allowVendorConsoleLogs) {
|
|
511
|
+
suppressVendorConsoleWindow();
|
|
512
|
+
}
|
|
402
513
|
const ok = g.CheckCaptcha();
|
|
403
514
|
const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;
|
|
404
515
|
return ok ? { ok: true, token } : { ok: false };
|
|
@@ -475,8 +586,9 @@ function parsePolicy(policy) {
|
|
|
475
586
|
}
|
|
476
587
|
function getSiaraShieldCspDirectives(options) {
|
|
477
588
|
const includeGoogleApis = options?.includeGoogleApis ?? false;
|
|
478
|
-
|
|
479
|
-
const
|
|
589
|
+
// Default to strict/safe CSP. Customers can explicitly opt-in if they accept the risk.
|
|
590
|
+
const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? false;
|
|
591
|
+
const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? false;
|
|
480
592
|
const nonce = nonceSource(options?.nonce);
|
|
481
593
|
const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];
|
|
482
594
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siarashield_workspace.mjs","sources":["../../../projects/siarashield-workspace/src/lib/siara-shield.globals.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-script-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","type ScriptStatus = 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\ninterface DynamicScriptNoncePatchState {\n nonceByDocument: WeakMap<Document, string>;\n patched: boolean;\n}\n\nconst SCRIPT_STATUS_BY_DOCUMENT = new WeakMap<Document, Map<string, ScriptStatus>>();\nconst SCRIPT_PENDING_BY_DOCUMENT = new WeakMap<Document, Map<string, Promise<void>>>();\nconst DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';\n\nfunction getStatusBySrc(documentRef: Document): Map<string, ScriptStatus> {\n let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);\n if (!statusBySrc) {\n statusBySrc = new Map<string, ScriptStatus>();\n SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);\n }\n\n return statusBySrc;\n}\n\nfunction getPendingBySrc(documentRef: Document): Map<string, Promise<void>> {\n let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);\n if (!pendingBySrc) {\n pendingBySrc = new Map<string, Promise<void>>();\n SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);\n }\n\n return pendingBySrc;\n}\n\nfunction getDynamicScriptNoncePatchState(): DynamicScriptNoncePatchState {\n const globalState = globalThis as typeof globalThis & {\n [DYNAMIC_SCRIPT_NONCE_STATE_KEY]?: DynamicScriptNoncePatchState;\n };\n\n if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {\n globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {\n nonceByDocument: new WeakMap<Document, string>(),\n patched: false,\n };\n }\n\n return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];\n}\n\nfunction normalizeNonce(nonce?: string | null): string | undefined {\n const trimmed = nonce?.trim();\n return trimmed ? trimmed : undefined;\n}\n\nfunction isScriptElement(node: Node): node is HTMLScriptElement {\n return node instanceof Element && node.tagName.toLowerCase() === 'script';\n}\n\nexport function applyScriptNonce(script: HTMLScriptElement, nonce?: string): void {\n const resolvedNonce = normalizeNonce(nonce);\n if (!resolvedNonce) {\n return;\n }\n\n script.setAttribute('nonce', resolvedNonce);\n script.nonce = resolvedNonce;\n}\n\nfunction applyTrackedNonce(node: Node): void {\n if (!isScriptElement(node)) {\n return;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return;\n }\n\n const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);\n applyScriptNonce(node, nonce);\n}\n\nfunction patchDynamicScriptInsertion(): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.patched) {\n return;\n }\n\n const originalAppendChild = Node.prototype.appendChild;\n const originalInsertBefore = Node.prototype.insertBefore;\n const originalReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.appendChild = function <T extends Node>(node: T): T {\n applyTrackedNonce(node);\n return originalAppendChild.call(this, node) as T;\n };\n\n Node.prototype.insertBefore = function <T extends Node>(node: T, child: Node | null): T {\n applyTrackedNonce(node);\n return originalInsertBefore.call(this, node, child) as T;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(node: Node, child: T): T {\n applyTrackedNonce(node);\n return originalReplaceChild.call(this, node, child) as T;\n };\n\n patchState.patched = true;\n}\n\nexport function resolveCspNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedExplicitNonce = normalizeNonce(explicitNonce);\n if (resolvedExplicitNonce) {\n return resolvedExplicitNonce;\n }\n\n const scriptWithNonce = documentRef.querySelector<HTMLScriptElement>('script[nonce]');\n const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);\n if (nonceFromScript) {\n return nonceFromScript;\n }\n\n const nonceMeta = documentRef.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return normalizeNonce(nonceMeta?.content);\n}\n\nexport function prepareScriptNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);\n const patchState = getDynamicScriptNoncePatchState();\n\n patchDynamicScriptInsertion();\n\n if (resolvedNonce) {\n patchState.nonceByDocument.set(documentRef, resolvedNonce);\n } else {\n patchState.nonceByDocument.delete(documentRef);\n }\n\n return resolvedNonce;\n}\n\nexport function loadScript(documentRef: Document, src: string, options?: ScriptLoadOptions): Promise<void> {\n const nonce = prepareScriptNonce(documentRef, options?.nonce);\n const statusBySrc = getStatusBySrc(documentRef);\n const pendingBySrc = getPendingBySrc(documentRef);\n const existing = documentRef.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n\n if (existing) {\n applyScriptNonce(existing, nonce);\n const status = statusBySrc.get(src);\n if (status === 'loaded') {\n return Promise.resolve();\n }\n\n const pending = pendingBySrc.get(src);\n if (pending) {\n return pending;\n }\n\n return Promise.resolve();\n }\n\n statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = documentRef.createElement('script');\n script.src = src;\n script.async = true;\n applyScriptNonce(script, nonce);\n script.onload = () => {\n statusBySrc.set(src, 'loaded');\n pendingBySrc.delete(src);\n resolve();\n };\n script.onerror = () => {\n statusBySrc.set(src, 'error');\n pendingBySrc.delete(src);\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n documentRef.head.appendChild(script);\n });\n\n pendingBySrc.set(src, pending);\n return pending;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { loadScript, type ScriptLoadOptions } from './siara-shield-script-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n return loadScript(this.document, src, options);\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { prepareScriptNonce } from './siara-shield-script-utils';\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface SiaraShieldInitOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\r\n\r\n@Component({\r\n selector: 'siara-shield',\r\n standalone: true,\r\n template: `<div class=\"SiaraShield\"></div>`,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class SiaraShieldComponent implements AfterViewInit {\n @Input({ required: true }) publicKey!: string;\r\n @Input() loadJQuery = true;\n @Input() cspNonce?: string;\n\r\n /**\r\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\r\n */\r\n @Output() token = new EventEmitter<string>();\r\n\r\n private initialized = false;\r\n\r\n constructor(\n private readonly host: ElementRef<HTMLElement>,\n private readonly loader: SiaraShieldLoaderService,\n ) {}\n\r\n async ngAfterViewInit(): Promise<void> {\r\n await this.init({ publicKey: this.publicKey, loadJQuery: this.loadJQuery, cspNonce: this.cspNonce });\r\n }\r\n\r\n async init(options: SiaraShieldInitOptions): Promise<void> {\r\n if (this.initialized) return;\r\n\r\n // Ensure the host element is in DOM before scripts run.\r\n void this.host.nativeElement;\r\n\r\n if (!options.publicKey) {\n throw new Error('SiaraShieldComponent: publicKey is required.');\n }\n const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n this.preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await this.waitForCheckCaptchaApi();\r\n this.initialized = true;\r\n }\r\n\r\n /**\r\n * Detect preloaded jQuery from global object or an existing script tag.\r\n */\r\n private isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n 'script[src*=\"jquery\"]',\r\n );\r\n return Boolean(existingJqueryScript);\r\n }\r\n\r\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\n );\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n }\n\r\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n }\n\r\n /**\r\n * Calls the global `CheckCaptcha()` from SiaraShield script.\r\n * Returns true when captcha is valid; emits token if available.\r\n */\r\n checkCaptcha(): boolean {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n if (ok && typeof g.CyberSiaraToken === 'string') {\r\n this.token.emit(g.CyberSiaraToken);\r\n }\r\n return ok;\r\n }\r\n\r\n /**\r\n * Async-friendly captcha validation to avoid first-click timing issues.\r\n * Retries briefly until token/check API settles.\r\n */\r\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number }): Promise<boolean> {\r\n const timeoutMs = options?.timeoutMs ?? 2000;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const startedAt = Date.now();\r\n\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { loadScript, prepareScriptNonce } from './siara-shield-script-utils';\n\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface InitSiaraShieldOptions {\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\n publicKey: string;\n /**\n * Loads jQuery before SiaraShield script.\n * Default is true for easier integration.\n * Set to false only if your site/app already loads jQuery.\n */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\n\r\nlet pending: Promise<void> | null = null;\nlet initialized = false;\n\nfunction isJQueryAlreadyAvailable(): boolean {\n const g = getSiaraShieldGlobals();\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\n return true;\n }\n\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\n return Boolean(existingJqueryScript);\n}\n\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n}\n\r\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n if (getSiaraShieldGlobals().CheckCaptcha) {\n return;\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n}\n\r\n/**\r\n * Drop-in initializer for SiaraShield.\r\n * - Loads required scripts (optionally jQuery)\r\n * - Calls global `initCaptcha(publicKey)`\r\n *\r\n * Requirements in your HTML/template:\r\n * - You must render: `<div class=\"SiaraShield\"></div>`\r\n */\r\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\r\n if (initialized) return;\r\n if (pending) return pending;\r\n\r\n if (!options?.publicKey) {\r\n throw new Error('initSiaraShield: publicKey is required.');\r\n }\n\n pending = (async () => {\n const cspNonce = prepareScriptNonce(document, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\n await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await loadScript(document, CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await loadScript(document, VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await waitForCheckCaptchaApi();\r\n initialized = true;\r\n })();\r\n\r\n try {\r\n await pending;\r\n } finally {\r\n // keep `pending` cached for subsequent callers\r\n }\r\n}\r\n\r\n/**\r\n * Calls global `CheckCaptcha()` and returns its boolean result.\r\n * If successful, returns `{ ok: true, token?: string }`.\r\n */\r\nexport function checkSiaraShieldCaptcha(): { ok: boolean; token?: string } {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\r\n return ok ? { ok: true, token } : { ok: false };\r\n}\r\n\r\n/**\r\n * Async-friendly captcha check to handle delayed token population.\r\n */\r\nexport async function checkSiaraShieldCaptchaAsync(options?: {\r\n timeoutMs?: number;\r\n pollIntervalMs?: number;\r\n}): Promise<{ ok: boolean; token?: string }> {\r\n const timeoutMs = options?.timeoutMs ?? 1200;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\r\n if (!firstCheck.ok) return firstCheck;\r\n if (firstCheck.token) return firstCheck;\r\n\r\n const startedAt = Date.now();\r\n // Token can be assigned slightly after successful verification.\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n const token = getSiaraShieldGlobals().CyberSiaraToken;\r\n if (typeof token === 'string' && token.length > 0) {\r\n return { ok: true, token };\r\n }\r\n }\r\n\r\n return { ok: true };\r\n}\r\n\r\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Keep `'unsafe-inline'` in `script-src` for strict vendor compatibility. */\n includeUnsafeInlineScript?: boolean;\n /** Keep `style-src 'unsafe-inline'` for current vendor markup/styles. */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'] as const;\nconst STYLE_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://mycybersiara.com',\n 'https://fonts.googleapis.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst FONT_HOSTS = [\n 'https://fonts.gstatic.com',\n 'https://mycybersiara.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst IMG_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://embedcdn.mycybersiara.com',\n 'https://mycybersiara.com',\n] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? true;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? true;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'default-src': unique([SELF]),\n 'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),\n 'font-src': unique([SELF, ...FONT_HOSTS, DATA]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","i1.SiaraShieldL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ts","../../../projects/siarashield-workspace/src/lib/siara-shield-log-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-script-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","interface ConsolePatchState {\r\n depth: number;\r\n originalLog: Console['log'];\r\n originalInfo: Console['info'];\r\n originalWarn: Console['warn'];\r\n originalDebug: Console['debug'];\r\n}\r\n\r\nconst CONSOLE_PATCH_STATE_KEY = '__siaraShieldConsolePatchState__';\r\nconst DEFAULT_SUPPRESS_WINDOW_MS = 2000;\r\n\r\nfunction getConsolePatchState(): ConsolePatchState {\r\n const globalState = globalThis as typeof globalThis & {\r\n [CONSOLE_PATCH_STATE_KEY]?: ConsolePatchState;\r\n };\r\n\r\n if (!globalState[CONSOLE_PATCH_STATE_KEY]) {\r\n globalState[CONSOLE_PATCH_STATE_KEY] = {\r\n depth: 0,\r\n originalLog: console.log.bind(console),\r\n originalInfo: console.info.bind(console),\r\n originalWarn: console.warn.bind(console),\r\n originalDebug: console.debug.bind(console),\r\n };\r\n }\r\n\r\n return globalState[CONSOLE_PATCH_STATE_KEY];\r\n}\r\n\r\nfunction muteConsole(): void {\r\n const patchState = getConsolePatchState();\r\n patchState.depth += 1;\r\n if (patchState.depth > 1) return;\r\n\r\n console.log = () => undefined;\r\n console.info = () => undefined;\r\n console.warn = () => undefined;\r\n console.debug = () => undefined;\r\n}\r\n\r\nfunction unmuteConsole(): void {\r\n const patchState = getConsolePatchState();\r\n if (patchState.depth === 0) return;\r\n patchState.depth -= 1;\r\n if (patchState.depth > 0) return;\r\n\r\n console.log = patchState.originalLog;\r\n console.info = patchState.originalInfo;\r\n console.warn = patchState.originalWarn;\r\n console.debug = patchState.originalDebug;\r\n}\r\n\r\nexport function suppressVendorConsoleWindow(windowMs = DEFAULT_SUPPRESS_WINDOW_MS): void {\r\n muteConsole();\r\n setTimeout(() => {\r\n unmuteConsole();\r\n }, windowMs);\r\n}\r\n\r\n","type ScriptStatus = 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\ninterface DynamicScriptNoncePatchState {\n nonceByDocument: WeakMap<Document, string>;\n observerByDocument: WeakMap<Document, MutationObserver>;\n patched: boolean;\n}\n\nconst SCRIPT_STATUS_BY_DOCUMENT = new WeakMap<Document, Map<string, ScriptStatus>>();\nconst SCRIPT_PENDING_BY_DOCUMENT = new WeakMap<Document, Map<string, Promise<void>>>();\nconst DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';\n\nfunction getStatusBySrc(documentRef: Document): Map<string, ScriptStatus> {\n let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);\n if (!statusBySrc) {\n statusBySrc = new Map<string, ScriptStatus>();\n SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);\n }\n\n return statusBySrc;\n}\n\nfunction getPendingBySrc(documentRef: Document): Map<string, Promise<void>> {\n let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);\n if (!pendingBySrc) {\n pendingBySrc = new Map<string, Promise<void>>();\n SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);\n }\n\n return pendingBySrc;\n}\n\nfunction getDynamicScriptNoncePatchState(): DynamicScriptNoncePatchState {\n const globalState = globalThis as typeof globalThis & {\n [DYNAMIC_SCRIPT_NONCE_STATE_KEY]?: DynamicScriptNoncePatchState;\n };\n\n if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {\n globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {\n nonceByDocument: new WeakMap<Document, string>(),\n observerByDocument: new WeakMap<Document, MutationObserver>(),\n patched: false,\n };\n }\n\n return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];\n}\n\nfunction normalizeNonce(nonce?: string | null): string | undefined {\n const trimmed = nonce?.trim();\n return trimmed ? trimmed : undefined;\n}\n\nfunction isScriptElement(node: Node): node is HTMLScriptElement {\n return node instanceof Element && node.tagName.toLowerCase() === 'script';\n}\n\nexport function applyScriptNonce(script: HTMLScriptElement, nonce?: string): void {\n const resolvedNonce = normalizeNonce(nonce);\n if (!resolvedNonce) {\n return;\n }\n\n script.setAttribute('nonce', resolvedNonce);\n script.nonce = resolvedNonce;\n}\n\nfunction applyTrackedNonce(node: Node): void {\n if (!isScriptElement(node)) {\n return;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return;\n }\n\n const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);\n applyScriptNonce(node, nonce);\n}\n\nfunction walkAndApplyNonce(root: Node, nonce?: string): void {\n if (!nonce) return;\n\n // Fast path: root itself is a script.\n if (isScriptElement(root)) {\n applyScriptNonce(root, nonce);\n return;\n }\n\n // Common path for jQuery: append DocumentFragment containing scripts created via HTML parsing.\n if (root instanceof Element || root instanceof DocumentFragment) {\n const scripts = root.querySelectorAll?.('script') ?? [];\n for (const script of scripts) {\n applyScriptNonce(script as HTMLScriptElement, nonce);\n }\n }\n}\n\nfunction ensureNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.observerByDocument.get(documentRef)) {\n return;\n }\n\n const observer = new MutationObserver((records) => {\n const nonce = patchState.nonceByDocument.get(documentRef);\n if (!nonce) return;\n\n for (const record of records) {\n for (const node of record.addedNodes) {\n walkAndApplyNonce(node, nonce);\n }\n }\n });\n\n // Observe the full document because scripts can be injected into body/head by vendor/jQuery.\n const root = documentRef.documentElement ?? documentRef;\n observer.observe(root, { childList: true, subtree: true });\n patchState.observerByDocument.set(documentRef, observer);\n}\n\nfunction teardownNonceMutationObserver(documentRef: Document): void {\n const patchState = getDynamicScriptNoncePatchState();\n const observer = patchState.observerByDocument.get(documentRef);\n if (!observer) return;\n observer.disconnect();\n patchState.observerByDocument.delete(documentRef);\n}\n\nfunction patchDynamicScriptInsertion(): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.patched) {\n return;\n }\n\n const originalAppendChild = Node.prototype.appendChild;\n const originalInsertBefore = Node.prototype.insertBefore;\n const originalReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.appendChild = function <T extends Node>(node: T): T {\n applyTrackedNonce(node);\n return originalAppendChild.call(this, node) as T;\n };\n\n Node.prototype.insertBefore = function <T extends Node>(node: T, child: Node | null): T {\n applyTrackedNonce(node);\n return originalInsertBefore.call(this, node, child) as T;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(node: Node, child: T): T {\n applyTrackedNonce(node);\n return originalReplaceChild.call(this, node, child) as T;\n };\n\n patchState.patched = true;\n}\n\nexport function resolveCspNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedExplicitNonce = normalizeNonce(explicitNonce);\n if (resolvedExplicitNonce) {\n return resolvedExplicitNonce;\n }\n\n const scriptWithNonce = documentRef.querySelector<HTMLScriptElement>('script[nonce]');\n const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);\n if (nonceFromScript) {\n return nonceFromScript;\n }\n\n const nonceMeta = documentRef.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return normalizeNonce(nonceMeta?.content);\n}\n\nexport function prepareScriptNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);\n const patchState = getDynamicScriptNoncePatchState();\n\n patchDynamicScriptInsertion();\n\n if (resolvedNonce) {\n patchState.nonceByDocument.set(documentRef, resolvedNonce);\n ensureNonceMutationObserver(documentRef);\n } else {\n patchState.nonceByDocument.delete(documentRef);\n teardownNonceMutationObserver(documentRef);\n }\n\n return resolvedNonce;\n}\n\nexport function loadScript(documentRef: Document, src: string, options?: ScriptLoadOptions): Promise<void> {\n const nonce = prepareScriptNonce(documentRef, options?.nonce);\n const statusBySrc = getStatusBySrc(documentRef);\n const pendingBySrc = getPendingBySrc(documentRef);\n const existing = documentRef.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n\n if (existing) {\n applyScriptNonce(existing, nonce);\n const status = statusBySrc.get(src);\n if (status === 'loaded') {\n return Promise.resolve();\n }\n\n const pending = pendingBySrc.get(src);\n if (pending) {\n return pending;\n }\n\n return Promise.resolve();\n }\n\n statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = documentRef.createElement('script');\n script.src = src;\n script.async = true;\n applyScriptNonce(script, nonce);\n script.onload = () => {\n statusBySrc.set(src, 'loaded');\n pendingBySrc.delete(src);\n resolve();\n };\n script.onerror = () => {\n statusBySrc.set(src, 'error');\n pendingBySrc.delete(src);\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n documentRef.head.appendChild(script);\n });\n\n pendingBySrc.set(src, pending);\n return pending;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { loadScript, type ScriptLoadOptions } from './siara-shield-script-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n return loadScript(this.document, src, options);\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\r\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\r\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\nimport { suppressVendorConsoleWindow } from './siara-shield-log-utils';\r\nimport { prepareScriptNonce } from './siara-shield-script-utils';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\r\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\r\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\r\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\r\n\r\nexport interface SiaraShieldInitOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\r\n loadJQuery?: boolean;\r\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\r\n cspNonce?: string;\r\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\r\n allowVendorConsoleLogs?: boolean;\r\n}\r\n\r\n@Component({\r\n selector: 'siara-shield',\r\n standalone: true,\r\n template: `<div class=\"SiaraShield\"></div>`,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class SiaraShieldComponent implements AfterViewInit {\r\n @Input({ required: true }) publicKey!: string;\r\n @Input() loadJQuery = true;\r\n @Input() cspNonce?: string;\r\n @Input() allowVendorConsoleLogs = false;\r\n\r\n /**\r\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\r\n */\r\n @Output() token = new EventEmitter<string>();\r\n\r\n private initialized = false;\r\n\r\n constructor(\r\n private readonly host: ElementRef<HTMLElement>,\r\n private readonly loader: SiaraShieldLoaderService,\r\n ) {}\r\n\r\n async ngAfterViewInit(): Promise<void> {\r\n await this.init({\r\n publicKey: this.publicKey,\r\n loadJQuery: this.loadJQuery,\r\n cspNonce: this.cspNonce,\r\n allowVendorConsoleLogs: this.allowVendorConsoleLogs,\r\n });\r\n }\r\n\r\n async init(options: SiaraShieldInitOptions): Promise<void> {\r\n if (this.initialized) return;\r\n\r\n // Ensure the host element is in DOM before scripts run.\r\n void this.host.nativeElement;\r\n\r\n if (!options.publicKey) {\r\n throw new Error('SiaraShieldComponent: publicKey is required.');\r\n }\r\n const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);\r\n\r\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\r\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\r\n }\r\n\r\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n\r\n const g = getSiaraShieldGlobals();\r\n this.preventDuplicateValidationBootstrap(g);\r\n const initCaptchaFn = getInitCaptchaFn(g);\r\n if (!initCaptchaFn) {\r\n throw new Error(\r\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\r\n );\r\n }\r\n\r\n if (!options.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n initCaptchaFn(options.publicKey);\r\n await this.waitForCheckCaptchaApi();\r\n this.initialized = true;\r\n }\r\n\r\n /**\r\n * Detect preloaded jQuery from global object or an existing script tag.\r\n */\r\n private isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n 'script[src*=\"jquery\"]',\r\n );\r\n return Boolean(existingJqueryScript);\r\n }\r\n\r\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\r\n const originalAppendValidation = g.AppendValidationJS;\r\n if (typeof originalAppendValidation !== 'function') {\r\n return;\r\n }\r\n\r\n g.AppendValidationJS = () => {\r\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\r\n );\r\n if (existing) {\r\n return;\r\n }\r\n\r\n originalAppendValidation();\r\n };\r\n }\r\n\r\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\r\n }\r\n\r\n /**\r\n * Calls the global `CheckCaptcha()` from SiaraShield script.\r\n * Returns true when captcha is valid; emits token if available.\r\n */\r\n checkCaptcha(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (!g.CheckCaptcha) {\r\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\r\n }\r\n\r\n if (!this.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n const ok = g.CheckCaptcha();\r\n if (ok && typeof g.CyberSiaraToken === 'string') {\r\n this.token.emit(g.CyberSiaraToken);\r\n }\r\n return ok;\r\n }\r\n\r\n /**\r\n * Async-friendly captcha validation to avoid first-click timing issues.\r\n * Retries briefly until token/check API settles.\r\n */\r\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number }): Promise<boolean> {\r\n const timeoutMs = options?.timeoutMs ?? 2000;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const startedAt = Date.now();\r\n\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\nimport { suppressVendorConsoleWindow } from './siara-shield-log-utils';\r\nimport { loadScript, prepareScriptNonce } from './siara-shield-script-utils';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\r\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\r\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\r\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\r\n\r\nexport interface InitSiaraShieldOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /**\r\n * Loads jQuery before SiaraShield script.\r\n * Default is true for easier integration.\r\n * Set to false only if your site/app already loads jQuery.\r\n */\r\n loadJQuery?: boolean;\r\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\r\n cspNonce?: string;\r\n /** Set true only when actively debugging vendor/runtime internals in browser console. */\r\n allowVendorConsoleLogs?: boolean;\r\n}\r\n\r\nlet pending: Promise<void> | null = null;\r\nlet initialized = false;\r\n\r\nfunction isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\r\n return Boolean(existingJqueryScript);\r\n}\r\n\r\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\r\n const originalAppendValidation = g.AppendValidationJS;\r\n if (typeof originalAppendValidation !== 'function') {\r\n return;\r\n }\r\n\r\n g.AppendValidationJS = () => {\r\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\r\n if (existing) {\r\n return;\r\n }\r\n\r\n originalAppendValidation();\r\n };\r\n}\r\n\r\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\r\n}\r\n\r\n/**\r\n * Drop-in initializer for SiaraShield.\r\n * - Loads required scripts (optionally jQuery)\r\n * - Calls global `initCaptcha(publicKey)`\r\n *\r\n * Requirements in your HTML/template:\r\n * - You must render: `<div class=\"SiaraShield\"></div>`\r\n */\r\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\r\n if (initialized) return;\r\n if (pending) return pending;\r\n\r\n if (!options?.publicKey) {\r\n throw new Error('initSiaraShield: publicKey is required.');\r\n }\r\n\r\n pending = (async () => {\r\n const cspNonce = prepareScriptNonce(document, options.cspNonce);\r\n\r\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\r\n await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });\r\n }\r\n\r\n await loadScript(document, CAPTCHA_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n await loadScript(document, VALIDATION_SCRIPT_SRC, {\r\n nonce: cspNonce,\r\n });\r\n\r\n const g = getSiaraShieldGlobals();\r\n preventDuplicateValidationBootstrap(g);\r\n const initCaptchaFn = getInitCaptchaFn(g);\r\n if (!initCaptchaFn) {\r\n throw new Error(\r\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\r\n );\r\n }\r\n\r\n if (!options.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n initCaptchaFn(options.publicKey);\r\n await waitForCheckCaptchaApi();\r\n initialized = true;\r\n })();\r\n\r\n try {\r\n await pending;\r\n } finally {\r\n // keep `pending` cached for subsequent callers\r\n }\r\n}\r\n\r\n/**\r\n * Calls global `CheckCaptcha()` and returns its boolean result.\r\n * If successful, returns `{ ok: true, token?: string }`.\r\n */\r\nexport function checkSiaraShieldCaptcha(options?: { allowVendorConsoleLogs?: boolean }): { ok: boolean; token?: string } {\r\n const g = getSiaraShieldGlobals();\r\n if (!g.CheckCaptcha) {\r\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\r\n }\r\n\r\n if (!options?.allowVendorConsoleLogs) {\r\n suppressVendorConsoleWindow();\r\n }\r\n const ok = g.CheckCaptcha();\r\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\r\n return ok ? { ok: true, token } : { ok: false };\r\n}\r\n\r\n/**\r\n * Async-friendly captcha check to handle delayed token population.\r\n */\r\nexport async function checkSiaraShieldCaptchaAsync(options?: {\r\n timeoutMs?: number;\r\n pollIntervalMs?: number;\r\n}): Promise<{ ok: boolean; token?: string }> {\r\n const timeoutMs = options?.timeoutMs ?? 1200;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\r\n if (!firstCheck.ok) return firstCheck;\r\n if (firstCheck.token) return firstCheck;\r\n\r\n const startedAt = Date.now();\r\n // Token can be assigned slightly after successful verification.\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n const token = getSiaraShieldGlobals().CyberSiaraToken;\r\n if (typeof token === 'string' && token.length > 0) {\r\n return { ok: true, token };\r\n }\r\n }\r\n\r\n return { ok: true };\r\n}\r\n\r\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Include `script-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineScript?: boolean;\n /** Include `style-src 'unsafe-inline'` (not recommended for production). */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'] as const;\nconst STYLE_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://mycybersiara.com',\n 'https://fonts.googleapis.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst FONT_HOSTS = [\n 'https://fonts.gstatic.com',\n 'https://mycybersiara.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst IMG_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://embedcdn.mycybersiara.com',\n 'https://mycybersiara.com',\n] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n // Default to strict/safe CSP. Customers can explicitly opt-in if they accept the risk.\n const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? false;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? false;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'default-src': unique([SELF]),\n 'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),\n 'font-src': unique([SELF, ...FONT_HOSTS, DATA]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","i1.SiaraShieldLoaderService"],"mappings":";;;;SAagB,qBAAqB,GAAA;AACnC,IAAA,OAAQ,UAAwE;AAClF;AAEM,SAAU,gBAAgB,CAAC,CAAqB,EAAA;AACpD,IAAA,OAAO,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW;AACvC;;ACXA,MAAM,uBAAuB,GAAG,kCAAkC;AAClE,MAAM,0BAA0B,GAAG,IAAI;AAEvC,SAAS,oBAAoB,GAAA;IAC3B,MAAM,WAAW,GAAG,UAEnB;AAED,IAAA,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,EAAE;QACzC,WAAW,CAAC,uBAAuB,CAAC,GAAG;AACrC,YAAA,KAAK,EAAE,CAAC;YACR,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;YACtC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACxC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACxC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;SAC3C;IACH;AAEA,IAAA,OAAO,WAAW,CAAC,uBAAuB,CAAC;AAC7C;AAEA,SAAS,WAAW,GAAA;AAClB,IAAA,MAAM,UAAU,GAAG,oBAAoB,EAAE;AACzC,IAAA,UAAU,CAAC,KAAK,IAAI,CAAC;AACrB,IAAA,IAAI,UAAU,CAAC,KAAK,GAAG,CAAC;QAAE;AAE1B,IAAA,OAAO,CAAC,GAAG,GAAG,MA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,MAAM,CAAC,KAAK,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC;AACf;;AC1GA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -20,6 +20,8 @@ interface SiaraShieldInitOptions {
|
|
|
20
20
|
loadJQuery?: boolean;
|
|
21
21
|
/** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */
|
|
22
22
|
cspNonce?: string;
|
|
23
|
+
/** Set true only when actively debugging vendor/runtime internals in browser console. */
|
|
24
|
+
allowVendorConsoleLogs?: boolean;
|
|
23
25
|
}
|
|
24
26
|
declare class SiaraShieldComponent implements AfterViewInit {
|
|
25
27
|
private readonly host;
|
|
@@ -27,6 +29,7 @@ declare class SiaraShieldComponent implements AfterViewInit {
|
|
|
27
29
|
publicKey: string;
|
|
28
30
|
loadJQuery: boolean;
|
|
29
31
|
cspNonce?: string;
|
|
32
|
+
allowVendorConsoleLogs: boolean;
|
|
30
33
|
/**
|
|
31
34
|
* Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.
|
|
32
35
|
*/
|
|
@@ -55,7 +58,7 @@ declare class SiaraShieldComponent implements AfterViewInit {
|
|
|
55
58
|
pollIntervalMs?: number;
|
|
56
59
|
}): Promise<boolean>;
|
|
57
60
|
static ɵfac: i0.ɵɵFactoryDeclaration<SiaraShieldComponent, never>;
|
|
58
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SiaraShieldComponent, "siara-shield", never, { "publicKey": { "alias": "publicKey"; "required": true; }; "loadJQuery": { "alias": "loadJQuery"; "required": false; }; "cspNonce": { "alias": "cspNonce"; "required": false; }; }, { "token": "token"; }, never, never, true, never>;
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiaraShieldComponent, "siara-shield", never, { "publicKey": { "alias": "publicKey"; "required": true; }; "loadJQuery": { "alias": "loadJQuery"; "required": false; }; "cspNonce": { "alias": "cspNonce"; "required": false; }; "allowVendorConsoleLogs": { "alias": "allowVendorConsoleLogs"; "required": false; }; }, { "token": "token"; }, never, never, true, never>;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
type InitCaptchaFn = (publicKey: string) => void;
|
|
@@ -83,6 +86,8 @@ interface InitSiaraShieldOptions {
|
|
|
83
86
|
loadJQuery?: boolean;
|
|
84
87
|
/** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */
|
|
85
88
|
cspNonce?: string;
|
|
89
|
+
/** Set true only when actively debugging vendor/runtime internals in browser console. */
|
|
90
|
+
allowVendorConsoleLogs?: boolean;
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
88
93
|
* Drop-in initializer for SiaraShield.
|
|
@@ -97,7 +102,9 @@ declare function initSiaraShield(options: InitSiaraShieldOptions): Promise<void>
|
|
|
97
102
|
* Calls global `CheckCaptcha()` and returns its boolean result.
|
|
98
103
|
* If successful, returns `{ ok: true, token?: string }`.
|
|
99
104
|
*/
|
|
100
|
-
declare function checkSiaraShieldCaptcha(
|
|
105
|
+
declare function checkSiaraShieldCaptcha(options?: {
|
|
106
|
+
allowVendorConsoleLogs?: boolean;
|
|
107
|
+
}): {
|
|
101
108
|
ok: boolean;
|
|
102
109
|
token?: string;
|
|
103
110
|
};
|
|
@@ -117,9 +124,9 @@ interface SiaraShieldCspOptions {
|
|
|
117
124
|
nonce?: string;
|
|
118
125
|
/** Optional if the customer still loads jQuery from Google's CDN. */
|
|
119
126
|
includeGoogleApis?: boolean;
|
|
120
|
-
/**
|
|
127
|
+
/** Include `script-src 'unsafe-inline'` (not recommended for production). */
|
|
121
128
|
includeUnsafeInlineScript?: boolean;
|
|
122
|
-
/**
|
|
129
|
+
/** Include `style-src 'unsafe-inline'` (not recommended for production). */
|
|
123
130
|
includeUnsafeInlineStyle?: boolean;
|
|
124
131
|
}
|
|
125
132
|
type SiaraShieldCspDirectives = Record<string, string[]>;
|