Update/contract sdk (#61)

This commit is contained in:
nicoshark
2025-02-11 00:17:13 +09:00
committed by GitHub
parent a23d40718b
commit 03b5428d92
25 changed files with 2986 additions and 4051 deletions

BIN
common/bun.lockb Executable file

Binary file not shown.

View File

@@ -32,6 +32,7 @@
"path": "^0.12.7",
"pkijs": "^3.2.4",
"poseidon-lite": "^0.2.0",
"snarkjs": "^0.7.5",
"ts-mocha": "^10.0.0",
"typescript-parser": "^2.6.1"
},

View File

@@ -152,6 +152,37 @@ export const circuitToSelectorMode = {
prove_offchain: [1, 1],
};
export const revealedDataTypes = {
'issuing_state': 0,
'name': 1,
'passport_number': 2,
'nationality': 3,
'date_of_birth': 4,
'gender': 5,
'expiry_date': 6,
'older_than': 7,
'ofac': 8,
}
export const CIRCUIT_CONSTANTS = {
REGISTER_NULLIFIER_INDEX: 0,
REGISTER_COMMITMENT_INDEX: 1,
REGISTER_MERKLE_ROOT_INDEX: 2,
DSC_TREE_LEAF_INDEX: 0,
DSC_CSCA_ROOT_INDEX: 1,
VC_AND_DISCLOSE_REVEALED_DATA_PACKED_INDEX: 0,
VC_AND_DISCLOSE_FORBIDDEN_COUNTRIES_LIST_PACKED_INDEX: 3,
VC_AND_DISCLOSE_NULLIFIER_INDEX: 4,
VC_AND_DISCLOSE_ATTESTATION_ID_INDEX: 5,
VC_AND_DISCLOSE_MERKLE_ROOT_INDEX: 6,
VC_AND_DISCLOSE_CURRENT_DATE_INDEX: 7,
VC_AND_DISCLOSE_SMT_ROOT_INDEX: 13,
VC_AND_DISCLOSE_SCOPE_INDEX: 14,
VC_AND_DISCLOSE_USER_IDENTIFIER_INDEX: 15,
}
export const MAX_BYTES_IN_FIELD = 31;
export const MAX_PUBKEY_DSC_BYTES = 525;

View File

