@ecodev/natural 68.0.3 → 68.1.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.
- package/fesm2022/ecodev-natural.mjs +25 -8
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/_natural.scss +7 -228
- package/src/lib/styles/backgrounds.scss +164 -0
- package/src/lib/styles/buttons.scss +104 -0
- package/src/lib/styles/fab.scss +79 -0
- package/src/lib/styles/icons.scss +56 -0
- package/src/lib/styles/material-overrides.scss +1 -10
- package/src/lib/styles/color.scss +0 -152
|
@@ -11508,11 +11508,16 @@ const naturalProviders = [
|
|
|
11508
11508
|
localStorageProvider,
|
|
11509
11509
|
];
|
|
11510
11510
|
|
|
11511
|
+
// Keep those strings obfuscated, to make it harder to CTRL+F things in compiled code
|
|
11512
|
+
const cannotSignAGraphQLQueryThatIsUsingFormDataButThatIsMissingTheKeyOperations = atob('Q2Fubm90IHNpZ24gYSBHcmFwaFFMIHF1ZXJ5IHRoYXQgaXMgdXNpbmcgRm9ybURhdGEgYnV0IHRoYXQgaXMgbWlzc2luZyB0aGUga2V5IGBvcGVyYXRpb25zYA==');
|
|
11513
|
+
const graphqlQuerySignerRequiresANonEmptyKeyConfigureItInLocalPphpUnderSignedQueries = atob('Z3JhcGhxbFF1ZXJ5U2lnbmVyIHJlcXVpcmVzIGEgbm9uLWVtcHR5IGtleS4gQ29uZmlndXJlIGl0IGluIGxvY2FsLnBocCB1bmRlciBzaWduZWRRdWVyaWVzLg==');
|
|
11514
|
+
const xSignature = atob('WC1TaWduYXR1cmU=');
|
|
11515
|
+
const v1 = atob('djE=');
|
|
11511
11516
|
function getOperations(req) {
|
|
11512
11517
|
if (req.body instanceof FormData) {
|
|
11513
11518
|
const operations = req.body.get('operations');
|
|
11514
11519
|
if (typeof operations !== 'string') {
|
|
11515
|
-
throw new Error(
|
|
11520
|
+
throw new Error(cannotSignAGraphQLQueryThatIsUsingFormDataButThatIsMissingTheKeyOperations);
|
|
11516
11521
|
}
|
|
11517
11522
|
return operations;
|
|
11518
11523
|
}
|
|
@@ -11529,20 +11534,32 @@ function graphqlQuerySigner(key) {
|
|
|
11529
11534
|
// Validates the configuration exactly 1 time (not for
|
|
11530
11535
|
// every query), and if not reject **all** HTTP requests
|
|
11531
11536
|
if (!key) {
|
|
11532
|
-
return () =>
|
|
11537
|
+
return () => {
|
|
11538
|
+
return throwError(() => new Error(graphqlQuerySignerRequiresANonEmptyKeyConfigureItInLocalPphpUnderSignedQueries));
|
|
11539
|
+
};
|
|
11533
11540
|
}
|
|
11534
11541
|
return (req, next) => {
|
|
11535
11542
|
const mustSign = req.method === 'POST' && /\/graphql(\?|$)/.exec(req.url);
|
|
11536
11543
|
if (!mustSign) {
|
|
11537
11544
|
return next(req);
|
|
11538
11545
|
}
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11546
|
+
return of(req).pipe(map$1(req => {
|
|
11547
|
+
const timestamp = Math.round(Date.now() / 1000);
|
|
11548
|
+
const operations = getOperations(req);
|
|
11549
|
+
return {
|
|
11550
|
+
operations: operations,
|
|
11551
|
+
timestamp: timestamp,
|
|
11552
|
+
payload: timestamp + operations,
|
|
11553
|
+
};
|
|
11554
|
+
}), switchMap(async (data) => {
|
|
11555
|
+
return {
|
|
11556
|
+
...data,
|
|
11557
|
+
hash: await hmacSha256(key, data.payload),
|
|
11558
|
+
};
|
|
11559
|
+
}), switchMap(data => {
|
|
11560
|
+
const header = `${v1}.${data.timestamp}.${data.hash}`;
|
|
11544
11561
|
const signedRequest = req.clone({
|
|
11545
|
-
headers: req.headers.set(
|
|
11562
|
+
headers: req.headers.set(xSignature, header),
|
|
11546
11563
|
});
|
|
11547
11564
|
return next(signedRequest);
|
|
11548
11565
|
}));
|