From 644061257583fbba5cde40e629c370083458da35 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Thu, 21 Nov 2024 07:26:53 -0800 Subject: [PATCH] fix: remove identityVerify document and tests --- .../schema/v1/wallet-contract-documents.json | 70 -------- .../test/unit/walletContract.spec.js | 164 ------------------ 2 files changed, 234 deletions(-) diff --git a/packages/wallet-contract/schema/v1/wallet-contract-documents.json b/packages/wallet-contract/schema/v1/wallet-contract-documents.json index 688c104581..7aa9dbfe95 100644 --- a/packages/wallet-contract/schema/v1/wallet-contract-documents.json +++ b/packages/wallet-contract/schema/v1/wallet-contract-documents.json @@ -51,75 +51,5 @@ "$createdAt" ], "additionalProperties": false - }, - "identityVerify": { - "documentsMutable": true, - "canBeDeleted": true, - "type": "object", - "properties": { - "normalizedLabel": { - "position": 0, - "type": "string", - "pattern": "^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-]{0,61}[a-hj-km-np-z0-9]$", - "maxLength": 63, - "description": "Domain label converted to lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'b0b'", - "$comment": "Must match a domain document to provide further information. Must be equal to the label in lowercase. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\"." - }, - "normalizedParentDomainName": { - "type": "string", - "pattern": "^$|^[a-hj-km-np-z0-9][a-hj-km-np-z0-9-\\.]{0,61}[a-hj-km-np-z0-9]$", - "minLength": 0, - "maxLength": 63, - "position": 1, - "description": "A parent domain name in lowercase for case-insensitive uniqueness validation. \"o\", \"i\" and \"l\" replaced with \"0\" and \"1\" to mitigate homograph attack. e.g. 'dash'", - "$comment": "Must either be equal to an existing domain or empty to create a top level domain. \"o\", \"i\" and \"l\" must be replaced with \"0\" and \"1\". Only the data contract owner can create top level domains." - }, - "url": { - "position": 2, - "type": "string", - "description": "The identity verification URL to be stored.", - "maxLength": 128, - "pattern": "^https?://.*", - "format": "uri" - } - }, - "indices": [ - { - "name": "ownerId", - "properties": [ - { - "$ownerId": "asc" - } - ] - }, - { - "name": "ownerId_NormDomainName_NormLabel", - "properties": [ - { - "$ownerId": "asc" - }, - { - "normalizedParentDomainName": "asc" - }, - { - "normalizedLabel": "asc" - } - ] - }, - { - "name": "uniqueUsernameIndex", - "properties": [ - { - "normalizedLabel": "asc" - } - ] - } - ], - "required": [ - "url", - "normalizedLabel", - "normalizedParentDomainName" - ], - "additionalProperties": false } } \ No newline at end of file diff --git a/packages/wallet-contract/test/unit/walletContract.spec.js b/packages/wallet-contract/test/unit/walletContract.spec.js index 922a04c7e6..f39514c423 100644 --- a/packages/wallet-contract/test/unit/walletContract.spec.js +++ b/packages/wallet-contract/test/unit/walletContract.spec.js @@ -167,169 +167,5 @@ describe('Wallet Contract', () => { .true(); }); }); - - describe('verifyIdentity', () => { - let rawIdentityVerifyDocument; - - beforeEach(async () => { - rawIdentityVerifyDocument = { - normalizedLabel: 'wa11et', // lower case and base58 chars only - normalizedParentDomainName: 'dash', - url: "https://dash.org" - }; - }); - - describe('normalizedLabel', () => { - it('should be defined', async () => { - delete rawIdentityVerifyDocument.normalizedLabel; - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('required'); - expect(error.params.missingProperty) - .to - .equal('normalizedLabel'); - }); - - it('should follow pattern', async () => { - rawIdentityVerifyDocument.normalizedLabel = 'InValiD label'; - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/normalizedLabel'); - }); - - it('should be less than 63 chars', async () => { - rawIdentityVerifyDocument.normalizedLabel = 'a'.repeat(64); - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult, 2); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/normalizedLabel'); - }); - }); - - describe('normalizedParentDomainName', () => { - it('should be defined', async () => { - delete rawIdentityVerifyDocument.normalizedParentDomainName; - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('required'); - expect(error.params.missingProperty) - .to - .equal('normalizedParentDomainName'); - }); - - it('should be less than 190 chars', async () => { - rawIdentityVerifyDocument.normalizedParentDomainName = 'a'.repeat(191); - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult, 2); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/normalizedParentDomainName'); - }); - - it('should follow pattern', async () => { - rawIdentityVerifyDocument.normalizedParentDomainName = '&'.repeat(50); - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/normalizedParentDomainName'); - }); - }); - - describe('url', () => { - it('should be defined', async () => { - delete rawIdentityVerifyDocument.url; - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('required'); - expect(error.params.missingProperty) - .to - .equal('url'); - }); - - it('should be less than 128 chars', async () => { - rawIdentityVerifyDocument.url = 'a'.repeat(129); - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult, 2); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/url'); - }); - - it('should follow pattern', async () => { - rawIdentityVerifyDocument.url = '&'.repeat(50); - - const document = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - const validationResult = document.validate(dpp.protocolVersion); - const error = expectJsonSchemaError(validationResult); - - expect(error.keyword) - .to - .equal('pattern'); - expect(error.instancePath) - .to - .equal('/url'); - }); - }); - - it('should be valid', async () => { - const domain = dpp.document.create(dataContract, identityId, 'domain', rawIdentityVerifyDocument); - - const result = await domain.validate(dpp.protocolVersion); - - expect(result.isValid()) - .to - .be - .true(); - }); - }); }); });