@@ -1,12 +1,10 @@
import { UserIdType } from "./circuits/uuid";
export type CircuitName = 'prove' | 'disclose';
export type CircuitMode = 'prove_onchain' | 'register' | 'prove_offchain';
export type CircuitName = 'disclose';
export type Mode = 'prove_offchain' | 'prove_onchain' | 'register' | 'vc_and_disclose' | 'dsc';
// OpenPassportAppType
export interface OpenPassportAppPartial {
mode: Mode;
export interface SelfAppPartial {
appName: string;
scope: string;
websocketUrl: string;
@@ -16,7 +14,7 @@ export interface OpenPassportAppPartial {
devMode: boolean;
}
export interface OpenPassportApp extends OpenPassportAppPartial {
export interface SelfApp extends SelfAppPartial {
args: ArgumentsProveOffChain | ArgumentsProveOnChain | ArgumentsRegister | ArgumentsDisclose;
}
@@ -38,7 +36,6 @@ export interface ArgumentsRegister {
export interface ArgumentsDisclose {
disclosureOptions: DisclosureOptions;
commitmentMerkleTreeUrl: string;
}
export interface DisclosureOptions {

View File

@@ -3,9 +3,9 @@ import { DisclosureOptions } from '../appType';
/*** OpenPassport Attestation ***/
export function formatForbiddenCountriesListFromCircuitOutput(
forbiddenCountriesList: string[]
forbiddenCountriesList: string
): string[] {
const countryList1 = unpackReveal(forbiddenCountriesList[0]);
const countryList1 = unpackReveal(forbiddenCountriesList);
// dump every '\x00' value from the list
const cleanedCountryList = countryList1.filter((value) => value !== '\x00');
// Concatenate every 3 elements to form country codes

View File

@@ -1,372 +0,0 @@
import { ECDSA_K_LENGTH_FACTOR, k_dsc, k_dsc_ecdsa } from '../constants/constants';
import { Mode } from 'fs';
import { bigIntToHex, castToScope, castToUUID, UserIdType } from './circuits/uuid';
import { formatForbiddenCountriesListFromCircuitOutput, getAttributeFromUnpackedReveal } from './circuits/formatOutputs';
import { unpackReveal } from './circuits/formatOutputs';
export interface OpenPassportAttestation {
'@context': string[];
type: string[];
issuer: string;
issuanceDate: string;
credentialSubject: {
userId: string;
application: string;
scope?: string;
merkle_root?: string;
attestation_id?: string;
current_date?: string;
issuing_state?: string;
name?: string;
passport_number?: string;
nationality?: string;
date_of_birth?: string;
gender?: string;
expiry_date?: string;
older_than?: string;
owner_of?: string;
pubKey?: string[];
valid?: boolean;
nullifier?: string;
blinded_dsc_commitment?: string;
};
proof: {
mode: Mode;
signatureAlgorithm: string;
hashFunction: string;
type: string;
verificationMethod: string;
value: {
proof: string[];
publicSignals: string[];
};
vkey: string;
};
dscProof: {
signatureAlgorithm: string;
hashFunction: string;
type: string;
verificationMethod: string;
value: {
proof: string[];
publicSignals: string[];
};
vkey: string;
};
dsc: {
type: string;
value: string;
encoding: string;
};
}
export function buildAttestation(options: {
userIdType: UserIdType;
mode: Mode;
proof: string[];
publicSignals: string[];
signatureAlgorithm: string;
hashFunction: string;
dscProof?: string[];
dscPublicSignals?: string[];
signatureAlgorithmDsc?: string;
hashFunctionDsc?: string;
dsc?: string;
}): OpenPassportDynamicAttestation {
const {
mode,
proof,
publicSignals,
signatureAlgorithm,
hashFunction,
dscProof = [],
dscPublicSignals = [],
signatureAlgorithmDsc = '',
hashFunctionDsc = '',
dsc = '',
userIdType,
} = options;
let kScaled: number;
switch (signatureAlgorithm) {
case 'ecdsa':
kScaled = ECDSA_K_LENGTH_FACTOR * k_dsc_ecdsa;
break;
default:
kScaled = k_dsc;
}
let parsedPublicSignals;
switch (mode) {
case 'vc_and_disclose':
parsedPublicSignals = parsePublicSignalsDisclose(publicSignals);
break;
default:
parsedPublicSignals = parsePublicSignalsProve(publicSignals, kScaled);
}
const rawUserId = parsedPublicSignals.user_identifier;
let userId: string;
switch (userIdType) {
case 'ascii':
userId = castToScope(BigInt(rawUserId));
break;
case 'hex':
userId = bigIntToHex(BigInt(rawUserId));
break;
case 'uuid':
userId = castToUUID(BigInt(rawUserId));
break;
default:
userId = rawUserId;
}
const scope = castToScope(BigInt(parsedPublicSignals.scope));
// Unpack the revealed data
const unpackedReveal = unpackReveal(parsedPublicSignals.revealedData_packed);
const attributeNames = [
'issuing_state',
'name',
'passport_number',
'nationality',
'date_of_birth',
'gender',
'expiry_date',
'older_than',
];
const formattedCountryList = formatForbiddenCountriesListFromCircuitOutput(
parsedPublicSignals.forbidden_countries_list_packed_disclosed
);
const credentialSubject: any = {
userId: userId,
application: scope,
nullifier: bigIntToHex(BigInt(parsedPublicSignals.nullifier)),
scope: scope,
current_date: parsedPublicSignals.current_date.toString(),
blinded_dsc_commitment: parsedPublicSignals.blinded_dsc_commitment ?? '',
not_in_ofac_list: parsedPublicSignals.ofac_result.toString(),
not_in_countries: formattedCountryList,
};
attributeNames.forEach((attrName) => {
const value = getAttributeFromUnpackedReveal(unpackedReveal, attrName);
if (value !== undefined && value !== null) {
credentialSubject[attrName] = value;
}
});
// Include pubKey if needed
credentialSubject.pubKey = parsedPublicSignals.pubKey_disclosed ?? [];
const attestation: OpenPassportAttestation = {
'@context': ['https://www.w3.org/2018/credentials/v1', 'https://openpassport.app'],
type: ['OpenPassportAttestation', 'PassportCredential'],
issuer: 'https://openpassport.app',
issuanceDate: new Date().toISOString(),
credentialSubject: credentialSubject,
proof: {
mode: mode,
signatureAlgorithm: signatureAlgorithm,
hashFunction: hashFunction,
type: 'ZeroKnowledgeProof',
verificationMethod: 'https://github.com/zk-passport/openpassport',
value: {
proof: proof,
publicSignals: publicSignals,
},
vkey: 'https://github.com/zk-passport/openpassport/blob/main/common/src/constants/vkey.ts',
},
dscProof: {
signatureAlgorithm: signatureAlgorithmDsc,
hashFunction: hashFunctionDsc,
type: 'ZeroKnowledgeProof',
verificationMethod: 'https://github.com/zk-passport/openpassport',
value: {
proof: dscProof || [],
publicSignals: dscPublicSignals || [],
},
vkey: 'https://github.com/zk-passport/openpassport/blob/main/common/src/constants/vkey.ts',
},
dsc: {
type: 'X509Certificate',
value: dsc || '',
encoding: 'PEM',
},
};
// Return an instance of OpenPassportDynamicAttestation
return new OpenPassportDynamicAttestation(attestation, userIdType);
}
// New OpenPassportDynamicAttestation class extending OpenPassportAttestation
export class OpenPassportDynamicAttestation implements OpenPassportAttestation {
'@context': string[];
type: string[];
issuer: string;
issuanceDate: string;
credentialSubject: {
userId: string;
application: string;
scope?: string;
merkle_root?: string;
attestation_id?: string;
current_date?: string;
issuing_state?: string;
name?: string;
passport_number?: string;
nationality?: string;
date_of_birth?: string;
gender?: string;
expiry_date?: string;
older_than?: string;
owner_of?: string;
pubKey?: string[];
valid?: boolean;
nullifier?: string;
};
proof: {
mode: Mode;
signatureAlgorithm: string;
hashFunction: string;
type: string;
verificationMethod: string;
value: {
proof: string[];
publicSignals: string[];
};
vkey;
};
dscProof: {
signatureAlgorithm: string;
hashFunction: string;
type: string;
verificationMethod: string;
value: {
proof: string[];
publicSignals: string[];
};
vkey;
};
dsc: {
type: string;
value: string;
encoding: string;
};
private parsedPublicSignals: any;
private userIdType: UserIdType;
constructor(attestation: OpenPassportAttestation, userIdType: UserIdType = 'uuid') {
this['@context'] = attestation['@context'];
this.type = attestation.type;
this.issuer = attestation.issuer;
this.issuanceDate = attestation.issuanceDate;
this.credentialSubject = attestation.credentialSubject;
this.proof = attestation.proof;
this.dscProof = attestation.dscProof;
this.dsc = attestation.dsc;
this.userIdType = userIdType;
}
private parsePublicSignals() {
if (this.proof.mode === 'vc_and_disclose') {
return parsePublicSignalsDisclose(this.proof.value.publicSignals);
} else {
let kScaled: number;
switch (this.proof.signatureAlgorithm) {
case 'ecdsa':
kScaled = ECDSA_K_LENGTH_FACTOR * k_dsc_ecdsa;
break;
default:
kScaled = k_dsc;
}
return parsePublicSignalsProve(this.proof.value.publicSignals, kScaled);
}
// Parse the public signals
}
getUserId(): string {
const parsedPublicSignals = this.parsePublicSignals();
const rawUserId = (parsedPublicSignals as any).user_identifier;
switch (this.userIdType) {
case 'ascii':
return castToScope(BigInt(rawUserId));
case 'hex':
return bigIntToHex(BigInt(rawUserId));
case 'uuid':
return castToUUID(BigInt(rawUserId));
default:
return rawUserId;
}
}
getNullifier(): string {
const parsedPublicSignals = this.parsePublicSignals();
return bigIntToHex(BigInt(parsedPublicSignals.nullifier));
}
getCommitment(): string {
const parsedPublicSignals = this.parsePublicSignals();
if (this.proof.mode === 'vc_and_disclose') {
return '';
} else {
return (parsedPublicSignals as any).commitment;
}
}
getNationality(): string {
const parsedPublicSignals = this.parsePublicSignals();
const revealedData_packed = (parsedPublicSignals as any).revealedData_packed;
const unpackedReveal = unpackReveal(revealedData_packed);
return getAttributeFromUnpackedReveal(unpackedReveal, 'nationality');
}
getCSCAMerkleRoot(): string {
if (this.dscProof.value.publicSignals) {
const parsedPublicSignalsDsc = parsePublicSignalsDsc(this.dscProof.value.publicSignals);
return parsedPublicSignalsDsc.merkle_root;
} else {
throw new Error('No DSC proof found');
}
}
}
export function parsePublicSignalsProve(publicSignals, kScaled) {
return {
nullifier: publicSignals[0],
revealedData_packed: [publicSignals[1], publicSignals[2], publicSignals[3]],
older_than: [publicSignals[4], publicSignals[5]],
pubKey_disclosed: publicSignals.slice(6, 6 + kScaled),
forbidden_countries_list_packed_disclosed: publicSignals.slice(6 + kScaled, 8 + kScaled),
ofac_result: publicSignals[8 + kScaled],
commitment: publicSignals[9 + kScaled],
blinded_dsc_commitment: publicSignals[10 + kScaled],
current_date: publicSignals.slice(11 + kScaled, 11 + kScaled + 6),
user_identifier: publicSignals[17 + kScaled],
scope: publicSignals[18 + kScaled],
};
}
export function parsePublicSignalsDsc(publicSignals) {
return {
blinded_dsc_commitment: publicSignals[0],
merkle_root: publicSignals[1],
};
}
export function parsePublicSignalsDisclose(publicSignals) {
return {
nullifier: publicSignals[0],
revealedData_packed: publicSignals.slice(1, 4),
older_than: publicSignals.slice(4, 6),
forbidden_countries_list_packed_disclosed: publicSignals.slice(6, 8),
ofac_result: publicSignals[8],
attestation_id: publicSignals[9],
merkle_root: publicSignals[10],
scope: publicSignals[11],
current_date: publicSignals.slice(12, 18),
user_identifier: publicSignals[18],
smt_root: publicSignals[19],
};
}

View File

@@ -0,0 +1,218 @@
import { bigIntToHex, castToScope, castToUUID, UserIdType } from './circuits/uuid';
import { formatForbiddenCountriesListFromCircuitOutput, getAttributeFromUnpackedReveal } from './circuits/formatOutputs';
import { unpackReveal } from './circuits/formatOutputs';
import { Groth16Proof, PublicSignals } from 'snarkjs';
export interface SelfAttestation {
'@context': string[];
type: string[];
issuer: string;
issuanceDate: string;
credentialSubject: {
userId: string;
application: string;
scope?: string;
merkle_root?: string;
attestation_id?: string;
targetRootTimestamp?: string;
current_date?: string;
issuing_state?: string;
name?: string;
passport_number?: string;
nationality?: string;
date_of_birth?: string;
gender?: string;
expiry_date?: string;
older_than?: string;
valid?: boolean;
nullifier?: string;
};
proof: {
type: string;
verificationMethod: string;
value: {
proof: Groth16Proof;
publicSignals: PublicSignals;
};
vkey: string;
};
}
export function buildAttestation(options: {
userIdType: UserIdType;
proof: Groth16Proof;
publicSignals: PublicSignals;
}): SelfAttestation {
const {
proof,
publicSignals,
userIdType,
} = options;
let parsedPublicSignals = parsePublicSignalsDisclose(publicSignals);
const rawUserId = parsedPublicSignals.user_identifier;
let userId: string;
switch (userIdType) {
case 'ascii':
userId = castToScope(BigInt(rawUserId));
break;
case 'hex':
userId = bigIntToHex(BigInt(rawUserId));
break;
case 'uuid':
userId = castToUUID(BigInt(rawUserId));
break;
default:
userId = rawUserId;
}
const scope = castToScope(BigInt(parsedPublicSignals.scope));
// Unpack the revealed data
const unpackedReveal = unpackReveal(parsedPublicSignals.revealedData_packed);
const attributeNames = [
'issuing_state',
'name',
'passport_number',
'nationality',
'date_of_birth',
'gender',
'expiry_date',
'older_than',
'ofac',
];
const formattedCountryList = formatForbiddenCountriesListFromCircuitOutput(
parsedPublicSignals.forbidden_countries_list_packed
);
const credentialSubject: any = {
userId: userId,
application: scope,
nullifier: bigIntToHex(BigInt(parsedPublicSignals.nullifier)),
scope: scope,
current_date: parsedPublicSignals.current_date.toString(),
not_in_countries: formattedCountryList,
};
attributeNames.forEach((attrName) => {
const value = getAttributeFromUnpackedReveal(unpackedReveal, attrName);
if (value !== undefined && value !== null) {
credentialSubject[attrName] = value;
}
});
const attestation: SelfAttestation = {
'@context': ['https://www.w3.org/2018/credentials/v1', 'https://openpassport.app'],
type: ['SelfAttestation', 'PassportCredential'],
issuer: 'https://openpassport.app',
issuanceDate: new Date().toISOString(),
credentialSubject: credentialSubject,
proof: {
type: 'ZeroKnowledgeProof',
verificationMethod: 'https://github.com/celo-org/self',
value: {
proof: proof,
publicSignals: publicSignals,
},
vkey: 'https://github.com/zk-passport/openpassport/blob/main/common/src/constants/vkey.ts',
},
};
// Return an instance of OpenPassportDynamicAttestation
return new SelfAttestation(attestation, userIdType);
}
// New OpenPassportDynamicAttestation class extending OpenPassportAttestation
export class SelfAttestation implements SelfAttestation {
'@context': string[];
type: string[];
issuer: string;
issuanceDate: string;
credentialSubject: {
userId: string;
application: string;
scope?: string;
merkle_root?: string;
attestation_id?: string;
current_date?: string;
issuing_state?: string;
name?: string;
passport_number?: string;
nationality?: string;
date_of_birth?: string;
gender?: string;
expiry_date?: string;
older_than?: string;
owner_of?: string;
pubKey?: string[];
valid?: boolean;
nullifier?: string;
};
proof: {
type: string;
verificationMethod: string;
value: {
proof: string[];
publicSignals: string[];
};
vkey;
};
private userIdType: UserIdType;
constructor(attestation: SelfAttestation, userIdType: UserIdType = 'uuid') {
this['@context'] = attestation['@context'];
this.type = attestation.type;
this.issuer = attestation.issuer;
this.issuanceDate = attestation.issuanceDate;
this.credentialSubject = attestation.credentialSubject;
this.proof = attestation.proof;
this.userIdType = userIdType;
}
private parsePublicSignals() {
return parsePublicSignalsDisclose(this.proof.value.publicSignals);
}
getUserId(): string {
const parsedPublicSignals = this.parsePublicSignals();
const rawUserId = (parsedPublicSignals as any).user_identifier;
switch (this.userIdType) {
case 'ascii':
return castToScope(BigInt(rawUserId));
case 'hex':
return bigIntToHex(BigInt(rawUserId));
case 'uuid':
return castToUUID(BigInt(rawUserId));
default:
return rawUserId;
}
}
getNullifier(): string {
const parsedPublicSignals = this.parsePublicSignals();
return bigIntToHex(BigInt(parsedPublicSignals.nullifier));
}
getNationality(): string {
const parsedPublicSignals = this.parsePublicSignals();
const revealedData_packed = (parsedPublicSignals as any).revealedData_packed;
const unpackedReveal = unpackReveal(revealedData_packed);
return getAttributeFromUnpackedReveal(unpackedReveal, 'nationality');
}
}
export function parsePublicSignalsDisclose(publicSignals) {
return {
revealedData_packed: publicSignals.slice(0, 2),
forbidden_countries_list_packed: publicSignals.slice(3),
nullifier: publicSignals[4],
attestation_id: publicSignals[5],
merkle_root: publicSignals[6],
current_date: publicSignals.slice(7, 12),
smt_root: publicSignals[13],
user_identifier: publicSignals[14],
scope: publicSignals[15],
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {IIdentityVerificationHubV1} from "../interfaces/IIdentityVerificationHubV1.sol";
import {IIdentityRegistryV1} from "../interfaces/IIdentityRegistryV1.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {CircuitConstants} from "../constants/CircuitConstants.sol";
contract VerifyAll is Ownable {
IIdentityVerificationHubV1 _hub;
IIdentityRegistryV1 _registry;
constructor(
address hub,
address registry
) Ownable(msg.sender) {
_hub = IIdentityVerificationHubV1(hub);
_registry = IIdentityRegistryV1(registry);
}
function verifyAll (
uint256 targetRootTimestamp,
IIdentityVerificationHubV1.VcAndDiscloseHubProof memory proof,
IIdentityVerificationHubV1.RevealedDataType[] memory types
)
external
view
returns (
IIdentityVerificationHubV1.ReadableRevealedData memory,
bool
)
{
IIdentityVerificationHubV1.VcAndDiscloseVerificationResult memory result;
try _hub.verifyVcAndDisclose(proof) returns (IIdentityVerificationHubV1.VcAndDiscloseVerificationResult memory _result) {
result = _result;
} catch {
IIdentityVerificationHubV1.ReadableRevealedData memory emptyData = IIdentityVerificationHubV1.ReadableRevealedData({
issuingState: "",
name: new string[](0),
passportNumber: "",
nationality: "",
dateOfBirth: "",
gender: "",
expiryDate: "",
olderThan: 0,
ofac: 0
});
return (emptyData, false);
}
if (targetRootTimestamp != 0) {
if (_registry.rootTimestamps(result.identityCommitmentRoot) != targetRootTimestamp) {
IIdentityVerificationHubV1.ReadableRevealedData memory emptyData = IIdentityVerificationHubV1.ReadableRevealedData({
issuingState: "",
name: new string[](0),
passportNumber: "",
nationality: "",
dateOfBirth: "",
gender: "",
expiryDate: "",
olderThan: 0,
ofac: 0
});
return (emptyData, false);
}
}
uint256[3] memory revealedDataPacked = result.revealedDataPacked;
IIdentityVerificationHubV1.ReadableRevealedData memory readableData = _hub.getReadableRevealedData(revealedDataPacked, types);
return (readableData, true);
}
function setHub(address hub) external onlyOwner {
_hub = IIdentityVerificationHubV1(hub);
}
function setRegistry(address registry) external onlyOwner {
_registry = IIdentityRegistryV1(registry);
}
}

View File

@@ -0,0 +1,18 @@
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
import hre from "hardhat";
import fs from "fs";
import path from "path";
export default buildModule("DeployVerifyAll", (m) => {
const networkName = hre.network.config.chainId;
const deployedAddressesPath = path.join(__dirname, `../deployments/chain-${networkName}/deployed_addresses.json`);
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf8"));
const hubAddress = deployedAddresses["DeployHub#IdentityVerificationHub"];
const registryAddress = deployedAddresses["DeployRegistryModule#IdentityRegistry"];
const verifyAll = m.contract("VerifyAll", [hubAddress, registryAddress]);
return {
verifyAll,
};
});

View File

@@ -28,6 +28,7 @@
"deploy:verifiers:sepolia": "npx hardhat ignition deploy ignition/modules/deploy_verifiers.ts --network sepolia --verify",
"deploy:registry:sepolia": "npx hardhat ignition deploy ignition/modules/deploy_registry.ts --network sepolia --verify",
"deploy:hub:sepolia": "npx hardhat ignition deploy ignition/modules/deploy_hub.ts --network sepolia --verify",
"deploy:verifyall:sepolia": "npx hardhat ignition deploy ignition/modules/deployVerifyAll.ts --network sepolia --verify",
"deploy:all:sepolia": "npm run deploy:verifiers:sepolia && npm run deploy:registry:sepolia && npm run deploy:hub:sepolia",
"update:cscaroot:sepolia": "npx hardhat ignition deploy ignition/modules/scripts/updateRegistryCscaRoot.ts --network sepolia",
"update:ofacroot:sepolia": "npx hardhat ignition deploy ignition/modules/scripts/updateRegistryOfacRoot.ts --network sepolia",

View File

@@ -9,11 +9,12 @@ import { LeanIMT } from "@openpassport/zk-kit-lean-imt";
import { poseidon2 } from "poseidon-lite";
import { generateCommitment } from "../../../common/src/utils/passports/passport";
import { BigNumberish } from "ethers";
import { generateRandomFieldElement } from "../utils/utils";
import { generateRandomFieldElement, getStartOfDayTimestamp } from "../utils/utils";
import { SMT, ChildNodes } from "@openpassport/zk-kit-smt";
import { getStartOfDayTimestamp } from "../utils/utils";
import { Formatter, CircuitAttributeHandler } from "../utils/formatter";
import { formatCountriesList, reverseBytes,reverseCountryBytes } from '../../../common/src/utils/circuits/formatInputs';
import { formatCountriesList, reverseBytes, reverseCountryBytes } from '../../../common/src/utils/circuits/formatInputs';
import fs from 'fs';
import path from 'path';
describe("VC and Disclose", () => {
let deployedActors: DeployedActors;
@@ -25,10 +26,10 @@ describe("VC and Disclose", () => {
let commitment: any;
let nullifier: any;
let forbiddenCountriesList: any;
let invalidForbiddenCountriesList: any;
let forbiddenCountriesListPacked: any;
let invalidForbiddenCountriesListPacked: any;
let forbiddenCountriesList: string[];
let invalidForbiddenCountriesList: string[];
let forbiddenCountriesListPacked: string;
let invalidForbiddenCountriesListPacked: string;
before(async () => {
deployedActors = await deploySystemFixtures();
@@ -655,7 +656,7 @@ describe("VC and Disclose", () => {
expect(readableData[7]).to.equal(20n);
expect(readableData[8]).to.equal(0n);
});
it("should only return ofac", async () => {
const { readableData } = await setupVcAndDiscloseTest(['8']);
expect(readableData[0]).to.equal('');
@@ -736,4 +737,5 @@ describe("VC and Disclose", () => {
});
});
});

View File

@@ -1,14 +1,12 @@
import { OpenPassportVerifierReport } from './src/OpenPassportVerifierReport';
import { OpenPassportVerifier } from './src/OpenPassportVerifier';
import { SelfVerifierReport } from './src/SelfVerifierReport';
import { SelfVerifier } from './src/SelfVerifier';
import { countryCodes } from '../../common/src/constants/constants';
import {
OpenPassportAttestation,
OpenPassportDynamicAttestation,
} from '../../common/src/utils/openPassportAttestation';
} from '../../common/src/utils/selfAttestation';
export {
OpenPassportVerifier,
OpenPassportAttestation,
OpenPassportDynamicAttestation,
OpenPassportVerifierReport,
SelfVerifier,
SelfVerifierReport,
countryCodes,
};

View File

@@ -10,10 +10,14 @@
},
"author": "turnoffthiscomputer",
"dependencies": {
"@openpassport/zk-kit-imt": "^0.0.5",
"@openpassport/zk-kit-lean-imt": "^0.0.6",
"@openpassport/zk-kit-smt": "^0.0.1",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"elliptic": "^6.5.7",
"ethers": "^6.13.5",
"fs": "^0.0.1-security",
"js-sha1": "^0.7.0",
"js-sha256": "^0.11.0",
@@ -26,10 +30,7 @@
"poseidon-lite": "^0.2.0",
"snarkjs": "^0.7.4",
"uuid": "^10.0.0",
"zlib": "^1.0.5",
"@openpassport/zk-kit-imt": "^0.0.5",
"@openpassport/zk-kit-lean-imt": "^0.0.6",
"@openpassport/zk-kit-smt": "^0.0.1"
"zlib": "^1.0.5"
},
"devDependencies": {
"@types/chai": "^4.3.6",
@@ -74,4 +75,4 @@
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
}

View File

@@ -0,0 +1,63 @@
import { ethers } from 'ethers';
import fs from 'fs';
import path from 'path';
import { verifyAllAbi } from '../src/abi/VerifyAll';
import {groth16} from 'snarkjs';
import dotenv from 'dotenv';
import { pid } from 'process';
import { generateVcAndDiscloseProof } from '../../../contracts/test/utils/generateProof';
import { ATTESTATION_ID } from '../../../contracts/test/utils/constants';
dotenv.config();
async function main() {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const deployedAddresses = JSON.parse(fs.readFileSync(path.join(__dirname, '../src/contractAddress/chain-11155111_deployed_addresses.json'), 'utf8'));
const verifyAllAddress = deployedAddresses["DeployVerifyAll#VerifyAll"];
console.log(`Using verifyAll contract at address: ${verifyAllAddress}`);
const verifyAllContract = new ethers.Contract(verifyAllAddress, verifyAllAbi, provider);
const registerSecret = "0x0000000000000000000000000000000000000000000000000000000000000000";
const proof = await generateVcAndDiscloseProof(
registerSecret,
BigInt(ATTESTATION_ID.E_PASSPORT).toString(),
mockPassport,
"test-scope",
new Array(88).fill("1"),
"1",
imt,
"20",
undefined,
undefined,
forbiddenCountriesList,
(await deployedActors.user1.getAddress()).slice(2)
);
try {
const result = await verifyAllContract.verifyAll(
"0x0000000000000000000000000000000000000000000000000000000000000000",
{
olderThanEnabled: true,
olderThan: "20",
forbiddenCountriesEnabled: true,
forbiddenCountriesListPacked: "0x0000000000000000000000000000000000000000000000000000000000000000",
ofacEnabled: true,
vcAndDiscloseProof: [
proof.a,
proof.b,
proof.c,
proof.pubSignals
]
},
["0"]
);
console.log('Result:', result);
} catch (err) {
console.error('Error calling contract function:', err);
}
}
main().catch(console.error);

View File

@@ -1,294 +1,135 @@
import { groth16 } from 'snarkjs';
import {
n_dsc,
k_dsc,
ECDSA_K_LENGTH_FACTOR,
k_dsc_ecdsa,
countryNames,
countryCodes,
} from '../../../common/src/constants/constants';
import type { SelfAttestation } from '../../../common/src/utils/selfAttestation';
import {
areArraysEqual,
getCurrentDateFormatted,
getVkeyFromArtifacts,
verifyDSCValidity,
} from '../utils/utils';
import {
OpenPassportAttestation,
parsePublicSignalsDisclose,
parsePublicSignalsDsc,
parsePublicSignalsProve,
} from '../../../common/src/utils/openPassportAttestation';
import { Mode } from 'fs';
import forge from 'node-forge';
} from '../../../common/src/utils/selfAttestation';
import {
castToScope,
formatForbiddenCountriesListFromCircuitOutput,
getAttributeFromUnpackedReveal,
getOlderThanFromCircuitOutput,
splitToWords,
} from '../../../common/src/utils/utils';
import { unpackReveal } from '../../../common/src/utils/revealBitmap';
import { getCSCAModulusMerkleTree } from '../../../common/src/utils/csca';
import { OpenPassportVerifierReport } from './OpenPassportVerifierReport';
import { fetchTreeFromUrl } from '../../../common/src/utils/pubkeyTree';
import { parseCertificateSimple } from '../../../common/src/utils/certificate_parsing/parseCertificateSimple';
import { PublicKeyDetailsRSA } from '../../../common/src/utils/certificate_parsing/dataStructure';
unpackReveal,
} from '../../../common/src/utils/circuits/formatOutputs';
import { castToScope } from '../../../common/src/utils/circuits/uuid';
import { SelfVerifierReport } from './SelfVerifierReport';
import {
registryAbi
} from "./abi/IdentityRegistryImplV1";
import {
verifyAllAbi
} from "./abi/VerifyAll";
import { ethers } from 'ethers';
// import type { VcAndDiscloseHubProofStruct } from "../../../common/src/utils/contracts/typechain-types/contracts/IdentityVerificationHubImplV1.sol/IdentityVerificationHubImplV1";
import {
groth16,
Groth16Proof,
PublicSignals
} from 'snarkjs';
import { CIRCUIT_CONSTANTS, revealedDataTypes } from '../../../common/src/constants/constants';
export class AttestationVerifier {
protected devMode: boolean;
protected scope: string;
protected report: OpenPassportVerifierReport;
protected report: SelfVerifierReport;
protected attestationId: number = 1;
protected targetRootTimestamp: number = 0;
protected minimumAge: { enabled: boolean; value: string } = { enabled: false, value: '18' };
protected nationality: { enabled: boolean; value: (typeof countryNames)[number] } = {
enabled: false,
value: '' as (typeof countryNames)[number],
};
protected excludedCountries: { enabled: boolean; value: (typeof countryNames)[number][] } = {
enabled: false,
value: [],
};
protected ofac: boolean = false;
protected commitmentMerkleTreeUrl: string = '';
constructor(devMode: boolean = false) {
this.devMode = devMode;
this.report = new OpenPassportVerifierReport();
}
protected registryContract: any;
protected verifyAllContract: any;
public async verify(attestation: OpenPassportAttestation): Promise<OpenPassportVerifierReport> {
const kScaled =
attestation.proof.signatureAlgorithm === 'ecdsa'
? ECDSA_K_LENGTH_FACTOR * k_dsc_ecdsa
: k_dsc;
let parsedPublicSignals;
if (attestation.proof.mode === 'vc_and_disclose') {
parsedPublicSignals = parsePublicSignalsDisclose(attestation.proof.value.publicSignals);
} else {
parsedPublicSignals = parsePublicSignalsProve(attestation.proof.value.publicSignals, kScaled);
}
this.verifyAttribute('scope', castToScope(parsedPublicSignals.scope), this.scope);
await this.verifyProof(
attestation.proof.mode,
attestation.proof.value.proof,
attestation.proof.value.publicSignals,
attestation.proof.signatureAlgorithm,
attestation.proof.hashFunction
);
switch (attestation.proof.mode) {
case 'register':
await this.verifyRegister(attestation);
break;
case 'prove_onchain':
await this.verifyProveOnChain(attestation);
break;
case 'prove_offchain':
await this.verifyProveOffChain(attestation);
break;
case 'vc_and_disclose':
await this.verifyDisclose(attestation);
break;
}
return this.report;
}
private async verifyRegister(attestation: OpenPassportAttestation) {
// verify dscProof
await this.verifyDscProof(attestation);
// verify that the blinded dscCommitments of proof and dscProof match
this.verifyBlindedDscCommitments(attestation);
// verify the root of the csca merkle tree
this.verifyCSCARoot(attestation);
}
private async verifyProveOffChain(attestation: OpenPassportAttestation) {
// verify disclose attributes
this.verifyDiscloseAttributes(attestation);
// verify certificate chain
this.verifyCertificateChain(attestation);
}
private async verifyProveOnChain(attestation: OpenPassportAttestation) {
// verify attributes
this.verifyDiscloseAttributes(attestation);
// verify the dsc proof
await this.verifyDscProof(attestation);
// verify that the blinded dscCommitments of proof and dscProof match
this.verifyBlindedDscCommitments(attestation);
// verify the root of the csca merkle tree
this.verifyCSCARoot(attestation);
}
private async verifyDisclose(attestation: OpenPassportAttestation) {
// verify the root of the commitment
this.verifyCommitment(attestation);
// verify disclose attributes
this.verifyDiscloseAttributes(attestation);
}
private verifyDiscloseAttributes(attestation: OpenPassportAttestation) {
let parsedPublicSignals;
if (attestation.proof.mode === 'vc_and_disclose') {
parsedPublicSignals = parsePublicSignalsDisclose(attestation.proof.value.publicSignals);
} else {
parsedPublicSignals = parsePublicSignalsProve(attestation.proof.value.publicSignals, k_dsc);
}
this.verifyAttribute(
'current_date',
parsedPublicSignals.current_date.toString(),
getCurrentDateFormatted().toString()
);
const unpackedReveal = unpackReveal(parsedPublicSignals.revealedData_packed);
if (this.minimumAge.enabled) {
const attributeValueInt = getOlderThanFromCircuitOutput(parsedPublicSignals.older_than);
const selfAttributeOlderThan = parseInt(this.minimumAge.value);
if (attributeValueInt < selfAttributeOlderThan) {
this.report.exposeAttribute(
'older_than',
attributeValueInt.toString(),
this.minimumAge.value.toString()
);
} else {
console.log('\x1b[32m%s\x1b[0m', '- minimum age verified');
}
}
if (this.nationality.enabled) {
if (this.nationality.value === 'Any') {
console.log('\x1b[32m%s\x1b[0m', '- nationality verified');
} else {
const attributeValue = getAttributeFromUnpackedReveal(unpackedReveal, 'nationality');
this.verifyAttribute('nationality', countryCodes[attributeValue], this.nationality.value);
}
}
if (this.ofac) {
const attributeValue = parsedPublicSignals.ofac_result.toString();
this.verifyAttribute('ofac', attributeValue, '1');
}
if (this.excludedCountries.enabled) {
const formattedCountryList = formatForbiddenCountriesListFromCircuitOutput(
parsedPublicSignals.forbidden_countries_list_packed_disclosed
);
const formattedCountryListFullCountryNames = formattedCountryList.map(
(countryCode) => countryCodes[countryCode]
);
this.verifyAttribute(
'forbidden_countries_list',
formattedCountryListFullCountryNames.toString(),
this.excludedCountries.value.toString()
);
}
}
private verifyCSCARoot(attestation: OpenPassportAttestation) {
// verify the root of the csca merkle tree
const parsedDscPublicSignals = parsePublicSignalsDsc(attestation.dscProof.value.publicSignals);
const cscaMerkleTreeFromDscProof = parsedDscPublicSignals.merkle_root;
const cscaMerkleTree = getCSCAModulusMerkleTree();
const cscaRoot = cscaMerkleTree.root;
this.verifyAttribute('merkle_root_csca', cscaRoot, cscaMerkleTreeFromDscProof);
}
private async verifyCommitment(attestation: OpenPassportAttestation) {
const tree = await fetchTreeFromUrl(this.commitmentMerkleTreeUrl);
const parsedPublicSignals = parsePublicSignalsDisclose(attestation.proof.value.publicSignals);
this.verifyAttribute(
'merkle_root_commitment',
tree.root.toString(),
parsedPublicSignals.merkle_root
);
}
private verifyCertificateChain(attestation: OpenPassportAttestation) {
const dscCertificate = forge.pki.certificateFromPem(attestation.dsc.value);
const verified_certificate = verifyDSCValidity(dscCertificate, this.devMode);
if (!verified_certificate) {
this.report.exposeAttribute('dsc', attestation.dsc.value, 'certificate chain is not valid');
} else {
console.log('\x1b[32m%s\x1b[0m', '- certificate verified');
}
const parsedDsc = parseCertificateSimple(attestation.dsc.value);
const signatureAlgorithmDsc = parsedDsc.signatureAlgorithm;
if (signatureAlgorithmDsc === 'ecdsa') {
throw new Error('ECDSA not supported yet');
} else {
const publicKeyDetails: PublicKeyDetailsRSA = parsedDsc.publicKeyDetails as PublicKeyDetailsRSA;
const dscModulus = publicKeyDetails.modulus;
const dscModulusBigInt = BigInt(`0x${dscModulus}`);
const dscModulusWords = splitToWords(dscModulusBigInt, n_dsc, k_dsc);
const pubKeyFromProof = parsePublicSignalsProve(
attestation.proof.value.publicSignals,
k_dsc
).pubKey_disclosed;
const verified_modulus = areArraysEqual(dscModulusWords, pubKeyFromProof);
if (!verified_modulus) {
this.report.exposeAttribute(
'pubKey',
pubKeyFromProof,
'pubKey from proof does not match pubKey from DSC certificate'
);
} else {
console.log('\x1b[32m%s\x1b[0m', '- modulus verified');
}
}
}
private verifyBlindedDscCommitments(attestation: OpenPassportAttestation) {
const parsedPublicSignals = parsePublicSignalsProve(
attestation.proof.value.publicSignals,
k_dsc
);
const proofBlindedDscCommitment = parsedPublicSignals.blinded_dsc_commitment;
const parsedDscPublicSignals = parsePublicSignalsDsc(attestation.dscProof.value.publicSignals);
const dscBlindedDscCommitment = parsedDscPublicSignals.blinded_dsc_commitment;
this.verifyAttribute(
'blinded_dsc_commitment',
proofBlindedDscCommitment,
dscBlindedDscCommitment
);
}
private async verifyProof(
mode: Mode,
proof: string[],
publicSignals: string[],
signatureAlgorithm: string,
hashFunction: string
): Promise<void> {
const vkey = getVkeyFromArtifacts(mode, signatureAlgorithm, hashFunction);
const isVerified = await groth16.verify(vkey, publicSignals, proof as any);
this.verifyAttribute('proof', isVerified.toString(), 'true');
}
private async verifyDscProof(attestation: OpenPassportAttestation) {
const dscSignatureAlgorithm = attestation.dscProof.signatureAlgorithm;
const dscHashFunction = attestation.dscProof.hashFunction;
const vkey = getVkeyFromArtifacts('dsc', dscSignatureAlgorithm, dscHashFunction);
const isVerified = await groth16.verify(
vkey,
attestation.dscProof.value.publicSignals,
attestation.dscProof.value.proof as any
);
this.verifyAttribute('dscProof', isVerified.toString(), 'true');
}
private verifyAttribute(
attribute: keyof OpenPassportVerifierReport,
value: string,
expectedValue: string
constructor(
devMode: boolean = false,
rpcUrl: string,
registryContractAddress: `0x${string}`,
verifyAllContractAddress: `0x${string}`,
targetRootTimestamp: number = 0
) {
if (value !== expectedValue) {
this.report.exposeAttribute(attribute, value, expectedValue);
} else {
console.log('\x1b[32m%s\x1b[0m', `- attribute ${attribute} verified`);
}
this.devMode = devMode;
this.report = new SelfVerifierReport();
const provider = new ethers.JsonRpcProvider(rpcUrl);
this.registryContract = new ethers.Contract(registryContractAddress, registryAbi, provider);
this.verifyAllContract = new ethers.Contract(verifyAllContractAddress, verifyAllAbi, provider);
this.targetRootTimestamp = targetRootTimestamp;
}
public async verify(proof: Groth16Proof, publicSignals: PublicSignals): Promise<SelfAttestation> {
const solidityProof = await groth16.exportSolidityCallData(
proof,
publicSignals,
);
const vcAndDiscloseHubProof: any = {
olderThanEnabled: this.minimumAge.enabled,
olderThan: BigInt(this.minimumAge.value),
forbiddenCountriesEnabled: this.excludedCountries.enabled,
forbiddenCountriesListPacked: BigInt(this.excludedCountries.value.length),
ofacEnabled: this.ofac,
vcAndDiscloseProof: solidityProof
}
const result = await this.verifyAllContract.verifyAll(
this.targetRootTimestamp,
vcAndDiscloseHubProof,
[
revealedDataTypes.issuing_state,
revealedDataTypes.name,
revealedDataTypes.passport_number,
revealedDataTypes.nationality,
revealedDataTypes.date_of_birth,
revealedDataTypes.gender,
revealedDataTypes.expiry_date,
]
);
console.log(result);
const credentialSubject = {
userId: "",
application: this.scope,
merkle_root: "",
attestation_id: "",
current_date: "",
issuing_state: result[0],
name: result[1],
passport_number: result[2],
nationality: result[3],
date_of_birth: result[4],
gender: result[5],
expiry_date: result[6],
older_than: result[7],
valid: result[8],
nullifier: publicSignals[CIRCUIT_CONSTANTS.REGISTER_NULLIFIER_INDEX],
}
const attestation: SelfAttestation = {
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential', 'SelfAttestation'],
issuer: 'https://selfattestation.com',
issuanceDate: new Date().toISOString(),
credentialSubject: credentialSubject,
proof: {
type: "Groth16Proof",
verificationMethod: "Vc and Disclose",
value: {
proof: proof,
publicSignals: publicSignals,
},
vkey: "",
}
}
return attestation;
}
}

View File

@@ -1,169 +0,0 @@
import {
ArgumentsDisclose,
ArgumentsProveOffChain,
ArgumentsProveOnChain,
ArgumentsRegister,
Mode,
OpenPassportAppPartial,
OpenPassportApp
} from '../../../common/src/utils/appType';
import {
DEFAULT_RPC_URL,
MODAL_SERVER_ADDRESS,
WEBSOCKET_URL,
countryNames,
} from '../../../common/src/constants/constants';
import { UserIdType } from '../../../common/src/utils/utils';
import * as pako from 'pako';
import msgpack from 'msgpack-lite';
import { AttestationVerifier } from './AttestationVerifier';
export class OpenPassportVerifier extends AttestationVerifier {
private mode: Mode;
private modalServerUrl: string = MODAL_SERVER_ADDRESS;
private rpcUrl: string = DEFAULT_RPC_URL;
private cscaMerkleTreeUrl: string = '';
constructor(mode: Mode, scope: string, devMode: boolean = false) {
super(devMode);
this.mode = mode;
this.scope = scope;
}
// Disclose
setMinimumAge(age: number): this {
if (age < 10) {
throw new Error('Minimum age must be at least 10 years old');
}
if (age > 100) {
throw new Error('Minimum age must be at most 100 years old');
}
this.minimumAge = { enabled: true, value: age.toString() };
return this;
}
setNationality(country: (typeof countryNames)[number]): this {
this.nationality = { enabled: true, value: country };
return this;
}
discloseNationality(): this {
this.setNationality('Any');
return this;
}
excludeCountries(...countries: (typeof countryNames)[number][]): this {
this.excludedCountries = { enabled: true, value: countries };
return this;
}
enableOFACCheck(): this {
this.ofac = true;
return this;
}
// Register
setModalServerUrl(modalServerUrl: string): this {
this.modalServerUrl = modalServerUrl;
return this;
}
setCommitmentMerkleTreeUrl(commitmentMerkleTreeUrl: string): this {
this.commitmentMerkleTreeUrl = commitmentMerkleTreeUrl;
return this;
}
// On chain
setRpcUrl(rpcUrl: string): this {
this.rpcUrl = rpcUrl;
return this;
}
allowMockPassports(): this {
this.devMode = true;
return this;
}
getIntent(
appName: string,
userId: string,
userIdType: UserIdType,
sessionId: string,
websocketUrl: string = WEBSOCKET_URL
): string {
const intent_raw: OpenPassportAppPartial = {
appName: appName,
mode: this.mode,
scope: this.scope,
websocketUrl: websocketUrl,
sessionId: sessionId,
userId: userId,
userIdType: userIdType,
devMode: this.devMode,
};
let openPassportArguments: ArgumentsProveOffChain | ArgumentsRegister;
switch (this.mode) {
case 'prove_onchain':
const argsProveOnChain: ArgumentsProveOnChain = {
disclosureOptions: {
minimumAge: this.minimumAge,
nationality: this.nationality,
excludedCountries: this.excludedCountries,
ofac: this.ofac,
},
modalServerUrl: this.modalServerUrl,
merkleTreeUrl: this.cscaMerkleTreeUrl,
};
openPassportArguments = argsProveOnChain;
break;
case 'prove_offchain':
const argsProveOffChain: ArgumentsProveOffChain = {
disclosureOptions: {
minimumAge: this.minimumAge,
nationality: this.nationality,
excludedCountries: this.excludedCountries,
ofac: this.ofac,
},
};
openPassportArguments = argsProveOffChain;
break;
case 'register':
if (!this.commitmentMerkleTreeUrl) {
throw new Error("Commitment merkle tree URL is required for mode 'register'");
}
const argsRegisterOnChain: ArgumentsRegister = {
modalServerUrl: this.modalServerUrl,
cscaMerkleTreeUrl: this.cscaMerkleTreeUrl,
commitmentMerkleTreeUrl: this.commitmentMerkleTreeUrl,
};
openPassportArguments = argsRegisterOnChain;
break;
case 'vc_and_disclose':
const argsVcAndDisclose: ArgumentsDisclose = {
disclosureOptions: {
minimumAge: this.minimumAge,
nationality: this.nationality,
excludedCountries: this.excludedCountries,
ofac: this.ofac,
},
commitmentMerkleTreeUrl: this.commitmentMerkleTreeUrl,
};
openPassportArguments = argsVcAndDisclose;
break;
}
const intent: OpenPassportApp = {
...intent_raw,
args: openPassportArguments,
};
const encoded = msgpack.encode(intent);
try {
const compressedData = pako.deflate(encoded);
return btoa(String.fromCharCode(...new Uint8Array(compressedData)));
} catch (err) {
console.error(err);
return '';
}
}
}

View File

@@ -0,0 +1,117 @@
// import {
// ArgumentsDisclose,
// ArgumentsProveOffChain,
// ArgumentsProveOnChain,
// ArgumentsRegister,
// Mode,
// SelfAppPartial,
// SelfApp
// } from '../../../common/src/utils/appType';
import {
DEFAULT_RPC_URL,
countryNames,
} from '../../../common/src/constants/constants';
// import { UserIdType } from '../../../common/src/utils/circuits/uuid';
import { AttestationVerifier } from './AttestationVerifier';
export class SelfVerifier extends AttestationVerifier {
constructor(
scope: string,
devMode: boolean = false,
rpcUrl: string = DEFAULT_RPC_URL,
registryContractAddress: `0x${string}`,
hubContractAddress: `0x${string}`
) {
super(
devMode,
rpcUrl,
registryContractAddress,
hubContractAddress
);
this.scope = scope;
}
setTargetRootTimestamp(targetRootTimestamp: number): this {
this.targetRootTimestamp = targetRootTimestamp;
return this;
}
setMinimumAge(age: number): this {
if (age < 10) {
throw new Error('Minimum age must be at least 10 years old');
}
if (age > 100) {
throw new Error('Minimum age must be at most 100 years old');
}
this.minimumAge = { enabled: true, value: age.toString() };
return this;
}
setNationality(country: (typeof countryNames)[number]): this {
this.nationality = { enabled: true, value: country };
return this;
}
discloseNationality(): this {
this.setNationality('Any');
return this;
}
excludeCountries(...countries: (typeof countryNames)[number][]): this {
this.excludedCountries = { enabled: true, value: countries };
return this;
}
enableOFACCheck(): this {
this.ofac = true;
return this;
}
allowMockPassports(): this {
this.devMode = true;
return this;
}
// TODO: related to the qr code
getIntent(
appName: string,
userId: string,
userIdType: UserIdType,
sessionId: string,
websocketUrl: string = WEBSOCKET_URL
): string {
const intent_raw: SelfAppPartial = {
appName: appName,
scope: this.scope,
websocketUrl: websocketUrl,
sessionId: sessionId,
userId: userId,
userIdType: userIdType,
devMode: this.devMode,
};
let selfArguments: ArgumentsProveOffChain | ArgumentsRegister;
const argsVcAndDisclose: ArgumentsDisclose = {
disclosureOptions: {
minimumAge: this.minimumAge,
nationality: this.nationality,
excludedCountries: this.excludedCountries,
ofac: this.ofac,
};
selfArguments = argsVcAndDisclose;
}
const intent: SelfApp = {
...intent_raw,
args: selfArguments,
};
const encoded = msgpack.encode(intent);
try {
const compressedData = pako.deflate(encoded);
return btoa(String.fromCharCode(...new Uint8Array(compressedData)));
} catch (err) {
console.error(err);
return '';
}
}
}

View File

@@ -1,7 +1,6 @@
export class OpenPassportVerifierReport {
export class SelfVerifierReport {
scope: boolean = true;
merkle_root_commitment: boolean = true;
merkle_root_csca: boolean = true;
attestation_id: boolean = true;
current_date: boolean = true;
issuing_state: boolean = true;
@@ -12,14 +11,10 @@ export class OpenPassportVerifierReport {
gender: boolean = true;
expiry_date: boolean = true;
older_than: boolean = true;
owner_of: boolean = true;
blinded_dsc_commitment: boolean = true;
proof: boolean = true;
dscProof: boolean = true;
dsc: boolean = true;
pubKey: boolean = true;
valid: boolean = true;
ofac: boolean = true;
merkle_root_ofac: boolean = true;
forbidden_countries_list: boolean = true;
public user_identifier: string;
@@ -28,7 +23,7 @@ export class OpenPassportVerifierReport {
constructor() {}
exposeAttribute(
attribute: keyof OpenPassportVerifierReport,
attribute: keyof SelfVerifierReport,
value: any = '',
expectedValue: any = ''
) {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,915 @@
export const hubAbi = [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
}
],
"name": "AddressEmptyCode",
"type": "error"
},
{
"inputs": [],
"name": "CURRENT_DATE_NOT_IN_VALID_RANGE",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "ERC1967InvalidImplementation",
"type": "error"
},
{
"inputs": [],
"name": "ERC1967NonPayable",
"type": "error"
},
{
"inputs": [],
"name": "FailedCall",
"type": "error"
},
{
"inputs": [],
"name": "INSUFFICIENT_CHARCODE_LEN",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_COMMITMENT_ROOT",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_CSCA_ROOT",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_DSC_PROOF",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_FORBIDDEN_COUNTRIES",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_OFAC",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_OFAC_ROOT",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_OLDER_THAN",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_REGISTER_PROOF",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_REVEALED_DATA_TYPE",
"type": "error"
},
{
"inputs": [],
"name": "INVALID_VC_AND_DISCLOSE_PROOF",
"type": "error"
},
{
"inputs": [],
"name": "InvalidAsciiCode",
"type": "error"
},
{
"inputs": [],
"name": "InvalidDateLength",
"type": "error"
},
{
"inputs": [],
"name": "InvalidInitialization",
"type": "error"
},
{
"inputs": [],
"name": "LENGTH_MISMATCH",
"type": "error"
},
{
"inputs": [],
"name": "NO_VERIFIER_SET",
"type": "error"
},
{
"inputs": [],
"name": "NotInitializing",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"inputs": [],
"name": "UUPSUnauthorizedCallContext",
"type": "error"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "slot",
"type": "bytes32"
}
],
"name": "UUPSUnsupportedProxiableUUID",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "verifier",
"type": "address"
}
],
"name": "DscCircuitVerifierUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "registry",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "vcAndDiscloseCircuitVerifier",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "registerCircuitVerifierIds",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "address[]",
"name": "registerCircuitVerifiers",
"type": "address[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "dscCircuitVerifierIds",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "address[]",
"name": "dscCircuitVerifiers",
"type": "address[]"
}
],
"name": "HubInitialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint64",
"name": "version",
"type": "uint64"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "verifier",
"type": "address"
}
],
"name": "RegisterCircuitVerifierUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "registry",
"type": "address"
}
],
"name": "RegistryUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "vcAndDiscloseCircuitVerifier",
"type": "address"
}
],
"name": "VcAndDiscloseCircuitUpdated",
"type": "event"
},
{
"inputs": [],
"name": "UPGRADE_INTERFACE_VERSION",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "typeIds",
"type": "uint256[]"
},
{
"internalType": "address[]",
"name": "verifierAddresses",
"type": "address[]"
}
],
"name": "batchUpdateDscCircuitVerifiers",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "typeIds",
"type": "uint256[]"
},
{
"internalType": "address[]",
"name": "verifierAddresses",
"type": "address[]"
}
],
"name": "batchUpdateRegisterCircuitVerifiers",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "forbiddenCountriesListPacked",
"type": "uint256"
}
],
"name": "getReadableForbiddenCountries",
"outputs": [
{
"internalType": "string[10]",
"name": "",
"type": "string[10]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[3]",
"name": "revealedDataPacked",
"type": "uint256[3]"
},
{
"internalType": "enum IIdentityVerificationHubV1.RevealedDataType[]",
"name": "types",
"type": "uint8[]"
}
],
"name": "getReadableRevealedData",
"outputs": [
{
"components": [
{
"internalType": "string",
"name": "issuingState",
"type": "string"
},
{
"internalType": "string[]",
"name": "name",
"type": "string[]"
},
{
"internalType": "string",
"name": "passportNumber",
"type": "string"
},
{
"internalType": "string",
"name": "nationality",
"type": "string"
},
{
"internalType": "string",
"name": "dateOfBirth",
"type": "string"
},
{
"internalType": "string",
"name": "gender",
"type": "string"
},
{
"internalType": "string",
"name": "expiryDate",
"type": "string"
},
{
"internalType": "uint256",
"name": "olderThan",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ofac",
"type": "uint256"
}
],
"internalType": "struct IIdentityVerificationHubV1.ReadableRevealedData",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "registryAddress",
"type": "address"
},
{
"internalType": "address",
"name": "vcAndDiscloseCircuitVerifierAddress",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "registerCircuitVerifierIds",
"type": "uint256[]"
},
{
"internalType": "address[]",
"name": "registerCircuitVerifierAddresses",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "dscCircuitVerifierIds",
"type": "uint256[]"
},
{
"internalType": "address[]",
"name": "dscCircuitVerifierAddresses",
"type": "address[]"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "dscCircuitVerifierId",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
},
{
"internalType": "uint256[2]",
"name": "pubSignals",
"type": "uint256[2]"
}
],
"internalType": "struct IDscCircuitVerifier.DscCircuitProof",
"name": "dscCircuitProof",
"type": "tuple"
}
],
"name": "registerDscKeyCommitment",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "registerCircuitVerifierId",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
},
{
"internalType": "uint256[3]",
"name": "pubSignals",
"type": "uint256[3]"
}
],
"internalType": "struct IRegisterCircuitVerifier.RegisterCircuitProof",
"name": "registerCircuitProof",
"type": "tuple"
}
],
"name": "registerPassportCommitment",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "registry",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
}
],
"name": "sigTypeToDscCircuitVerifiers",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
}
],
"name": "sigTypeToRegisterCircuitVerifiers",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
},
{
"internalType": "address",
"name": "verifierAddress",
"type": "address"
}
],
"name": "updateDscVerifier",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "typeId",
"type": "uint256"
},
{
"internalType": "address",
"name": "verifierAddress",
"type": "address"
}
],
"name": "updateRegisterCircuitVerifier",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "registryAddress",
"type": "address"
}
],
"name": "updateRegistry",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "vcAndDiscloseCircuitVerifierAddress",
"type": "address"
}
],
"name": "updateVcAndDiscloseCircuit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "upgradeToAndCall",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "vcAndDiscloseCircuitVerifier",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bool",
"name": "olderThanEnabled",
"type": "bool"
},
{
"internalType": "uint256",
"name": "olderThan",
"type": "uint256"
},
{
"internalType": "bool",
"name": "forbiddenCountriesEnabled",
"type": "bool"
},
{
"internalType": "uint256",
"name": "forbiddenCountriesListPacked",
"type": "uint256"
},
{
"internalType": "bool",
"name": "ofacEnabled",
"type": "bool"
},
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
},
{
"internalType": "uint256[16]",
"name": "pubSignals",
"type": "uint256[16]"
}
],
"internalType": "struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof",
"name": "vcAndDiscloseProof",
"type": "tuple"
}
],
"internalType": "struct IIdentityVerificationHubV1.VcAndDiscloseHubProof",
"name": "proof",
"type": "tuple"
}
],
"name": "verifyVcAndDisclose",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "attestationId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "scope",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "userIdentifier",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "nullifier",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "identityCommitmentRoot",
"type": "uint256"
},
{
"internalType": "uint256[3]",
"name": "revealedDataPacked",
"type": "uint256[3]"
},
{
"internalType": "uint256",
"name": "forbiddenCountriesListPacked",
"type": "uint256"
}
],
"internalType": "struct IIdentityVerificationHubV1.VcAndDiscloseVerificationResult",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
}
];

