@twin.org/rights-management-plugins 0.0.3-next.10
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/es/index.js +21 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IExampleDataAccessHandlerConstructorOptions.js +4 -0
- package/dist/es/models/IExampleDataAccessHandlerConstructorOptions.js.map +1 -0
- package/dist/es/models/IExamplePolicyArbiterConstructorOptions.js +4 -0
- package/dist/es/models/IExamplePolicyArbiterConstructorOptions.js.map +1 -0
- package/dist/es/models/IExamplePolicyEnforcementProcessorConstructorOptions.js +4 -0
- package/dist/es/models/IExamplePolicyEnforcementProcessorConstructorOptions.js.map +1 -0
- package/dist/es/models/IExamplePolicyNegotiatorConstructorOptions.js +4 -0
- package/dist/es/models/IExamplePolicyNegotiatorConstructorOptions.js.map +1 -0
- package/dist/es/models/IExamplePolicyRequesterConstructorOptions.js +4 -0
- package/dist/es/models/IExamplePolicyRequesterConstructorOptions.js.map +1 -0
- package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js +4 -0
- package/dist/es/models/IIdentityPolicyInformationSourceConstructorOptions.js.map +1 -0
- package/dist/es/models/ILoggingPolicyExecutionActionConfig.js +2 -0
- package/dist/es/models/ILoggingPolicyExecutionActionConfig.js.map +1 -0
- package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js +2 -0
- package/dist/es/models/ILoggingPolicyExecutionActionConstructorOptions.js.map +1 -0
- package/dist/es/models/IStaticPolicyInformationSource.js +2 -0
- package/dist/es/models/IStaticPolicyInformationSource.js.map +1 -0
- package/dist/es/models/IStaticPolicyInformationSourceConfig.js +2 -0
- package/dist/es/models/IStaticPolicyInformationSourceConfig.js.map +1 -0
- package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js +2 -0
- package/dist/es/models/IStaticPolicyInformationSourceConstructorOptions.js.map +1 -0
- package/dist/es/policyArbiters/examplePolicyArbiter.js +50 -0
- package/dist/es/policyArbiters/examplePolicyArbiter.js.map +1 -0
- package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js +42 -0
- package/dist/es/policyEnforcementProcessor/examplePolicyEnforcementProcessor.js.map +1 -0
- package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js +117 -0
- package/dist/es/policyExecutionActions/loggingPolicyExecutionAction.js.map +1 -0
- package/dist/es/policyInformationSources/identityPolicyInformationSource.js +79 -0
- package/dist/es/policyInformationSources/identityPolicyInformationSource.js.map +1 -0
- package/dist/es/policyInformationSources/staticPolicyInformationSource.js +94 -0
- package/dist/es/policyInformationSources/staticPolicyInformationSource.js.map +1 -0
- package/dist/es/policyNegotiators/examplePolicyNegotiator.js +61 -0
- package/dist/es/policyNegotiators/examplePolicyNegotiator.js.map +1 -0
- package/dist/es/policyRequesters/examplePolicyRequester.js +69 -0
- package/dist/es/policyRequesters/examplePolicyRequester.js.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/models/IExampleDataAccessHandlerConstructorOptions.d.ts +10 -0
- package/dist/types/models/IExamplePolicyArbiterConstructorOptions.d.ts +10 -0
- package/dist/types/models/IExamplePolicyEnforcementProcessorConstructorOptions.d.ts +10 -0
- package/dist/types/models/IExamplePolicyNegotiatorConstructorOptions.d.ts +10 -0
- package/dist/types/models/IExamplePolicyRequesterConstructorOptions.d.ts +10 -0
- package/dist/types/models/IIdentityPolicyInformationSourceConstructorOptions.d.ts +15 -0
- package/dist/types/models/ILoggingPolicyExecutionActionConfig.d.ts +25 -0
- package/dist/types/models/ILoggingPolicyExecutionActionConstructorOptions.d.ts +15 -0
- package/dist/types/models/IStaticPolicyInformationSource.d.ts +20 -0
- package/dist/types/models/IStaticPolicyInformationSourceConfig.d.ts +10 -0
- package/dist/types/models/IStaticPolicyInformationSourceConstructorOptions.d.ts +15 -0
- package/dist/types/policyArbiters/examplePolicyArbiter.d.ts +36 -0
- package/dist/types/policyEnforcementProcessor/examplePolicyEnforcementProcessor.d.ts +29 -0
- package/dist/types/policyExecutionActions/loggingPolicyExecutionAction.d.ts +49 -0
- package/dist/types/policyInformationSources/identityPolicyInformationSource.d.ts +32 -0
- package/dist/types/policyInformationSources/staticPolicyInformationSource.d.ts +38 -0
- package/dist/types/policyNegotiators/examplePolicyNegotiator.d.ts +45 -0
- package/dist/types/policyRequesters/examplePolicyRequester.d.ts +53 -0
- package/docs/changelog.md +102 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/ExamplePolicyArbiter.md +121 -0
- package/docs/reference/classes/ExamplePolicyEnforcementProcessor.md +101 -0
- package/docs/reference/classes/ExamplePolicyNegotiator.md +143 -0
- package/docs/reference/classes/ExamplePolicyRequester.md +187 -0
- package/docs/reference/classes/IdentityPolicyInformationSource.md +103 -0
- package/docs/reference/classes/LoggingPolicyExecutionAction.md +127 -0
- package/docs/reference/classes/StaticPolicyInformationSource.md +123 -0
- package/docs/reference/index.md +25 -0
- package/docs/reference/interfaces/IExampleDataAccessHandlerConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IExamplePolicyArbiterConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IExamplePolicyEnforcementProcessorConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IExamplePolicyNegotiatorConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IExamplePolicyRequesterConstructorOptions.md +17 -0
- package/docs/reference/interfaces/IIdentityPolicyInformationSourceConstructorOptions.md +31 -0
- package/docs/reference/interfaces/ILoggingPolicyExecutionActionConfig.md +53 -0
- package/docs/reference/interfaces/ILoggingPolicyExecutionActionConstructorOptions.md +25 -0
- package/docs/reference/interfaces/IStaticPolicyInformationSource.md +28 -0
- package/docs/reference/interfaces/IStaticPolicyInformationSourceConfig.md +11 -0
- package/docs/reference/interfaces/IStaticPolicyInformationSourceConstructorOptions.md +25 -0
- package/locales/en.json +20 -0
- package/package.json +57 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type IPolicyDecision, type IPolicyExecutionAction, type IPolicyLocator, PolicyDecisionStage } from "@twin.org/rights-management-models";
|
|
2
|
+
import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
|
|
3
|
+
import type { ILoggingPolicyExecutionActionConstructorOptions } from "../models/ILoggingPolicyExecutionActionConstructorOptions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Logging Policy Execution Action to send decisions to logging.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LoggingPolicyExecutionAction implements IPolicyExecutionAction {
|
|
8
|
+
/**
|
|
9
|
+
* The class name of the Logging Policy Execution Action.
|
|
10
|
+
*/
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to include the data in the log.
|
|
14
|
+
*/
|
|
15
|
+
private readonly _includeData;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to include the policies in the log.
|
|
18
|
+
*/
|
|
19
|
+
private readonly _includePolicies;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to include the decisions in the log.
|
|
22
|
+
*/
|
|
23
|
+
private readonly _includeDecisions;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new instance of LoggingPolicyExecutionAction.
|
|
26
|
+
* @param options The options for the logging policy execution action.
|
|
27
|
+
*/
|
|
28
|
+
constructor(options?: ILoggingPolicyExecutionActionConstructorOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Returns the class name of the component.
|
|
31
|
+
* @returns The class name of the component.
|
|
32
|
+
*/
|
|
33
|
+
className(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Which stages should the action be executed at.
|
|
36
|
+
* @returns List of stages.
|
|
37
|
+
*/
|
|
38
|
+
supportedStages(): PolicyDecisionStage[];
|
|
39
|
+
/**
|
|
40
|
+
* Execute function type for policy actions.
|
|
41
|
+
* @param stage The stage of the policy decision.
|
|
42
|
+
* @param locator The locator to find relevant policies.
|
|
43
|
+
* @param policies The policies that apply to the data.
|
|
44
|
+
* @param decisions The decisions made by the PDP.
|
|
45
|
+
* @param data The data to process.
|
|
46
|
+
* @returns A promise that resolves when the action is complete.
|
|
47
|
+
*/
|
|
48
|
+
execute<D = unknown>(stage: PolicyDecisionStage, locator: IPolicyLocator, policies?: IOdrlPolicy[], decisions?: IPolicyDecision[], data?: D): Promise<void>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IPolicyInformationSource, type IPolicyLocator, PolicyInformationAccessMode } from "@twin.org/rights-management-models";
|
|
3
|
+
import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
|
|
4
|
+
import type { IIdentityPolicyInformationSourceConstructorOptions } from "../models/IIdentityPolicyInformationSourceConstructorOptions.js";
|
|
5
|
+
/**
|
|
6
|
+
* Policy information source which retrieves the identity information.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IdentityPolicyInformationSource implements IPolicyInformationSource {
|
|
9
|
+
/**
|
|
10
|
+
* The class name of the Identity Policy Information Source.
|
|
11
|
+
*/
|
|
12
|
+
static readonly CLASS_NAME: string;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance of IdentityPolicyInformationSource.
|
|
15
|
+
* @param options The options for the logging policy source.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options?: IIdentityPolicyInformationSourceConstructorOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Returns the class name of the component.
|
|
20
|
+
* @returns The class name of the component.
|
|
21
|
+
*/
|
|
22
|
+
className(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve information from the sources.
|
|
25
|
+
* @param locator The locator to find relevant policies.
|
|
26
|
+
* @param accessMode The access mode to use for the retrieval.
|
|
27
|
+
* @param policies The policies that apply to the data.
|
|
28
|
+
* @param data The data to process.
|
|
29
|
+
* @returns The objects containing relevant information or undefined if nothing relevant is found.
|
|
30
|
+
*/
|
|
31
|
+
retrieve<D = unknown>(locator: IPolicyLocator, accessMode: PolicyInformationAccessMode, policies: IOdrlPolicy[], data?: D): Promise<IJsonLdNodeObject[] | undefined>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import { PolicyInformationAccessMode, type IPolicyInformationSource, type IPolicyLocator } from "@twin.org/rights-management-models";
|
|
3
|
+
import type { IOdrlPolicy } from "@twin.org/standards-w3c-odrl";
|
|
4
|
+
import type { IStaticPolicyInformationSource } from "../models/IStaticPolicyInformationSource.js";
|
|
5
|
+
import type { IStaticPolicyInformationSourceConstructorOptions } from "../models/IStaticPolicyInformationSourceConstructorOptions.js";
|
|
6
|
+
/**
|
|
7
|
+
* Policy information source which retrieves static information.
|
|
8
|
+
*/
|
|
9
|
+
export declare class StaticPolicyInformationSource implements IPolicyInformationSource {
|
|
10
|
+
/**
|
|
11
|
+
* The class name of the Static Policy Information Source.
|
|
12
|
+
*/
|
|
13
|
+
static readonly CLASS_NAME: string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new instance of StaticPolicyInformationSource.
|
|
16
|
+
* @param options The options for the logging policy source.
|
|
17
|
+
*/
|
|
18
|
+
constructor(options?: IStaticPolicyInformationSourceConstructorOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Returns the class name of the component.
|
|
21
|
+
* @returns The class name of the component.
|
|
22
|
+
*/
|
|
23
|
+
className(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve information from the sources.
|
|
26
|
+
* @param locator The locator to find relevant policies.
|
|
27
|
+
* @param accessMode The access mode to use for the retrieval.
|
|
28
|
+
* @param policies The policies that apply to the data.
|
|
29
|
+
* @param data The data to process.
|
|
30
|
+
* @returns The objects containing relevant information or undefined if nothing relevant is found.
|
|
31
|
+
*/
|
|
32
|
+
retrieve<D = unknown>(locator: IPolicyLocator, accessMode: PolicyInformationAccessMode, policies: IOdrlPolicy[], data?: D): Promise<IJsonLdNodeObject[] | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Add static policy information.
|
|
35
|
+
* @param info The static policy information to add.
|
|
36
|
+
*/
|
|
37
|
+
addInformation(info: IStaticPolicyInformationSource): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IPolicyInformation, IPolicyNegotiator } from "@twin.org/rights-management-models";
|
|
2
|
+
import type { IOdrlAgreement, IOdrlOffer } from "@twin.org/standards-w3c-odrl";
|
|
3
|
+
import type { IExamplePolicyNegotiatorConstructorOptions } from "../models/IExamplePolicyNegotiatorConstructorOptions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Example Policy Negotiator.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExamplePolicyNegotiator implements IPolicyNegotiator {
|
|
8
|
+
/**
|
|
9
|
+
* The class name of the Example Policy Negotiator.
|
|
10
|
+
*/
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new instance of ExamplePolicyNegotiator.
|
|
14
|
+
* @param options The options for the example policy negotiator.
|
|
15
|
+
*/
|
|
16
|
+
constructor(options?: IExamplePolicyNegotiatorConstructorOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Returns the class name of the component.
|
|
19
|
+
* @returns The class name of the component.
|
|
20
|
+
*/
|
|
21
|
+
className(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Determines if the negotiator supports the given offer.
|
|
24
|
+
* @param offer The offer to check.
|
|
25
|
+
* @returns Sets the supports flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
|
|
26
|
+
*/
|
|
27
|
+
supportsOffer(offer: IOdrlOffer): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Handle the offer.
|
|
30
|
+
* @param offer The offer to check.
|
|
31
|
+
* @param information Information provided by the requester to determine if a policy can be created.
|
|
32
|
+
* @returns Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
|
|
33
|
+
*/
|
|
34
|
+
handleOffer(offer: IOdrlOffer, information?: IPolicyInformation): Promise<{
|
|
35
|
+
accepted: boolean;
|
|
36
|
+
interventionRequired: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an agreement based on the offer.
|
|
40
|
+
* @param offer The offer to create the agreement from.
|
|
41
|
+
* @param information Information provided by the requester to aid in the creation of the agreement.
|
|
42
|
+
* @returns The agreement created from the offer or undefined if an agreement could not be created.
|
|
43
|
+
*/
|
|
44
|
+
createAgreement(offer: IOdrlOffer, information?: IPolicyInformation): Promise<IOdrlAgreement | undefined>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { IPolicyRequester } from "@twin.org/rights-management-models";
|
|
2
|
+
import type { IOdrlAgreement, IOdrlOffer } from "@twin.org/standards-w3c-odrl";
|
|
3
|
+
import type { IExamplePolicyRequesterConstructorOptions } from "../models/IExamplePolicyRequesterConstructorOptions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Example Policy Requester.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExamplePolicyRequester implements IPolicyRequester {
|
|
8
|
+
/**
|
|
9
|
+
* The class name of the Example Policy Requester.
|
|
10
|
+
*/
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new instance of ExamplePolicyRequester.
|
|
14
|
+
* @param options The options for the example policy Requester.
|
|
15
|
+
*/
|
|
16
|
+
constructor(options?: IExamplePolicyRequesterConstructorOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Returns the class name of the component.
|
|
19
|
+
* @returns The class name of the component.
|
|
20
|
+
*/
|
|
21
|
+
className(): string;
|
|
22
|
+
/**
|
|
23
|
+
* The unique id of the requester.
|
|
24
|
+
* @returns The requester id.
|
|
25
|
+
*/
|
|
26
|
+
requesterId(): string;
|
|
27
|
+
/**
|
|
28
|
+
* A policy has been offered by a provider, let the requester know about it.
|
|
29
|
+
* @param negotiationId The id of the negotiation.
|
|
30
|
+
* @param offer The offer sent by the provider.
|
|
31
|
+
* @returns True if the offer was accepted, false otherwise.
|
|
32
|
+
*/
|
|
33
|
+
offer(negotiationId: string, offer: IOdrlOffer): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* A policy agreement has been sent by a provider, let the requester know about it.
|
|
36
|
+
* @param negotiationId The id of the negotiation.
|
|
37
|
+
* @param agreement The agreement sent by the provider.
|
|
38
|
+
* @returns True if the agreement was accepted, false otherwise.
|
|
39
|
+
*/
|
|
40
|
+
agreement(negotiationId: string, agreement: IOdrlAgreement): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* A policy finalisation has been sent by a provider, let the requester know about it.
|
|
43
|
+
* @param negotiationId The id of the negotiation.
|
|
44
|
+
* @returns Nothing.
|
|
45
|
+
*/
|
|
46
|
+
finalised(negotiationId: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* A policy termination has been sent by a provider, let the requester know about it.
|
|
49
|
+
* @param negotiationId The id of the negotiation.
|
|
50
|
+
* @returns Nothing.
|
|
51
|
+
*/
|
|
52
|
+
terminated(negotiationId: string): Promise<void>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.9...rights-management-plugins-v0.0.3-next.10) (2026-01-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove data access point ([#67](https://github.com/twinfoundation/rights-management/issues/67)) ([8573676](https://github.com/twinfoundation/rights-management/commit/8573676862c9f1634a66a0677b225b4de16a89cd))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.8...rights-management-plugins-v0.0.3-next.9) (2026-01-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **rights-management-plugins:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.7...rights-management-plugins-v0.0.3-next.8) (2026-01-21)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **rights-management-plugins:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.6...rights-management-plugins-v0.0.3-next.7) (2026-01-14)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* **rights-management-plugins:** Synchronize repo versions
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.5...rights-management-plugins-v0.0.3-next.6) (2026-01-12)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **rights-management-plugins:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.4...rights-management-plugins-v0.0.3-next.5) (2026-01-06)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* add missing dependency ([f7c8e0e](https://github.com/twinfoundation/rights-management/commit/f7c8e0e4819c945ef823b853139440ad7999b9b9))
|
|
79
|
+
* add missing dependency ([c62a098](https://github.com/twinfoundation/rights-management/commit/c62a0983e912c252ab0c27261c9bb92a63c06f96))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Dependencies
|
|
83
|
+
|
|
84
|
+
* The following workspace dependencies were updated
|
|
85
|
+
* dependencies
|
|
86
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
87
|
+
|
|
88
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/rights-management/compare/rights-management-plugins-v0.0.3-next.3...rights-management-plugins-v0.0.3-next.4) (2025-12-04)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Features
|
|
92
|
+
|
|
93
|
+
* add factory pattern ([d26b4c0](https://github.com/twinfoundation/rights-management/commit/d26b4c08a2f3ba5758df66a1c48203b8d8e3638e))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Dependencies
|
|
97
|
+
|
|
98
|
+
* The following workspace dependencies were updated
|
|
99
|
+
* dependencies
|
|
100
|
+
* @twin.org/rights-management-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
101
|
+
|
|
102
|
+
## @twin.org/rights-management-plugins - Changelog
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/rights-management-plugins - Examples
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Class: ExamplePolicyArbiter
|
|
2
|
+
|
|
3
|
+
Example Policy Arbiter.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IPolicyArbiter`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new ExamplePolicyArbiter**(`options?`): `ExamplePolicyArbiter`
|
|
14
|
+
|
|
15
|
+
Create a new instance of ExamplePolicyArbiter.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IExamplePolicyArbiterConstructorOptions`](../interfaces/IExamplePolicyArbiterConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the example policy arbiter.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`ExamplePolicyArbiter`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
The class name of the Example Policy Arbiter.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### className()
|
|
40
|
+
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`IPolicyArbiter.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### supportedPolicies()
|
|
58
|
+
|
|
59
|
+
> **supportedPolicies**(): `IPolicyLocator`[]
|
|
60
|
+
|
|
61
|
+
The policies supported by this arbiter.
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`IPolicyLocator`[]
|
|
66
|
+
|
|
67
|
+
The supported policies, if empty can be used for all.
|
|
68
|
+
|
|
69
|
+
#### Implementation of
|
|
70
|
+
|
|
71
|
+
`IPolicyArbiter.supportedPolicies`
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### decide()
|
|
76
|
+
|
|
77
|
+
> **decide**\<`D`\>(`locator`, `information?`, `policies?`, `data?`): `Promise`\<`IPolicyDecision`[]\>
|
|
78
|
+
|
|
79
|
+
Makes decisions regarding policy access to data.
|
|
80
|
+
|
|
81
|
+
#### Type Parameters
|
|
82
|
+
|
|
83
|
+
##### D
|
|
84
|
+
|
|
85
|
+
`D` = `unknown`
|
|
86
|
+
|
|
87
|
+
#### Parameters
|
|
88
|
+
|
|
89
|
+
##### locator
|
|
90
|
+
|
|
91
|
+
`IPolicyLocator`
|
|
92
|
+
|
|
93
|
+
The locator to find relevant policies.
|
|
94
|
+
|
|
95
|
+
##### information?
|
|
96
|
+
|
|
97
|
+
`IPolicyInformation`
|
|
98
|
+
|
|
99
|
+
Information provided by the requester to determine if a policy can be created.
|
|
100
|
+
|
|
101
|
+
##### policies?
|
|
102
|
+
|
|
103
|
+
`IOdrlPolicy`[]
|
|
104
|
+
|
|
105
|
+
The policies that apply to the data.
|
|
106
|
+
|
|
107
|
+
##### data?
|
|
108
|
+
|
|
109
|
+
`D`
|
|
110
|
+
|
|
111
|
+
The data to make a decision on.
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`Promise`\<`IPolicyDecision`[]\>
|
|
116
|
+
|
|
117
|
+
The decisions about access to the data.
|
|
118
|
+
|
|
119
|
+
#### Implementation of
|
|
120
|
+
|
|
121
|
+
`IPolicyArbiter.decide`
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Class: ExamplePolicyEnforcementProcessor
|
|
2
|
+
|
|
3
|
+
Example Policy Enforcement Processor.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IPolicyEnforcementProcessor`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new ExamplePolicyEnforcementProcessor**(`options?`): `ExamplePolicyEnforcementProcessor`
|
|
14
|
+
|
|
15
|
+
Create a new instance of ExamplePolicyEnforcementProcessor.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IExamplePolicyEnforcementProcessorConstructorOptions`](../interfaces/IExamplePolicyEnforcementProcessorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the example policy enforcement processor.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`ExamplePolicyEnforcementProcessor`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
The class name of the Example Policy Enforcement Processor.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### className()
|
|
40
|
+
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`IPolicyEnforcementProcessor.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### process()
|
|
58
|
+
|
|
59
|
+
> **process**\<`D`, `R`\>(`locator`, `decisions`, `data?`): `Promise`\<`R`\>
|
|
60
|
+
|
|
61
|
+
Process the response from the policy decision point.
|
|
62
|
+
|
|
63
|
+
#### Type Parameters
|
|
64
|
+
|
|
65
|
+
##### D
|
|
66
|
+
|
|
67
|
+
`D` = `unknown`
|
|
68
|
+
|
|
69
|
+
##### R
|
|
70
|
+
|
|
71
|
+
`R` = `D`
|
|
72
|
+
|
|
73
|
+
#### Parameters
|
|
74
|
+
|
|
75
|
+
##### locator
|
|
76
|
+
|
|
77
|
+
`IPolicyLocator`
|
|
78
|
+
|
|
79
|
+
The locator to find relevant policies.
|
|
80
|
+
|
|
81
|
+
##### decisions
|
|
82
|
+
|
|
83
|
+
`IPolicyDecision`[]
|
|
84
|
+
|
|
85
|
+
The decisions made by the policy decision point.
|
|
86
|
+
|
|
87
|
+
##### data?
|
|
88
|
+
|
|
89
|
+
`D`
|
|
90
|
+
|
|
91
|
+
The data to process.
|
|
92
|
+
|
|
93
|
+
#### Returns
|
|
94
|
+
|
|
95
|
+
`Promise`\<`R`\>
|
|
96
|
+
|
|
97
|
+
The data after processing.
|
|
98
|
+
|
|
99
|
+
#### Implementation of
|
|
100
|
+
|
|
101
|
+
`IPolicyEnforcementProcessor.process`
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Class: ExamplePolicyNegotiator
|
|
2
|
+
|
|
3
|
+
Example Policy Negotiator.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IPolicyNegotiator`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new ExamplePolicyNegotiator**(`options?`): `ExamplePolicyNegotiator`
|
|
14
|
+
|
|
15
|
+
Create a new instance of ExamplePolicyNegotiator.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IExamplePolicyNegotiatorConstructorOptions`](../interfaces/IExamplePolicyNegotiatorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the example policy negotiator.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`ExamplePolicyNegotiator`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
The class name of the Example Policy Negotiator.
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### className()
|
|
40
|
+
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`IPolicyNegotiator.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### supportsOffer()
|
|
58
|
+
|
|
59
|
+
> **supportsOffer**(`offer`): `boolean`
|
|
60
|
+
|
|
61
|
+
Determines if the negotiator supports the given offer.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### offer
|
|
66
|
+
|
|
67
|
+
`IOdrlOffer`
|
|
68
|
+
|
|
69
|
+
The offer to check.
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`boolean`
|
|
74
|
+
|
|
75
|
+
Sets the supports flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
|
|
76
|
+
|
|
77
|
+
#### Implementation of
|
|
78
|
+
|
|
79
|
+
`IPolicyNegotiator.supportsOffer`
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### handleOffer()
|
|
84
|
+
|
|
85
|
+
> **handleOffer**(`offer`, `information?`): `Promise`\<\{ `accepted`: `boolean`; `interventionRequired`: `boolean`; \}\>
|
|
86
|
+
|
|
87
|
+
Handle the offer.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### offer
|
|
92
|
+
|
|
93
|
+
`IOdrlOffer`
|
|
94
|
+
|
|
95
|
+
The offer to check.
|
|
96
|
+
|
|
97
|
+
##### information?
|
|
98
|
+
|
|
99
|
+
`IPolicyInformation`
|
|
100
|
+
|
|
101
|
+
Information provided by the requester to determine if a policy can be created.
|
|
102
|
+
|
|
103
|
+
#### Returns
|
|
104
|
+
|
|
105
|
+
`Promise`\<\{ `accepted`: `boolean`; `interventionRequired`: `boolean`; \}\>
|
|
106
|
+
|
|
107
|
+
Sets the accepted flag if it can be offered, and the interventionRequired flag if manual agreement is needed.
|
|
108
|
+
|
|
109
|
+
#### Implementation of
|
|
110
|
+
|
|
111
|
+
`IPolicyNegotiator.handleOffer`
|
|
112
|
+
|
|
113
|
+
***
|
|
114
|
+
|
|
115
|
+
### createAgreement()
|
|
116
|
+
|
|
117
|
+
> **createAgreement**(`offer`, `information?`): `Promise`\<`IOdrlAgreement` \| `undefined`\>
|
|
118
|
+
|
|
119
|
+
Create an agreement based on the offer.
|
|
120
|
+
|
|
121
|
+
#### Parameters
|
|
122
|
+
|
|
123
|
+
##### offer
|
|
124
|
+
|
|
125
|
+
`IOdrlOffer`
|
|
126
|
+
|
|
127
|
+
The offer to create the agreement from.
|
|
128
|
+
|
|
129
|
+
##### information?
|
|
130
|
+
|
|
131
|
+
`IPolicyInformation`
|
|
132
|
+
|
|
133
|
+
Information provided by the requester to aid in the creation of the agreement.
|
|
134
|
+
|
|
135
|
+
#### Returns
|
|
136
|
+
|
|
137
|
+
`Promise`\<`IOdrlAgreement` \| `undefined`\>
|
|
138
|
+
|
|
139
|
+
The agreement created from the offer or undefined if an agreement could not be created.
|
|
140
|
+
|
|
141
|
+
#### Implementation of
|
|
142
|
+
|
|
143
|
+
`IPolicyNegotiator.createAgreement`
|