diff --git a/package-lock.json b/package-lock.json index 1c7caf57..627cad04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@js-soft/docdb-access-mongo": "1.1.9", "@js-soft/node-logger": "1.2.0", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/runtime": "6.13.0", + "@nmshd/runtime": "6.16.0", "@nmshd/typescript-ioc": "^3.2.4", "@nmshd/typescript-rest": "^3.0.5", "agentkeepalive": "4.5.0", @@ -46,8 +46,8 @@ "@js-soft/eslint-config-ts": "1.6.13", "@js-soft/license-check": "1.0.9", "@nmshd/connector-sdk": "*", - "@nmshd/content": "6.13.0", - "@nmshd/core-types": "6.13.0", + "@nmshd/content": "6.16.0", + "@nmshd/core-types": "6.16.0", "@nmshd/typescript-rest-swagger": "^1.4.1", "@types/amqplib": "^0.10.6", "@types/compression": "^1.7.5", @@ -1582,7 +1582,8 @@ "node_modules/@js-soft/docdb-querytranslator": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/@js-soft/docdb-querytranslator/-/docdb-querytranslator-1.1.5.tgz", - "integrity": "sha512-VfuAWmGF3fJ/hrbvk+2CYh3p6kdqlcdUtHrOM6LK9q7lnZrVHmlnaE242fhGoUiAiKF0w5PWhUtd5/lggEb0EA==" + "integrity": "sha512-VfuAWmGF3fJ/hrbvk+2CYh3p6kdqlcdUtHrOM6LK9q7lnZrVHmlnaE242fhGoUiAiKF0w5PWhUtd5/lggEb0EA==", + "license": "MIT" }, "node_modules/@js-soft/eslint-config-ts": { "version": "1.6.13", @@ -1638,6 +1639,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/@js-soft/simple-logger/-/simple-logger-1.0.5.tgz", "integrity": "sha512-ISrOACkOKJrlxsRazXHzXC1NeVxJEqUnorwPbb74wLPUkS09IY+8QE17QUkoLhv3R7eMJrhlaUMW/ZLyCn+kWQ==", + "license": "MIT", "dependencies": { "@js-soft/logging-abstractions": "1.0.1", "json-stringify-safe": "^5.0.1", @@ -1712,37 +1714,40 @@ "link": true }, "node_modules/@nmshd/consumption": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-6.13.0.tgz", - "integrity": "sha512-fZPbj5bBumJJXEZ8/tYUsbzR7VN8GBJnqdDxVEFimNOO+PDKQG/1fSg/aT3CC+gkUKu/UoEOQ3nW4oStfxsTKg==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/@nmshd/consumption/-/consumption-6.16.0.tgz", + "integrity": "sha512-P4LSGdIE11h0zfa0Z5wAQZOhgYe/htWJ8e5a2SOpZrIOqoXv0NucH16vDdnuZipPN6+QqR5OCUI8VV4rp1J67Q==", + "license": "MIT", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.5", "@js-soft/ts-serval": "2.0.11", "@js-soft/ts-utils": "2.3.3", - "@nmshd/content": "6.13.0", - "@nmshd/core-types": "6.13.0", + "@nmshd/content": "6.16.0", + "@nmshd/core-types": "6.16.0", "@nmshd/iql": "^1.0.2", - "@nmshd/transport": "6.13.0", + "@nmshd/transport": "6.16.0", "lodash": "^4.17.21", "ts-simple-nameof": "^1.3.1" } }, "node_modules/@nmshd/content": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-6.13.0.tgz", - "integrity": "sha512-KGSsb0xgqiho4LF2S28yw5lVtEq2Jg7mvc1C/GoTSd5Hoo3/HK2DZ18nRflmMDr8TEiH5BWEbcY4X2o4bs/IyA==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/@nmshd/content/-/content-6.16.0.tgz", + "integrity": "sha512-5q3eImQi5YhJlqP5aSRNY51bAXRgHB0sd2OPVVezQp808bOvwK0+pRyPQdEIqU4wKE+vk5xsUonvzqSpzMgJWA==", + "license": "MIT", "dependencies": { "@js-soft/ts-serval": "2.0.11", - "@nmshd/core-types": "6.13.0", + "@nmshd/core-types": "6.16.0", "@nmshd/iql": "^1.0.2", "luxon": "^3.5.0", "ts-simple-nameof": "^1.3.1" } }, "node_modules/@nmshd/core-types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@nmshd/core-types/-/core-types-6.13.0.tgz", - "integrity": "sha512-YtMl6P5eGYAzZsa0obAV0xFW4gimkQSg3csEMSM3iAZ7N7G2T4L0itdS3H392ri2h1lPRDLttjOSMRTG90i9TA==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/@nmshd/core-types/-/core-types-6.16.0.tgz", + "integrity": "sha512-iU0mnAlMitzFgdfD0uafDlr2GAvb0XTY3EfAxyl7yf0YtVywu6zbLx3yQ5fdj+4H/FGq4vzMormiBkaRjCDo3g==", + "license": "MIT", "dependencies": { "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/ts-serval": "2.0.11", @@ -1754,6 +1759,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/@nmshd/crypto/-/crypto-2.1.0.tgz", "integrity": "sha512-hYpYnpSSRv7ohBxsU5lHKTTmDKTefOIjsOPCtA1cYIAMWDwbQA9kuLBYzXLN/vP0oLU7zI+s+/OTOOF702AnQQ==", + "license": "MIT", "dependencies": { "libsodium-wrappers-sumo": "0.7.15", "uuid": "10.0.0" @@ -1766,20 +1772,21 @@ "license": "MIT" }, "node_modules/@nmshd/runtime": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-6.13.0.tgz", - "integrity": "sha512-Qy4BPGIt9TwMteY6NLAOlutCwtS1E+u5kMN9SxPvduJ73j8GmA36iZpXtrypRZB006BzHK3CxjzEuVCwICNM+g==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/@nmshd/runtime/-/runtime-6.16.0.tgz", + "integrity": "sha512-LKFUfYC1+YzMgZDLgRpLADUd27GlAjUU+4b5vj8mQvRpBAykHT7dmp79L6Y9uEpG5iGKB03ue5X93tmOCvK3BA==", + "license": "MIT", "dependencies": { "@js-soft/docdb-querytranslator": "^1.1.5", "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/ts-serval": "2.0.11", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/consumption": "6.13.0", - "@nmshd/content": "6.13.0", - "@nmshd/core-types": "6.13.0", + "@nmshd/consumption": "6.16.0", + "@nmshd/content": "6.16.0", + "@nmshd/core-types": "6.16.0", "@nmshd/crypto": "2.1.0", "@nmshd/iql": "^1.0.2", - "@nmshd/transport": "6.13.0", + "@nmshd/transport": "6.16.0", "@nmshd/typescript-ioc": "3.2.4", "ajv": "^8.17.1", "ajv-errors": "^3.0.0", @@ -1793,20 +1800,21 @@ } }, "node_modules/@nmshd/transport": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-6.13.0.tgz", - "integrity": "sha512-Fdz5ZF783DaUKFYk21bXjjbNe0k+4UnWyX9tukbGWtwMO8HrPZqkeG17ldGpJ0ehwzPcpYKXl3j0lmNM/P0zWQ==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/@nmshd/transport/-/transport-6.16.0.tgz", + "integrity": "sha512-KUcU37KNwVY5qbDMBLWaLL+ML++oqidXg2kPPuSQRCpkQiDUf1SVfic34rHsQM+ent4bT7AZIG50EfgirwWxBg==", + "license": "MIT", "dependencies": { "@js-soft/docdb-access-abstractions": "1.0.4", "@js-soft/logging-abstractions": "^1.0.1", "@js-soft/simple-logger": "1.0.5", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/core-types": "6.13.0", + "@nmshd/core-types": "6.16.0", "@nmshd/crypto": "2.1.0", - "axios": "^1.7.8", + "axios": "^1.7.9", "fast-json-patch": "^3.1.1", "form-data": "^4.0.1", - "https-proxy-agent": "^7.0.5", + "https-proxy-agent": "^7.0.6", "json-stringify-safe": "^5.0.1", "lodash": "^4.17.21", "luxon": "^3.5.0", @@ -1824,6 +1832,7 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/esm/bin/uuid" } @@ -3414,13 +3423,10 @@ } }, "node_modules/agent-base": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", - "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, "engines": { "node": ">= 14" } @@ -7149,12 +7155,12 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", - "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "license": "MIT", "dependencies": { - "agent-base": "^7.0.2", + "agent-base": "^7.1.2", "debug": "4" }, "engines": { @@ -8798,12 +8804,14 @@ "node_modules/libsodium-sumo": { "version": "0.7.15", "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.15.tgz", - "integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==" + "integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==", + "license": "ISC" }, "node_modules/libsodium-wrappers-sumo": { "version": "0.7.15", "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.15.tgz", "integrity": "sha512-aSWY8wKDZh5TC7rMvEdTHoyppVq/1dTSAeAR7H6pzd6QRT3vQWcT5pGwCotLcpPEOLXX6VvqihSPkpEhYAjANA==", + "license": "ISC", "dependencies": { "libsodium-sumo": "^0.7.15" } @@ -13172,12 +13180,14 @@ "node_modules/typescript-logging": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typescript-logging/-/typescript-logging-2.2.0.tgz", - "integrity": "sha512-mPKFGAgGJmeCqrzA6B64Lqoz6vLPtxa8yCd7sWAnfrz9opuNlxqW57VxjtEOL0OOoQeTdc/kBjGUh8sieBXa8A==" + "integrity": "sha512-mPKFGAgGJmeCqrzA6B64Lqoz6vLPtxa8yCd7sWAnfrz9opuNlxqW57VxjtEOL0OOoQeTdc/kBjGUh8sieBXa8A==", + "license": "Apache-2.0" }, "node_modules/typescript-logging-log4ts-style": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typescript-logging-log4ts-style/-/typescript-logging-log4ts-style-2.2.0.tgz", "integrity": "sha512-NP8uoFVoNJkhH6iOM1Y8+/RVFoSPCxLe/kgdxQ0uJNhUJh4CLp7CuMIh/njC9mzK0wdq2DgSJcmlzkqnRXx1Eg==", + "license": "Apache-2.0", "peerDependencies": { "typescript-logging": "~2.2.0" } @@ -13325,6 +13335,7 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -13845,7 +13856,7 @@ "name": "@nmshd/connector-sdk", "license": "MIT", "dependencies": { - "@nmshd/content": "6.13.0", + "@nmshd/content": "6.16.0", "axios": "^1.7.9", "form-data": "^4.0.1", "qs": "^6.13.1" diff --git a/package.json b/package.json index d0f02c05..f4c1af30 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "@js-soft/docdb-access-mongo": "1.1.9", "@js-soft/node-logger": "1.2.0", "@js-soft/ts-utils": "^2.3.3", - "@nmshd/runtime": "6.13.0", + "@nmshd/runtime": "6.16.0", "@nmshd/typescript-ioc": "^3.2.4", "@nmshd/typescript-rest": "^3.0.5", "agentkeepalive": "4.5.0", @@ -113,8 +113,8 @@ "@js-soft/eslint-config-ts": "1.6.13", "@js-soft/license-check": "1.0.9", "@nmshd/connector-sdk": "*", - "@nmshd/content": "6.13.0", - "@nmshd/core-types": "6.13.0", + "@nmshd/content": "6.16.0", + "@nmshd/core-types": "6.16.0", "@nmshd/typescript-rest-swagger": "^1.4.1", "@types/amqplib": "^0.10.6", "@types/compression": "^1.7.5", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 482b0dad..d478a472 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -30,7 +30,7 @@ "build:schemas:watch": "npx nodemon -e ts -w 'src/types' --exec 'npm run build:schemas'" }, "dependencies": { - "@nmshd/content": "6.13.0", + "@nmshd/content": "6.16.0", "axios": "^1.7.9", "form-data": "^4.0.1", "qs": "^6.13.1" diff --git a/packages/sdk/src/types/relationshipTemplates/requests/GetOwnRelationshipTemplatesRequest.ts b/packages/sdk/src/types/relationshipTemplates/requests/GetOwnRelationshipTemplatesRequest.ts index bc683db4..3af87cc4 100644 --- a/packages/sdk/src/types/relationshipTemplates/requests/GetOwnRelationshipTemplatesRequest.ts +++ b/packages/sdk/src/types/relationshipTemplates/requests/GetOwnRelationshipTemplatesRequest.ts @@ -4,4 +4,7 @@ export interface GetOwnTemplatesRequest { createdByDevice?: string | string[]; maxNumberOfAllocations?: number | number[]; forIdentity?: string | string[]; + passwordProtection?: "" | "!"; + "passwordProtection.password"?: string | string[]; + "passwordProtection.passwordIsPin"?: "true" | "!"; } diff --git a/packages/sdk/src/types/relationshipTemplates/requests/GetPeerRelationshipTemplatesRequest.ts b/packages/sdk/src/types/relationshipTemplates/requests/GetPeerRelationshipTemplatesRequest.ts index a1bfd834..cab31c78 100644 --- a/packages/sdk/src/types/relationshipTemplates/requests/GetPeerRelationshipTemplatesRequest.ts +++ b/packages/sdk/src/types/relationshipTemplates/requests/GetPeerRelationshipTemplatesRequest.ts @@ -4,4 +4,7 @@ export interface GetPeerRelationshipTemplatesRequest { createdBy?: string | string[]; maxNumberOfAllocations?: number | number[]; forIdentity?: string; + passwordProtection?: "" | "!"; + "passwordProtection.password"?: string | string[]; + "passwordProtection.passwordIsPin"?: "true" | "!"; } diff --git a/packages/sdk/src/types/relationshipTemplates/requests/GetRelationshipTemplatesRequest.ts b/packages/sdk/src/types/relationshipTemplates/requests/GetRelationshipTemplatesRequest.ts index db525988..88793228 100644 --- a/packages/sdk/src/types/relationshipTemplates/requests/GetRelationshipTemplatesRequest.ts +++ b/packages/sdk/src/types/relationshipTemplates/requests/GetRelationshipTemplatesRequest.ts @@ -5,5 +5,8 @@ export interface GetRelationshipTemplatesRequest { createdByDevice?: string | string[]; maxNumberOfAllocations?: number | number[]; forIdentity?: string | string[]; + passwordProtection?: "" | "!"; + "passwordProtection.password"?: string | string[]; + "passwordProtection.passwordIsPin"?: "true" | "!"; isOwn?: boolean | boolean[]; } diff --git a/packages/sdk/src/types/tokens/requests/GetOwnTokensRequest.ts b/packages/sdk/src/types/tokens/requests/GetOwnTokensRequest.ts index e28f426e..562df8bc 100644 --- a/packages/sdk/src/types/tokens/requests/GetOwnTokensRequest.ts +++ b/packages/sdk/src/types/tokens/requests/GetOwnTokensRequest.ts @@ -3,4 +3,7 @@ export interface GetOwnTokensRequest { createdByDevice?: string | string[]; expiresAt?: string | string[]; forIdentity?: string | string[]; + passwordProtection?: "" | "!"; + "passwordProtection.password"?: string | string[]; + "passwordProtection.passwordIsPin"?: "true" | "!"; } diff --git a/packages/sdk/src/types/tokens/requests/GetPeerTokensRequest.ts b/packages/sdk/src/types/tokens/requests/GetPeerTokensRequest.ts index 8a9b063f..fa4de3b9 100644 --- a/packages/sdk/src/types/tokens/requests/GetPeerTokensRequest.ts +++ b/packages/sdk/src/types/tokens/requests/GetPeerTokensRequest.ts @@ -3,4 +3,7 @@ export interface GetPeerTokensRequest { createdBy?: string | string[]; expiresAt?: string | string[]; forIdentity?: string; + passwordProtection?: "" | "!"; + "passwordProtection.password"?: string | string[]; + "passwordProtection.passwordIsPin"?: "true" | "!"; } diff --git a/src/modules/coreHttpApi/openapi.yml b/src/modules/coreHttpApi/openapi.yml index 98a2bd92..26445fd8 100644 --- a/src/modules/coreHttpApi/openapi.yml +++ b/src/modules/coreHttpApi/openapi.yml @@ -3235,6 +3235,18 @@ paths: name: forIdentity schema: $ref: "#/components/schemas/IdFilter" + - in: query + name: passwordProtection + schema: + $ref: "#/components/schemas/ExistenceFilter" + - in: query + name: passwordProtection.password + schema: + $ref: "#/components/schemas/TextFilter" + - in: query + name: passwordProtection.passwordIsPin + schema: + $ref: "#/components/schemas/PartialBooleanFilter" - in: query name: isOwn schema: @@ -3364,6 +3376,18 @@ paths: name: forIdentity schema: $ref: "#/components/schemas/IdFilter" + - in: query + name: passwordProtection + schema: + $ref: "#/components/schemas/ExistenceFilter" + - in: query + name: passwordProtection.password + schema: + $ref: "#/components/schemas/TextFilter" + - in: query + name: passwordProtection.passwordIsPin + schema: + $ref: "#/components/schemas/PartialBooleanFilter" responses: 200: description: Success @@ -3467,6 +3491,18 @@ paths: name: forIdentity schema: $ref: "#/components/schemas/IdFilter" + - in: query + name: passwordProtection + schema: + $ref: "#/components/schemas/ExistenceFilter" + - in: query + name: passwordProtection.password + schema: + $ref: "#/components/schemas/TextFilter" + - in: query + name: passwordProtection.passwordIsPin + schema: + $ref: "#/components/schemas/PartialBooleanFilter" responses: 200: description: Success @@ -4225,6 +4261,18 @@ paths: name: forIdentity schema: $ref: "#/components/schemas/IdFilter" + - in: query + name: passwordProtection + schema: + $ref: "#/components/schemas/ExistenceFilter" + - in: query + name: passwordProtection.password + schema: + $ref: "#/components/schemas/TextFilter" + - in: query + name: passwordProtection.passwordIsPin + schema: + $ref: "#/components/schemas/PartialBooleanFilter" responses: 200: description: Success @@ -4326,6 +4374,18 @@ paths: name: forIdentity schema: $ref: "#/components/schemas/IdFilter" + - in: query + name: passwordProtection + schema: + $ref: "#/components/schemas/ExistenceFilter" + - in: query + name: passwordProtection.password + schema: + $ref: "#/components/schemas/TextFilter" + - in: query + name: passwordProtection.passwordIsPin + schema: + $ref: "#/components/schemas/PartialBooleanFilter" responses: 200: description: Success @@ -4571,16 +4631,58 @@ components:
* Due to limitations of Swagger UI, this feature cannot be tested in Swagger UI. Use a REST Client instead (e.g. Postman).
+ PartialBooleanFilter: + type: string + description: > +Filters for a boolean that's either true or undefined. +
The following operators are supported:
+Operation | +Example | +
---|---|
is true | +?foo=true | +
is undefined | +?foo=! | +
* Due to limitations of Swagger UI, this feature cannot be tested in Swagger UI. Use a REST Client instead (e.g. Postman).
+ + ExistenceFilter: + type: string + description: > +Filters for whether a property exists, i. e. is not undefined. +
The following operators are supported:
+Operation | +Example | +
---|---|
exists | +?foo= | +
doesn't exist | +?foo=! | +
* Due to limitations of Swagger UI, this feature cannot be tested in Swagger UI. Use a REST Client instead (e.g. Postman).
+ NumberFilter: type: string description: > diff --git a/test/relationshipTemplates.test.ts b/test/relationshipTemplates.test.ts index 851d27ba..bc3d3dc6 100644 --- a/test/relationshipTemplates.test.ts +++ b/test/relationshipTemplates.test.ts @@ -225,7 +225,7 @@ describe("Serialization Errors", () => { describe("RelationshipTemplates Query", () => { test("query templates", async () => { - const template = await createTemplate(client1, (await client1.account.getIdentityInfo()).result.address); + const template = await createTemplate(client1, (await client1.account.getIdentityInfo()).result.address, { password: "password" }); const conditions = new QueryParamConditions(template, client1) .addBooleanSet("isOwn") .addDateSet("createdAt") @@ -233,20 +233,52 @@ describe("RelationshipTemplates Query", () => { .addStringSet("createdBy") .addStringSet("createdByDevice") .addNumberSet("maxNumberOfAllocations") - .addStringSet("forIdentity"); + .addStringSet("forIdentity") + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection", + value: "" + }) + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection", + value: "!" + }) + .addStringSet("passwordProtection.password") + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection.passwordIsPin", + value: "true" + }) + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection.passwordIsPin", + value: "!" + }); await conditions.executeTests((c, q) => c.relationshipTemplates.getRelationshipTemplates(q), ValidationSchema.RelationshipTemplates); }); test("query own templates", async () => { - const template = await createTemplate(client1, (await client1.account.getIdentityInfo()).result.address); + const template = await createTemplate(client1, (await client1.account.getIdentityInfo()).result.address, { password: "1234", passwordIsPin: true }); const conditions = new QueryParamConditions(template, client1) .addDateSet("createdAt") .addDateSet("expiresAt") .addStringSet("createdBy") .addStringSet("createdByDevice") .addNumberSet("maxNumberOfAllocations") - .addStringSet("forIdentity"); + .addStringSet("forIdentity") + .addStringSet("passwordProtection.password") + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection.passwordIsPin", + value: "true" + }) + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection.passwordIsPin", + value: "!" + }); await conditions.executeTests((c, q) => c.relationshipTemplates.getOwnRelationshipTemplates(q), ValidationSchema.RelationshipTemplates); }); @@ -258,7 +290,17 @@ describe("RelationshipTemplates Query", () => { .addStringSet("createdBy") .addStringSet("createdByDevice") .addNumberSet("maxNumberOfAllocations") - .addStringSet("forIdentity"); + .addStringSet("forIdentity") + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection", + value: "" + }) + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection", + value: "!" + }); await conditions.executeTests((c, q) => c.relationshipTemplates.getPeerRelationshipTemplates(q), ValidationSchema.RelationshipTemplates); }); diff --git a/test/tokens.test.ts b/test/tokens.test.ts index 8b8c147c..e3c35fa0 100644 --- a/test/tokens.test.ts +++ b/test/tokens.test.ts @@ -72,14 +72,70 @@ test("send and receive a PIN-protected token", async () => { describe("Tokens query", () => { test("query own tokens", async () => { - const token = await uploadOwnToken(client1, (await client1.account.getIdentityInfo()).result.address); - const conditions = new QueryParamConditions(token, client1).addDateSet("expiresAt").addDateSet("createdAt").addStringSet("createdByDevice").addStringSet("forIdentity"); + const token = await uploadOwnToken(client1, (await client1.account.getIdentityInfo()).result.address, { password: "password" }); + const conditions = new QueryParamConditions(token, client1) + .addDateSet("expiresAt") + .addDateSet("createdAt") + .addStringSet("createdByDevice") + .addStringSet("forIdentity") + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection", + value: "" + }) + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection", + value: "!" + }) + .addStringSet("passwordProtection.password") + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection.passwordIsPin", + value: "true" + }) + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection.passwordIsPin", + value: "!" + }); + await conditions.executeTests((c, q) => c.tokens.getOwnTokens(q), ValidationSchema.Tokens); + }); + + test("query own PIN-protected tokens", async () => { + const token = await uploadOwnToken(client1, (await client1.account.getIdentityInfo()).result.address, { password: "1234", passwordIsPin: true }); + const conditions = new QueryParamConditions(token, client1) + .addStringSet("passwordProtection.password") + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection.passwordIsPin", + value: "true" + }) + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection.passwordIsPin", + value: "!" + }); await conditions.executeTests((c, q) => c.tokens.getOwnTokens(q), ValidationSchema.Tokens); }); test("query peer tokens", async () => { const token = await exchangeToken(client1, client2, (await client2.account.getIdentityInfo()).result.address); - const conditions = new QueryParamConditions(token, client2).addDateSet("expiresAt").addDateSet("createdAt").addStringSet("createdBy").addStringSet("forIdentity"); + const conditions = new QueryParamConditions(token, client2) + .addDateSet("expiresAt") + .addDateSet("createdAt") + .addStringSet("createdBy") + .addStringSet("forIdentity") + .addSingleCondition({ + expectedResult: false, + key: "passwordProtection", + value: "" + }) + .addSingleCondition({ + expectedResult: true, + key: "passwordProtection", + value: "!" + }); await conditions.executeTests((c, q) => c.tokens.getPeerTokens(q), ValidationSchema.Tokens); }); });