View File

@@ -0,0 +1,230 @@
export const verifyAllAbi = [
{
"inputs": [
{
"internalType": "address",
"name": "hub",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "hub",
"type": "address"
}
],
"name": "setHub",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bool",
"name": "olderThanEnabled",
"type": "bool"
},
{
"internalType": "uint256",
"name": "olderThan",
"type": "uint256"
},
{
"internalType": "bool",
"name": "forbiddenCountriesEnabled",
"type": "bool"
},
{
"internalType": "uint256",
"name": "forbiddenCountriesListPacked",
"type": "uint256"
},
{
"internalType": "bool",
"name": "ofacEnabled",
"type": "bool"
},
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
},
{
"internalType": "uint256[16]",
"name": "pubSignals",
"type": "uint256[16]"
}
],
"internalType": "struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof",
"name": "vcAndDiscloseProof",
"type": "tuple"
}
],
"internalType": "struct IIdentityVerificationHubV1.VcAndDiscloseHubProof",
"name": "proof",
"type": "tuple"
},
{
"internalType": "enum IIdentityVerificationHubV1.RevealedDataType[]",
"name": "types",
"type": "uint8[]"
},
{
"components": [
{
"internalType": "string",
"name": "issuingState",
"type": "string"
},
{
"internalType": "string[]",
"name": "name",
"type": "string[]"
},
{
"internalType": "string",
"name": "passportNumber",
"type": "string"
},
{
"internalType": "string",
"name": "nationality",
"type": "string"
},
{
"internalType": "string",
"name": "dateOfBirth",
"type": "string"
},
{
"internalType": "string",
"name": "gender",
"type": "string"
},
{
"internalType": "string",
"name": "expiryDate",
"type": "string"
},
{
"internalType": "uint256",
"name": "olderThan",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "ofac",
"type": "uint256"
}
],
"internalType": "struct IIdentityVerificationHubV1.ReadableRevealedData",
"name": "expectedData",
"type": "tuple"
}
],
"name": "verifyAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@@ -0,0 +1,14 @@
{
"DeployVerifiers#Verifier_dsc_sha256_rsa_65537_4096": "0x7a4DD396a164d49D82DB0Ba0D26E4c028f9Ac23b",
"DeployVerifiers#Verifier_register_sha256_sha256_sha256_rsa_65537_4096": "0xA3d441c6c8c53A9E53ad10C720161890E39524D9",
"DeployVerifiers#Verifier_vc_and_disclose": "0x2a4e75c6164d746D2113884f557f0A1c8eb57F39",
"DeployRegistryModule#PoseidonT3": "0xeB0A32b54953f5DA3c363739C8CB1dE41F155011",
"DeployRegistryModule#IdentityRegistryImplV1": "0xa339Fa4D27533BEb0122aB3586Cc48dfBfFB9CE4",
"DeployRegistryModule#IdentityRegistry": "0xc35f7882F2cEbE48eb10cAdB57f533ae6B19bd9A",
"DeployHub#IdentityVerificationHubImplV1": "0xBc542eAF0983A216B8d896f88E002233f01Cb804",
"DeployHub#IdentityVerificationHub": "0xCa88837092A5CF34B31727955962f8c57d06eaB1",
"UpdateRegistryCscaRoot#IdentityRegistryImplV1": "0xc35f7882F2cEbE48eb10cAdB57f533ae6B19bd9A",
"UpdateRegistryOfacRoot#IdentityRegistryImplV1": "0xc35f7882F2cEbE48eb10cAdB57f533ae6B19bd9A",
"UpdateRegistryHub#IdentityRegistryImplV1": "0xc35f7882F2cEbE48eb10cAdB57f533ae6B19bd9A",
"DeployVerifyAll#VerifyAll": "0x027BDac4bF61c495Be84347feF3e408DCb64EF13"
}

