@tsg-dsp/tsg-sdk 0.0.0-stage → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +273 -2
- package/dist/.generated/control-plane.d.ts +7882 -0
- package/dist/.generated/sso-bridge.d.ts +3062 -0
- package/dist/.generated/wallet.d.ts +6350 -0
- package/dist/auth/auth.provider.d.ts +45 -0
- package/dist/auth/auth.provider.d.ts.map +1 -0
- package/dist/auth/auth.provider.js +158 -0
- package/dist/auth/auth.provider.js.map +1 -0
- package/dist/auth/auth.types.d.ts +27 -0
- package/dist/auth/auth.types.d.ts.map +1 -0
- package/dist/auth/auth.types.js +2 -0
- package/dist/auth/auth.types.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/browser.d.ts +1243 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +215 -0
- package/dist/browser.js.map +1 -0
- package/dist/catalog/catalog.sdk.d.ts +149 -0
- package/dist/catalog/catalog.sdk.d.ts.map +1 -0
- package/dist/catalog/catalog.sdk.js +155 -0
- package/dist/catalog/catalog.sdk.js.map +1 -0
- package/dist/catalog/index.d.ts +2 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +2 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/client.d.ts +43 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +107 -0
- package/dist/client.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/sdk.config.d.ts +81 -0
- package/dist/config/sdk.config.d.ts.map +1 -0
- package/dist/config/sdk.config.js +2 -0
- package/dist/config/sdk.config.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/index.d.ts +2 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +2 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/metadata.sdk.d.ts +111 -0
- package/dist/metadata/metadata.sdk.d.ts.map +1 -0
- package/dist/metadata/metadata.sdk.js +142 -0
- package/dist/metadata/metadata.sdk.js.map +1 -0
- package/dist/negotiations/index.d.ts +2 -0
- package/dist/negotiations/index.d.ts.map +1 -0
- package/dist/negotiations/index.js +2 -0
- package/dist/negotiations/index.js.map +1 -0
- package/dist/negotiations/negotiations.sdk.d.ts +113 -0
- package/dist/negotiations/negotiations.sdk.d.ts.map +1 -0
- package/dist/negotiations/negotiations.sdk.js +146 -0
- package/dist/negotiations/negotiations.sdk.js.map +1 -0
- package/dist/requirements/index.d.ts +2 -0
- package/dist/requirements/index.d.ts.map +1 -0
- package/dist/requirements/index.js +2 -0
- package/dist/requirements/index.js.map +1 -0
- package/dist/requirements/requirements.sdk.d.ts +52 -0
- package/dist/requirements/requirements.sdk.d.ts.map +1 -0
- package/dist/requirements/requirements.sdk.js +123 -0
- package/dist/requirements/requirements.sdk.js.map +1 -0
- package/dist/sso/index.d.ts +3 -0
- package/dist/sso/index.d.ts.map +1 -0
- package/dist/sso/index.js +3 -0
- package/dist/sso/index.js.map +1 -0
- package/dist/sso/sso-management.sdk.d.ts +96 -0
- package/dist/sso/sso-management.sdk.d.ts.map +1 -0
- package/dist/sso/sso-management.sdk.js +152 -0
- package/dist/sso/sso-management.sdk.js.map +1 -0
- package/dist/sso/sso.sdk.d.ts +75 -0
- package/dist/sso/sso.sdk.d.ts.map +1 -0
- package/dist/sso/sso.sdk.js +147 -0
- package/dist/sso/sso.sdk.js.map +1 -0
- package/dist/transfers/index.d.ts +2 -0
- package/dist/transfers/index.d.ts.map +1 -0
- package/dist/transfers/index.js +2 -0
- package/dist/transfers/index.js.map +1 -0
- package/dist/transfers/transfers.sdk.d.ts +155 -0
- package/dist/transfers/transfers.sdk.d.ts.map +1 -0
- package/dist/transfers/transfers.sdk.js +186 -0
- package/dist/transfers/transfers.sdk.js.map +1 -0
- package/dist/tsg-sdk.d.ts +65 -0
- package/dist/tsg-sdk.d.ts.map +1 -0
- package/dist/tsg-sdk.js +128 -0
- package/dist/tsg-sdk.js.map +1 -0
- package/dist/utils/errors.d.ts +67 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +79 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/polling.d.ts +20 -0
- package/dist/utils/polling.d.ts.map +1 -0
- package/dist/utils/polling.js +35 -0
- package/dist/utils/polling.js.map +1 -0
- package/dist/utils/shape-validation.d.ts +59 -0
- package/dist/utils/shape-validation.d.ts.map +1 -0
- package/dist/utils/shape-validation.js +85 -0
- package/dist/utils/shape-validation.js.map +1 -0
- package/dist/utils/validate.d.ts +47 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +68 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/vendor/common-dtos/abac.policy.d.ts +60 -0
- package/dist/vendor/common-dtos/abac.policy.js +2 -0
- package/dist/vendor/common-dtos/audit.types.d.ts +74 -0
- package/dist/vendor/common-dtos/audit.types.js +9 -0
- package/dist/vendor/common-dtos/credential-requirements.d.ts +19 -0
- package/dist/vendor/common-dtos/credential-requirements.dto.d.ts +47 -0
- package/dist/vendor/common-dtos/credential-requirements.dto.js +251 -0
- package/dist/vendor/common-dtos/credential-requirements.js +181 -0
- package/dist/vendor/common-dtos/dataplane.dto.d.ts +6 -0
- package/dist/vendor/common-dtos/dataplane.dto.js +29 -0
- package/dist/vendor/common-dtos/dcp.dto.d.ts +90 -0
- package/dist/vendor/common-dtos/dcp.dto.js +490 -0
- package/dist/vendor/common-dtos/dcql.dto.d.ts +89 -0
- package/dist/vendor/common-dtos/dcql.dto.js +450 -0
- package/dist/vendor/common-dtos/did.schemas.d.ts +40 -0
- package/dist/vendor/common-dtos/did.schemas.js +260 -0
- package/dist/vendor/common-dtos/index.d.ts +19 -0
- package/dist/vendor/common-dtos/index.js +19 -0
- package/dist/vendor/common-dtos/metadata.dto.d.ts +6 -0
- package/dist/vendor/common-dtos/metadata.dto.js +30 -0
- package/dist/vendor/common-dtos/negotiations.dto.d.ts +29 -0
- package/dist/vendor/common-dtos/negotiations.dto.js +205 -0
- package/dist/vendor/common-dtos/permissions.d.ts +237 -0
- package/dist/vendor/common-dtos/permissions.js +337 -0
- package/dist/vendor/common-dtos/presentation.request.dto.d.ts +9 -0
- package/dist/vendor/common-dtos/presentation.request.dto.js +55 -0
- package/dist/vendor/common-dtos/presentation.status.dto.d.ts +13 -0
- package/dist/vendor/common-dtos/presentation.status.dto.js +83 -0
- package/dist/vendor/common-dtos/presentationdefinition.dto.d.ts +75 -0
- package/dist/vendor/common-dtos/presentationdefinition.dto.js +448 -0
- package/dist/vendor/common-dtos/signatures.dto.d.ts +32 -0
- package/dist/vendor/common-dtos/signatures.dto.js +210 -0
- package/dist/vendor/common-dtos/transfer.dto.d.ts +17 -0
- package/dist/vendor/common-dtos/transfer.dto.js +102 -0
- package/dist/vendor/common-dtos/utils.swagger.d.ts +13 -0
- package/dist/vendor/common-dtos/utils.swagger.js +63 -0
- package/dist/vendor/control-plane-dtos/index.d.ts +5 -0
- package/dist/vendor/control-plane-dtos/index.js +5 -0
- package/dist/vendor/control-plane-dtos/registry/registry.dto.d.ts +5 -0
- package/dist/vendor/control-plane-dtos/registry/registry.dto.js +26 -0
- package/dist/vendor/control-plane-dtos/registry/registry.search.dto.d.ts +29 -0
- package/dist/vendor/control-plane-dtos/registry/registry.search.dto.js +127 -0
- package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.d.ts +10 -0
- package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.js +44 -0
- package/dist/vendor/control-plane-dtos/status/status.dto.d.ts +38 -0
- package/dist/vendor/control-plane-dtos/status/status.dto.js +173 -0
- package/dist/vendor/sso-bridge-dtos/clients.dto.d.ts +22 -0
- package/dist/vendor/sso-bridge-dtos/clients.dto.js +113 -0
- package/dist/vendor/sso-bridge-dtos/grants.d.ts +3 -0
- package/dist/vendor/sso-bridge-dtos/grants.js +2 -0
- package/dist/vendor/sso-bridge-dtos/index.d.ts +5 -0
- package/dist/vendor/sso-bridge-dtos/index.js +5 -0
- package/dist/vendor/sso-bridge-dtos/users.dto.d.ts +24 -0
- package/dist/vendor/sso-bridge-dtos/users.dto.js +90 -0
- package/dist/vendor/wallet-dtos/clients.dto.d.ts +22 -0
- package/dist/vendor/wallet-dtos/clients.dto.js +14 -0
- package/dist/vendor/wallet-dtos/credentials.dto.d.ts +32 -0
- package/dist/vendor/wallet-dtos/credentials.dto.js +47 -0
- package/dist/vendor/wallet-dtos/index.d.ts +7 -0
- package/dist/vendor/wallet-dtos/index.js +7 -0
- package/dist/vendor/wallet-dtos/issuance.dto.d.ts +238 -0
- package/dist/vendor/wallet-dtos/issuance.dto.js +1140 -0
- package/dist/vendor/wallet-dtos/scopes.dto.d.ts +25 -0
- package/dist/vendor/wallet-dtos/scopes.dto.js +152 -0
- package/dist/vendor/wallet-dtos/status.dto.d.ts +36 -0
- package/dist/vendor/wallet-dtos/status.dto.js +170 -0
- package/dist/vendor/wallet-dtos/utils/schema-converter.d.ts +14 -0
- package/dist/vendor/wallet-dtos/utils/schema-converter.js +43 -0
- package/dist/wallet/index.d.ts +2 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +2 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/wallet.sdk.d.ts +285 -0
- package/dist/wallet/wallet.sdk.d.ts.map +1 -0
- package/dist/wallet/wallet.sdk.js +384 -0
- package/dist/wallet/wallet.sdk.js.map +1 -0
- package/package.json +78 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type JsonObject = Record<string, unknown>;
|
|
2
|
+
/**
|
|
3
|
+
* Validate an object response with a caller-provided type guard.
|
|
4
|
+
* @param data - Untrusted response body.
|
|
5
|
+
* @param name - Response name used in errors.
|
|
6
|
+
* @param predicate - Structural type guard.
|
|
7
|
+
* @returns The validated response.
|
|
8
|
+
*/
|
|
9
|
+
export declare function requireObjectResponse<T extends object>(data: unknown, name: string, predicate: (value: JsonObject) => value is JsonObject & T): T;
|
|
10
|
+
/**
|
|
11
|
+
* Validate every item in an array response.
|
|
12
|
+
* @param data - Untrusted response body.
|
|
13
|
+
* @param name - Response name used in errors.
|
|
14
|
+
* @param predicate - Structural item type guard.
|
|
15
|
+
* @returns The validated response array.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requireArrayResponse<T>(data: unknown, name: string, predicate: (value: JsonObject) => value is JsonObject & T): T[];
|
|
18
|
+
/**
|
|
19
|
+
* Require an object response without accepting arrays or null.
|
|
20
|
+
* @param data - Untrusted response body.
|
|
21
|
+
* @param name - Response name used in errors.
|
|
22
|
+
* @returns The object response.
|
|
23
|
+
*/
|
|
24
|
+
export declare function requireObject(data: unknown, name: string): JsonObject;
|
|
25
|
+
/**
|
|
26
|
+
* Check whether a value is a JSON object.
|
|
27
|
+
* @param value - Candidate value.
|
|
28
|
+
* @returns Whether the value is a non-null, non-array object.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isObject(value: unknown): value is JsonObject;
|
|
31
|
+
/**
|
|
32
|
+
* Check for a non-empty string property.
|
|
33
|
+
* @param value - Candidate object.
|
|
34
|
+
* @param key - Property name.
|
|
35
|
+
* @returns Whether the property is a non-empty string.
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasString(value: JsonObject, key: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check for a finite number property.
|
|
40
|
+
* @param value - Candidate object.
|
|
41
|
+
* @param key - Property name.
|
|
42
|
+
* @returns Whether the property is a finite number.
|
|
43
|
+
*/
|
|
44
|
+
export declare function hasNumber(value: JsonObject, key: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check for a boolean property.
|
|
47
|
+
* @param value - Candidate object.
|
|
48
|
+
* @param key - Property name.
|
|
49
|
+
* @returns Whether the property is boolean.
|
|
50
|
+
*/
|
|
51
|
+
export declare function hasBoolean(value: JsonObject, key: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Check for an array property and narrow its type.
|
|
54
|
+
* @param value - Candidate object.
|
|
55
|
+
* @param key - Property name.
|
|
56
|
+
* @returns Whether the property is an array.
|
|
57
|
+
*/
|
|
58
|
+
export declare function hasArray<K extends string>(value: JsonObject, key: K): value is JsonObject & Record<K, unknown[]>;
|
|
59
|
+
//# sourceMappingURL=shape-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-validation.d.ts","sourceRoot":"","sources":["../../src/utils/shape-validation.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,IAAI,UAAU,GAAG,CAAC,GACxD,CAAC,CAQH;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,IAAI,UAAU,GAAG,CAAC,GACxD,CAAC,EAAE,CAWL;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAQrE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,CAAC,GACL,KAAK,IAAI,UAAU,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAE5C"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { SdkError, SdkErrorCode } from "./errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validate an object response with a caller-provided type guard.
|
|
4
|
+
* @param data - Untrusted response body.
|
|
5
|
+
* @param name - Response name used in errors.
|
|
6
|
+
* @param predicate - Structural type guard.
|
|
7
|
+
* @returns The validated response.
|
|
8
|
+
*/
|
|
9
|
+
export function requireObjectResponse(data, name, predicate) {
|
|
10
|
+
if (!isObject(data) || !predicate(data)) {
|
|
11
|
+
throw new SdkError(`Invalid ${name} response`, SdkErrorCode.VALIDATION_FAILED);
|
|
12
|
+
}
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validate every item in an array response.
|
|
17
|
+
* @param data - Untrusted response body.
|
|
18
|
+
* @param name - Response name used in errors.
|
|
19
|
+
* @param predicate - Structural item type guard.
|
|
20
|
+
* @returns The validated response array.
|
|
21
|
+
*/
|
|
22
|
+
export function requireArrayResponse(data, name, predicate) {
|
|
23
|
+
if (!Array.isArray(data) ||
|
|
24
|
+
!data.every((item) => isObject(item) && predicate(item))) {
|
|
25
|
+
throw new SdkError(`Invalid ${name} response`, SdkErrorCode.VALIDATION_FAILED);
|
|
26
|
+
}
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Require an object response without accepting arrays or null.
|
|
31
|
+
* @param data - Untrusted response body.
|
|
32
|
+
* @param name - Response name used in errors.
|
|
33
|
+
* @returns The object response.
|
|
34
|
+
*/
|
|
35
|
+
export function requireObject(data, name) {
|
|
36
|
+
if (!isObject(data)) {
|
|
37
|
+
throw new SdkError(`Invalid ${name} response: expected an object`, SdkErrorCode.VALIDATION_FAILED);
|
|
38
|
+
}
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check whether a value is a JSON object.
|
|
43
|
+
* @param value - Candidate value.
|
|
44
|
+
* @returns Whether the value is a non-null, non-array object.
|
|
45
|
+
*/
|
|
46
|
+
export function isObject(value) {
|
|
47
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check for a non-empty string property.
|
|
51
|
+
* @param value - Candidate object.
|
|
52
|
+
* @param key - Property name.
|
|
53
|
+
* @returns Whether the property is a non-empty string.
|
|
54
|
+
*/
|
|
55
|
+
export function hasString(value, key) {
|
|
56
|
+
return typeof value[key] === "string" && value[key].length > 0;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check for a finite number property.
|
|
60
|
+
* @param value - Candidate object.
|
|
61
|
+
* @param key - Property name.
|
|
62
|
+
* @returns Whether the property is a finite number.
|
|
63
|
+
*/
|
|
64
|
+
export function hasNumber(value, key) {
|
|
65
|
+
return typeof value[key] === "number" && Number.isFinite(value[key]);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check for a boolean property.
|
|
69
|
+
* @param value - Candidate object.
|
|
70
|
+
* @param key - Property name.
|
|
71
|
+
* @returns Whether the property is boolean.
|
|
72
|
+
*/
|
|
73
|
+
export function hasBoolean(value, key) {
|
|
74
|
+
return typeof value[key] === "boolean";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check for an array property and narrow its type.
|
|
78
|
+
* @param value - Candidate object.
|
|
79
|
+
* @param key - Property name.
|
|
80
|
+
* @returns Whether the property is an array.
|
|
81
|
+
*/
|
|
82
|
+
export function hasArray(value, key) {
|
|
83
|
+
return Array.isArray(value[key]);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=shape-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-validation.js","sourceRoot":"","sources":["../../src/utils/shape-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIrD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAa,EACb,IAAY,EACZ,SAAyD;IAEzD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,QAAQ,CAChB,WAAW,IAAI,WAAW,EAC1B,YAAY,CAAC,iBAAiB,CAC/B,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,IAAY,EACZ,SAAyD;IAEzD,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACpB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,EACxD,CAAC;QACD,MAAM,IAAI,QAAQ,CAChB,WAAW,IAAI,WAAW,EAC1B,YAAY,CAAC,iBAAiB,CAC/B,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAa,EAAE,IAAY;IACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,QAAQ,CAChB,WAAW,IAAI,+BAA+B,EAC9C,YAAY,CAAC,iBAAiB,CAC/B,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,GAAW;IACtD,OAAO,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,GAAW;IACtD,OAAO,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,GAAW;IACvD,OAAO,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAiB,EACjB,GAAM;IAEN,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ContextDto, SerializableClass } from "@tsg-dsp/common-dsp";
|
|
2
|
+
import { type ClassConstructor } from "class-transformer";
|
|
3
|
+
/**
|
|
4
|
+
* Infer the raw DTO type from a JSON-LD serializable class.
|
|
5
|
+
*
|
|
6
|
+
* For example, `DtoOf<Catalog>` resolves to `CatalogDto`.
|
|
7
|
+
*/
|
|
8
|
+
export type DtoOf<T> = T extends SerializableClass<infer DTO> ? DTO : never;
|
|
9
|
+
/**
|
|
10
|
+
* Validate an API response against a DTO class.
|
|
11
|
+
*
|
|
12
|
+
* Creates a class instance from the plain data, runs `class-validator` checks,
|
|
13
|
+
* and throws a descriptive error if validation fails. Returns the transformed
|
|
14
|
+
* class instance so `class-transformer` conversions such as `Date` coercion are
|
|
15
|
+
* preserved for SDK consumers.
|
|
16
|
+
* @typeParam T - The DTO class type.
|
|
17
|
+
* @param dto - The class constructor to validate against.
|
|
18
|
+
* @param data - The plain object received from the API.
|
|
19
|
+
* @returns A validated instance of `T`.
|
|
20
|
+
* @throws Throws an {@link SdkError} with code {@link SdkErrorCode.VALIDATION_FAILED} if validation errors are found.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateResponse<T extends object>(dto: ClassConstructor<T>, data: object): T;
|
|
23
|
+
/**
|
|
24
|
+
* Validate an array of API responses against a DTO class.
|
|
25
|
+
*
|
|
26
|
+
* Each item is validated individually using {@link validateResponse}.
|
|
27
|
+
* @typeParam T - The DTO class type.
|
|
28
|
+
* @param dto - The class constructor to validate against.
|
|
29
|
+
* @param data - The array of plain objects received from the API.
|
|
30
|
+
* @returns An array of validated instances of `T`.
|
|
31
|
+
* @throws Throws an {@link SdkError} with code {@link SdkErrorCode.VALIDATION_FAILED} if any item fails validation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateResponseArray<T extends object>(dto: ClassConstructor<T>, data: object[]): T[];
|
|
34
|
+
/**
|
|
35
|
+
* Deserialize and validate a JSON-LD API response.
|
|
36
|
+
*
|
|
37
|
+
* Uses the `@tsg-dsp/common-dsp` deserializer to convert JSON-LD payloads
|
|
38
|
+
* into typed class instances.
|
|
39
|
+
* @typeParam T - The target serializable class type.
|
|
40
|
+
* @param data - The raw JSON-LD data from the API.
|
|
41
|
+
* @param returnDto - When `true`, returns the raw DTO-shaped data instead of the deserialized class instance.
|
|
42
|
+
* @returns The deserialized class instance, or the raw DTO when `returnDto` is `true`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateJsonLD<T extends SerializableClass<ContextDto>>(data: unknown, returnDto: true): Promise<DtoOf<T>>;
|
|
45
|
+
export declare function validateJsonLD<T extends SerializableClass<ContextDto>>(data: unknown, returnDto?: false): Promise<T>;
|
|
46
|
+
export declare function validateJsonLD<T extends SerializableClass<ContextDto>>(data: unknown, returnDto: boolean): Promise<T | DtoOf<T>>;
|
|
47
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AA6B3E;;;;GAIG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,GACX,CAAC,CAcH;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,EAAE,GACb,CAAC,EAAE,CAEL;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,iBAAiB,CAAC,UAAU,CAAC,EAC1E,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,IAAI,GACd,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,wBAAsB,cAAc,CAAC,CAAC,SAAS,iBAAiB,CAAC,UAAU,CAAC,EAC1E,IAAI,EAAE,OAAO,EACb,SAAS,CAAC,EAAE,KAAK,GAChB,OAAO,CAAC,CAAC,CAAC,CAAC;AACd,wBAAsB,cAAc,CAAC,CAAC,SAAS,iBAAiB,CAAC,UAAU,CAAC,EAC1E,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { deserialize } from "@tsg-dsp/common-dsp";
|
|
2
|
+
import { plainToInstance } from "class-transformer";
|
|
3
|
+
import { validateSync } from "class-validator";
|
|
4
|
+
import { SdkError, SdkErrorCode } from "./errors.js";
|
|
5
|
+
/**
|
|
6
|
+
* Validation error messages for a class-validator ValidationError array.
|
|
7
|
+
*
|
|
8
|
+
* Recursively traverses the ValidationError tree and returns a flat array of
|
|
9
|
+
* messages with the property path prepended to each message.
|
|
10
|
+
* @param errors - The array of ValidationError objects to process.
|
|
11
|
+
* @param parentPath - The property path of the parent object, used for recursion. Defaults to an empty string.
|
|
12
|
+
* @returns An array of strings containing the validation error messages with property paths.
|
|
13
|
+
*/
|
|
14
|
+
function validationMessages(errors, parentPath = "") {
|
|
15
|
+
return errors.flatMap((error) => {
|
|
16
|
+
const path = parentPath
|
|
17
|
+
? `${parentPath}.${error.property}`
|
|
18
|
+
: error.property;
|
|
19
|
+
const ownMessages = Object.values(error.constraints ?? {}).map((message) => `${path}: ${message}`);
|
|
20
|
+
return [...ownMessages, ...validationMessages(error.children ?? [], path)];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validate an API response against a DTO class.
|
|
25
|
+
*
|
|
26
|
+
* Creates a class instance from the plain data, runs `class-validator` checks,
|
|
27
|
+
* and throws a descriptive error if validation fails. Returns the transformed
|
|
28
|
+
* class instance so `class-transformer` conversions such as `Date` coercion are
|
|
29
|
+
* preserved for SDK consumers.
|
|
30
|
+
* @typeParam T - The DTO class type.
|
|
31
|
+
* @param dto - The class constructor to validate against.
|
|
32
|
+
* @param data - The plain object received from the API.
|
|
33
|
+
* @returns A validated instance of `T`.
|
|
34
|
+
* @throws Throws an {@link SdkError} with code {@link SdkErrorCode.VALIDATION_FAILED} if validation errors are found.
|
|
35
|
+
*/
|
|
36
|
+
export function validateResponse(dto, data) {
|
|
37
|
+
const instance = plainToInstance(dto, data);
|
|
38
|
+
const errors = validateSync(instance, {
|
|
39
|
+
whitelist: false,
|
|
40
|
+
forbidUnknownValues: false
|
|
41
|
+
});
|
|
42
|
+
if (errors.length > 0) {
|
|
43
|
+
const messages = validationMessages(errors);
|
|
44
|
+
throw new SdkError(`Invalid ${dto.name} response: ${messages.join("; ") || "validation failed"}`, SdkErrorCode.VALIDATION_FAILED);
|
|
45
|
+
}
|
|
46
|
+
return instance;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validate an array of API responses against a DTO class.
|
|
50
|
+
*
|
|
51
|
+
* Each item is validated individually using {@link validateResponse}.
|
|
52
|
+
* @typeParam T - The DTO class type.
|
|
53
|
+
* @param dto - The class constructor to validate against.
|
|
54
|
+
* @param data - The array of plain objects received from the API.
|
|
55
|
+
* @returns An array of validated instances of `T`.
|
|
56
|
+
* @throws Throws an {@link SdkError} with code {@link SdkErrorCode.VALIDATION_FAILED} if any item fails validation.
|
|
57
|
+
*/
|
|
58
|
+
export function validateResponseArray(dto, data) {
|
|
59
|
+
return data.map((item) => validateResponse(dto, item));
|
|
60
|
+
}
|
|
61
|
+
export async function validateJsonLD(data, returnDto = false) {
|
|
62
|
+
const deserialized = await deserialize(data);
|
|
63
|
+
if (returnDto) {
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
return deserialized;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,MAAyB,EACzB,UAAU,GAAG,EAAE;IAEf,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAG,UAAU;YACrB,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;YACnC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAC5D,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CACnC,CAAC;QACF,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC;AASD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAwB,EACxB,IAAY;IAEZ,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE;QACpC,SAAS,EAAE,KAAK;QAChB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,IAAI,QAAQ,CAChB,WAAW,GAAG,CAAC,IAAI,cAAc,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,mBAAmB,EAAE,EAC7E,YAAY,CAAC,iBAAiB,CAC/B,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAwB,EACxB,IAAc;IAEd,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC;AAwBD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAa,EACb,YAAqB,KAAK;IAE1B,MAAM,YAAY,GAAG,MAAM,WAAW,CAAI,IAAI,CAAC,CAAC;IAChD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Action, PermissionString, RESERVED_SCOPES, Resource } from "./permissions.js";
|
|
2
|
+
export type ActorType = "user" | "service" | "system";
|
|
3
|
+
export interface RequestActor {
|
|
4
|
+
sub: string;
|
|
5
|
+
type: ActorType;
|
|
6
|
+
serviceName?: string;
|
|
7
|
+
permissions?: PermissionString[];
|
|
8
|
+
didId?: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface SubjectAttributes extends RequestActor {
|
|
13
|
+
permissions: PermissionString[];
|
|
14
|
+
}
|
|
15
|
+
export interface DelegationContext {
|
|
16
|
+
originalActor: RequestActor;
|
|
17
|
+
delegationChain: RequestActor[];
|
|
18
|
+
originTimestamp: Date;
|
|
19
|
+
correlationId: string;
|
|
20
|
+
effectivePermissions: PermissionString[];
|
|
21
|
+
}
|
|
22
|
+
export interface ResourceAttributes {
|
|
23
|
+
type: Resource;
|
|
24
|
+
id?: string;
|
|
25
|
+
ownerId?: string;
|
|
26
|
+
ownerIdentifier?: string;
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface EnvironmentAttributes {
|
|
31
|
+
timestamp: Date;
|
|
32
|
+
ipAddress?: string;
|
|
33
|
+
userAgent?: string;
|
|
34
|
+
requestPath?: string;
|
|
35
|
+
requestMethod?: string;
|
|
36
|
+
correlationId?: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
export interface RequestContext {
|
|
40
|
+
caller: RequestActor;
|
|
41
|
+
delegation?: DelegationContext;
|
|
42
|
+
isOnBehalfOf: boolean;
|
|
43
|
+
environment: EnvironmentAttributes;
|
|
44
|
+
}
|
|
45
|
+
export interface PolicyContext {
|
|
46
|
+
subject: SubjectAttributes;
|
|
47
|
+
action: Action;
|
|
48
|
+
resource: ResourceAttributes;
|
|
49
|
+
environment: EnvironmentAttributes;
|
|
50
|
+
delegation?: DelegationContext;
|
|
51
|
+
}
|
|
52
|
+
export type EffectiveScope = typeof RESERVED_SCOPES.ALL | typeof RESERVED_SCOPES.OWN | "specific";
|
|
53
|
+
export interface PolicyResult {
|
|
54
|
+
allowed: boolean;
|
|
55
|
+
reason?: string;
|
|
56
|
+
matchedPermission?: PermissionString;
|
|
57
|
+
effectiveScope?: EffectiveScope;
|
|
58
|
+
allowedResourceIds?: string[];
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=abac.policy.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Action, Resource } from "./permissions.js";
|
|
2
|
+
type AuditFilterValue<T> = T | T[];
|
|
3
|
+
export declare enum AuditSeverity {
|
|
4
|
+
DEBUG = "debug",
|
|
5
|
+
INFO = "info",
|
|
6
|
+
WARNING = "warning",
|
|
7
|
+
ERROR = "error",
|
|
8
|
+
CRITICAL = "critical"
|
|
9
|
+
}
|
|
10
|
+
export interface AuditLogEntry {
|
|
11
|
+
timestamp: Date;
|
|
12
|
+
severity: AuditSeverity;
|
|
13
|
+
correlationId?: string;
|
|
14
|
+
caller: {
|
|
15
|
+
sub: string;
|
|
16
|
+
type: "user" | "service" | "system";
|
|
17
|
+
serviceName?: string;
|
|
18
|
+
username?: string;
|
|
19
|
+
didId?: string;
|
|
20
|
+
};
|
|
21
|
+
onBehalfOf?: {
|
|
22
|
+
sub: string;
|
|
23
|
+
username?: string;
|
|
24
|
+
didId?: string;
|
|
25
|
+
};
|
|
26
|
+
delegationChain?: string[];
|
|
27
|
+
action: Action;
|
|
28
|
+
resource: {
|
|
29
|
+
type: Resource;
|
|
30
|
+
id?: string;
|
|
31
|
+
};
|
|
32
|
+
environment: {
|
|
33
|
+
ipAddress?: string;
|
|
34
|
+
userAgent?: string;
|
|
35
|
+
requestPath?: string;
|
|
36
|
+
requestMethod?: string;
|
|
37
|
+
};
|
|
38
|
+
result: {
|
|
39
|
+
allowed: boolean;
|
|
40
|
+
reason?: string;
|
|
41
|
+
matchedPermission?: string;
|
|
42
|
+
effectiveScope?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface AuditLogConfig {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
minSeverity: AuditSeverity;
|
|
48
|
+
logDenied: boolean;
|
|
49
|
+
logDelegated: boolean;
|
|
50
|
+
logMutations: boolean;
|
|
51
|
+
logExecute: boolean;
|
|
52
|
+
logReads: boolean;
|
|
53
|
+
sensitiveResources?: Resource[];
|
|
54
|
+
}
|
|
55
|
+
export interface AuditLogQueryParams {
|
|
56
|
+
page?: number;
|
|
57
|
+
perPage?: number;
|
|
58
|
+
orderBy?: string;
|
|
59
|
+
order?: "ASC" | "DESC";
|
|
60
|
+
severity?: AuditFilterValue<AuditSeverity>;
|
|
61
|
+
callerSub?: string;
|
|
62
|
+
callerType?: "user" | "service" | "system";
|
|
63
|
+
action?: AuditFilterValue<Action>;
|
|
64
|
+
resourceType?: AuditFilterValue<Resource | string>;
|
|
65
|
+
resultAllowed?: boolean;
|
|
66
|
+
correlationId?: string;
|
|
67
|
+
ipAddress?: string;
|
|
68
|
+
requestPath?: string;
|
|
69
|
+
from?: string;
|
|
70
|
+
to?: string;
|
|
71
|
+
search?: string;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=audit.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var AuditSeverity;
|
|
2
|
+
(function (AuditSeverity) {
|
|
3
|
+
AuditSeverity["DEBUG"] = "debug";
|
|
4
|
+
AuditSeverity["INFO"] = "info";
|
|
5
|
+
AuditSeverity["WARNING"] = "warning";
|
|
6
|
+
AuditSeverity["ERROR"] = "error";
|
|
7
|
+
AuditSeverity["CRITICAL"] = "critical";
|
|
8
|
+
})(AuditSeverity || (AuditSeverity = {}));
|
|
9
|
+
//# sourceMappingURL=audit.types.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CredentialRequirement, CredentialRequirementSet, CredentialRequirementSetCreate, RequirementEvaluation } from "./credential-requirements.dto.js";
|
|
2
|
+
export type CredentialRecord = Record<string, unknown>;
|
|
3
|
+
export interface CredentialMatchContext {
|
|
4
|
+
remoteParticipant?: string;
|
|
5
|
+
localParticipant?: string;
|
|
6
|
+
holder?: string;
|
|
7
|
+
now?: Date;
|
|
8
|
+
}
|
|
9
|
+
export interface CredentialMatchResult {
|
|
10
|
+
satisfied: boolean;
|
|
11
|
+
requirements: RequirementEvaluation[];
|
|
12
|
+
usableCredentialIds: string[];
|
|
13
|
+
missingRequirementIds: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function lintCredentialRequirementSet(requirementSet: CredentialRequirementSet | CredentialRequirementSetCreate): string[];
|
|
16
|
+
export declare function credentialMismatch(requirement: CredentialRequirement, credential: CredentialRecord, context?: CredentialMatchContext): string | undefined;
|
|
17
|
+
export declare function findCandidateCredentials(requirement: CredentialRequirement, credentials: CredentialRecord[], context?: CredentialMatchContext): CredentialRecord[];
|
|
18
|
+
export declare function matchCredentialRequirements(requirementSet: Pick<CredentialRequirementSet, "logic" | "requirements">, credentials: CredentialRecord[], context?: CredentialMatchContext): CredentialMatchResult;
|
|
19
|
+
//# sourceMappingURL=credential-requirements.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PresentationDefinition } from "./presentationdefinition.dto.js";
|
|
2
|
+
export declare class ProfileRef {
|
|
3
|
+
id: string;
|
|
4
|
+
version: string;
|
|
5
|
+
digest?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class VersionedRef {
|
|
8
|
+
id: string;
|
|
9
|
+
revision: number;
|
|
10
|
+
digest: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class CredentialClaimConstraint {
|
|
13
|
+
path: string[];
|
|
14
|
+
operator: "eq" | "in" | "exists";
|
|
15
|
+
value?: string | number | boolean | Array<string | number | boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare class CredentialRequirement {
|
|
18
|
+
id: string;
|
|
19
|
+
credentialTypes: string[];
|
|
20
|
+
acceptedIssuers?: string[];
|
|
21
|
+
holderBinding?: "required" | "not-required";
|
|
22
|
+
subjectBinding?: "remoteParticipant" | "localParticipant" | "none";
|
|
23
|
+
claimConstraints?: CredentialClaimConstraint[];
|
|
24
|
+
status?: "valid";
|
|
25
|
+
}
|
|
26
|
+
export declare class CredentialRequirementSetCreate {
|
|
27
|
+
id: string;
|
|
28
|
+
profile: ProfileRef;
|
|
29
|
+
logic: "all" | "any";
|
|
30
|
+
requirements: CredentialRequirement[];
|
|
31
|
+
}
|
|
32
|
+
export declare class CredentialRequirementSet extends CredentialRequirementSetCreate {
|
|
33
|
+
revision: number;
|
|
34
|
+
presentationDefinition: PresentationDefinition;
|
|
35
|
+
digest: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class CredentialRequirementSetPage {
|
|
38
|
+
data: CredentialRequirementSet[];
|
|
39
|
+
total: number;
|
|
40
|
+
}
|
|
41
|
+
export declare class RequirementEvaluation {
|
|
42
|
+
id: string;
|
|
43
|
+
satisfied: boolean;
|
|
44
|
+
matchedCredentialIds: string[];
|
|
45
|
+
reason?: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=credential-requirements.dto.d.ts.map
|