@twin.org/rights-management-models 0.0.2-next.12 → 0.0.2-next.13
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/dist/cjs/index.cjs +0 -106
- package/dist/esm/index.mjs +2 -107
- package/dist/types/index.d.ts +0 -2
- package/dist/types/models/api/dap/IDapCreateRequest.d.ts +6 -1
- package/dist/types/models/api/dap/IDapGetRequest.d.ts +6 -1
- package/dist/types/models/api/dap/IDapQueryRequest.d.ts +6 -1
- package/dist/types/models/api/dap/IDapRemoveRequest.d.ts +6 -1
- package/dist/types/models/api/dap/IDapUpdateRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpAgreementRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpAgreementVerificationRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpEventRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpNegotiateRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpNegotiationGetRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpOfferRequest.d.ts +6 -1
- package/dist/types/models/api/pnp/IPnpTerminateRequest.d.ts +6 -1
- package/dist/types/models/dap/IDataAccessPointComponent.d.ts +11 -10
- package/dist/types/models/pnp/IPolicyNegotiationPointComponent.d.ts +15 -14
- package/dist/types/models/rightsManagementTypes.d.ts +0 -4
- package/docs/changelog.md +7 -0
- package/docs/reference/index.md +0 -2
- package/docs/reference/interfaces/IDapCreateRequest.md +10 -2
- package/docs/reference/interfaces/IDapGetRequest.md +10 -2
- package/docs/reference/interfaces/IDapQueryRequest.md +10 -2
- package/docs/reference/interfaces/IDapRemoveRequest.md +10 -2
- package/docs/reference/interfaces/IDapUpdateRequest.md +10 -2
- package/docs/reference/interfaces/IDataAccessPointComponent.md +20 -20
- package/docs/reference/interfaces/IPnpAgreementRequest.md +10 -2
- package/docs/reference/interfaces/IPnpAgreementVerificationRequest.md +10 -2
- package/docs/reference/interfaces/IPnpEventRequest.md +10 -2
- package/docs/reference/interfaces/IPnpNegotiateRequest.md +10 -2
- package/docs/reference/interfaces/IPnpNegotiationGetRequest.md +10 -2
- package/docs/reference/interfaces/IPnpOfferRequest.md +10 -2
- package/docs/reference/interfaces/IPnpTerminateRequest.md +10 -2
- package/docs/reference/interfaces/IPolicyNegotiationPointComponent.md +28 -28
- package/docs/reference/variables/RightsManagementTypes.md +0 -6
- package/locales/en.json +1 -12
- package/package.json +2 -1
- package/dist/types/models/pnp/jsonLd/IPolicyRequest.d.ts +0 -28
- package/dist/types/utils/rightsManagementTokenHelper.d.ts +0 -43
- package/docs/reference/classes/RightsManagementTokenHelper.md +0 -151
- package/docs/reference/interfaces/IPolicyRequest.md +0 -43
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@twin.org/core');
|
|
4
|
-
var identityModels = require('@twin.org/identity-models');
|
|
5
|
-
var standardsW3cDid = require('@twin.org/standards-w3c-did');
|
|
6
4
|
|
|
7
5
|
// Copyright 2024 IOTA Stiftung.
|
|
8
6
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -96,10 +94,6 @@ const RightsManagementNamespaces = {
|
|
|
96
94
|
*/
|
|
97
95
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
98
96
|
const RightsManagementTypes = {
|
|
99
|
-
/**
|
|
100
|
-
* Represents policy request.
|
|
101
|
-
*/
|
|
102
|
-
PolicyRequest: "PolicyRequest",
|
|
103
97
|
/**
|
|
104
98
|
* Represents data access request.
|
|
105
99
|
*/
|
|
@@ -296,105 +290,6 @@ class OdrlPolicyHelper {
|
|
|
296
290
|
}
|
|
297
291
|
}
|
|
298
292
|
|
|
299
|
-
// Copyright 2024 IOTA Stiftung.
|
|
300
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
301
|
-
/**
|
|
302
|
-
* Helper methods for creating and verifying rights managements requests.
|
|
303
|
-
*/
|
|
304
|
-
class RightsManagementTokenHelper {
|
|
305
|
-
/**
|
|
306
|
-
* The class name of the Rights Management Token Helper.
|
|
307
|
-
*/
|
|
308
|
-
static CLASS_NAME = "RightsManagementTokenHelper";
|
|
309
|
-
/**
|
|
310
|
-
* Create the token for an object.
|
|
311
|
-
* @param identityConnector The identity connector to use for creating the token.
|
|
312
|
-
* @param verificationMethodId The verification method id to use for creating the token.
|
|
313
|
-
* @param item The item to create the token for.
|
|
314
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
315
|
-
* @returns The token.
|
|
316
|
-
* @throws GeneralError is the token creation fails.
|
|
317
|
-
*/
|
|
318
|
-
static async createToken(identityConnector, verificationMethodId, item, tokenTtlInSeconds) {
|
|
319
|
-
core.Guards.object(RightsManagementTokenHelper.CLASS_NAME, "identityConnector", identityConnector);
|
|
320
|
-
core.Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "verificationMethodId", verificationMethodId);
|
|
321
|
-
core.Guards.integer(RightsManagementTokenHelper.CLASS_NAME, "tokenTtlInSeconds", tokenTtlInSeconds);
|
|
322
|
-
const ttlMs = tokenTtlInSeconds * 1000;
|
|
323
|
-
const parts = identityModels.DocumentHelper.parseId(verificationMethodId);
|
|
324
|
-
const credential = await identityConnector.createVerifiableCredential(parts.id, verificationMethodId, undefined, item, {
|
|
325
|
-
expirationDate: new Date(Date.now() + ttlMs)
|
|
326
|
-
});
|
|
327
|
-
return credential.jwt;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Verify the token.
|
|
331
|
-
* @param identityConnector The identity connector to use for verifying the token.
|
|
332
|
-
* @param checkProperties Properties to compare against the subject to see if they match.
|
|
333
|
-
* @param token The token containing the necessary information.
|
|
334
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
335
|
-
* @returns The verifiable credential if the token is valid.
|
|
336
|
-
* @throws GeneralError is the token verification fails.
|
|
337
|
-
*/
|
|
338
|
-
static async verifyToken(identityConnector, checkProperties, token, tokenTtlInSeconds) {
|
|
339
|
-
core.Guards.object(RightsManagementTokenHelper.CLASS_NAME, "identityConnector", identityConnector);
|
|
340
|
-
core.Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "token", token);
|
|
341
|
-
try {
|
|
342
|
-
const result = await identityConnector.checkVerifiableCredential(token);
|
|
343
|
-
const verifiableCredential = result.verifiableCredential;
|
|
344
|
-
if (core.Is.empty(verifiableCredential)) {
|
|
345
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenNoCredential");
|
|
346
|
-
}
|
|
347
|
-
const issuer = core.Is.stringValue(verifiableCredential.issuer)
|
|
348
|
-
? verifiableCredential.issuer
|
|
349
|
-
: undefined;
|
|
350
|
-
if (core.Is.empty(issuer)) {
|
|
351
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenNoIssuer");
|
|
352
|
-
}
|
|
353
|
-
for (const checkProperty of Object.keys(checkProperties)) {
|
|
354
|
-
if (core.ObjectHelper.propertyGet(checkProperties, checkProperty) !==
|
|
355
|
-
core.ObjectHelper.propertyGet(verifiableCredential.credentialSubject, checkProperty)) {
|
|
356
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenItemMismatch", {
|
|
357
|
-
property: checkProperty
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
await RightsManagementTokenHelper.verifyIssuanceDate(standardsW3cDid.VerifiableCredentialHelper.getValidFrom(verifiableCredential), issuer, tokenTtlInSeconds);
|
|
362
|
-
return {
|
|
363
|
-
...verifiableCredential,
|
|
364
|
-
issuer
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
catch (err) {
|
|
368
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenFailed", undefined, err);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Verify that the token has an issuance date and that it is within the allowed time-to-live (TTL).
|
|
373
|
-
* @param issuanceDate The issuance date from the token.
|
|
374
|
-
* @param assignee The identity of the node performing the action.
|
|
375
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
376
|
-
* @throws GeneralError if the token is missing the issuance date or if it has expired.
|
|
377
|
-
*/
|
|
378
|
-
static async verifyIssuanceDate(issuanceDate, assignee, tokenTtlInSeconds) {
|
|
379
|
-
core.Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "assignee", assignee);
|
|
380
|
-
core.Guards.number(RightsManagementTokenHelper.CLASS_NAME, "tokenTtlInSeconds", tokenTtlInSeconds);
|
|
381
|
-
if (core.Is.empty(issuanceDate)) {
|
|
382
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenMissingIssuanceDate", {
|
|
383
|
-
assignee
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
const tokenCreated = new Date(issuanceDate);
|
|
387
|
-
const now = Date.now();
|
|
388
|
-
const tokenTtlInMs = tokenTtlInSeconds * 1000;
|
|
389
|
-
// If the token has expired then we should reject it
|
|
390
|
-
if (tokenCreated.getTime() + tokenTtlInMs < now) {
|
|
391
|
-
throw new core.GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenExpired", {
|
|
392
|
-
assignee
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
293
|
exports.LocatorHelper = LocatorHelper;
|
|
399
294
|
exports.OdrlPolicyHelper = OdrlPolicyHelper;
|
|
400
295
|
exports.PolicyDecision = PolicyDecision;
|
|
@@ -402,5 +297,4 @@ exports.PolicyDecisionStage = PolicyDecisionStage;
|
|
|
402
297
|
exports.PolicyInformationAccessMode = PolicyInformationAccessMode;
|
|
403
298
|
exports.RightsManagementContexts = RightsManagementContexts;
|
|
404
299
|
exports.RightsManagementNamespaces = RightsManagementNamespaces;
|
|
405
|
-
exports.RightsManagementTokenHelper = RightsManagementTokenHelper;
|
|
406
300
|
exports.RightsManagementTypes = RightsManagementTypes;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Is
|
|
2
|
-
import { DocumentHelper } from '@twin.org/identity-models';
|
|
3
|
-
import { VerifiableCredentialHelper } from '@twin.org/standards-w3c-did';
|
|
1
|
+
import { Is } from '@twin.org/core';
|
|
4
2
|
|
|
5
3
|
// Copyright 2024 IOTA Stiftung.
|
|
6
4
|
// SPDX-License-Identifier: Apache-2.0.
|
|
@@ -94,10 +92,6 @@ const RightsManagementNamespaces = {
|
|
|
94
92
|
*/
|
|
95
93
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
96
94
|
const RightsManagementTypes = {
|
|
97
|
-
/**
|
|
98
|
-
* Represents policy request.
|
|
99
|
-
*/
|
|
100
|
-
PolicyRequest: "PolicyRequest",
|
|
101
95
|
/**
|
|
102
96
|
* Represents data access request.
|
|
103
97
|
*/
|
|
@@ -294,103 +288,4 @@ class OdrlPolicyHelper {
|
|
|
294
288
|
}
|
|
295
289
|
}
|
|
296
290
|
|
|
297
|
-
|
|
298
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
299
|
-
/**
|
|
300
|
-
* Helper methods for creating and verifying rights managements requests.
|
|
301
|
-
*/
|
|
302
|
-
class RightsManagementTokenHelper {
|
|
303
|
-
/**
|
|
304
|
-
* The class name of the Rights Management Token Helper.
|
|
305
|
-
*/
|
|
306
|
-
static CLASS_NAME = "RightsManagementTokenHelper";
|
|
307
|
-
/**
|
|
308
|
-
* Create the token for an object.
|
|
309
|
-
* @param identityConnector The identity connector to use for creating the token.
|
|
310
|
-
* @param verificationMethodId The verification method id to use for creating the token.
|
|
311
|
-
* @param item The item to create the token for.
|
|
312
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
313
|
-
* @returns The token.
|
|
314
|
-
* @throws GeneralError is the token creation fails.
|
|
315
|
-
*/
|
|
316
|
-
static async createToken(identityConnector, verificationMethodId, item, tokenTtlInSeconds) {
|
|
317
|
-
Guards.object(RightsManagementTokenHelper.CLASS_NAME, "identityConnector", identityConnector);
|
|
318
|
-
Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "verificationMethodId", verificationMethodId);
|
|
319
|
-
Guards.integer(RightsManagementTokenHelper.CLASS_NAME, "tokenTtlInSeconds", tokenTtlInSeconds);
|
|
320
|
-
const ttlMs = tokenTtlInSeconds * 1000;
|
|
321
|
-
const parts = DocumentHelper.parseId(verificationMethodId);
|
|
322
|
-
const credential = await identityConnector.createVerifiableCredential(parts.id, verificationMethodId, undefined, item, {
|
|
323
|
-
expirationDate: new Date(Date.now() + ttlMs)
|
|
324
|
-
});
|
|
325
|
-
return credential.jwt;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Verify the token.
|
|
329
|
-
* @param identityConnector The identity connector to use for verifying the token.
|
|
330
|
-
* @param checkProperties Properties to compare against the subject to see if they match.
|
|
331
|
-
* @param token The token containing the necessary information.
|
|
332
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
333
|
-
* @returns The verifiable credential if the token is valid.
|
|
334
|
-
* @throws GeneralError is the token verification fails.
|
|
335
|
-
*/
|
|
336
|
-
static async verifyToken(identityConnector, checkProperties, token, tokenTtlInSeconds) {
|
|
337
|
-
Guards.object(RightsManagementTokenHelper.CLASS_NAME, "identityConnector", identityConnector);
|
|
338
|
-
Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "token", token);
|
|
339
|
-
try {
|
|
340
|
-
const result = await identityConnector.checkVerifiableCredential(token);
|
|
341
|
-
const verifiableCredential = result.verifiableCredential;
|
|
342
|
-
if (Is.empty(verifiableCredential)) {
|
|
343
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenNoCredential");
|
|
344
|
-
}
|
|
345
|
-
const issuer = Is.stringValue(verifiableCredential.issuer)
|
|
346
|
-
? verifiableCredential.issuer
|
|
347
|
-
: undefined;
|
|
348
|
-
if (Is.empty(issuer)) {
|
|
349
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenNoIssuer");
|
|
350
|
-
}
|
|
351
|
-
for (const checkProperty of Object.keys(checkProperties)) {
|
|
352
|
-
if (ObjectHelper.propertyGet(checkProperties, checkProperty) !==
|
|
353
|
-
ObjectHelper.propertyGet(verifiableCredential.credentialSubject, checkProperty)) {
|
|
354
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenItemMismatch", {
|
|
355
|
-
property: checkProperty
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
await RightsManagementTokenHelper.verifyIssuanceDate(VerifiableCredentialHelper.getValidFrom(verifiableCredential), issuer, tokenTtlInSeconds);
|
|
360
|
-
return {
|
|
361
|
-
...verifiableCredential,
|
|
362
|
-
issuer
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
catch (err) {
|
|
366
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenFailed", undefined, err);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Verify that the token has an issuance date and that it is within the allowed time-to-live (TTL).
|
|
371
|
-
* @param issuanceDate The issuance date from the token.
|
|
372
|
-
* @param assignee The identity of the node performing the action.
|
|
373
|
-
* @param tokenTtlInSeconds The time-to-live (TTL) for the token in seconds.
|
|
374
|
-
* @throws GeneralError if the token is missing the issuance date or if it has expired.
|
|
375
|
-
*/
|
|
376
|
-
static async verifyIssuanceDate(issuanceDate, assignee, tokenTtlInSeconds) {
|
|
377
|
-
Guards.stringValue(RightsManagementTokenHelper.CLASS_NAME, "assignee", assignee);
|
|
378
|
-
Guards.number(RightsManagementTokenHelper.CLASS_NAME, "tokenTtlInSeconds", tokenTtlInSeconds);
|
|
379
|
-
if (Is.empty(issuanceDate)) {
|
|
380
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenMissingIssuanceDate", {
|
|
381
|
-
assignee
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
const tokenCreated = new Date(issuanceDate);
|
|
385
|
-
const now = Date.now();
|
|
386
|
-
const tokenTtlInMs = tokenTtlInSeconds * 1000;
|
|
387
|
-
// If the token has expired then we should reject it
|
|
388
|
-
if (tokenCreated.getTime() + tokenTtlInMs < now) {
|
|
389
|
-
throw new GeneralError(RightsManagementTokenHelper.CLASS_NAME, "tokenExpired", {
|
|
390
|
-
assignee
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export { LocatorHelper, OdrlPolicyHelper, PolicyDecision, PolicyDecisionStage, PolicyInformationAccessMode, RightsManagementContexts, RightsManagementNamespaces, RightsManagementTokenHelper, RightsManagementTypes };
|
|
291
|
+
export { LocatorHelper, OdrlPolicyHelper, PolicyDecision, PolicyDecisionStage, PolicyInformationAccessMode, RightsManagementContexts, RightsManagementNamespaces, RightsManagementTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -54,7 +54,6 @@ export * from "./models/pnp/IPolicyNegotiationAdminPointComponent";
|
|
|
54
54
|
export * from "./models/pnp/IPolicyNegotiationPointComponent";
|
|
55
55
|
export * from "./models/pnp/IPolicyNegotiator";
|
|
56
56
|
export * from "./models/pnp/IPolicyRequester";
|
|
57
|
-
export * from "./models/pnp/jsonLd/IPolicyRequest";
|
|
58
57
|
export * from "./models/pxp/IPolicyExecutionAction";
|
|
59
58
|
export * from "./models/pxp/IPolicyExecutionPointComponent";
|
|
60
59
|
export * from "./models/rightsManagementContexts";
|
|
@@ -62,4 +61,3 @@ export * from "./models/rightsManagementNamespaces";
|
|
|
62
61
|
export * from "./models/rightsManagementTypes";
|
|
63
62
|
export * from "./utils/locatorHelper";
|
|
64
63
|
export * from "./utils/odrlPolicyHelper";
|
|
65
|
-
export * from "./utils/rightsManagementTokenHelper";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
import type { IDataAccessRequestWithObject } from "../../dap/jsonLd/IDataAccessRequestWithObject";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IDapCreateRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IDapCreateRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IDataAccessRequestWithObject;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
/**
|
|
3
4
|
* The request structure for getting an item with the DAP.
|
|
@@ -8,7 +9,7 @@ export interface IDapGetRequest {
|
|
|
8
9
|
*/
|
|
9
10
|
headers: {
|
|
10
11
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
11
|
-
[HeaderTypes.Authorization]
|
|
12
|
+
[HeaderTypes.Authorization]?: string;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* The path parameters of the request.
|
|
@@ -23,4 +24,8 @@ export interface IDapGetRequest {
|
|
|
23
24
|
*/
|
|
24
25
|
id: string;
|
|
25
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* The action request used in the verifiable credential.
|
|
29
|
+
*/
|
|
30
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
26
31
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
import type { IDataAccessQuery } from "../../dap/jsonLd/IDataAccessQuery";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IDapQueryRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IDapQueryRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IDataAccessQuery;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
/**
|
|
3
4
|
* The request structure for removing an item with the DAP.
|
|
@@ -8,7 +9,7 @@ export interface IDapRemoveRequest {
|
|
|
8
9
|
*/
|
|
9
10
|
headers: {
|
|
10
11
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
11
|
-
[HeaderTypes.Authorization]
|
|
12
|
+
[HeaderTypes.Authorization]?: string;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* The path parameters of the request.
|
|
@@ -23,4 +24,8 @@ export interface IDapRemoveRequest {
|
|
|
23
24
|
*/
|
|
24
25
|
id: string;
|
|
25
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* The action request used in the verifiable credential.
|
|
29
|
+
*/
|
|
30
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
26
31
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
import type { IDataAccessRequestWithObject } from "../../dap/jsonLd/IDataAccessRequestWithObject";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IDapUpdateRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -28,4 +29,8 @@ export interface IDapUpdateRequest {
|
|
|
28
29
|
* The body parameters of the updated.
|
|
29
30
|
*/
|
|
30
31
|
body: IDataAccessRequestWithObject;
|
|
32
|
+
/**
|
|
33
|
+
* The action request used in the verifiable credential.
|
|
34
|
+
*/
|
|
35
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
31
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractAgreementMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpAgreementRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpAgreementRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractAgreementMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractAgreementVerificationMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpAgreementVerificationRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpAgreementVerificationRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractAgreementVerificationMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractNegotiationEventMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpEventRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpEventRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractNegotiationEventMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractRequestMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpNegotiateRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpNegotiateRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractRequestMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
2
3
|
/**
|
|
3
4
|
* The request structure for requesting a contract negotiation.
|
|
@@ -8,7 +9,7 @@ export interface IPnpNegotiationGetRequest {
|
|
|
8
9
|
*/
|
|
9
10
|
headers: {
|
|
10
11
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
11
|
-
[HeaderTypes.Authorization]
|
|
12
|
+
[HeaderTypes.Authorization]?: string;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* The path parameters of the request.
|
|
@@ -19,4 +20,8 @@ export interface IPnpNegotiationGetRequest {
|
|
|
19
20
|
*/
|
|
20
21
|
id: string;
|
|
21
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The action request used in the verifiable credential.
|
|
25
|
+
*/
|
|
26
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
22
27
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractOfferMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpOfferRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpOfferRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractOfferMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
1
2
|
import type { IIdsContractNegotiationTerminationMessage } from "@twin.org/standards-ids-contract-negotiation";
|
|
2
3
|
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export interface IPnpTerminateRequest {
|
|
|
9
10
|
*/
|
|
10
11
|
headers: {
|
|
11
12
|
[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;
|
|
12
|
-
[HeaderTypes.Authorization]
|
|
13
|
+
[HeaderTypes.Authorization]?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The path parameters of the request.
|
|
@@ -24,4 +25,8 @@ export interface IPnpTerminateRequest {
|
|
|
24
25
|
* The body parameters of the request.
|
|
25
26
|
*/
|
|
26
27
|
body: IIdsContractNegotiationTerminationMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The action request used in the verifiable credential.
|
|
30
|
+
*/
|
|
31
|
+
authentication: IIdentityAuthenticationActionRequest;
|
|
27
32
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
3
|
import type { EntityCondition } from "@twin.org/entity";
|
|
4
|
+
import type { IIdentityAuthenticationActionRequest } from "@twin.org/identity-authentication";
|
|
4
5
|
import type { IDataAccessHandler } from "./IDataAccessHandler";
|
|
5
6
|
/**
|
|
6
7
|
* Interface describing a Data Access Point (DAP) contract.
|
|
@@ -13,44 +14,44 @@ export interface IDataAccessPointComponent extends IComponent {
|
|
|
13
14
|
* Create an item.
|
|
14
15
|
* @param assetType The type of the item to create.
|
|
15
16
|
* @param item The item to create.
|
|
16
|
-
* @param
|
|
17
|
+
* @param actionRequest The action request used in the verifiable credential.
|
|
17
18
|
* @returns The id of the item created, for some items this is supplied in the `item`.
|
|
18
19
|
*/
|
|
19
|
-
create(assetType: string, item: IJsonLdNodeObject,
|
|
20
|
+
create(assetType: string, item: IJsonLdNodeObject, actionRequest: IIdentityAuthenticationActionRequest): Promise<string>;
|
|
20
21
|
/**
|
|
21
22
|
* Get an item.
|
|
22
23
|
* @param assetType The type of the item to retrieve.
|
|
23
24
|
* @param id The ID of the item to retrieve.
|
|
24
|
-
* @param
|
|
25
|
+
* @param actionRequest The action request used in the verifiable credential.
|
|
25
26
|
* @returns The item retrieved if the policies allow it.
|
|
26
27
|
*/
|
|
27
|
-
get(assetType: string, id: string,
|
|
28
|
+
get(assetType: string, id: string, actionRequest: IIdentityAuthenticationActionRequest): Promise<IJsonLdNodeObject>;
|
|
28
29
|
/**
|
|
29
30
|
* Update an item.
|
|
30
31
|
* @param assetType The type of the item to update.
|
|
31
32
|
* @param item The item to update.
|
|
32
|
-
* @param
|
|
33
|
+
* @param actionRequest The action request used in the verifiable credential.
|
|
33
34
|
* @returns Nothing.
|
|
34
35
|
*/
|
|
35
|
-
update(assetType: string, item: IJsonLdNodeObject,
|
|
36
|
+
update(assetType: string, item: IJsonLdNodeObject, actionRequest: IIdentityAuthenticationActionRequest): Promise<void>;
|
|
36
37
|
/**
|
|
37
38
|
* Remove an item.
|
|
38
39
|
* @param assetType The type of the item to remove.
|
|
39
40
|
* @param id The id of the item to remove.
|
|
40
|
-
* @param
|
|
41
|
+
* @param actionRequest The action request used in the verifiable credential.
|
|
41
42
|
* @returns Nothing.
|
|
42
43
|
*/
|
|
43
|
-
remove(assetType: string, id: string,
|
|
44
|
+
remove(assetType: string, id: string, actionRequest: IIdentityAuthenticationActionRequest): Promise<void>;
|
|
44
45
|
/**
|
|
45
46
|
* Query for items.
|
|
46
47
|
* @param assetType The type of the item to query.
|
|
47
48
|
* @param conditions The conditions to apply to the query.
|
|
48
49
|
* @param cursor The cursor for pagination.
|
|
49
50
|
* @param options Additional options which might be supported by the handler.
|
|
50
|
-
* @param
|
|
51
|
+
* @param actionRequest The action request used in the verifiable credential.
|
|
51
52
|
* @returns The items matching the query and cursor if there are more items.
|
|
52
53
|
*/
|
|
53
|
-
query(assetType: string, conditions: EntityCondition<IJsonLdNodeObject> | undefined, cursor: string | undefined, options: unknown | undefined,
|
|
54
|
+
query(assetType: string, conditions: EntityCondition<IJsonLdNodeObject> | undefined, cursor: string | undefined, options: unknown | undefined, actionRequest: IIdentityAuthenticationActionRequest): Promise<{
|
|
54
55
|
items: IJsonLdNodeObject[];
|
|
55
56
|
cursor?: string;
|
|
56
57
|
}>;
|