gdc-common-utils-ts 2.7.0 → 2.7.2
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 +1 -0
- package/dist/constants/didcomm.d.ts +1 -0
- package/dist/constants/didcomm.js +1 -0
- package/dist/examples/didcomm-identity.d.ts +23 -0
- package/dist/examples/didcomm-identity.js +65 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +1 -0
- package/dist/examples/shared.d.ts +1 -1
- package/dist/examples/shared.js +3 -1
- package/dist/models/confidential-message.d.ts +12 -3
- package/dist/models/consent-rule.d.ts +18 -0
- package/dist/models/consent-rule.js +15 -0
- package/dist/utils/bundle-document-builder.js +19 -10
- package/dist/utils/consent-entry-editor.d.ts +3 -1
- package/dist/utils/consent-entry-editor.js +2 -0
- package/dist/utils/consent.d.ts +1 -0
- package/dist/utils/consent.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,7 @@ entry types, FHIR-like resources, and `resource.meta.claims` fit together,
|
|
|
152
152
|
read first:
|
|
153
153
|
|
|
154
154
|
- [`docs/101-ID_TOKEN.md`](docs/101-ID_TOKEN.md)
|
|
155
|
+
- [`docs/101-DIDCOMM-IDENTITY-BOUNDARY.md`](docs/101-DIDCOMM-IDENTITY-BOUNDARY.md)
|
|
155
156
|
- [`docs/101-COMMUNICATION_LAYERING.md`](docs/101-COMMUNICATION_LAYERING.md)
|
|
156
157
|
- [`docs/101-BUNDLE_EDITOR_READER.md`](docs/101-BUNDLE_EDITOR_READER.md)
|
|
157
158
|
- [`docs/101-CLINICAL-IPS.md`](docs/101-CLINICAL-IPS.md)
|
|
@@ -10,6 +10,7 @@ export declare const DidcommMessageTypes: Readonly<{
|
|
|
10
10
|
readonly CommunicationAttachedBundle: "Communication-attached-bundle-v1.0";
|
|
11
11
|
readonly CommunicationBundleSubmit: "Communication-bundle-submit-v1.0";
|
|
12
12
|
readonly CommunicationResponse: "Communication-response-v1.0";
|
|
13
|
+
readonly SmartTokenRequest: "Smart-token-request-v1.0";
|
|
13
14
|
}>;
|
|
14
15
|
/**
|
|
15
16
|
* Canonical low-level DIDComm acknowledgement body keys used in shared tests
|
|
@@ -10,6 +10,7 @@ export const DidcommMessageTypes = Object.freeze({
|
|
|
10
10
|
CommunicationAttachedBundle: 'Communication-attached-bundle-v1.0',
|
|
11
11
|
CommunicationBundleSubmit: 'Communication-bundle-submit-v1.0',
|
|
12
12
|
CommunicationResponse: 'Communication-response-v1.0',
|
|
13
|
+
SmartTokenRequest: 'Smart-token-request-v1.0',
|
|
13
14
|
});
|
|
14
15
|
/**
|
|
15
16
|
* Canonical low-level DIDComm acknowledgement body keys used in shared tests
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IDecodedDidcommPayload } from '../models/confidential-message';
|
|
2
|
+
/** Signing verification method controlled by the direct actor DID. */
|
|
3
|
+
export declare const EXAMPLE_DIRECT_ACTOR_SIGNING_KEY_ID: `${string}#communication-signing`;
|
|
4
|
+
/** Signing verification method registered for the DCR client/device. */
|
|
5
|
+
export declare const EXAMPLE_DCR_DEVICE_SIGNING_KEY_ID: "did:web:device-001#dcr-signing";
|
|
6
|
+
/**
|
|
7
|
+
* Canonical direct DIDComm/FAPI message.
|
|
8
|
+
*
|
|
9
|
+
* `from` and `iss` identify the same direct sender. `kid` identifies the
|
|
10
|
+
* concrete signing key and therefore remains in the signed JWS header. The
|
|
11
|
+
* FHIR-like Communication stays inside `body`; transport identity never
|
|
12
|
+
* becomes a FHIR field.
|
|
13
|
+
*/
|
|
14
|
+
export declare const EXAMPLE_DIRECT_ACTOR_DIDCOMM_MESSAGE: IDecodedDidcommPayload;
|
|
15
|
+
/**
|
|
16
|
+
* Canonical device-bound SMART request.
|
|
17
|
+
*
|
|
18
|
+
* The DCR client/device is the DIDComm/FAPI sender and issuer because it signs
|
|
19
|
+
* the request. Its registered `kid` selects the proof key. SMART `sub`
|
|
20
|
+
* separately identifies the professional actor and `scope` separately limits
|
|
21
|
+
* the subject data requested by that actor.
|
|
22
|
+
*/
|
|
23
|
+
export declare const EXAMPLE_DEVICE_BOUND_SMART_DIDCOMM_MESSAGE: IDecodedDidcommPayload;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DidcommMessageTypes } from '../constants/didcomm.js';
|
|
2
|
+
import { buildSmartCompositionReadScope } from '../utils/smart-scope.js';
|
|
3
|
+
import { EXAMPLE_DEVICE_CLIENT_ID, EXAMPLE_HOSTING_OPERATOR_DID, EXAMPLE_PROFESSIONAL_DID, EXAMPLE_SUBJECT_DID, buildExampleCommunicationIngestionPayload, } from './shared.js';
|
|
4
|
+
/** Signing verification method controlled by the direct actor DID. */
|
|
5
|
+
export const EXAMPLE_DIRECT_ACTOR_SIGNING_KEY_ID = `${EXAMPLE_PROFESSIONAL_DID}#communication-signing`;
|
|
6
|
+
/** Signing verification method registered for the DCR client/device. */
|
|
7
|
+
export const EXAMPLE_DCR_DEVICE_SIGNING_KEY_ID = `${EXAMPLE_DEVICE_CLIENT_ID}#dcr-signing`;
|
|
8
|
+
/**
|
|
9
|
+
* Canonical direct DIDComm/FAPI message.
|
|
10
|
+
*
|
|
11
|
+
* `from` and `iss` identify the same direct sender. `kid` identifies the
|
|
12
|
+
* concrete signing key and therefore remains in the signed JWS header. The
|
|
13
|
+
* FHIR-like Communication stays inside `body`; transport identity never
|
|
14
|
+
* becomes a FHIR field.
|
|
15
|
+
*/
|
|
16
|
+
export const EXAMPLE_DIRECT_ACTOR_DIDCOMM_MESSAGE = {
|
|
17
|
+
meta: {
|
|
18
|
+
jws: {
|
|
19
|
+
protected: {
|
|
20
|
+
alg: 'ES384',
|
|
21
|
+
kid: EXAMPLE_DIRECT_ACTOR_SIGNING_KEY_ID,
|
|
22
|
+
typ: 'JWT',
|
|
23
|
+
cty: 'application/didcomm-signed+json',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
iss: EXAMPLE_PROFESSIONAL_DID,
|
|
28
|
+
from: EXAMPLE_PROFESSIONAL_DID,
|
|
29
|
+
aud: EXAMPLE_HOSTING_OPERATOR_DID,
|
|
30
|
+
jti: 'urn:uuid:didcomm-direct-example',
|
|
31
|
+
thid: 'didcomm-direct-example',
|
|
32
|
+
type: DidcommMessageTypes.CommunicationAttachedBundle,
|
|
33
|
+
body: buildExampleCommunicationIngestionPayload().body,
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Canonical device-bound SMART request.
|
|
37
|
+
*
|
|
38
|
+
* The DCR client/device is the DIDComm/FAPI sender and issuer because it signs
|
|
39
|
+
* the request. Its registered `kid` selects the proof key. SMART `sub`
|
|
40
|
+
* separately identifies the professional actor and `scope` separately limits
|
|
41
|
+
* the subject data requested by that actor.
|
|
42
|
+
*/
|
|
43
|
+
export const EXAMPLE_DEVICE_BOUND_SMART_DIDCOMM_MESSAGE = {
|
|
44
|
+
meta: {
|
|
45
|
+
jws: {
|
|
46
|
+
protected: {
|
|
47
|
+
alg: 'ES384',
|
|
48
|
+
kid: EXAMPLE_DCR_DEVICE_SIGNING_KEY_ID,
|
|
49
|
+
typ: 'JWT',
|
|
50
|
+
cty: 'application/didcomm-signed+json',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
iss: EXAMPLE_DEVICE_CLIENT_ID,
|
|
55
|
+
from: EXAMPLE_DEVICE_CLIENT_ID,
|
|
56
|
+
aud: EXAMPLE_HOSTING_OPERATOR_DID,
|
|
57
|
+
jti: 'urn:uuid:didcomm-smart-example',
|
|
58
|
+
thid: 'didcomm-smart-example',
|
|
59
|
+
type: DidcommMessageTypes.SmartTokenRequest,
|
|
60
|
+
body: {
|
|
61
|
+
client_id: EXAMPLE_DEVICE_CLIENT_ID,
|
|
62
|
+
sub: EXAMPLE_PROFESSIONAL_DID,
|
|
63
|
+
scope: buildSmartCompositionReadScope({ subjectDid: EXAMPLE_SUBJECT_DID }),
|
|
64
|
+
},
|
|
65
|
+
};
|
package/dist/examples/index.d.ts
CHANGED
package/dist/examples/index.js
CHANGED
|
@@ -661,7 +661,7 @@ export declare function buildExampleCommunicationIngestionPayload({ subjectDid,
|
|
|
661
661
|
}[];
|
|
662
662
|
meta: {
|
|
663
663
|
claims: {
|
|
664
|
-
'@context': "org.hl7.fhir.
|
|
664
|
+
'@context': "org.hl7.fhir.api";
|
|
665
665
|
"Communication.category": string;
|
|
666
666
|
"Communication.subject": string;
|
|
667
667
|
"Communication.sent": string;
|
package/dist/examples/shared.js
CHANGED
|
@@ -640,7 +640,9 @@ export function buildExampleCommunicationIngestionPayload({ subjectDid = EXAMPLE
|
|
|
640
640
|
note: [{ text: EXAMPLE_IPS_BUNDLE_NOTE_TEXT }],
|
|
641
641
|
meta: {
|
|
642
642
|
claims: {
|
|
643
|
-
|
|
643
|
+
// The surrounding resource is native FHIR R4, while flat
|
|
644
|
+
// claims remain version-neutral and can later render as R4 or R5.
|
|
645
|
+
'@context': Format.FHIR_API,
|
|
644
646
|
[CommunicationClaim.Category]: CommunicationCategoryCodes.Notification.claim,
|
|
645
647
|
[CommunicationClaim.Subject]: subjectDid,
|
|
646
648
|
[CommunicationClaim.Sent]: sent,
|
|
@@ -43,8 +43,11 @@ export interface IDecodedDidcommPayload {
|
|
|
43
43
|
/** Relevant information available through the decryption and verification process */
|
|
44
44
|
meta?: DidCommDecodedMetadata;
|
|
45
45
|
/**
|
|
46
|
-
* (Issuer)
|
|
47
|
-
* REQUIRED for FAPI. MUST
|
|
46
|
+
* (Issuer) DID of the entity that issued and signed the message.
|
|
47
|
+
* REQUIRED for FAPI. It MUST be bound to the signer of the enclosing JWS.
|
|
48
|
+
* The signing key is identified separately by `meta.jws.protected.kid`;
|
|
49
|
+
* `iss` is never the key id. For a DCR-bound client this is normally the
|
|
50
|
+
* client/device DID, while a SMART human actor remains in `body.sub`.
|
|
48
51
|
*/
|
|
49
52
|
iss: string;
|
|
50
53
|
/**
|
|
@@ -71,7 +74,13 @@ export interface IDecodedDidcommPayload {
|
|
|
71
74
|
pthid?: string;
|
|
72
75
|
/** The DID of the intended recipient. Used for P2P messaging, informational in client-server requests. */
|
|
73
76
|
to?: string[];
|
|
74
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* DIDComm sender DID. In a direct signed request this normally equals `iss`.
|
|
79
|
+
* It is never a raw email, telephone, card id or `urn:multibase` alias. When
|
|
80
|
+
* a DCR client acts for a human, `from`/`iss` identify the client and SMART
|
|
81
|
+
* `body.sub` identifies the human actor. `iss` remains authoritative for
|
|
82
|
+
* the FAPI signature boundary.
|
|
83
|
+
*/
|
|
75
84
|
from?: string;
|
|
76
85
|
/**
|
|
77
86
|
* The Message Type URI, identifying the type of data in the body or protocol used.
|
|
@@ -47,6 +47,22 @@ export declare const ConsentDecisions: Readonly<{
|
|
|
47
47
|
readonly Deny: "deny";
|
|
48
48
|
}>;
|
|
49
49
|
export type ConsentDecision = typeof ConsentDecisions[keyof typeof ConsentDecisions];
|
|
50
|
+
/**
|
|
51
|
+
* Canonical FHIR R5 Consent lifecycle states.
|
|
52
|
+
*
|
|
53
|
+
* `draft` is the only state used for a professional permission request. A
|
|
54
|
+
* draft is carried to the controller for review and must never participate in
|
|
55
|
+
* authorization evaluation. Only `active` consent rules can grant access.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ConsentStatuses: Readonly<{
|
|
58
|
+
readonly Draft: "draft";
|
|
59
|
+
readonly Active: "active";
|
|
60
|
+
readonly Inactive: "inactive";
|
|
61
|
+
readonly NotDone: "not-done";
|
|
62
|
+
readonly EnteredInError: "entered-in-error";
|
|
63
|
+
readonly Unknown: "unknown";
|
|
64
|
+
}>;
|
|
65
|
+
export type ConsentStatus = typeof ConsentStatuses[keyof typeof ConsentStatuses];
|
|
50
66
|
/**
|
|
51
67
|
* Defines the structured, query-optimized format for storing a single, atomic consent rule
|
|
52
68
|
* in the vault (e.g., Firestore, CouchDB).
|
|
@@ -67,6 +83,8 @@ export interface ConsentRule {
|
|
|
67
83
|
* Value MUST be "org.hl7.fhir.api".
|
|
68
84
|
*/
|
|
69
85
|
'@context': 'org.hl7.fhir.api';
|
|
86
|
+
/** FHIR Consent lifecycle state; authorization evaluators accept only `active`. */
|
|
87
|
+
'Consent.status'?: ConsentStatus;
|
|
70
88
|
/**
|
|
71
89
|
* The decision of the rule: permit or deny.
|
|
72
90
|
* Derived from the `org.hl7.fhir.api.Consent.decision` claim.
|
|
@@ -48,3 +48,18 @@ export const ConsentDecisions = Object.freeze({
|
|
|
48
48
|
Permit: 'permit',
|
|
49
49
|
Deny: 'deny',
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* Canonical FHIR R5 Consent lifecycle states.
|
|
53
|
+
*
|
|
54
|
+
* `draft` is the only state used for a professional permission request. A
|
|
55
|
+
* draft is carried to the controller for review and must never participate in
|
|
56
|
+
* authorization evaluation. Only `active` consent rules can grant access.
|
|
57
|
+
*/
|
|
58
|
+
export const ConsentStatuses = Object.freeze({
|
|
59
|
+
Draft: 'draft',
|
|
60
|
+
Active: 'active',
|
|
61
|
+
Inactive: 'inactive',
|
|
62
|
+
NotDone: 'not-done',
|
|
63
|
+
EnteredInError: 'entered-in-error',
|
|
64
|
+
Unknown: 'unknown',
|
|
65
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
|
|
2
|
+
import { Format } from '../constants/Schemas.js';
|
|
2
3
|
import { AllergyIntoleranceClaim } from '../models/interoperable-claims/allergy-intolerance-claims.js';
|
|
3
4
|
import { CompositionClaim } from '../models/interoperable-claims/composition-claims.js';
|
|
4
5
|
import { ConditionClaim } from '../models/interoperable-claims/condition-claims.js';
|
|
@@ -7,7 +8,13 @@ import { MedicationStatementClaim } from '../models/interoperable-claims/medicat
|
|
|
7
8
|
import { ClaimConsent } from '../models/consent-rule.js';
|
|
8
9
|
import { allergyIntoleranceFlatToFhirR4, appointmentResponseFlatToFhirR4, appointmentFlatToFhirR4, carePlanFlatToFhirR4, clinicalImpressionFlatToFhirR4, compositionFlatToFhirR4, conditionFlatToFhirR4, consentFlatToFhirR4, convertFhirResourceToClaims, coverageFlatToFhirR4, deviceFlatToFhirR4, deviceUseStatementFlatToFhirR4, documentReferenceFlatToFhirR4, diagnosticReportFlatToFhirR4, encounterFlatToFhirR4, flagFlatToFhirR4, flatClaimsToFhirResource, immunizationFlatToFhirR4, locationFlatToFhirR4, medicationStatementFlatToFhirR4, observationFromFlatToFhirR4, organizationFlatToFhirR4, procedureFlatToFhirR4, practitionerRoleFlatToFhirR4, relatedPersonFlatToFhirR4, } from './clinical-resource-converters.js';
|
|
9
10
|
/** Version-independent FHIR SearchParameter claim context. */
|
|
10
|
-
const FHIR_API_CLAIMS_CONTEXT =
|
|
11
|
+
const FHIR_API_CLAIMS_CONTEXT = Format.FHIR_API;
|
|
12
|
+
const READABLE_FHIR_CLAIMS_CONTEXTS = [
|
|
13
|
+
Format.FHIR_API,
|
|
14
|
+
// Deprecated response compatibility. New flat-claim writers use FHIR_API
|
|
15
|
+
// regardless of the selected native FHIR representation version.
|
|
16
|
+
Format.FHIR_R4,
|
|
17
|
+
];
|
|
11
18
|
function asTrimmedString(value) {
|
|
12
19
|
if (value === undefined || value === null)
|
|
13
20
|
return '';
|
|
@@ -23,9 +30,7 @@ export function getSimpleClaimAttributeName(key) {
|
|
|
23
30
|
const value = asTrimmedString(key);
|
|
24
31
|
if (!value)
|
|
25
32
|
return '';
|
|
26
|
-
const knownPrefixes =
|
|
27
|
-
`${FHIR_API_CLAIMS_CONTEXT}.`,
|
|
28
|
-
];
|
|
33
|
+
const knownPrefixes = READABLE_FHIR_CLAIMS_CONTEXTS.map((context) => `${context}.`);
|
|
29
34
|
for (const prefix of knownPrefixes) {
|
|
30
35
|
if (value.startsWith(prefix)) {
|
|
31
36
|
return value.slice(prefix.length);
|
|
@@ -40,15 +45,19 @@ export function extractFlatClaimValue(record, key) {
|
|
|
40
45
|
const direct = record[normalizedKey];
|
|
41
46
|
if (typeof direct === 'string' && direct.trim())
|
|
42
47
|
return direct.trim();
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
for (const context of READABLE_FHIR_CLAIMS_CONTEXTS) {
|
|
49
|
+
const contextualized = record[`${context}.${normalizedKey}`];
|
|
50
|
+
if (typeof contextualized === 'string' && contextualized.trim())
|
|
51
|
+
return contextualized.trim();
|
|
52
|
+
}
|
|
46
53
|
const nested = record?.meta?.claims?.[normalizedKey];
|
|
47
54
|
if (typeof nested === 'string' && nested.trim())
|
|
48
55
|
return nested.trim();
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
for (const context of READABLE_FHIR_CLAIMS_CONTEXTS) {
|
|
57
|
+
const nestedContextualized = record?.meta?.claims?.[`${context}.${normalizedKey}`];
|
|
58
|
+
if (typeof nestedContextualized === 'string' && nestedContextualized.trim())
|
|
59
|
+
return nestedContextualized.trim();
|
|
60
|
+
}
|
|
52
61
|
return '';
|
|
53
62
|
}
|
|
54
63
|
function claimsToFlatStrings(claims) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* - Read `ARCHITECTURE.md` and `CONTRIBUTING.md` before changing this module.
|
|
4
4
|
* - This file owns only the typed editor for one staged Consent entry.
|
|
5
5
|
*/
|
|
6
|
-
import { type ConsentDecision } from '../models/consent-rule';
|
|
6
|
+
import { type ConsentDecision, type ConsentStatus } from '../models/consent-rule';
|
|
7
7
|
import { BundleEntryEditor } from './bundle-entry-editor';
|
|
8
8
|
/**
|
|
9
9
|
* Typed editor for one Consent permission staged inside a Bundle.
|
|
@@ -17,6 +17,8 @@ export declare class ConsentEntryEditor extends BundleEntryEditor {
|
|
|
17
17
|
ensureIdentifier(): string;
|
|
18
18
|
setSubject(value?: string | null): this;
|
|
19
19
|
getSubject(): string | undefined;
|
|
20
|
+
setStatus(value?: ConsentStatus | null): this;
|
|
21
|
+
getStatus(): string | undefined;
|
|
20
22
|
setDecision(value?: ConsentDecision | null): this;
|
|
21
23
|
getDecision(): string | undefined;
|
|
22
24
|
setActorIdentifierList(values: readonly string[]): this;
|
|
@@ -43,6 +43,8 @@ export class ConsentEntryEditor extends BundleEntryEditor {
|
|
|
43
43
|
}
|
|
44
44
|
setSubject(value) { return this.setOptionalText(ClaimConsent.subject, value); }
|
|
45
45
|
getSubject() { return this.getOptionalText(ClaimConsent.subject); }
|
|
46
|
+
setStatus(value) { return this.setOptionalText(ClaimConsent.status, value); }
|
|
47
|
+
getStatus() { return this.getOptionalText(ClaimConsent.status); }
|
|
46
48
|
setDecision(value) { return this.setOptionalText(ClaimConsent.decision, value); }
|
|
47
49
|
getDecision() { return this.getOptionalText(ClaimConsent.decision); }
|
|
48
50
|
setActorIdentifierList(values) { return this.setList(ClaimConsent.actorIdentifier, values); }
|
package/dist/utils/consent.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ export declare function resolveConsentActor(actor: ConsentActorDescriptor): Reso
|
|
|
197
197
|
*
|
|
198
198
|
* A rule is active when:
|
|
199
199
|
* - it matches the requested subject when one is provided
|
|
200
|
+
* - `Consent.status` is absent for legacy compatibility or is exactly `active`
|
|
200
201
|
* - `Consent.period-start` is absent or already effective
|
|
201
202
|
* - `Consent.period-end` is absent or still in the future
|
|
202
203
|
*
|
package/dist/utils/consent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
import { ClaimConsent } from '../models/consent-rule.js';
|
|
2
|
+
import { ClaimConsent, ConsentStatuses } from '../models/consent-rule.js';
|
|
3
3
|
import { assignCidToClaimsId } from './fhir-cid.js';
|
|
4
4
|
/**
|
|
5
5
|
* Normalizes a phone string into a compact token form.
|
|
@@ -512,6 +512,7 @@ export function resolveConsentActor(actor) {
|
|
|
512
512
|
*
|
|
513
513
|
* A rule is active when:
|
|
514
514
|
* - it matches the requested subject when one is provided
|
|
515
|
+
* - `Consent.status` is absent for legacy compatibility or is exactly `active`
|
|
515
516
|
* - `Consent.period-start` is absent or already effective
|
|
516
517
|
* - `Consent.period-end` is absent or still in the future
|
|
517
518
|
*
|
|
@@ -523,6 +524,9 @@ export function isConsentRuleActive(rule, options = {}) {
|
|
|
523
524
|
if (options.subject && String(readConsentRuleClaim(rule, ClaimConsent.subject) || '').trim() !== String(options.subject || '').trim()) {
|
|
524
525
|
return false;
|
|
525
526
|
}
|
|
527
|
+
const status = String(readConsentRuleClaim(rule, ClaimConsent.status) || '').trim();
|
|
528
|
+
if (status && status !== ConsentStatuses.Active)
|
|
529
|
+
return false;
|
|
526
530
|
const now = options.now instanceof Date
|
|
527
531
|
? options.now.getTime()
|
|
528
532
|
: options.now
|