View File

@@ -0,0 +1,12 @@
{
"DeployRegistryModule#PoseidonT3": "0x8F3acfD2738a732AA1e0367480559f13e8DEF69C",
"DeployRegistryModule#IdentityRegistryImplV1": "0xBF4fD550c7BD3Cf6eC6A0b30bD4c8e603bbC16a8",
"DeployRegistryModule#IdentityRegistry": "0xC8c6E4176C9a23e886A9BcCcb80ABCbc3C5c2D65",
"DeployVerifiers#Verifier_dsc_sha256_rsa_65537_4096": "0xCfaa0489f27b8A6980DeA5134f32516c755B7e63",
"DeployVerifiers#Verifier_register_sha256_sha256_sha256_rsa_65537_4096": "0xAE17B5B870fA5DD28Eb444D30B7862BfAd84882B",
"DeployVerifiers#Verifier_vc_and_disclose": "0x5d4dA1C5D567733B7552cC26612d9B3e3A0345FF",
"DeployHubModule#IdentityVerificationHubImplV1": "0xA39ad940F2a8Dd2E4ACBEdBEb17017c3727A1CFC",
"DeployHubModule#IdentityVerificationHub": "0xC2469d565A2DC77f4a496Ff5e3B25ED69Ea8AB6b",
"DeployHub#IdentityVerificationHubImplV1": "0xEDBA386C67364084c5eCbb4C50422eEDCfB19374",
"DeployHub#IdentityVerificationHub": "0x06b77ee016f8F2f6Ff7E361F5b7165ba16797CcE"
}

View File

@@ -21,7 +21,7 @@
"circuits/**/*",
"circuits/**/*.json",
"utils/utils.ts",
"../../common/src/utils/openPassportAttestation.ts"
"../../common/src/utils/selfAttestation.ts"
],
"exclude": [
"node_modules",