@twin.org/rights-management-service 0.0.2-next.7 → 0.0.2-next.9

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.
@@ -4,13 +4,15 @@ var apiModels = require('@twin.org/api-models');
4
4
  var core = require('@twin.org/core');
5
5
  var standardsW3cOdrl = require('@twin.org/standards-w3c-odrl');
6
6
  var web = require('@twin.org/web');
7
+ var rightsManagementModels = require('@twin.org/rights-management-models');
8
+ var standardsW3cDid = require('@twin.org/standards-w3c-did');
7
9
 
8
10
  // Copyright 2024 IOTA Stiftung.
9
11
  // SPDX-License-Identifier: Apache-2.0.
10
12
  /**
11
13
  * The source used when communicating about these routes.
12
14
  */
13
- const ROUTES_SOURCE$3 = "policyAdministrationPointRoutes";
15
+ const ROUTES_SOURCE$2 = "policyAdministrationPointRoutes";
14
16
  /**
15
17
  * The tag to associate with the routes.
16
18
  */
@@ -237,8 +239,8 @@ function generateRestRoutesPolicyAdministrationPoint(baseRouteName, componentNam
237
239
  * @returns The response object with additional http response properties.
238
240
  */
239
241
  async function papCreate(httpRequestContext, componentName, request) {
240
- core.Guards.object(ROUTES_SOURCE$3, "request", request);
241
- core.Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
242
+ core.Guards.object(ROUTES_SOURCE$2, "request", request);
243
+ core.Guards.object(ROUTES_SOURCE$2, "request.body", request.body);
242
244
  const component = core.ComponentFactory.get(componentName);
243
245
  const policy = request.body;
244
246
  const uid = await component.create(policy);
@@ -257,10 +259,10 @@ async function papCreate(httpRequestContext, componentName, request) {
257
259
  * @returns The response object with additional http response properties.
258
260
  */
259
261
  async function papUpdate(httpRequestContext, componentName, request) {
260
- core.Guards.object(ROUTES_SOURCE$3, "request", request);
261
- core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
262
- core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
263
- core.Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
262
+ core.Guards.object(ROUTES_SOURCE$2, "request", request);
263
+ core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
264
+ core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
265
+ core.Guards.object(ROUTES_SOURCE$2, "request.body", request.body);
264
266
  const component = core.ComponentFactory.get(componentName);
265
267
  await component.update(request.body);
266
268
  return {
@@ -275,9 +277,9 @@ async function papUpdate(httpRequestContext, componentName, request) {
275
277
  * @returns The response object with additional http response properties.
276
278
  */
277
279
  async function papGet(httpRequestContext, componentName, request) {
278
- core.Guards.object(ROUTES_SOURCE$3, "request", request);
279
- core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
280
- core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
280
+ core.Guards.object(ROUTES_SOURCE$2, "request", request);
281
+ core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
282
+ core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
281
283
  const component = core.ComponentFactory.get(componentName);
282
284
  const policy = await component.get(request.pathParams.id);
283
285
  return {
@@ -292,9 +294,9 @@ async function papGet(httpRequestContext, componentName, request) {
292
294
  * @returns The response object with additional http response properties.
293
295
  */
294
296
  async function papRemove(httpRequestContext, componentName, request) {
295
- core.Guards.object(ROUTES_SOURCE$3, "request", request);
296
- core.Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
297
- core.Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
297
+ core.Guards.object(ROUTES_SOURCE$2, "request", request);
298
+ core.Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
299
+ core.Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
298
300
  const component = core.ComponentFactory.get(componentName);
299
301
  await component.remove(request.pathParams.id);
300
302
  return {
@@ -309,7 +311,7 @@ async function papRemove(httpRequestContext, componentName, request) {
309
311
  * @returns The response object with additional http response properties.
310
312
  */
311
313
  async function papQuery(httpRequestContext, componentName, request) {
312
- core.Guards.object(ROUTES_SOURCE$3, "request", request);
314
+ core.Guards.object(ROUTES_SOURCE$2, "request", request);
313
315
  const component = core.ComponentFactory.get(componentName);
314
316
  const result = await component.query(apiModels.HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.cursor, core.Coerce.integer(request.query?.pageSize));
315
317
  return {
@@ -320,91 +322,6 @@ async function papQuery(httpRequestContext, componentName, request) {
320
322
  };
321
323
  }
322
324
 
323
- /**
324
- * The source used when communicating about these routes.
325
- */
326
- const ROUTES_SOURCE$2 = "policyEnforcementPointRoutes";
327
- /**
328
- * The tag to associate with the routes.
329
- */
330
- const pepTags = [
331
- {
332
- name: "Policy Enforcement Point",
333
- description: "Endpoints for managing ODRL policies in the Policy Enforcement Point"
334
- }
335
- ];
336
- /**
337
- * The REST routes for the Policy Enforcement Point.
338
- * @param baseRouteName Prefix to prepend to the paths.
339
- * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
340
- * @returns The generated routes.
341
- */
342
- function generateRestRoutesPolicyEnforcementPoint(baseRouteName, componentName) {
343
- const pepInterceptRoute = {
344
- operationId: "pepIntercept",
345
- summary: "Intercept a request",
346
- tag: pepTags[0].name,
347
- method: "POST",
348
- path: `${baseRouteName}/pep/intercept`,
349
- handler: async (httpRequestContext, request) => pepIntercept(httpRequestContext, componentName, request),
350
- requestType: {
351
- type: "IPepInterceptRequest",
352
- examples: [
353
- {
354
- id: "pepInterceptRequestExample",
355
- request: {
356
- body: {
357
- assetType: "document",
358
- action: "view",
359
- data: {
360
- id: "document-1",
361
- param1: 1,
362
- param2: 2
363
- }
364
- }
365
- }
366
- }
367
- ]
368
- },
369
- responseType: [
370
- {
371
- type: "IPepInterceptResponse",
372
- examples: [
373
- {
374
- id: "pepInterceptResponseExample",
375
- response: {
376
- body: {
377
- id: "document-1",
378
- param1: 1
379
- }
380
- }
381
- }
382
- ]
383
- }
384
- ]
385
- };
386
- return [pepInterceptRoute];
387
- }
388
- /**
389
- * PEP: Intercept.
390
- * @param httpRequestContext The request context for the API.
391
- * @param componentName The name of the component to use in the routes.
392
- * @param request The request.
393
- * @returns The response object with additional http response properties.
394
- */
395
- async function pepIntercept(httpRequestContext, componentName, request) {
396
- core.Guards.object(ROUTES_SOURCE$2, "request", request);
397
- const component = core.ComponentFactory.get(componentName);
398
- const result = await component.intercept(request.body.assetType, request.body.action, {
399
- ...(request.body.context ?? {}),
400
- userIdentity: httpRequestContext.userIdentity,
401
- nodeIdentity: httpRequestContext.nodeIdentity
402
- }, request.body.data);
403
- return {
404
- body: result
405
- };
406
- }
407
-
408
325
  /**
409
326
  * The source used when communicating about these routes.
410
327
  */
@@ -456,7 +373,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
456
373
  dateCreated: "2025-09-03T00:00:00.000Z",
457
374
  assetType: "document",
458
375
  action: "view",
459
- context: {}
376
+ nodeIdentity: "urn:example:node:1"
460
377
  }
461
378
  }
462
379
  }
@@ -484,7 +401,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
484
401
  dateCreated: "2025-09-03T00:00:00.000Z",
485
402
  assetType: "document",
486
403
  action: "view",
487
- context: {}
404
+ nodeIdentity: "urn:example:node:1"
488
405
  }
489
406
  }
490
407
  }
@@ -545,7 +462,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
545
462
  dateCreated: "2025-09-03T00:00:00.000Z",
546
463
  assetType: "document",
547
464
  action: "view",
548
- context: {}
465
+ nodeIdentity: "urn:example:node:1"
549
466
  }
550
467
  ],
551
468
  cursor: "next-cursor"
@@ -663,11 +580,11 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
663
580
  id: "pnpNegotiateRequestExample",
664
581
  request: {
665
582
  body: {
583
+ "@context": [rightsManagementModels.RightsManagementContexts.ContextRoot, standardsW3cDid.DidContexts.ContextVCv2],
584
+ type: rightsManagementModels.RightsManagementTypes.PolicyNegotiationRequest,
666
585
  assetType: "document",
667
586
  action: "view",
668
- context: {
669
- nodeIdentity: "urn:example:node:1"
670
- },
587
+ nodeIdentity: "urn:example:node:1",
671
588
  proof: {
672
589
  created: "2024-08-22T11:56:56.272Z",
673
590
  type: "DataIntegrityProof",
@@ -689,6 +606,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
689
606
  id: "IPnpNegotiateResponseExample",
690
607
  response: {
691
608
  body: {
609
+ "@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
610
+ type: rightsManagementModels.RightsManagementTypes.PolicyState,
692
611
  id: "policy-1",
693
612
  status: "approved"
694
613
  }
@@ -716,6 +635,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
716
635
  policyId: "policy-1"
717
636
  },
718
637
  body: {
638
+ "@context": [rightsManagementModels.RightsManagementContexts.ContextRoot, standardsW3cDid.DidContexts.ContextVCv2],
639
+ type: rightsManagementModels.RightsManagementTypes.PolicyRequest,
719
640
  nodeIdentity: "urn:example:node:1",
720
641
  proof: {
721
642
  created: "2024-08-22T11:56:56.272Z",
@@ -738,6 +659,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
738
659
  id: "IPnpNegotiationStateResponseExample",
739
660
  response: {
740
661
  body: {
662
+ "@context": rightsManagementModels.RightsManagementContexts.ContextRoot,
663
+ type: rightsManagementModels.RightsManagementTypes.PolicyState,
741
664
  id: "policy-1",
742
665
  status: "approved"
743
666
  }
@@ -765,6 +688,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
765
688
  policyId: "policy-1"
766
689
  },
767
690
  body: {
691
+ "@context": [rightsManagementModels.RightsManagementContexts.ContextRoot, standardsW3cDid.DidContexts.ContextVCv2],
692
+ type: rightsManagementModels.RightsManagementTypes.PolicyRequest,
768
693
  nodeIdentity: "urn:example:node:1",
769
694
  proof: {
770
695
  created: "2024-08-22T11:56:56.272Z",
@@ -797,9 +722,13 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
797
722
  */
798
723
  async function pnpNegotiate(httpRequestContext, componentName, request) {
799
724
  core.Guards.object(ROUTES_SOURCE, "request", request);
725
+ const mimeType = request.headers?.[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
800
726
  const component = core.ComponentFactory.get(componentName);
801
- const result = await component.negotiate(request.body.assetType, request.body.action, request.body.resourceId, request.body.context, request.body.requesterInformation, request.body.proof);
727
+ const result = await component.negotiate(request.body.assetType, request.body.action, request.body.resourceId, request.body.nodeIdentity, request.body.information, request.body.proof);
802
728
  return {
729
+ headers: {
730
+ [web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
731
+ },
803
732
  body: result
804
733
  };
805
734
  }
@@ -813,9 +742,13 @@ async function pnpNegotiate(httpRequestContext, componentName, request) {
813
742
  async function pnpNegotiationState(httpRequestContext, componentName, request) {
814
743
  core.Guards.object(ROUTES_SOURCE, "request", request);
815
744
  core.Guards.object(ROUTES_SOURCE, "request.body", request.body);
745
+ const mimeType = request.headers?.[web.HeaderTypes.Accept] === web.MimeTypes.JsonLd ? "jsonld" : "json";
816
746
  const component = core.ComponentFactory.get(componentName);
817
747
  const result = await component.negotiationState(request.pathParams.policyId, request.body.nodeIdentity, request.body.proof);
818
748
  return {
749
+ headers: {
750
+ [web.HeaderTypes.ContentType]: mimeType === "json" ? web.MimeTypes.Json : web.MimeTypes.JsonLd
751
+ },
819
752
  body: result
820
753
  };
821
754
  }
@@ -846,12 +779,6 @@ const restEntryPoints = [
846
779
  tags: papTags,
847
780
  generateRoutes: generateRestRoutesPolicyAdministrationPoint
848
781
  },
849
- {
850
- name: "policy-enforcement-point",
851
- defaultBaseRoute: "rights-management",
852
- tags: pepTags,
853
- generateRoutes: generateRestRoutesPolicyEnforcementPoint
854
- },
855
782
  {
856
783
  name: "policy-negotiation-point",
857
784
  defaultBaseRoute: "rights-management",
@@ -867,7 +794,6 @@ const restEntryPoints = [
867
794
  ];
868
795
 
869
796
  exports.generateRestRoutesPolicyAdministrationPoint = generateRestRoutesPolicyAdministrationPoint;
870
- exports.generateRestRoutesPolicyEnforcementPoint = generateRestRoutesPolicyEnforcementPoint;
871
797
  exports.generateRestRoutesPolicyNegotiationAdminPoint = generateRestRoutesPolicyNegotiationAdminPoint;
872
798
  exports.generateRestRoutesPolicyNegotiationPoint = generateRestRoutesPolicyNegotiationPoint;
873
799
  exports.papCreate = papCreate;
@@ -876,8 +802,6 @@ exports.papQuery = papQuery;
876
802
  exports.papRemove = papRemove;
877
803
  exports.papTags = papTags;
878
804
  exports.papUpdate = papUpdate;
879
- exports.pepIntercept = pepIntercept;
880
- exports.pepTags = pepTags;
881
805
  exports.pnapGet = pnapGet;
882
806
  exports.pnapQuery = pnapQuery;
883
807
  exports.pnapRemove = pnapRemove;
@@ -1,14 +1,16 @@
1
1
  import { HttpParameterHelper } from '@twin.org/api-models';
2
2
  import { Guards, ComponentFactory, Coerce } from '@twin.org/core';
3
3
  import { OdrlContexts } from '@twin.org/standards-w3c-odrl';
4
- import { HttpStatusCode, HttpMethod } from '@twin.org/web';
4
+ import { HttpStatusCode, HttpMethod, HeaderTypes, MimeTypes } from '@twin.org/web';
5
+ import { RightsManagementTypes, RightsManagementContexts } from '@twin.org/rights-management-models';
6
+ import { DidContexts } from '@twin.org/standards-w3c-did';
5
7
 
6
8
  // Copyright 2024 IOTA Stiftung.
7
9
  // SPDX-License-Identifier: Apache-2.0.
8
10
  /**
9
11
  * The source used when communicating about these routes.
10
12
  */
11
- const ROUTES_SOURCE$3 = "policyAdministrationPointRoutes";
13
+ const ROUTES_SOURCE$2 = "policyAdministrationPointRoutes";
12
14
  /**
13
15
  * The tag to associate with the routes.
14
16
  */
@@ -235,8 +237,8 @@ function generateRestRoutesPolicyAdministrationPoint(baseRouteName, componentNam
235
237
  * @returns The response object with additional http response properties.
236
238
  */
237
239
  async function papCreate(httpRequestContext, componentName, request) {
238
- Guards.object(ROUTES_SOURCE$3, "request", request);
239
- Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
240
+ Guards.object(ROUTES_SOURCE$2, "request", request);
241
+ Guards.object(ROUTES_SOURCE$2, "request.body", request.body);
240
242
  const component = ComponentFactory.get(componentName);
241
243
  const policy = request.body;
242
244
  const uid = await component.create(policy);
@@ -255,10 +257,10 @@ async function papCreate(httpRequestContext, componentName, request) {
255
257
  * @returns The response object with additional http response properties.
256
258
  */
257
259
  async function papUpdate(httpRequestContext, componentName, request) {
258
- Guards.object(ROUTES_SOURCE$3, "request", request);
259
- Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
260
- Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
261
- Guards.object(ROUTES_SOURCE$3, "request.body", request.body);
260
+ Guards.object(ROUTES_SOURCE$2, "request", request);
261
+ Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
262
+ Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
263
+ Guards.object(ROUTES_SOURCE$2, "request.body", request.body);
262
264
  const component = ComponentFactory.get(componentName);
263
265
  await component.update(request.body);
264
266
  return {
@@ -273,9 +275,9 @@ async function papUpdate(httpRequestContext, componentName, request) {
273
275
  * @returns The response object with additional http response properties.
274
276
  */
275
277
  async function papGet(httpRequestContext, componentName, request) {
276
- Guards.object(ROUTES_SOURCE$3, "request", request);
277
- Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
278
- Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
278
+ Guards.object(ROUTES_SOURCE$2, "request", request);
279
+ Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
280
+ Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
279
281
  const component = ComponentFactory.get(componentName);
280
282
  const policy = await component.get(request.pathParams.id);
281
283
  return {
@@ -290,9 +292,9 @@ async function papGet(httpRequestContext, componentName, request) {
290
292
  * @returns The response object with additional http response properties.
291
293
  */
292
294
  async function papRemove(httpRequestContext, componentName, request) {
293
- Guards.object(ROUTES_SOURCE$3, "request", request);
294
- Guards.object(ROUTES_SOURCE$3, "request.pathParams", request.pathParams);
295
- Guards.stringValue(ROUTES_SOURCE$3, "request.pathParams.id", request.pathParams.id);
295
+ Guards.object(ROUTES_SOURCE$2, "request", request);
296
+ Guards.object(ROUTES_SOURCE$2, "request.pathParams", request.pathParams);
297
+ Guards.stringValue(ROUTES_SOURCE$2, "request.pathParams.id", request.pathParams.id);
296
298
  const component = ComponentFactory.get(componentName);
297
299
  await component.remove(request.pathParams.id);
298
300
  return {
@@ -307,7 +309,7 @@ async function papRemove(httpRequestContext, componentName, request) {
307
309
  * @returns The response object with additional http response properties.
308
310
  */
309
311
  async function papQuery(httpRequestContext, componentName, request) {
310
- Guards.object(ROUTES_SOURCE$3, "request", request);
312
+ Guards.object(ROUTES_SOURCE$2, "request", request);
311
313
  const component = ComponentFactory.get(componentName);
312
314
  const result = await component.query(HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.cursor, Coerce.integer(request.query?.pageSize));
313
315
  return {
@@ -318,91 +320,6 @@ async function papQuery(httpRequestContext, componentName, request) {
318
320
  };
319
321
  }
320
322
 
321
- /**
322
- * The source used when communicating about these routes.
323
- */
324
- const ROUTES_SOURCE$2 = "policyEnforcementPointRoutes";
325
- /**
326
- * The tag to associate with the routes.
327
- */
328
- const pepTags = [
329
- {
330
- name: "Policy Enforcement Point",
331
- description: "Endpoints for managing ODRL policies in the Policy Enforcement Point"
332
- }
333
- ];
334
- /**
335
- * The REST routes for the Policy Enforcement Point.
336
- * @param baseRouteName Prefix to prepend to the paths.
337
- * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
338
- * @returns The generated routes.
339
- */
340
- function generateRestRoutesPolicyEnforcementPoint(baseRouteName, componentName) {
341
- const pepInterceptRoute = {
342
- operationId: "pepIntercept",
343
- summary: "Intercept a request",
344
- tag: pepTags[0].name,
345
- method: "POST",
346
- path: `${baseRouteName}/pep/intercept`,
347
- handler: async (httpRequestContext, request) => pepIntercept(httpRequestContext, componentName, request),
348
- requestType: {
349
- type: "IPepInterceptRequest",
350
- examples: [
351
- {
352
- id: "pepInterceptRequestExample",
353
- request: {
354
- body: {
355
- assetType: "document",
356
- action: "view",
357
- data: {
358
- id: "document-1",
359
- param1: 1,
360
- param2: 2
361
- }
362
- }
363
- }
364
- }
365
- ]
366
- },
367
- responseType: [
368
- {
369
- type: "IPepInterceptResponse",
370
- examples: [
371
- {
372
- id: "pepInterceptResponseExample",
373
- response: {
374
- body: {
375
- id: "document-1",
376
- param1: 1
377
- }
378
- }
379
- }
380
- ]
381
- }
382
- ]
383
- };
384
- return [pepInterceptRoute];
385
- }
386
- /**
387
- * PEP: Intercept.
388
- * @param httpRequestContext The request context for the API.
389
- * @param componentName The name of the component to use in the routes.
390
- * @param request The request.
391
- * @returns The response object with additional http response properties.
392
- */
393
- async function pepIntercept(httpRequestContext, componentName, request) {
394
- Guards.object(ROUTES_SOURCE$2, "request", request);
395
- const component = ComponentFactory.get(componentName);
396
- const result = await component.intercept(request.body.assetType, request.body.action, {
397
- ...(request.body.context ?? {}),
398
- userIdentity: httpRequestContext.userIdentity,
399
- nodeIdentity: httpRequestContext.nodeIdentity
400
- }, request.body.data);
401
- return {
402
- body: result
403
- };
404
- }
405
-
406
323
  /**
407
324
  * The source used when communicating about these routes.
408
325
  */
@@ -454,7 +371,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
454
371
  dateCreated: "2025-09-03T00:00:00.000Z",
455
372
  assetType: "document",
456
373
  action: "view",
457
- context: {}
374
+ nodeIdentity: "urn:example:node:1"
458
375
  }
459
376
  }
460
377
  }
@@ -482,7 +399,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
482
399
  dateCreated: "2025-09-03T00:00:00.000Z",
483
400
  assetType: "document",
484
401
  action: "view",
485
- context: {}
402
+ nodeIdentity: "urn:example:node:1"
486
403
  }
487
404
  }
488
405
  }
@@ -543,7 +460,7 @@ function generateRestRoutesPolicyNegotiationAdminPoint(baseRouteName, componentN
543
460
  dateCreated: "2025-09-03T00:00:00.000Z",
544
461
  assetType: "document",
545
462
  action: "view",
546
- context: {}
463
+ nodeIdentity: "urn:example:node:1"
547
464
  }
548
465
  ],
549
466
  cursor: "next-cursor"
@@ -661,11 +578,11 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
661
578
  id: "pnpNegotiateRequestExample",
662
579
  request: {
663
580
  body: {
581
+ "@context": [RightsManagementContexts.ContextRoot, DidContexts.ContextVCv2],
582
+ type: RightsManagementTypes.PolicyNegotiationRequest,
664
583
  assetType: "document",
665
584
  action: "view",
666
- context: {
667
- nodeIdentity: "urn:example:node:1"
668
- },
585
+ nodeIdentity: "urn:example:node:1",
669
586
  proof: {
670
587
  created: "2024-08-22T11:56:56.272Z",
671
588
  type: "DataIntegrityProof",
@@ -687,6 +604,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
687
604
  id: "IPnpNegotiateResponseExample",
688
605
  response: {
689
606
  body: {
607
+ "@context": RightsManagementContexts.ContextRoot,
608
+ type: RightsManagementTypes.PolicyState,
690
609
  id: "policy-1",
691
610
  status: "approved"
692
611
  }
@@ -714,6 +633,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
714
633
  policyId: "policy-1"
715
634
  },
716
635
  body: {
636
+ "@context": [RightsManagementContexts.ContextRoot, DidContexts.ContextVCv2],
637
+ type: RightsManagementTypes.PolicyRequest,
717
638
  nodeIdentity: "urn:example:node:1",
718
639
  proof: {
719
640
  created: "2024-08-22T11:56:56.272Z",
@@ -736,6 +657,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
736
657
  id: "IPnpNegotiationStateResponseExample",
737
658
  response: {
738
659
  body: {
660
+ "@context": RightsManagementContexts.ContextRoot,
661
+ type: RightsManagementTypes.PolicyState,
739
662
  id: "policy-1",
740
663
  status: "approved"
741
664
  }
@@ -763,6 +686,8 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
763
686
  policyId: "policy-1"
764
687
  },
765
688
  body: {
689
+ "@context": [RightsManagementContexts.ContextRoot, DidContexts.ContextVCv2],
690
+ type: RightsManagementTypes.PolicyRequest,
766
691
  nodeIdentity: "urn:example:node:1",
767
692
  proof: {
768
693
  created: "2024-08-22T11:56:56.272Z",
@@ -795,9 +720,13 @@ function generateRestRoutesPolicyNegotiationPoint(baseRouteName, componentName)
795
720
  */
796
721
  async function pnpNegotiate(httpRequestContext, componentName, request) {
797
722
  Guards.object(ROUTES_SOURCE, "request", request);
723
+ const mimeType = request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? "jsonld" : "json";
798
724
  const component = ComponentFactory.get(componentName);
799
- const result = await component.negotiate(request.body.assetType, request.body.action, request.body.resourceId, request.body.context, request.body.requesterInformation, request.body.proof);
725
+ const result = await component.negotiate(request.body.assetType, request.body.action, request.body.resourceId, request.body.nodeIdentity, request.body.information, request.body.proof);
800
726
  return {
727
+ headers: {
728
+ [HeaderTypes.ContentType]: mimeType === "json" ? MimeTypes.Json : MimeTypes.JsonLd
729
+ },
801
730
  body: result
802
731
  };
803
732
  }
@@ -811,9 +740,13 @@ async function pnpNegotiate(httpRequestContext, componentName, request) {
811
740
  async function pnpNegotiationState(httpRequestContext, componentName, request) {
812
741
  Guards.object(ROUTES_SOURCE, "request", request);
813
742
  Guards.object(ROUTES_SOURCE, "request.body", request.body);
743
+ const mimeType = request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? "jsonld" : "json";
814
744
  const component = ComponentFactory.get(componentName);
815
745
  const result = await component.negotiationState(request.pathParams.policyId, request.body.nodeIdentity, request.body.proof);
816
746
  return {
747
+ headers: {
748
+ [HeaderTypes.ContentType]: mimeType === "json" ? MimeTypes.Json : MimeTypes.JsonLd
749
+ },
817
750
  body: result
818
751
  };
819
752
  }
@@ -844,12 +777,6 @@ const restEntryPoints = [
844
777
  tags: papTags,
845
778
  generateRoutes: generateRestRoutesPolicyAdministrationPoint
846
779
  },
847
- {
848
- name: "policy-enforcement-point",
849
- defaultBaseRoute: "rights-management",
850
- tags: pepTags,
851
- generateRoutes: generateRestRoutesPolicyEnforcementPoint
852
- },
853
780
  {
854
781
  name: "policy-negotiation-point",
855
782
  defaultBaseRoute: "rights-management",
@@ -864,4 +791,4 @@ const restEntryPoints = [
864
791
  }
865
792
  ];
866
793
 
867
- export { generateRestRoutesPolicyAdministrationPoint, generateRestRoutesPolicyEnforcementPoint, generateRestRoutesPolicyNegotiationAdminPoint, generateRestRoutesPolicyNegotiationPoint, papCreate, papGet, papQuery, papRemove, papTags, papUpdate, pepIntercept, pepTags, pnapGet, pnapQuery, pnapRemove, pnapSet, pnapTags, pnpNegotiate, pnpNegotiationCancel, pnpNegotiationState, pnpTags, restEntryPoints };
794
+ export { generateRestRoutesPolicyAdministrationPoint, generateRestRoutesPolicyNegotiationAdminPoint, generateRestRoutesPolicyNegotiationPoint, papCreate, papGet, papQuery, papRemove, papTags, papUpdate, pnapGet, pnapQuery, pnapRemove, pnapSet, pnapTags, pnpNegotiate, pnpNegotiationCancel, pnpNegotiationState, pnpTags, restEntryPoints };
@@ -1,5 +1,4 @@
1
1
  export * from "./policyAdministrationPointRoutes";
2
- export * from "./policyEnforcementPointRoutes";
3
2
  export * from "./policyNegotiationAdminPointRoutes";
4
3
  export * from "./policyNegotiationPointRoutes";
5
4
  export * from "./restEntryPoints";
@@ -1,5 +1,5 @@
1
1
  import type { IHttpRequestContext, INoContentResponse, IRestRoute, ITag } from "@twin.org/api-models";
2
- import type { IPnpNegotiateRequest, IPnpNegotiateResponse, IPnpNegotiationCancelRequest, IPnpNegotiationStateRequest, IPnpNegotiationStateResponse } from "@twin.org/rights-management-models";
2
+ import { type IPnpNegotiateRequest, type IPnpNegotiateResponse, type IPnpNegotiationCancelRequest, type IPnpNegotiationStateRequest, type IPnpNegotiationStateResponse } from "@twin.org/rights-management-models";
3
3
  /**
4
4
  * The tag to associate with the routes.
5
5
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @twin.org/rights-management-pap-service - Changelog
2
2
 
3
+ ## [0.0.2-next.9](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.2-next.8...rights-management-service-v0.0.2-next.9) (2025-09-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add JSON-LD types for negotiation ([6be61f8](https://github.com/twinfoundation/rights-management/commit/6be61f890537cb9d22d4fad90092b858de2c9c2d))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/rights-management-models bumped from 0.0.2-next.8 to 0.0.2-next.9
16
+ * devDependencies
17
+ * @twin.org/rights-management-pap-service bumped from 0.0.2-next.8 to 0.0.2-next.9
18
+ * @twin.org/rights-management-pdp-service bumped from 0.0.2-next.8 to 0.0.2-next.9
19
+ * @twin.org/rights-management-pep-service bumped from 0.0.2-next.8 to 0.0.2-next.9
20
+ * @twin.org/rights-management-pip-service bumped from 0.0.2-next.8 to 0.0.2-next.9
21
+ * @twin.org/rights-management-pmp-service bumped from 0.0.2-next.8 to 0.0.2-next.9
22
+ * @twin.org/rights-management-pnp-service bumped from 0.0.2-next.8 to 0.0.2-next.9
23
+ * @twin.org/rights-management-pxp-service bumped from 0.0.2-next.8 to 0.0.2-next.9
24
+
25
+ ## [0.0.2-next.8](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.2-next.7...rights-management-service-v0.0.2-next.8) (2025-09-05)
26
+
27
+
28
+ ### Miscellaneous Chores
29
+
30
+ * **rights-management-service:** Synchronize repo versions
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @twin.org/rights-management-models bumped from 0.0.2-next.7 to 0.0.2-next.8
38
+ * devDependencies
39
+ * @twin.org/rights-management-pap-service bumped from 0.0.2-next.7 to 0.0.2-next.8
40
+ * @twin.org/rights-management-pdp-service bumped from 0.0.2-next.7 to 0.0.2-next.8
41
+ * @twin.org/rights-management-pep-service bumped from 0.0.2-next.7 to 0.0.2-next.8
42
+ * @twin.org/rights-management-pip-service bumped from 0.0.2-next.7 to 0.0.2-next.8
43
+ * @twin.org/rights-management-pmp-service bumped from 0.0.2-next.7 to 0.0.2-next.8
44
+ * @twin.org/rights-management-pnp-service bumped from 0.0.2-next.7 to 0.0.2-next.8
45
+ * @twin.org/rights-management-pxp-service bumped from 0.0.2-next.7 to 0.0.2-next.8
46
+
3
47
  ## [0.0.2-next.7](https://github.com/twinfoundation/rights-management/compare/rights-management-service-v0.0.2-next.6...rights-management-service-v0.0.2-next.7) (2025-09-05)
4
48
 
5
49
 
@@ -19,10 +19,6 @@
19
19
  "name": "Policy Administration Point",
20
20
  "description": "Endpoints for managing ODRL policies in the Policy Administration Point"
21
21
  },
22
- {
23
- "name": "Policy Enforcement Point",
24
- "description": "Endpoints for managing ODRL policies in the Policy Enforcement Point"
25
- },
26
22
  {
27
23
  "name": "Policy Negotiation Point",
28
24
  "description": "Endpoints for managing ODRL policies in the Policy Negotiation Point"
@@ -589,121 +585,6 @@
589
585
  }
590
586
  }
591
587
  },
592
- "/rights-management/pep/intercept": {
593
- "post": {
594
- "operationId": "pepIntercept",
595
- "summary": "Intercept a request",
596
- "tags": [
597
- "Policy Enforcement Point"
598
- ],
599
- "security": [
600
- {
601
- "jwtBearerAuthScheme": []
602
- }
603
- ],
604
- "requestBody": {
605
- "description": "The request structure for intercepting a request and enforcing a policy.",
606
- "required": true,
607
- "content": {
608
- "application/json": {
609
- "schema": {
610
- "$ref": "#/components/schemas/PepInterceptRequest"
611
- },
612
- "examples": {
613
- "pepInterceptRequestExample": {
614
- "value": {
615
- "assetType": "document",
616
- "action": "view",
617
- "data": {
618
- "id": "document-1",
619
- "param1": 1,
620
- "param2": 2
621
- }
622
- }
623
- }
624
- }
625
- }
626
- }
627
- },
628
- "responses": {
629
- "200": {
630
- "description": "The response structure for intercepting a request and enforcing a policy.",
631
- "content": {
632
- "application/json": {
633
- "schema": {
634
- "$ref": "#/components/schemas/PepInterceptResponse"
635
- },
636
- "examples": {
637
- "pepInterceptResponseExample": {
638
- "value": {
639
- "id": "document-1",
640
- "param1": 1
641
- }
642
- }
643
- }
644
- }
645
- }
646
- },
647
- "400": {
648
- "description": "The server cannot process the request, see the content for more details.",
649
- "content": {
650
- "application/json": {
651
- "schema": {
652
- "$ref": "#/components/schemas/Error"
653
- },
654
- "examples": {
655
- "exampleResponse": {
656
- "value": {
657
- "name": "GeneralError",
658
- "message": "component.error",
659
- "properties": {
660
- "foo": "bar"
661
- }
662
- }
663
- }
664
- }
665
- }
666
- }
667
- },
668
- "401": {
669
- "description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
670
- "content": {
671
- "application/json": {
672
- "schema": {
673
- "$ref": "#/components/schemas/Error"
674
- },
675
- "examples": {
676
- "exampleResponse": {
677
- "value": {
678
- "name": "UnauthorizedError",
679
- "message": "component.error"
680
- }
681
- }
682
- }
683
- }
684
- }
685
- },
686
- "500": {
687
- "description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
688
- "content": {
689
- "application/json": {
690
- "schema": {
691
- "$ref": "#/components/schemas/Error"
692
- },
693
- "examples": {
694
- "exampleResponse": {
695
- "value": {
696
- "name": "InternalServerError",
697
- "message": "component.error"
698
- }
699
- }
700
- }
701
- }
702
- }
703
- }
704
- }
705
- }
706
- },
707
588
  "/rights-management/pnp/negotiate": {
708
589
  "post": {
709
590
  "operationId": "pnpNegotiate",
@@ -711,22 +592,36 @@
711
592
  "tags": [
712
593
  "Policy Negotiation Point"
713
594
  ],
595
+ "parameters": [
596
+ {
597
+ "name": "accept",
598
+ "in": "header",
599
+ "required": true,
600
+ "schema": {
601
+ "type": "string"
602
+ },
603
+ "style": "simple"
604
+ }
605
+ ],
714
606
  "requestBody": {
715
607
  "description": "The request structure for negotiating a policy.",
716
608
  "required": true,
717
609
  "content": {
718
610
  "application/json": {
719
611
  "schema": {
720
- "$ref": "#/components/schemas/PnpNegotiateRequest"
612
+ "$ref": "#/components/schemas/PolicyNegotiationRequest"
721
613
  },
722
614
  "examples": {
723
615
  "pnpNegotiateRequestExample": {
724
616
  "value": {
617
+ "@context": [
618
+ "https://schema.twindev.org/rights-management",
619
+ "https://www.w3.org/ns/credentials/v2"
620
+ ],
621
+ "type": "PolicyNegotiationRequest",
725
622
  "assetType": "document",
726
623
  "action": "view",
727
- "context": {
728
- "nodeIdentity": "urn:example:node:1"
729
- },
624
+ "nodeIdentity": "urn:example:node:1",
730
625
  "proof": {
731
626
  "created": "2024-08-22T11:56:56.272Z",
732
627
  "type": "DataIntegrityProof",
@@ -752,6 +647,8 @@
752
647
  "examples": {
753
648
  "IPnpNegotiateResponseExample": {
754
649
  "value": {
650
+ "@context": "https://schema.twindev.org/rights-management",
651
+ "type": "PolicyState",
755
652
  "id": "policy-1",
756
653
  "status": "approved"
757
654
  }
@@ -820,6 +717,15 @@
820
717
  },
821
718
  "style": "simple",
822
719
  "example": "policy-1"
720
+ },
721
+ {
722
+ "name": "accept",
723
+ "in": "header",
724
+ "required": true,
725
+ "schema": {
726
+ "type": "string"
727
+ },
728
+ "style": "simple"
823
729
  }
824
730
  ],
825
731
  "requestBody": {
@@ -828,11 +734,16 @@
828
734
  "content": {
829
735
  "application/json": {
830
736
  "schema": {
831
- "$ref": "#/components/schemas/PnpNegotiationStateRequest"
737
+ "$ref": "#/components/schemas/PolicyRequest"
832
738
  },
833
739
  "examples": {
834
740
  "pnpNegotiationStateRequestExample": {
835
741
  "value": {
742
+ "@context": [
743
+ "https://schema.twindev.org/rights-management",
744
+ "https://www.w3.org/ns/credentials/v2"
745
+ ],
746
+ "type": "PolicyRequest",
836
747
  "nodeIdentity": "urn:example:node:1",
837
748
  "proof": {
838
749
  "created": "2024-08-22T11:56:56.272Z",
@@ -859,6 +770,8 @@
859
770
  "examples": {
860
771
  "IPnpNegotiationStateResponseExample": {
861
772
  "value": {
773
+ "@context": "https://schema.twindev.org/rights-management",
774
+ "type": "PolicyState",
862
775
  "id": "policy-1",
863
776
  "status": "approved"
864
777
  }
@@ -925,6 +838,15 @@
925
838
  },
926
839
  "style": "simple",
927
840
  "example": "policy-1"
841
+ },
842
+ {
843
+ "name": "accept",
844
+ "in": "header",
845
+ "required": true,
846
+ "schema": {
847
+ "type": "string"
848
+ },
849
+ "style": "simple"
928
850
  }
929
851
  ],
930
852
  "requestBody": {
@@ -933,11 +855,16 @@
933
855
  "content": {
934
856
  "application/json": {
935
857
  "schema": {
936
- "$ref": "#/components/schemas/PnpNegotiationCancelRequest"
858
+ "$ref": "#/components/schemas/PolicyRequest"
937
859
  },
938
860
  "examples": {
939
861
  "pnpNegotiationCancelRequestExample": {
940
862
  "value": {
863
+ "@context": [
864
+ "https://schema.twindev.org/rights-management",
865
+ "https://www.w3.org/ns/credentials/v2"
866
+ ],
867
+ "type": "PolicyRequest",
941
868
  "nodeIdentity": "urn:example:node:1",
942
869
  "proof": {
943
870
  "created": "2024-08-22T11:56:56.272Z",
@@ -1040,7 +967,7 @@
1040
967
  "dateCreated": "2025-09-03T00:00:00.000Z",
1041
968
  "assetType": "document",
1042
969
  "action": "view",
1043
- "context": {}
970
+ "nodeIdentity": "urn:example:node:1"
1044
971
  }
1045
972
  }
1046
973
  }
@@ -1146,7 +1073,7 @@
1146
1073
  "dateCreated": "2025-09-03T00:00:00.000Z",
1147
1074
  "assetType": "document",
1148
1075
  "action": "view",
1149
- "context": {}
1076
+ "nodeIdentity": "urn:example:node:1"
1150
1077
  }
1151
1078
  }
1152
1079
  }
@@ -1356,7 +1283,7 @@
1356
1283
  "dateCreated": "2025-09-03T00:00:00.000Z",
1357
1284
  "assetType": "document",
1358
1285
  "action": "view",
1359
- "context": {}
1286
+ "nodeIdentity": "urn:example:node:1"
1360
1287
  }
1361
1288
  ],
1362
1289
  "cursor": "next-cursor"
@@ -1912,34 +1839,6 @@
1912
1839
  "additionalProperties": false,
1913
1840
  "description": "The body of the response."
1914
1841
  },
1915
- "PepInterceptRequest": {
1916
- "type": "object",
1917
- "properties": {
1918
- "assetType": {
1919
- "type": "string",
1920
- "description": "The type of the asset to enforce the policy on."
1921
- },
1922
- "action": {
1923
- "type": "string",
1924
- "description": "The action to perform on the asset."
1925
- },
1926
- "context": {
1927
- "description": "The context in which the action is being performed. userIdentity and nodeIdentity should not be passed as they will be populated by the authenticated context on the server side."
1928
- },
1929
- "data": {
1930
- "description": "The data to include in the request."
1931
- }
1932
- },
1933
- "required": [
1934
- "assetType",
1935
- "action"
1936
- ],
1937
- "additionalProperties": false,
1938
- "description": "The body parameters of the request."
1939
- },
1940
- "PepInterceptResponse": {
1941
- "description": "The manipulated data with any policies applied."
1942
- },
1943
1842
  "PnapQueryResponse": {
1944
1843
  "type": "object",
1945
1844
  "properties": {
@@ -1964,101 +1863,6 @@
1964
1863
  "additionalProperties": false,
1965
1864
  "description": "The body of the response."
1966
1865
  },
1967
- "PnpNegotiateRequest": {
1968
- "type": "object",
1969
- "properties": {
1970
- "assetType": {
1971
- "type": "string",
1972
- "description": "The type of the asset being requested."
1973
- },
1974
- "action": {
1975
- "type": "string",
1976
- "description": "The action being performed on the asset."
1977
- },
1978
- "resourceId": {
1979
- "type": "string",
1980
- "description": "The id of the item being requested."
1981
- },
1982
- "context": {
1983
- "$ref": "#/components/schemas/PolicyContext"
1984
- },
1985
- "requesterInformation": {
1986
- "type": "object",
1987
- "additionalProperties": {
1988
- "type": "array",
1989
- "items": false,
1990
- "prefixItems": [
1991
- {
1992
- "$ref": "https://schema.twindev.org/json-ld/JsonLdNodeObject"
1993
- }
1994
- ]
1995
- },
1996
- "description": "Additional information provided by the requester to determine if a policy can be created."
1997
- },
1998
- "proof": {
1999
- "$ref": "https://schema.twindev.org/w3c-did/Proof"
2000
- }
2001
- },
2002
- "required": [
2003
- "assetType",
2004
- "action",
2005
- "context",
2006
- "proof"
2007
- ],
2008
- "additionalProperties": false,
2009
- "description": "The body parameters of the request."
2010
- },
2011
- "PnpNegotiationCancelRequest": {
2012
- "type": "object",
2013
- "properties": {
2014
- "nodeIdentity": {
2015
- "type": "string",
2016
- "description": "The node sending the request."
2017
- },
2018
- "proof": {
2019
- "$ref": "https://schema.twindev.org/w3c-did/Proof"
2020
- }
2021
- },
2022
- "required": [
2023
- "nodeIdentity",
2024
- "proof"
2025
- ],
2026
- "additionalProperties": false,
2027
- "description": "The body of the request."
2028
- },
2029
- "PnpNegotiationStateRequest": {
2030
- "type": "object",
2031
- "properties": {
2032
- "nodeIdentity": {
2033
- "type": "string",
2034
- "description": "The node sending the request."
2035
- },
2036
- "proof": {
2037
- "$ref": "https://schema.twindev.org/w3c-did/Proof"
2038
- }
2039
- },
2040
- "required": [
2041
- "nodeIdentity",
2042
- "proof"
2043
- ],
2044
- "additionalProperties": false,
2045
- "description": "The body of the request."
2046
- },
2047
- "PolicyContext": {
2048
- "type": "object",
2049
- "properties": {
2050
- "userIdentity": {
2051
- "type": "string",
2052
- "description": "The user identity to use in the decision making."
2053
- },
2054
- "nodeIdentity": {
2055
- "type": "string",
2056
- "description": "The node identity to use in the decision making."
2057
- }
2058
- },
2059
- "additionalProperties": false,
2060
- "description": "Context information to be used when making a policy decision."
2061
- },
2062
1866
  "PolicyNegotiation": {
2063
1867
  "type": "object",
2064
1868
  "properties": {
@@ -2082,10 +1886,11 @@
2082
1886
  "type": "string",
2083
1887
  "description": "The resource id the negotiation is for."
2084
1888
  },
2085
- "context": {
2086
- "$ref": "#/components/schemas/PolicyContext"
1889
+ "nodeIdentity": {
1890
+ "type": "string",
1891
+ "description": "The identity of the node making the request."
2087
1892
  },
2088
- "requesterInformation": {
1893
+ "information": {
2089
1894
  "type": "object",
2090
1895
  "additionalProperties": {
2091
1896
  "type": "array",
@@ -2115,7 +1920,7 @@
2115
1920
  "dateCreated",
2116
1921
  "assetType",
2117
1922
  "action",
2118
- "context",
1923
+ "nodeIdentity",
2119
1924
  "status"
2120
1925
  ],
2121
1926
  "additionalProperties": false,
@@ -2144,6 +1949,16 @@
2144
1949
  "PolicyState": {
2145
1950
  "type": "object",
2146
1951
  "properties": {
1952
+ "@context": {
1953
+ "type": "string",
1954
+ "const": "https://schema.twindev.org/rights-management",
1955
+ "description": "The JSON-LD context."
1956
+ },
1957
+ "type": {
1958
+ "type": "string",
1959
+ "const": "PolicyState",
1960
+ "description": "The type of the proof."
1961
+ },
2147
1962
  "id": {
2148
1963
  "type": "string",
2149
1964
  "description": "The id of the policy."
@@ -2161,6 +1976,8 @@
2161
1976
  }
2162
1977
  },
2163
1978
  "required": [
1979
+ "@context",
1980
+ "type",
2164
1981
  "id",
2165
1982
  "status"
2166
1983
  ],
@@ -3,7 +3,6 @@
3
3
  ## Variables
4
4
 
5
5
  - [papTags](variables/papTags.md)
6
- - [pepTags](variables/pepTags.md)
7
6
  - [pnapTags](variables/pnapTags.md)
8
7
  - [pnpTags](variables/pnpTags.md)
9
8
  - [restEntryPoints](variables/restEntryPoints.md)
@@ -16,8 +15,6 @@
16
15
  - [papGet](functions/papGet.md)
17
16
  - [papRemove](functions/papRemove.md)
18
17
  - [papQuery](functions/papQuery.md)
19
- - [generateRestRoutesPolicyEnforcementPoint](functions/generateRestRoutesPolicyEnforcementPoint.md)
20
- - [pepIntercept](functions/pepIntercept.md)
21
18
  - [generateRestRoutesPolicyNegotiationAdminPoint](functions/generateRestRoutesPolicyNegotiationAdminPoint.md)
22
19
  - [pnapGet](functions/pnapGet.md)
23
20
  - [pnapSet](functions/pnapSet.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/rights-management-service",
3
- "version": "0.0.2-next.7",
3
+ "version": "0.0.2-next.9",
4
4
  "description": "Rights Management service implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/data-json-ld": "next",
20
20
  "@twin.org/entity": "next",
21
21
  "@twin.org/nameof": "next",
22
- "@twin.org/rights-management-models": "0.0.2-next.7",
22
+ "@twin.org/rights-management-models": "0.0.2-next.9",
23
23
  "@twin.org/standards-w3c-did": "next",
24
24
  "@twin.org/standards-w3c-odrl": "next",
25
25
  "@twin.org/web": "next"
@@ -1,21 +0,0 @@
1
- import type { IHttpRequestContext, IRestRoute, ITag } from "@twin.org/api-models";
2
- import type { IPepInterceptRequest, IPepInterceptResponse } from "@twin.org/rights-management-models";
3
- /**
4
- * The tag to associate with the routes.
5
- */
6
- export declare const pepTags: ITag[];
7
- /**
8
- * The REST routes for the Policy Enforcement Point.
9
- * @param baseRouteName Prefix to prepend to the paths.
10
- * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
11
- * @returns The generated routes.
12
- */
13
- export declare function generateRestRoutesPolicyEnforcementPoint(baseRouteName: string, componentName: string): IRestRoute[];
14
- /**
15
- * PEP: Intercept.
16
- * @param httpRequestContext The request context for the API.
17
- * @param componentName The name of the component to use in the routes.
18
- * @param request The request.
19
- * @returns The response object with additional http response properties.
20
- */
21
- export declare function pepIntercept(httpRequestContext: IHttpRequestContext, componentName: string, request: IPepInterceptRequest): Promise<IPepInterceptResponse>;
@@ -1,25 +0,0 @@
1
- # Function: generateRestRoutesPolicyEnforcementPoint()
2
-
3
- > **generateRestRoutesPolicyEnforcementPoint**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
-
5
- The REST routes for the Policy Enforcement Point.
6
-
7
- ## Parameters
8
-
9
- ### baseRouteName
10
-
11
- `string`
12
-
13
- Prefix to prepend to the paths.
14
-
15
- ### componentName
16
-
17
- `string`
18
-
19
- The name of the component to use in the routes stored in the ComponentFactory.
20
-
21
- ## Returns
22
-
23
- `IRestRoute`\<`any`, `any`\>[]
24
-
25
- The generated routes.
@@ -1,31 +0,0 @@
1
- # Function: pepIntercept()
2
-
3
- > **pepIntercept**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IPepInterceptResponse`\>
4
-
5
- PEP: Intercept.
6
-
7
- ## Parameters
8
-
9
- ### httpRequestContext
10
-
11
- `IHttpRequestContext`
12
-
13
- The request context for the API.
14
-
15
- ### componentName
16
-
17
- `string`
18
-
19
- The name of the component to use in the routes.
20
-
21
- ### request
22
-
23
- `IPepInterceptRequest`
24
-
25
- The request.
26
-
27
- ## Returns
28
-
29
- `Promise`\<`IPepInterceptResponse`\>
30
-
31
- The response object with additional http response properties.
@@ -1,5 +0,0 @@
1
- # Variable: pepTags
2
-
3
- > `const` **pepTags**: `ITag`[]
4
-
5
- The tag to associate with the routes.