From a4b33c6cbf02902bd6bd26468935f1a6b9d08780 Mon Sep 17 00:00:00 2001 From: Doris Benda Date: Thu, 12 Sep 2024 13:35:24 +0300 Subject: [PATCH] Add legal country for set and not-set membership proofs --- packages/sdk/CHANGELOG.md | 6 ++++++ packages/sdk/src/id/idProofs.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index a0498c755..7cb0c85af 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixed + +- Add `legalCountry` as allowed attribute for set/not-set memebership proofs. + ## 8.0.1 ### Breaking changes diff --git a/packages/sdk/src/id/idProofs.ts b/packages/sdk/src/id/idProofs.ts index a357a9b2e..6625591d2 100644 --- a/packages/sdk/src/id/idProofs.ts +++ b/packages/sdk/src/id/idProofs.ts @@ -127,6 +127,11 @@ function verifySetStatement(statement: MembershipStatement | NonMembershipStatem throw new Error('idDocType values must be one from IdDocType enum'); } break; + case AttributeKeyString.legalCountry: + if (!statement.set.every(isISO3166_1Alpha2)) { + throw new Error(statement.attributeTag + ' values must be ISO3166-1 Alpha 2 codes in upper case'); + } + break; default: throw new Error(statement.attributeTag + ' is not allowed to be used in ' + typeName + ' statements'); }