Skip to content

Commit

Permalink
rename rsa 2704
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvolear committed Apr 29, 2024
1 parent b003b57 commit 9b07346
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Afterwards, you will be able to use the application by calling the `Registration
Currently only a few AA verification methods are supported:

- RSA + SHA1 with 2688 encapsulated content bits
- RSA + SHA1 with 2704 encapsulated content bits
- ECDSA + SHA1 with 1704 encapsulated content bits

## License

Expand Down
2 changes: 1 addition & 1 deletion contracts/registration/PassportTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
pragma solidity 0.8.16;

bytes32 constant RSA_SHA1_2688 = keccak256("RSA_SHA1_2688");
bytes32 constant RSA_SHA1_2704 = keccak256("RSA_SHA1_2704");
bytes32 constant RSA_SHA1_2688_TIMESTAMP = keccak256("RSA_SHA1_2688_TIMESTAMP");
bytes32 constant ECDSA_SHA1_2704 = keccak256("ECDSA_SHA1_2704");
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

pragma solidity >=0.7.0 <0.9.0;

contract RSASHA12704Verifier {
contract RSASHA12688TimestampVerifier {
// Scalar field size
uint256 constant r =
21888242871839275222246405745257275088548364400416034343698204186575808495617;
Expand Down
28 changes: 15 additions & 13 deletions deploy/1_setup.migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
RSASHA1Authenticator__factory,
ECDSASHA1Authenticator__factory,
RSASHA12688Verifier__factory,
RSASHA12704Verifier__factory,
RSASHA12688TimestampVerifier__factory,
VerifierMock__factory,
} from "@ethers-v6";

import { ECDSA_SHA1_2704, RSA_SHA1_2688, RSA_SHA1_2704 } from "@/scripts/utils/passport-types";
import { ECDSA_SHA1_2704, RSA_SHA1_2688, RSA_SHA1_2688_TIMESTAMP } from "@/scripts/utils/passport-types";

const treeHeight = 80;
const tssSigner = "0x038D006846a3e203738cF80A02418e124203beb2";
Expand All @@ -28,17 +28,19 @@ const deployRSASHA12688Dispatcher = async (deployer: Deployer) => {
return dispatcher;
};

const deployRSASHA12704Dispatcher = async (deployer: Deployer) => {
const verifier = await deployer.deploy(RSASHA12704Verifier__factory);
const authenticator = await deployer.deploy(RSASHA1Authenticator__factory, { name: "RSASHA12704Authenticator" });
const dispatcher = await deployer.deploy(RSASHA1Dispatcher__factory, { name: "RSASHA12704Dispatcher" });
const deployRSASHA12688TimestampDispatcher = async (deployer: Deployer) => {
const verifier = await deployer.deploy(RSASHA12688TimestampVerifier__factory);
const authenticator = await deployer.deploy(RSASHA1Authenticator__factory, {
name: "RSASHA12688TimestampAuthenticator",
});
const dispatcher = await deployer.deploy(RSASHA1Dispatcher__factory, { name: "RSASHA12688TimestampDispatcher" });

await dispatcher.__RSASHA1Dispatcher_init(await authenticator.getAddress(), await verifier.getAddress());

return dispatcher;
};

const deployECDSASHA1Dispatcher = async (deployer: Deployer) => {
const deployECDSASHA12704Dispatcher = async (deployer: Deployer) => {
const verifier = await deployer.deploy(VerifierMock__factory);
const authenticator = await deployer.deploy(ECDSASHA1Authenticator__factory);
const dispatcher = await deployer.deploy(ECDSASHA1Dispatcher__factory);
Expand All @@ -52,21 +54,21 @@ export = async (deployer: Deployer) => {
await deployPoseidons(deployer, [1, 2, 3, 5]);

const rsaSha12688Dispatcher = await deployRSASHA12688Dispatcher(deployer);
const rsaSha12704Dispatcher = await deployRSASHA12704Dispatcher(deployer);
const ecdsaSha1Dispatcher = await deployECDSASHA1Dispatcher(deployer);
const rsaSha12688TimestampDispatcher = await deployRSASHA12688TimestampDispatcher(deployer);
const ecdsaSha12704Dispatcher = await deployECDSASHA12704Dispatcher(deployer);

const registration = await deployer.deploy(Registration__factory);

await registration.__Registration_init(treeHeight, tssSigner, icaoMasterTreeMerkleRoot);

await registration.addDispatcher(RSA_SHA1_2688, await rsaSha12688Dispatcher.getAddress());
await registration.addDispatcher(RSA_SHA1_2704, await rsaSha12704Dispatcher.getAddress());
await registration.addDispatcher(ECDSA_SHA1_2704, await ecdsaSha1Dispatcher.getAddress());
await registration.addDispatcher(RSA_SHA1_2688_TIMESTAMP, await rsaSha12688TimestampDispatcher.getAddress());
await registration.addDispatcher(ECDSA_SHA1_2704, await ecdsaSha12704Dispatcher.getAddress());

Reporter.reportContracts(
["Registration", `${await registration.getAddress()}`],
["RSASHA12688Dispatcher", `${await rsaSha12688Dispatcher.getAddress()}`],
["RSASHA12704Dispatcher", `${await rsaSha12704Dispatcher.getAddress()}`],
["ECDSASHA1Dispatcher", `${await ecdsaSha1Dispatcher.getAddress()}`],
["RSASHA12688TimestampDispatcher", `${await rsaSha12688TimestampDispatcher.getAddress()}`],
["ECDSASHA12704Dispatcher", `${await ecdsaSha12704Dispatcher.getAddress()}`],
);
};
2 changes: 1 addition & 1 deletion scripts/utils/passport-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "hardhat";

export const RSA_SHA1_2688 = ethers.solidityPackedKeccak256(["string"], ["RSA_SHA1_2688"]);
export const RSA_SHA1_2704 = ethers.solidityPackedKeccak256(["string"], ["RSA_SHA1_2704"]);
export const RSA_SHA1_2688_TIMESTAMP = ethers.solidityPackedKeccak256(["string"], ["RSA_SHA1_2688_TIMESTAMP"]);
export const ECDSA_SHA1_2704 = ethers.solidityPackedKeccak256(["string"], ["ECDSA_SHA1_2704"]);

0 comments on commit 9b07346

Please sign in to comment.