diff --git a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_isDKIMPublicKeyHashValid.t.sol b/packages/contracts/test/utils/JwtRegistry/JwtRegistry_isDKIMPublicKeyHashValid.t.sol deleted file mode 100644 index f7980730..00000000 --- a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_isDKIMPublicKeyHashValid.t.sol +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.12; - -import "forge-std/Test.sol"; -import "forge-std/console.sol"; -import {EmailAuth, EmailAuthMsg} from "../../../src/EmailAuth.sol"; -import {RecoveryController} from "../../helpers/RecoveryController.sol"; -import {StructHelper} from "../../helpers/StructHelper.sol"; -import {SimpleWallet} from "../../helpers/SimpleWallet.sol"; -import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; - -contract JwtRegistryTest_isDKIMPublicKeyHashValid is StructHelper { - constructor() {} - - function setUp() public override { - super.setUp(); - } - - function testFail_isDKIMPublicKeyHashValid_invalidKid() public { - string memory domainName = "54321|https://example.com|client-id-12345"; - bool res = jwtRegistry.isDKIMPublicKeyHashValid( - domainName, - publicKeyHash - ); - assertEq(res, true); - } - - function testFail_isDKIMPublicKeyHashValid_invalidIss() public { - string memory domainName = "12345|https://example.xyz|client-id-12345"; - bool res = jwtRegistry.isDKIMPublicKeyHashValid( - domainName, - publicKeyHash - ); - assertEq(res, true); - } - - function testFail_isDKIMPublicKeyHashValid_invalidAzp() public { - string memory domainName = "12345|https://example.com|client-id-54321"; - bool res = jwtRegistry.isDKIMPublicKeyHashValid( - domainName, - publicKeyHash - ); - assertEq(res, true); - } - - function test_isDKIMPublicKeyHashValid() public { - string memory domainName = "12345|https://example.com|client-id-12345"; - bool res = jwtRegistry.isDKIMPublicKeyHashValid( - domainName, - publicKeyHash - ); - assertEq(res, true); - } -} diff --git a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_revokeDKIMPublicKeyHash.t.sol b/packages/contracts/test/utils/JwtRegistry/JwtRegistry_revokeDKIMPublicKeyHash.t.sol deleted file mode 100644 index b9dfe176..00000000 --- a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_revokeDKIMPublicKeyHash.t.sol +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.12; - -import "forge-std/Test.sol"; -import "forge-std/console.sol"; -import {EmailAuth, EmailAuthMsg} from "../../../src/EmailAuth.sol"; -import {RecoveryController} from "../../helpers/RecoveryController.sol"; -import {StructHelper} from "../../helpers/StructHelper.sol"; -import {SimpleWallet} from "../../helpers/SimpleWallet.sol"; -import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import "@zk-email/contracts/DKIMRegistry.sol"; - -contract JwtRegistryTest_revokeDKIMPublicKeyHash is StructHelper { - constructor() {} - - function setUp() public override { - super.setUp(); - } - - function testRevert_revokeDKIMPublicKeyHash_invalidDomainName() public { - string memory domainName = ""; - vm.expectRevert(bytes("Invalid domain name")); - jwtRegistry.revokeDKIMPublicKeyHash(domainName, publicKeyHash); - } - - function testRevert_revokeDKIMPublicKeyHash_invalidPublicKeyHash() public { - string memory domainName = "12345|https://example.com|client-id-12345"; - vm.expectRevert(bytes("Invalid public key hash")); - jwtRegistry.revokeDKIMPublicKeyHash(domainName, bytes32(0)); - } - - function testRevert_revokeDKIMPublicKeyHash_publicKeyHashIsNotSet() public { - string memory domainName = "54321|https://example.com|client-id-12345"; - vm.expectRevert(bytes("publicKeyHash is not set")); - jwtRegistry.revokeDKIMPublicKeyHash(domainName, publicKeyHash); - } - - function test_revokeDKIMPublicKeyHash() public { - string memory domainName = "12345|https://example.com|client-id-12345"; - jwtRegistry.revokeDKIMPublicKeyHash(domainName, publicKeyHash); - assertEq(jwtRegistry.whitelistedClients("client-id-12345"), false); - } -} diff --git a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_setDKIMPublicKeyHash.t.sol b/packages/contracts/test/utils/JwtRegistry/JwtRegistry_setDKIMPublicKeyHash.t.sol deleted file mode 100644 index 07c92f07..00000000 --- a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_setDKIMPublicKeyHash.t.sol +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.12; - -import "forge-std/Test.sol"; -import "forge-std/console.sol"; -import {EmailAuth, EmailAuthMsg} from "../../../src/EmailAuth.sol"; -import {RecoveryController} from "../../helpers/RecoveryController.sol"; -import {StructHelper} from "../../helpers/StructHelper.sol"; -import {SimpleWallet} from "../../helpers/SimpleWallet.sol"; -import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; -import "@zk-email/contracts/DKIMRegistry.sol"; - -contract JwtRegistryTest_setDKIMPublicKeyHash is StructHelper { - constructor() {} - - function setUp() public override { - super.setUp(); - } - - function testRevert_setDKIMPublicKeyHash_publicKeyHashIsAlreadySet() - public - { - string memory domainName = "12345|https://example.com|client-id-12345"; - vm.expectRevert(bytes("publicKeyHash is already set")); - jwtRegistry.setDKIMPublicKeyHash(domainName, publicKeyHash); - } - - function testRevert_setDKIMPublicKeyHash_publicKeyHashIsRevoked() public { - string memory domainName = "12345|https://example.com|client-id-12345"; - jwtRegistry.revokeDKIMPublicKeyHash(domainName, publicKeyHash); - vm.expectRevert(bytes("publicKeyHash is revoked")); - jwtRegistry.setDKIMPublicKeyHash(domainName, publicKeyHash); - } - - function test_setDKIMPublicKeyHash() public { - string memory domainName = "12345|https://example.xyz|client-id-12345"; - jwtRegistry.setDKIMPublicKeyHash(domainName, publicKeyHash); - assertEq(jwtRegistry.whitelistedClients("client-id-12345"), true); - } -} diff --git a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_stringToArray.t.sol b/packages/contracts/test/utils/JwtRegistry/JwtRegistry_stringToArray.t.sol deleted file mode 100644 index 5a995646..00000000 --- a/packages/contracts/test/utils/JwtRegistry/JwtRegistry_stringToArray.t.sol +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.12; - -import "forge-std/Test.sol"; -import "forge-std/console.sol"; -import {EmailAuth, EmailAuthMsg} from "../../../src/EmailAuth.sol"; -import {RecoveryController} from "../../helpers/RecoveryController.sol"; -import {StructHelper} from "../../helpers/StructHelper.sol"; -import {SimpleWallet} from "../../helpers/SimpleWallet.sol"; -import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; - -contract JwtRegistryTest_stringToArray is StructHelper { - constructor() {} - - function setUp() public override { - super.setUp(); - } - - function test_stringToArray() public { - string[] memory points = jwtRegistry.stringToArray("12345|https://example.com|client-id-12345"); - assertEq(points[0], "12345"); - assertEq(points[1], "https://example.com"); - assertEq(points[2], "client-id-12345"); - } -} \ No newline at end of file