mirror of
https://github.com/selfxyz/self.git
synced 2026-01-14 17:17:59 -05:00
Merge pull request #198 from zk-passport/refactor-passportData
refactor mockPassportData generation
This commit is contained in:
7
.github/workflows/action.yml
vendored
7
.github/workflows/action.yml
vendored
@@ -37,7 +37,6 @@ jobs:
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
@@ -58,6 +57,10 @@ jobs:
|
||||
working-directory: ./circuits
|
||||
run: yarn lint
|
||||
|
||||
- name: Run Tests
|
||||
- name: Run Tests (Circuits)
|
||||
working-directory: ./circuits
|
||||
run: yarn test
|
||||
|
||||
- name: Run Tests (Common)
|
||||
working-directory: ./common
|
||||
run: yarn test
|
||||
@@ -28,7 +28,7 @@ import NextScreen from './NextScreen';
|
||||
import RegisterScreen from './RegisterScreen';
|
||||
import AppScreen from './AppScreen';
|
||||
// import constants
|
||||
import { RPC_URL, SignatureAlgorithm } from '../../../common/src/constants/constants';
|
||||
import { RPC_URL, SignatureAlgorithmIndex } from '../../../common/src/constants/constants';
|
||||
import { mock_csca_sha256_rsa_4096, mock_dsc_sha256_rsa_4096 } from '../../../common/src/constants/mockCertificates';
|
||||
import DatePicker from 'react-native-date-picker'
|
||||
import StartScreen from './StartScreen';
|
||||
@@ -143,8 +143,8 @@ const MainScreen: React.FC = () => {
|
||||
// console.log('CSCA Proof received:', cscaProof);
|
||||
// if ((cscaProof !== null) && (localProof !== null)) {
|
||||
// const sendTransaction = async () => {
|
||||
// const sigAlgFormatted = formatSigAlgNameForCircuit(passportData.signatureAlgorithm, passportData.pubKey.exponent);
|
||||
// const sigAlgIndex = SignatureAlgorithm[sigAlgFormatted as keyof typeof SignatureAlgorithm]
|
||||
// const sigAlgFormatted = formatSigAlgNameForCircuit(passportData.signatureAlgorithm, passportData.pubKey.exponent); // this is old formatting
|
||||
// const sigAlgIndex = SignatureAlgorithmIndex[sigAlgFormatted as keyof typeof SignatureAlgorithmIndex]
|
||||
// console.log("local proof already generated, sending transaction");
|
||||
// const provider = new ethers.JsonRpcProvider(RPC_URL);
|
||||
// const serverResponse = await sendRegisterTransaction(localProof, cscaProof, sigAlgIndex)
|
||||
|
||||
@@ -10,8 +10,9 @@ import { genMockPassportData } from '../../../common/src/utils/genMockPassportDa
|
||||
import { countryCodes } from '../../../common/src/constants/constants';
|
||||
import getCountryISO2 from "country-iso-3-to-2";
|
||||
import { flag } from 'country-emoji';
|
||||
import { getSignatureAlgorithm, getCircuitName } from '../../../common/src/utils/handleCertificate';
|
||||
import { parseDSC, getCircuitName } from '../../../common/src/utils/handleCertificate';
|
||||
import { downloadZkey } from '../utils/zkeyDownload';
|
||||
|
||||
const MockDataScreen: React.FC = () => {
|
||||
const [signatureAlgorithm, setSignatureAlgorithm] = useState("rsa_sha256");
|
||||
const listOfSignatureAlgorithms = ["rsa_sha1", "rsa_sha256", "rsapss_sha256"];
|
||||
@@ -35,8 +36,8 @@ const MockDataScreen: React.FC = () => {
|
||||
const mockPassportData = genMockPassportData(signatureAlgorithm as "rsa_sha256" | "rsa_sha1" | "rsapss_sha256", nationality as keyof typeof countryCodes, castDate(dateOfBirthDatePicker), castDate(dateOfExpiryDatePicker));
|
||||
useUserStore.getState().registerPassportData(mockPassportData);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
const sigAlgName = getSignatureAlgorithm(mockPassportData.dsc as string);
|
||||
const circuitName = getCircuitName("prove", sigAlgName.signatureAlgorithm, sigAlgName.hashFunction);
|
||||
const { signatureAlgorithm: sigAlg, hashFunction } = parseDSC(mockPassportData.dsc);
|
||||
const circuitName = getCircuitName("prove", sigAlg, hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
resolve(null);
|
||||
}, 0));
|
||||
|
||||
@@ -11,7 +11,7 @@ import { generateCircuitInputsProve } from '../../../common/src/utils/generateIn
|
||||
import { revealBitmapFromAttributes } from '../../../common/src/utils/revealBitmap';
|
||||
import { formatProof, generateProof } from '../utils/prover';
|
||||
import io, { Socket } from 'socket.io-client';
|
||||
import { getCircuitName, getSignatureAlgorithm } from '../../../common/src/utils/handleCertificate';
|
||||
import { getCircuitName, parseDSC } from '../../../common/src/utils/handleCertificate';
|
||||
import { CircuitName } from '../utils/zkeyDownload';
|
||||
import { generateCircuitInputsInApp } from '../utils/generateInputsInApp';
|
||||
interface ProveScreenProps {
|
||||
@@ -37,7 +37,7 @@ const ProveScreen: React.FC<ProveScreenProps> = ({ setSheetRegisterIsOpen }) =>
|
||||
|
||||
const [socket, setSocket] = useState<Socket | null>(null);
|
||||
const [isConnecting, setIsConnecting] = useState(false);
|
||||
const { signatureAlgorithm, hashFunction } = getSignatureAlgorithm(passportData.dsc as string);
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(passportData.dsc);
|
||||
const circuitName = getCircuitName(selectedApp.circuit, signatureAlgorithm, hashFunction);
|
||||
|
||||
const waitForSocketConnection = (socket: Socket): Promise<void> => {
|
||||
|
||||
@@ -4,12 +4,12 @@ import {
|
||||
DEFAULT_DOB,
|
||||
DEFAULT_DOE,
|
||||
} from '@env';
|
||||
import { mockPassportData_sha256_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { PassportData, Proof } from '../../../common/src/utils/types';
|
||||
import * as Keychain from 'react-native-keychain';
|
||||
import * as amplitude from '@amplitude/analytics-react-native';
|
||||
import { loadPassportData, loadSecret, loadSecretOrCreateIt, storePassportData } from '../utils/keychain';
|
||||
import { generateDscSecret } from '../../../common/src/utils/csca';
|
||||
import { genMockPassportData } from '../../../common/src/utils/genMockPassportData';
|
||||
|
||||
interface UserState {
|
||||
passportNumber: string
|
||||
@@ -43,7 +43,7 @@ const useUserStore = create<UserState>((set, get) => ({
|
||||
dateOfExpiry: DEFAULT_DOE ?? "",
|
||||
dscSecret: null,
|
||||
registered: false,
|
||||
passportData: mockPassportData_sha256_rsa_65537,
|
||||
passportData: genMockPassportData("rsa_sha256", "FRA", "19900101", "20300101"),
|
||||
secret: "",
|
||||
cscaProof: null,
|
||||
localProof: null,
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
import { AppType } from '../../../common/src/utils/appType';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import { generateCircuitInputsProve, generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { DEFAULT_MAJORITY, k_dsc, n_dsc, PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
import { DEFAULT_MAJORITY, k_dsc, k_dsc_ecdsa, n_dsc, n_dsc_ecdsa, PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
import { revealBitmapFromAttributes } from '../../../common/src/utils/revealBitmap';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import { ArgumentsProve } from '../../../common/src/utils/appType'
|
||||
import { parseDSC } from '../../../common/src/utils/handleCertificate';
|
||||
|
||||
export const generateCircuitInputsInApp = (
|
||||
passportData: PassportData,
|
||||
@@ -14,7 +15,15 @@ export const generateCircuitInputsInApp = (
|
||||
switch (app.circuit) {
|
||||
case 'register': {
|
||||
const { secret, dscSecret } = useUserStore.getState();
|
||||
return generateCircuitInputsRegister(secret, dscSecret as string, PASSPORT_ATTESTATION_ID, passportData, n_dsc, k_dsc);
|
||||
const { signatureAlgorithm } = parseDSC(passportData.dsc);
|
||||
return generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret as string,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
signatureAlgorithm === 'ecdsa' ? n_dsc_ecdsa : n_dsc,
|
||||
signatureAlgorithm === 'ecdsa' ? k_dsc_ecdsa : k_dsc,
|
||||
);
|
||||
}
|
||||
case 'prove': {
|
||||
const disclosureOptions = (app.arguments as ArgumentsProve).disclosureOptions || {};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { NativeModules, Platform } from 'react-native';
|
||||
// @ts-ignore
|
||||
import PassportReader from 'react-native-passport-reader';
|
||||
import { toStandardName } from '../../../common/src/utils/formatNames';
|
||||
import { checkInputs } from '../utils/utils';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import forge from 'node-forge';
|
||||
@@ -9,7 +8,7 @@ import { Buffer } from 'buffer';
|
||||
import * as amplitude from '@amplitude/analytics-react-native';
|
||||
import useUserStore from '../stores/userStore';
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import { getSignatureAlgorithm, getCircuitName } from '../../../common/src/utils/handleCertificate';
|
||||
import { parseDSC, getCircuitName } from '../../../common/src/utils/handleCertificate';
|
||||
import { downloadZkey } from './zkeyDownload';
|
||||
|
||||
export const scan = async (setModalProofStep: (modalProofStep: number) => void) => {
|
||||
@@ -121,7 +120,6 @@ const handleResponseIOS = async (
|
||||
|
||||
const eContentBase64 = parsed.eContentBase64; // this is what we call concatenatedDataHashes in android world
|
||||
const signedAttributes = parsed.signedAttributes; // this is what we call eContent in android world
|
||||
const signatureAlgorithm = parsed.signatureAlgorithm;
|
||||
const mrz = parsed.passportMRZ;
|
||||
const signatureBase64 = parsed.signatureBase64;
|
||||
console.log('dataGroupsPresent', parsed.dataGroupsPresent)
|
||||
@@ -131,19 +129,12 @@ const handleResponseIOS = async (
|
||||
console.log('isChipAuthenticationSupported', parsed.isChipAuthenticationSupported)
|
||||
console.log('residenceAddress', parsed.residenceAddress)
|
||||
console.log('passportPhoto', parsed.passportPhoto.substring(0, 100) + '...')
|
||||
console.log('signatureAlgorithm', signatureAlgorithm)
|
||||
console.log('encapsulatedContentDigestAlgorithm', parsed.encapsulatedContentDigestAlgorithm)
|
||||
console.log('parsed.documentSigningCertificate', parsed.documentSigningCertificate)
|
||||
const pem = JSON.parse(parsed.documentSigningCertificate).PEM.replace(/\n/g, '');
|
||||
const certificate = forge.pki.certificateFromPem(pem);
|
||||
console.log('pem', pem)
|
||||
|
||||
try {
|
||||
const publicKey = certificate.publicKey;
|
||||
//console.log('publicKey', publicKey);
|
||||
|
||||
const modulus = (publicKey as any).n.toString(10);
|
||||
|
||||
const eContentArray = Array.from(Buffer.from(signedAttributes, 'base64'));
|
||||
const signedEContentArray = eContentArray.map(byte => byte > 127 ? byte - 256 : byte);
|
||||
|
||||
@@ -153,15 +144,9 @@ const handleResponseIOS = async (
|
||||
const encryptedDigestArray = Array.from(Buffer.from(signatureBase64, 'base64')).map(byte => byte > 127 ? byte - 256 : byte);
|
||||
|
||||
//amplitude.track('Sig alg before conversion: ' + signatureAlgorithm);
|
||||
console.log('signatureAlgorithm before conversion', signatureAlgorithm);
|
||||
const passportData = {
|
||||
mrz,
|
||||
signatureAlgorithm: toStandardName(signatureAlgorithm),
|
||||
dsc: pem,
|
||||
pubKey: {
|
||||
modulus: modulus,
|
||||
exponent: (publicKey as any).e.toString(10),
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashesArraySigned,
|
||||
eContent: signedEContentArray,
|
||||
encryptedDigest: encryptedDigestArray,
|
||||
@@ -169,8 +154,8 @@ const handleResponseIOS = async (
|
||||
mockUser: false
|
||||
};
|
||||
useUserStore.getState().registerPassportData(passportData)
|
||||
const sigAlgName = getSignatureAlgorithm(pem);
|
||||
const circuitName = getCircuitName("prove", sigAlgName.signatureAlgorithm, sigAlgName.hashFunction);
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(pem);
|
||||
const circuitName = getCircuitName("prove", signatureAlgorithm, hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
} catch (e: any) {
|
||||
@@ -191,10 +176,6 @@ const handleResponseAndroid = async (
|
||||
) => {
|
||||
const {
|
||||
mrz,
|
||||
signatureAlgorithm,
|
||||
modulus,
|
||||
curveName,
|
||||
publicKeyQ,
|
||||
eContent,
|
||||
encryptedDigest,
|
||||
photo,
|
||||
@@ -210,22 +191,9 @@ const handleResponseAndroid = async (
|
||||
//amplitude.track('Sig alg before conversion: ' + signatureAlgorithm);
|
||||
|
||||
const pem = "-----BEGIN CERTIFICATE-----" + documentSigningCertificate + "-----END CERTIFICATE-----"
|
||||
|
||||
const cert = forge.pki.certificateFromPem(pem);
|
||||
console.log('cert', cert);
|
||||
const publicKey = cert.publicKey;
|
||||
console.log('publicKey', publicKey);
|
||||
|
||||
const passportData: PassportData = {
|
||||
mrz: mrz.replace(/\n/g, ''),
|
||||
signatureAlgorithm: toStandardName(signatureAlgorithm),
|
||||
dsc: pem,
|
||||
pubKey: {
|
||||
modulus: modulus,
|
||||
exponent: (publicKey as any).e.toString(10),
|
||||
curveName: curveName,
|
||||
publicKeyQ: publicKeyQ,
|
||||
},
|
||||
dataGroupHashes: JSON.parse(encapContent),
|
||||
eContent: JSON.parse(eContent),
|
||||
encryptedDigest: JSON.parse(encryptedDigest),
|
||||
@@ -240,8 +208,6 @@ const handleResponseAndroid = async (
|
||||
}, null, 2));
|
||||
|
||||
console.log('mrz', passportData.mrz);
|
||||
console.log('signatureAlgorithm', passportData.signatureAlgorithm);
|
||||
console.log('pubKey', passportData.pubKey);
|
||||
console.log('dataGroupHashes', passportData.dataGroupHashes);
|
||||
console.log('eContent', passportData.eContent);
|
||||
console.log('encryptedDigest', passportData.encryptedDigest);
|
||||
@@ -255,8 +221,8 @@ const handleResponseAndroid = async (
|
||||
console.log("documentSigningCertificate", documentSigningCertificate)
|
||||
useUserStore.getState().registerPassportData(passportData)
|
||||
|
||||
const sigAlgName = getSignatureAlgorithm(pem);
|
||||
const circuitName = getCircuitName("prove", sigAlgName.signatureAlgorithm, sigAlgName.hashFunction);
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(pem);
|
||||
const circuitName = getCircuitName("prove", signatureAlgorithm, hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NativeModules, Platform } from "react-native";
|
||||
import { AppType, reconstructAppType } from "../../../common/src/utils/appType";
|
||||
import useNavigationStore from '../stores/navigationStore';
|
||||
import { getCircuitName, getSignatureAlgorithm } from "../../../common/src/utils/handleCertificate";
|
||||
import { getCircuitName, parseDSC } from "../../../common/src/utils/handleCertificate";
|
||||
import useUserStore from "../stores/userStore";
|
||||
import { downloadZkey } from "./zkeyDownload";
|
||||
|
||||
@@ -56,8 +56,8 @@ const handleQRCodeScan = (result: string, toast: any, setSelectedApp: any, setSe
|
||||
console.log(result);
|
||||
const parsedJson = JSON.parse(result);
|
||||
const app: AppType = reconstructAppType(parsedJson);
|
||||
const dsc = useUserStore.getState().passportData?.dsc;
|
||||
const sigAlgName = getSignatureAlgorithm(dsc!);
|
||||
const dsc = useUserStore.getState().passportData.dsc;
|
||||
const sigAlgName = parseDSC(dsc!);
|
||||
const circuitName = getCircuitName(app.circuit, sigAlgName.signatureAlgorithm, sigAlgName.hashFunction);
|
||||
downloadZkey(circuitName as any);
|
||||
setSelectedApp(app);
|
||||
|
||||
@@ -27,11 +27,7 @@ export async function isCommitmentRegistered(secret: string, passportData: Passp
|
||||
|
||||
imt.import(response.data);
|
||||
|
||||
const pubkey_leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
modulus: passportData.pubKey!.modulus,
|
||||
exponent: passportData.pubKey!.exponent,
|
||||
});
|
||||
const pubkey_leaf = getLeaf(passportData);
|
||||
|
||||
const formattedMrz = formatMrz(passportData.mrz);
|
||||
const mrz_bytes = packBytes(formattedMrz);
|
||||
|
||||
@@ -4,14 +4,14 @@ import groth16ExportSolidityCallData from './snarkjs';
|
||||
import contractAddresses from "../../deployments/deployed_addresses.json";
|
||||
import registerArtefacts from "../../deployments/artifacts/Deploy_Registry#OpenPassportRegister.json";
|
||||
import sbtArtefacts from "../../deployments/artifacts/Deploy_Registry#SBT.json";
|
||||
import { CHAIN_NAME, RELAYER_URL, RPC_URL, SignatureAlgorithm } from '../../../common/src/constants/constants';
|
||||
import { CHAIN_NAME, RELAYER_URL, RPC_URL, SignatureAlgorithmIndex } from '../../../common/src/constants/constants';
|
||||
import { Proof } from "../../../common/src/utils/types";
|
||||
import { formatCallData_disclose, formatCallData_dsc, formatCallData_register } from "../../../common/src/utils/formatCallData";
|
||||
|
||||
export const sendRegisterTransaction = async (
|
||||
proof: Proof,
|
||||
cscaProof: Proof,
|
||||
sigAlgIndex: SignatureAlgorithm
|
||||
sigAlgIndex: SignatureAlgorithmIndex
|
||||
) => {
|
||||
const provider = new ethers.JsonRpcProvider(RPC_URL);
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { mockPassportData_sha256_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { formatMrz, packBytes } from '../../../common/src/utils/utils';
|
||||
import {
|
||||
attributeToPosition,
|
||||
COMMITMENT_TREE_DEPTH,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
} from '../../../common/src/constants/constants';
|
||||
import { poseidon1, poseidon2, poseidon6 } from 'poseidon-lite';
|
||||
@@ -14,13 +12,14 @@ import { getLeaf } from '../../../common/src/utils/pubkeyTree';
|
||||
import { generateCircuitInputsDisclose } from '../../../common/src/utils/generateInputs';
|
||||
import { formatAndUnpackReveal } from '../../../common/src/utils/revealBitmap';
|
||||
import crypto from 'crypto';
|
||||
import { genMockPassportData } from '../../../common/src/utils/genMockPassportData';
|
||||
|
||||
describe('Disclose', function () {
|
||||
this.timeout(0);
|
||||
let inputs: any;
|
||||
let circuit: any;
|
||||
let w: any;
|
||||
let passportData = mockPassportData_sha256_rsa_65537;
|
||||
const passportData = genMockPassportData('rsa_sha256', 'FRA', '000101', '300101');
|
||||
let tree: any;
|
||||
|
||||
before(async () => {
|
||||
@@ -43,11 +42,7 @@ describe('Disclose', function () {
|
||||
const scope = '@coboyApp';
|
||||
|
||||
// compute the commitment and insert it in the tree
|
||||
const pubkey_leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
modulus: passportData.pubKey.modulus,
|
||||
exponent: passportData.pubKey.exponent,
|
||||
}).toString();
|
||||
const pubkey_leaf = getLeaf(passportData).toString();
|
||||
const mrz_bytes = packBytes(formatMrz(passportData.mrz));
|
||||
const commitment = poseidon6([
|
||||
secret,
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import {
|
||||
mockPassportData_sha256_rsa_65537,
|
||||
mockPassportData2_sha256_rsa_65537,
|
||||
} from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsOfac } from '../../../common/src/utils/generateInputs';
|
||||
import { getLeaf } from '../../../common/src/utils/pubkeyTree';
|
||||
import { SMT } from '@ashpect/smt';
|
||||
@@ -17,10 +13,21 @@ import namejson from '../../../common/ofacdata/outputs/nameSMT.json';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import { PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
import crypto from 'crypto';
|
||||
import { genMockPassportData } from '../../../common/src/utils/genMockPassportData';
|
||||
|
||||
let circuit: any;
|
||||
const passportData = mockPassportData_sha256_rsa_65537; // Mock passport ADDED in ofac list to test circuits
|
||||
const passportData2 = mockPassportData2_sha256_rsa_65537; // Mock passport not added in ofac list to test circuits
|
||||
|
||||
// Mock passport added in ofac list to test circuits
|
||||
const passportData = genMockPassportData('rsa_sha256', 'FRA', '040211', '300101');
|
||||
// Mock passport not added in ofac list to test circuits
|
||||
const passportData2 = genMockPassportData(
|
||||
'rsa_sha256',
|
||||
'FRA',
|
||||
'000102',
|
||||
'300101',
|
||||
'24HB81833',
|
||||
'CLAQUE'
|
||||
);
|
||||
|
||||
// Calculating common validity inputs for all 3 circuits
|
||||
function getPassportInputs(passportData: PassportData) {
|
||||
@@ -31,11 +38,7 @@ function getPassportInputs(passportData: PassportData) {
|
||||
const bitmap = Array(90).fill('1');
|
||||
const scope = '@coboyApp';
|
||||
|
||||
const pubkey_leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
modulus: passportData.pubKey.modulus,
|
||||
exponent: passportData.pubKey.exponent,
|
||||
}).toString();
|
||||
const pubkey_leaf = getLeaf(passportData);
|
||||
const mrz_bytes = packBytes(formatMrz(passportData.mrz));
|
||||
const commitment = poseidon6([
|
||||
secret,
|
||||
@@ -141,7 +144,6 @@ describe('OFAC - Passport number match', function () {
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
expect(error.message).to.include('line: 43');
|
||||
expect(error.message).to.not.include('SMTVerify');
|
||||
}
|
||||
});
|
||||
@@ -229,7 +231,6 @@ describe('OFAC - Name and DOB match', function () {
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
expect(error.message).to.include('line: 54');
|
||||
expect(error.message).to.not.include('SMTVerify');
|
||||
}
|
||||
});
|
||||
@@ -317,7 +318,6 @@ describe('OFAC - Name match', function () {
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
expect(error.message).to.include('line: 46');
|
||||
expect(error.message).to.not.include('SMTVerify');
|
||||
}
|
||||
});
|
||||
|
||||
114
circuits/tests/prove.test.ts
Normal file
114
circuits/tests/prove.test.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
import { describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { generateCircuitInputsProve } from '../../common/src/utils/generateInputs';
|
||||
import { n_dsc, k_dsc, k_dsc_ecdsa, n_dsc_ecdsa } from '../../common/src/constants/constants';
|
||||
import { genMockPassportData } from '../../common/src/utils/genMockPassportData';
|
||||
import { getCircuitName } from '../../common/src/utils/handleCertificate';
|
||||
import { SignatureAlgorithm } from '../../common/src/utils/types';
|
||||
|
||||
const sigAlgs = [
|
||||
{ sigAlg: 'rsa', hashFunction: 'sha1' },
|
||||
{ sigAlg: 'rsa', hashFunction: 'sha256' },
|
||||
{ sigAlg: 'rsapss', hashFunction: 'sha256' },
|
||||
];
|
||||
|
||||
sigAlgs.forEach(({ sigAlg, hashFunction }) => {
|
||||
describe(`Prove - ${hashFunction.toUpperCase()} ${sigAlg.toUpperCase()}`, function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = genMockPassportData(
|
||||
`${sigAlg}_${hashFunction}` as SignatureAlgorithm,
|
||||
'FRA',
|
||||
'000101',
|
||||
'300101'
|
||||
);
|
||||
const majority = '18';
|
||||
const user_identifier = crypto.randomUUID();
|
||||
const scope = '@coboyApp';
|
||||
const bitmap = Array(90).fill('1');
|
||||
|
||||
const inputs = generateCircuitInputsProve(
|
||||
passportData,
|
||||
sigAlg === 'ecdsa' ? n_dsc_ecdsa : n_dsc,
|
||||
sigAlg === 'ecdsa' ? k_dsc_ecdsa : k_dsc,
|
||||
scope,
|
||||
bitmap,
|
||||
majority,
|
||||
user_identifier
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(
|
||||
__dirname,
|
||||
`../circuits/prove/${getCircuitName('prove', sigAlg, hashFunction)}.circom`
|
||||
),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
expect(nullifier).to.be.not.null;
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) =>
|
||||
String((parseInt(byte, 10) + 1) % 256)
|
||||
),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,95 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { mockPassportData_sha1_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsProve } from '../../../common/src/utils/generateInputs';
|
||||
import crypto from 'crypto';
|
||||
import { DEFAULT_MAJORITY, k_dsc, n_dsc } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('PROVE - RSA SHA1', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha1_rsa_65537;
|
||||
const majority = DEFAULT_MAJORITY;
|
||||
const user_identifier = crypto.randomUUID();
|
||||
const scope = '@coboyApp';
|
||||
const bitmap = Array(90).fill('1');
|
||||
|
||||
const inputs = generateCircuitInputsProve(
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc,
|
||||
scope,
|
||||
bitmap,
|
||||
majority,
|
||||
user_identifier
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/prove/prove_rsa_65537_sha1.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
expect(nullifier).to.be.not.null;
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,95 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { mockPassportData_sha256_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsProve } from '../../../common/src/utils/generateInputs';
|
||||
import crypto from 'crypto';
|
||||
import { k_dsc, n_dsc } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('PROVE - RSA SHA256', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha256_rsa_65537;
|
||||
const majority = '18';
|
||||
const user_identifier = crypto.randomUUID();
|
||||
const scope = '@coboyApp';
|
||||
const bitmap = Array(90).fill('1');
|
||||
|
||||
const inputs = generateCircuitInputsProve(
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc,
|
||||
scope,
|
||||
bitmap,
|
||||
majority,
|
||||
user_identifier
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/prove/prove_rsa_65537_sha256.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
expect(nullifier).to.be.not.null;
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,96 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { mockPassportData_sha256_rsapss_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsProve } from '../../../common/src/utils/generateInputs';
|
||||
import crypto from 'crypto';
|
||||
|
||||
describe('PROVE - RSAPSS SHA256', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha256_rsapss_65537;
|
||||
const n_dsc = 64;
|
||||
const k_dsc = 32;
|
||||
const majority = '18';
|
||||
const user_identifier = crypto.randomUUID();
|
||||
const scope = '@coboyApp';
|
||||
const bitmap = Array(90).fill('1');
|
||||
|
||||
const inputs = generateCircuitInputsProve(
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc,
|
||||
scope,
|
||||
bitmap,
|
||||
majority,
|
||||
user_identifier
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/prove/prove_rsapss_65537_sha256.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
expect(nullifier).to.be.not.null;
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
152
circuits/tests/register.test.ts
Normal file
152
circuits/tests/register.test.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { generateCircuitInputsRegister } from '../../common/src/utils/generateInputs';
|
||||
import { hexToDecimal, packBytes } from '../../common/src/utils/utils';
|
||||
import { computeLeafFromModulusBigInt } from '../../common/src/utils/csca';
|
||||
import {
|
||||
n_dsc,
|
||||
k_dsc,
|
||||
n_dsc_ecdsa,
|
||||
k_dsc_ecdsa,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
} from '../../common/src/constants/constants';
|
||||
import { genMockPassportData } from '../../common/src/utils/genMockPassportData';
|
||||
import { getCircuitName, parseDSC } from '../../common/src/utils/handleCertificate';
|
||||
import { getLeaf } from '../../common/src/utils/pubkeyTree';
|
||||
import { SignatureAlgorithm } from '../../common/src/utils/types';
|
||||
|
||||
const sigAlgs = [
|
||||
{ sigAlg: 'rsa', hashFunction: 'sha1' },
|
||||
{ sigAlg: 'rsa', hashFunction: 'sha256' },
|
||||
{ sigAlg: 'rsapss', hashFunction: 'sha256' },
|
||||
{ sigAlg: 'ecdsa', hashFunction: 'sha256' },
|
||||
{ sigAlg: 'ecdsa', hashFunction: 'sha1' },
|
||||
];
|
||||
|
||||
sigAlgs.forEach(({ sigAlg, hashFunction }) => {
|
||||
describe(`Register - ${hashFunction.toUpperCase()} ${sigAlg.toUpperCase()}`, function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = genMockPassportData(
|
||||
`${sigAlg}_${hashFunction}` as SignatureAlgorithm,
|
||||
'FRA',
|
||||
'000101',
|
||||
'300101'
|
||||
);
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
|
||||
const { modulus, x, y } = parseDSC(passportData.dsc);
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
sigAlg === 'ecdsa' ? n_dsc_ecdsa : n_dsc,
|
||||
sigAlg === 'ecdsa' ? k_dsc_ecdsa : k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(
|
||||
__dirname,
|
||||
`../circuits/register/${getCircuitName('register', sigAlg, hashFunction)}.circom`
|
||||
),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const leaf = getLeaf(passportData).toString();
|
||||
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
leaf,
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
console.log('commitment_js', commitment_js);
|
||||
console.log('commitment_circom', commitment_circom);
|
||||
// TODO: fix with new leaf hasher
|
||||
// expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) =>
|
||||
String((parseInt(byte, 10) + 1) % 256)
|
||||
),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature
|
||||
? inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256))
|
||||
: undefined,
|
||||
signature_s: inputs.signature_s
|
||||
? inputs.signature_s.map((byte: string) => String((parseInt(byte, 10) + 1) % 256))
|
||||
: undefined,
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,120 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import path from 'path';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { mockPassportData_sha1_ecdsa } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { BigintToArray, hexToDecimal, packBytes } from '../../../common/src/utils/utils';
|
||||
import { expect } from 'chai';
|
||||
import { getLeaf } from '../../../common/src/utils/pubkeyTree';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('Register - SHA1 WITH ECDSA', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha1_ecdsa;
|
||||
const n_dsc = 43; // 43 * 6 = 258 > 254 Cirom field size
|
||||
const k_dsc = 6;
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/register/register_ecdsa_sha1.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
'./node_modules/dmpierre/sha1-circom/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
publicKeyQ: passportData.pubKey.publicKeyQ,
|
||||
}).toString();
|
||||
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
leaf,
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
let wrong_signature_s = BigintToArray(43, 6, BigInt(hexToDecimal('10') + 1));
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature_s: wrong_signature_s,
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,119 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import path from 'path';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { mockPassportData_sha256_ecdsa } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { BigintToArray, hexToDecimal, packBytes } from '../../../common/src/utils/utils';
|
||||
import { expect } from 'chai';
|
||||
import { getLeaf } from '../../../common/src/utils/pubkeyTree';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('Register - SHA256 WITH ECDSA', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha256_ecdsa;
|
||||
const n_dsc = 43; // 43 * 6 = 258 > 254 Cirom field size
|
||||
const k_dsc = 6;
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/register/register_ecdsa_sha256.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
publicKeyQ: passportData.pubKey.publicKeyQ,
|
||||
}).toString();
|
||||
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
leaf,
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
let wrong_signature_s = BigintToArray(43, 6, BigInt(hexToDecimal('10') + 1));
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature_s: wrong_signature_s,
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,115 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { mockPassportData_sha1_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { packBytes } from '../../../common/src/utils/utils';
|
||||
import { computeLeafFromModulusBigInt } from '../../../common/src/utils/csca';
|
||||
import { k_dsc, n_dsc, PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('Register - SHA1 RSA', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha1_rsa_65537;
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/register/register_rsa_65537_sha1.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
'./node_modules/dmpierre/sha1-circom/circuits',
|
||||
'./node_modules/@zk-email/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
computeLeafFromModulusBigInt(BigInt(passportData.pubKey.modulus)),
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
//console.log('commitment_js', commitment_js)
|
||||
//console.log('commitment_circom', commitment_circom)
|
||||
expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,113 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { mockPassportData_sha256_rsa_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { packBytes } from '../../../common/src/utils/utils';
|
||||
import { computeLeafFromModulusBigInt } from '../../../common/src/utils/csca';
|
||||
import { k_dsc, n_dsc, PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('Register - SHA256 RSA', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha256_rsa_65537;
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/register/register_rsa_65537_sha256.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
computeLeafFromModulusBigInt(BigInt(passportData.pubKey.modulus)),
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
//console.log('commitment_js', commitment_js)
|
||||
//console.log('commitment_circom', commitment_circom)
|
||||
expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,118 +0,0 @@
|
||||
import { describe } from 'mocha';
|
||||
import { assert, expect } from 'chai';
|
||||
import path from 'path';
|
||||
import { wasm as wasm_tester } from 'circom_tester';
|
||||
import { poseidon6 } from 'poseidon-lite';
|
||||
import { mockPassportData_sha256_rsapss_65537 } from '../../../common/src/constants/mockPassportData';
|
||||
import { generateCircuitInputsRegister } from '../../../common/src/utils/generateInputs';
|
||||
import { packBytes } from '../../../common/src/utils/utils';
|
||||
import { computeLeafFromModulusBigInt } from '../../../common/src/utils/csca';
|
||||
import { PASSPORT_ATTESTATION_ID } from '../../../common/src/constants/constants';
|
||||
|
||||
describe('Register - SHA256 RSASSAPSS', function () {
|
||||
this.timeout(0);
|
||||
let circuit: any;
|
||||
|
||||
const passportData = mockPassportData_sha256_rsapss_65537;
|
||||
const secret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const dscSecret = BigInt(Math.floor(Math.random() * Math.pow(2, 254))).toString();
|
||||
const n_dsc = 64;
|
||||
const k_dsc = 32;
|
||||
|
||||
const inputs = generateCircuitInputsRegister(
|
||||
secret,
|
||||
dscSecret,
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
passportData,
|
||||
n_dsc,
|
||||
k_dsc
|
||||
);
|
||||
|
||||
before(async () => {
|
||||
circuit = await wasm_tester(
|
||||
path.join(__dirname, '../../circuits/register/register_rsapss_65537_sha256.circom'),
|
||||
{
|
||||
include: [
|
||||
'node_modules',
|
||||
'node_modules/@zk-email/circuits/helpers/sha.circom',
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should compile and load the circuit', async function () {
|
||||
expect(circuit).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should calculate the witness with correct inputs', async function () {
|
||||
console.time('calculateWitness');
|
||||
const w = await circuit.calculateWitness(inputs);
|
||||
console.timeEnd('calculateWitness');
|
||||
await circuit.checkConstraints(w);
|
||||
|
||||
const nullifier = (await circuit.getOutput(w, ['nullifier'])).nullifier;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'nullifier', nullifier);
|
||||
const commitment_circom = (await circuit.getOutput(w, ['commitment'])).commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'commitment', commitment_circom);
|
||||
const blinded_dsc_commitment = (await circuit.getOutput(w, ['blinded_dsc_commitment']))
|
||||
.blinded_dsc_commitment;
|
||||
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
|
||||
|
||||
const mrz_bytes = packBytes(inputs.mrz);
|
||||
const commitment_bytes = poseidon6([
|
||||
inputs.secret[0],
|
||||
PASSPORT_ATTESTATION_ID,
|
||||
computeLeafFromModulusBigInt(BigInt(passportData.pubKey.modulus)),
|
||||
mrz_bytes[0],
|
||||
mrz_bytes[1],
|
||||
mrz_bytes[2],
|
||||
]);
|
||||
const commitment_js = commitment_bytes.toString();
|
||||
//console.log('commitment_js', commitment_js)
|
||||
//console.log('commitment_circom', commitment_circom)
|
||||
expect(commitment_circom).to.be.equal(commitment_js);
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid mrz', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
mrz: Array(93)
|
||||
.fill(0)
|
||||
.map((byte) => BigInt(byte).toString()),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid dataHashes', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
dataHashes: inputs.dataHashes.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should fail to calculate witness with invalid signature', async function () {
|
||||
try {
|
||||
const invalidInputs = {
|
||||
...inputs,
|
||||
signature: inputs.signature.map((byte: string) => String((parseInt(byte, 10) + 1) % 256)),
|
||||
};
|
||||
await circuit.calculateWitness(invalidInputs);
|
||||
expect.fail('Expected an error but none was thrown.');
|
||||
} catch (error) {
|
||||
expect(error.message).to.include('Assert Failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -18,7 +18,7 @@ A ballpark number of 6917 individuals (at the time of writing this document) ent
|
||||
- For individuals, we parse:
|
||||
- full name (first name, last name), dob(day, month, year) in names.json
|
||||
- passports and passport issuing country in passport.json
|
||||
- The jsons are stored at ofacdata/inputes to be used by SMT's.
|
||||
- The jsons are stored at ofacdata/inputs to be used by SMT's.
|
||||
|
||||
## Data Usage
|
||||
These jsons are later used to create sparse merkle trees for non-membership proofs. We provide 3 levels of proofs.
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
{
|
||||
"name": "openpassport-common",
|
||||
"version": "0.0.1",
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "yarn ts-mocha tests/**/*.test.ts --exit",
|
||||
"format": "prettier --write .",
|
||||
"lint": "prettier --check ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@ashpect/smt": "https://github.com/ashpect/smt#main",
|
||||
"@babel/runtime": "^7.23.4",
|
||||
@@ -8,6 +17,7 @@
|
||||
"asn1.js": "^5.4.1",
|
||||
"asn1js": "^3.0.5",
|
||||
"axios": "^1.7.2",
|
||||
"chai": "^4.3.8",
|
||||
"elliptic": "^6.5.5",
|
||||
"fs": "^0.0.1-security",
|
||||
"js-sha1": "^0.7.0",
|
||||
@@ -15,13 +25,16 @@
|
||||
"js-sha512": "^0.9.0",
|
||||
"json-to-ts": "^2.1.0",
|
||||
"jsrsasign": "^11.1.0",
|
||||
"mocha": "^10.7.3",
|
||||
"node-forge": "https://github.com/remicolin/forge",
|
||||
"path": "^0.12.7",
|
||||
"pkijs": "^3.2.4",
|
||||
"poseidon-lite": "^0.2.0",
|
||||
"ts-mocha": "^10.0.0",
|
||||
"typescript-parser": "^2.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-forge": "^1.3.10"
|
||||
"@types/node-forge": "^1.3.10",
|
||||
"prettier": "^3.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# How to generate mock passport data based on your real data?
|
||||
|
||||
- Build the app and scan your passport to log your passport data.
|
||||
- Copy one of the files of this folder and paste your passport data.
|
||||
- Adapt the `verify` function to verify it. Once this is done, adapt the `genMockPassportData` to generate a mock one.
|
||||
- Once the mock passport data generated is verified correctly by the same `verify` function that verifies yours, you're all set!
|
||||
- Run the script to generate a mock passport data and add it to `common/src/utils/mockPassportData.ts`
|
||||
- Do a PR
|
||||
- DM us to collect your bounty!
|
||||
@@ -1,629 +0,0 @@
|
||||
{
|
||||
"mrz": "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02",
|
||||
"signatureAlgorithm": "sha256WithRSASSAPSS",
|
||||
"pubKey": {
|
||||
"modulus": "24462187253413274681146293990014601117483150253485750502784042435672184694412963307122026240846907391312882376801424642119473345751861224453041335405750030091821974208795494089279845074559882616814677854700627123408815125641207116387150180075958682953326415376187334908428885389819481874887447587379894859906385655519567588675165038354987379327125622417796020195813417774532495071662150990707566936780047952622227454986438290561518433120591444215515025611804148686981931860883842745085825036432179109865379231910853752492302597965268640127145219080386320748404798990484447108886155687702517815916586904444799519356177",
|
||||
"exponent": "65537"
|
||||
},
|
||||
"dataGroupHashes": [
|
||||
-114,
|
||||
-118,
|
||||
-62,
|
||||
50,
|
||||
66,
|
||||
9,
|
||||
-21,
|
||||
-98,
|
||||
-47,
|
||||
-62,
|
||||
-12,
|
||||
-83,
|
||||
77,
|
||||
111,
|
||||
103,
|
||||
117,
|
||||
-85,
|
||||
-35,
|
||||
-96,
|
||||
21,
|
||||
-11,
|
||||
-19,
|
||||
-27,
|
||||
-99,
|
||||
-119,
|
||||
62,
|
||||
-62,
|
||||
-36,
|
||||
-103,
|
||||
117,
|
||||
-80,
|
||||
-33,
|
||||
31,
|
||||
-123,
|
||||
108,
|
||||
84,
|
||||
-98,
|
||||
102,
|
||||
70,
|
||||
11,
|
||||
-91,
|
||||
-81,
|
||||
-60,
|
||||
12,
|
||||
-55,
|
||||
-126,
|
||||
25,
|
||||
-125,
|
||||
46,
|
||||
125,
|
||||
-100,
|
||||
-62,
|
||||
28,
|
||||
23,
|
||||
55,
|
||||
-123,
|
||||
-99,
|
||||
-92,
|
||||
-121,
|
||||
-120,
|
||||
-36,
|
||||
78,
|
||||
-66,
|
||||
82,
|
||||
-76,
|
||||
-21,
|
||||
-34,
|
||||
33,
|
||||
79,
|
||||
50,
|
||||
-104,
|
||||
-120,
|
||||
-114,
|
||||
35,
|
||||
116,
|
||||
-32,
|
||||
6,
|
||||
-14,
|
||||
-100,
|
||||
-115,
|
||||
-128,
|
||||
-8,
|
||||
10,
|
||||
61,
|
||||
98,
|
||||
86,
|
||||
-8,
|
||||
45,
|
||||
-49,
|
||||
-46,
|
||||
90,
|
||||
-24,
|
||||
-81,
|
||||
38,
|
||||
0,
|
||||
-62,
|
||||
104,
|
||||
108,
|
||||
-19,
|
||||
-10,
|
||||
97,
|
||||
-26,
|
||||
116,
|
||||
-58,
|
||||
69,
|
||||
110,
|
||||
26,
|
||||
87,
|
||||
17,
|
||||
89,
|
||||
110,
|
||||
-57,
|
||||
108,
|
||||
-6,
|
||||
36,
|
||||
21,
|
||||
39,
|
||||
87,
|
||||
110,
|
||||
102,
|
||||
-6,
|
||||
-43,
|
||||
-82,
|
||||
-125,
|
||||
-85,
|
||||
-82,
|
||||
-120,
|
||||
-101,
|
||||
87,
|
||||
-112,
|
||||
111,
|
||||
15,
|
||||
-104,
|
||||
127,
|
||||
85,
|
||||
25,
|
||||
-102,
|
||||
81,
|
||||
20,
|
||||
58,
|
||||
51,
|
||||
75,
|
||||
-63,
|
||||
116,
|
||||
-22,
|
||||
0,
|
||||
60,
|
||||
30,
|
||||
29,
|
||||
30,
|
||||
-73,
|
||||
-115,
|
||||
72,
|
||||
-9,
|
||||
-1,
|
||||
-53,
|
||||
100,
|
||||
124,
|
||||
41,
|
||||
-22,
|
||||
106,
|
||||
78,
|
||||
31,
|
||||
11,
|
||||
114,
|
||||
-119,
|
||||
-19,
|
||||
17,
|
||||
92,
|
||||
71,
|
||||
-122,
|
||||
47,
|
||||
62,
|
||||
78,
|
||||
-67,
|
||||
-23,
|
||||
-55,
|
||||
-42,
|
||||
53,
|
||||
4,
|
||||
47,
|
||||
-67,
|
||||
-55,
|
||||
-123,
|
||||
6,
|
||||
121,
|
||||
34,
|
||||
-125,
|
||||
64,
|
||||
-114,
|
||||
91,
|
||||
-34,
|
||||
-46,
|
||||
-63,
|
||||
62,
|
||||
-34,
|
||||
104,
|
||||
82,
|
||||
36,
|
||||
41,
|
||||
-118,
|
||||
-3,
|
||||
70,
|
||||
15,
|
||||
-108,
|
||||
-48,
|
||||
-100,
|
||||
45,
|
||||
105,
|
||||
-85,
|
||||
-15,
|
||||
-61,
|
||||
-71,
|
||||
43,
|
||||
-39,
|
||||
-94,
|
||||
-110,
|
||||
-55,
|
||||
-34,
|
||||
89,
|
||||
-18,
|
||||
38,
|
||||
76,
|
||||
123,
|
||||
-40,
|
||||
13,
|
||||
51,
|
||||
-29,
|
||||
72,
|
||||
-11,
|
||||
59,
|
||||
-63,
|
||||
-18,
|
||||
-90,
|
||||
103,
|
||||
49,
|
||||
23,
|
||||
-92,
|
||||
-85,
|
||||
-68,
|
||||
-62,
|
||||
-59,
|
||||
-100,
|
||||
-69,
|
||||
-7,
|
||||
28,
|
||||
-58,
|
||||
95,
|
||||
69,
|
||||
15,
|
||||
-74,
|
||||
56,
|
||||
54,
|
||||
38
|
||||
],
|
||||
"eContent": [
|
||||
49,
|
||||
102,
|
||||
48,
|
||||
21,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
3,
|
||||
49,
|
||||
8,
|
||||
6,
|
||||
6,
|
||||
103,
|
||||
-127,
|
||||
8,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
48,
|
||||
28,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
5,
|
||||
49,
|
||||
15,
|
||||
23,
|
||||
13,
|
||||
49,
|
||||
57,
|
||||
49,
|
||||
50,
|
||||
49,
|
||||
54,
|
||||
49,
|
||||
55,
|
||||
50,
|
||||
50,
|
||||
51,
|
||||
56,
|
||||
90,
|
||||
48,
|
||||
47,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
4,
|
||||
49,
|
||||
34,
|
||||
4,
|
||||
32,
|
||||
-122,
|
||||
-17,
|
||||
-90,
|
||||
-50,
|
||||
-85,
|
||||
-36,
|
||||
1,
|
||||
-60,
|
||||
98,
|
||||
23,
|
||||
122,
|
||||
117,
|
||||
-121,
|
||||
-30,
|
||||
85,
|
||||
120,
|
||||
53,
|
||||
83,
|
||||
-125,
|
||||
-57,
|
||||
-15,
|
||||
70,
|
||||
39,
|
||||
-114,
|
||||
64,
|
||||
123,
|
||||
39,
|
||||
-78,
|
||||
-76,
|
||||
-122,
|
||||
-50,
|
||||
-17
|
||||
],
|
||||
"encryptedDigest": [
|
||||
87,
|
||||
20,
|
||||
96,
|
||||
-119,
|
||||
-78,
|
||||
21,
|
||||
117,
|
||||
-35,
|
||||
91,
|
||||
41,
|
||||
86,
|
||||
-58,
|
||||
-21,
|
||||
72,
|
||||
-36,
|
||||
58,
|
||||
-79,
|
||||
-29,
|
||||
74,
|
||||
-103,
|
||||
-98,
|
||||
-46,
|
||||
-58,
|
||||
-84,
|
||||
110,
|
||||
29,
|
||||
-89,
|
||||
-15,
|
||||
127,
|
||||
121,
|
||||
92,
|
||||
125,
|
||||
106,
|
||||
81,
|
||||
-16,
|
||||
-96,
|
||||
-9,
|
||||
112,
|
||||
-33,
|
||||
-36,
|
||||
-52,
|
||||
-114,
|
||||
-14,
|
||||
-80,
|
||||
-61,
|
||||
-59,
|
||||
33,
|
||||
-104,
|
||||
120,
|
||||
-8,
|
||||
8,
|
||||
-29,
|
||||
-56,
|
||||
14,
|
||||
-79,
|
||||
-122,
|
||||
60,
|
||||
-23,
|
||||
-100,
|
||||
72,
|
||||
51,
|
||||
-31,
|
||||
-68,
|
||||
-70,
|
||||
37,
|
||||
18,
|
||||
-91,
|
||||
47,
|
||||
-19,
|
||||
-40,
|
||||
-4,
|
||||
-59,
|
||||
-66,
|
||||
88,
|
||||
103,
|
||||
32,
|
||||
-108,
|
||||
-77,
|
||||
-15,
|
||||
-44,
|
||||
-100,
|
||||
13,
|
||||
46,
|
||||
-45,
|
||||
-41,
|
||||
115,
|
||||
-18,
|
||||
110,
|
||||
-3,
|
||||
12,
|
||||
-17,
|
||||
85,
|
||||
111,
|
||||
-51,
|
||||
12,
|
||||
6,
|
||||
114,
|
||||
0,
|
||||
92,
|
||||
58,
|
||||
-26,
|
||||
-13,
|
||||
-40,
|
||||
34,
|
||||
43,
|
||||
11,
|
||||
87,
|
||||
-72,
|
||||
-1,
|
||||
-119,
|
||||
-86,
|
||||
13,
|
||||
79,
|
||||
-1,
|
||||
-72,
|
||||
16,
|
||||
-89,
|
||||
109,
|
||||
79,
|
||||
-99,
|
||||
-26,
|
||||
-110,
|
||||
-17,
|
||||
79,
|
||||
-2,
|
||||
-37,
|
||||
-59,
|
||||
-61,
|
||||
-3,
|
||||
-50,
|
||||
57,
|
||||
121,
|
||||
-10,
|
||||
-19,
|
||||
106,
|
||||
-76,
|
||||
-43,
|
||||
-33,
|
||||
-68,
|
||||
-1,
|
||||
5,
|
||||
22,
|
||||
-5,
|
||||
-39,
|
||||
-13,
|
||||
-10,
|
||||
73,
|
||||
33,
|
||||
28,
|
||||
-48,
|
||||
-24,
|
||||
-119,
|
||||
-49,
|
||||
127,
|
||||
-115,
|
||||
-99,
|
||||
59,
|
||||
10,
|
||||
-62,
|
||||
-47,
|
||||
-33,
|
||||
99,
|
||||
54,
|
||||
112,
|
||||
116,
|
||||
62,
|
||||
99,
|
||||
68,
|
||||
-87,
|
||||
-78,
|
||||
104,
|
||||
-84,
|
||||
-105,
|
||||
61,
|
||||
104,
|
||||
-56,
|
||||
-11,
|
||||
-56,
|
||||
-102,
|
||||
-39,
|
||||
-70,
|
||||
81,
|
||||
-58,
|
||||
-7,
|
||||
98,
|
||||
30,
|
||||
29,
|
||||
-116,
|
||||
6,
|
||||
-127,
|
||||
-103,
|
||||
-5,
|
||||
98,
|
||||
-64,
|
||||
-83,
|
||||
84,
|
||||
-4,
|
||||
100,
|
||||
70,
|
||||
112,
|
||||
29,
|
||||
114,
|
||||
109,
|
||||
-3,
|
||||
-72,
|
||||
-13,
|
||||
-4,
|
||||
-10,
|
||||
-14,
|
||||
-82,
|
||||
14,
|
||||
-38,
|
||||
112,
|
||||
-112,
|
||||
15,
|
||||
-10,
|
||||
-101,
|
||||
87,
|
||||
23,
|
||||
77,
|
||||
-31,
|
||||
101,
|
||||
121,
|
||||
-6,
|
||||
-125,
|
||||
117,
|
||||
126,
|
||||
103,
|
||||
100,
|
||||
10,
|
||||
95,
|
||||
-90,
|
||||
-103,
|
||||
-92,
|
||||
-118,
|
||||
32,
|
||||
124,
|
||||
-115,
|
||||
-116,
|
||||
4,
|
||||
73,
|
||||
-15,
|
||||
60,
|
||||
-16,
|
||||
-23,
|
||||
110,
|
||||
30,
|
||||
-122,
|
||||
42,
|
||||
-28,
|
||||
57,
|
||||
-59,
|
||||
-60,
|
||||
118,
|
||||
53,
|
||||
122
|
||||
],
|
||||
"photoBase64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import {
|
||||
hash,
|
||||
assembleEContent,
|
||||
formatAndConcatenateDataHashes,
|
||||
formatMrz,
|
||||
arraysAreEqual,
|
||||
findSubarrayIndex,
|
||||
} from '../../../common/src/utils/utils';
|
||||
import * as forge from 'node-forge';
|
||||
import { writeFileSync } from 'fs';
|
||||
import elliptic from 'elliptic';
|
||||
import * as crypto from 'crypto';
|
||||
import { sampleDataHashes_large } from '../../src/constants/sampleDataHashes';
|
||||
|
||||
const sampleMRZ =
|
||||
'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02';
|
||||
const signatureAlgorithm = 'ecdsa-with-SHA1';
|
||||
const hashLen = 20;
|
||||
|
||||
export function genMockPassportData_sha1WithECDSA(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
sampleDataHashes_large.unshift([1, mrzHash]);
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
33
|
||||
);
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const ec = new elliptic.ec('p256');
|
||||
const keyPair = ec.genKeyPair();
|
||||
const pubKey = keyPair.getPublic();
|
||||
|
||||
const md = forge.md.sha1.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const signature = keyPair.sign(md.digest().toHex(), 'hex');
|
||||
const signatureBytes = Array.from(Buffer.from(signature.toDER(), 'hex'));
|
||||
|
||||
const Qx = pubKey.getX().toString(16);
|
||||
const Qy = pubKey.getY().toString(16);
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
publicKeyQ: `(${Qx},${Qy},1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)`,
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } =
|
||||
passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash);
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes);
|
||||
assert(
|
||||
arraysAreEqual(concatHash, eContent.slice(eContent.length - concatHash.length)),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const cleanPublicKeyQ = pubKey.publicKeyQ.replace(/[()]/g, '').split(',');
|
||||
const Qx = cleanPublicKeyQ[0];
|
||||
const Qy = cleanPublicKeyQ[1];
|
||||
|
||||
const ec = new elliptic.ec('p256');
|
||||
const key = ec.keyFromPublic({ x: Qx, y: Qy }, 'hex');
|
||||
|
||||
const messageBuffer = Buffer.from(eContent);
|
||||
const msgHash = crypto.createHash('sha1').update(messageBuffer).digest();
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString('hex');
|
||||
|
||||
const isValid = key.verify(msgHash, signature);
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha1WithECDSA();
|
||||
console.log('Passport Data:', JSON.stringify(mockPassportData, null, 2));
|
||||
console.log('Signature valid:', verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,81 +0,0 @@
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { PassportData } from "../../src/utils/types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, hexToDecimal, arraysAreEqual, findSubarrayIndex } from "../../src/utils/utils";
|
||||
import * as forge from 'node-forge';
|
||||
import { assert } from "console";
|
||||
import { mock_dsc_key_sha1_rsa_4096 } from "../../src/constants/mockCertificates";
|
||||
import { sampleDataHashes_small } from "../../src/constants/sampleDataHashes";
|
||||
|
||||
const sampleMRZ = "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02"
|
||||
const signatureAlgorithm = 'sha1WithRSAEncryption'
|
||||
const hashLen = 20
|
||||
|
||||
export function genMockPassportData_sha1WithRSAEncryption_65537(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_small],
|
||||
hashLen,
|
||||
31 // could have been different
|
||||
);
|
||||
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const privKey = forge.pki.privateKeyFromPem(mock_dsc_key_sha1_rsa_4096);
|
||||
const modulus = privKey.n.toString(16);
|
||||
|
||||
const md = forge.md.sha1.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = privKey.sign(md)
|
||||
const signatureBytes = Array.from(signature, (c: string) => c.charCodeAt(0));
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
modulus: hexToDecimal(modulus),
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - concatHash.length)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const modulus = new forge.jsbn.BigInteger(pubKey.modulus, 10);
|
||||
const exponent = new forge.jsbn.BigInteger(pubKey.exponent, 10);
|
||||
const rsaPublicKey = forge.pki.rsa.setPublicKey(modulus, exponent);
|
||||
|
||||
const md = forge.md.sha1.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString(
|
||||
'binary',
|
||||
);
|
||||
|
||||
return rsaPublicKey.verify(md.digest().bytes(), signature);
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha1WithRSAEncryption_65537();
|
||||
console.log("Passport Data:", JSON.stringify(mockPassportData, null, 2));
|
||||
console.log("Signature valid:", verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,88 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import {
|
||||
hash,
|
||||
assembleEContent,
|
||||
formatAndConcatenateDataHashes,
|
||||
formatMrz,
|
||||
arraysAreEqual,
|
||||
findSubarrayIndex,
|
||||
} from '../../../common/src/utils/utils';
|
||||
import * as asn1 from 'asn1js';
|
||||
import { Certificate } from 'pkijs';
|
||||
import { writeFileSync } from 'fs';
|
||||
import elliptic from 'elliptic';
|
||||
import { sampleDataHashes_large } from '../../src/constants/sampleDataHashes';
|
||||
import { mock_dsc_key_sha256_ecdsa, mock_dsc_sha256_ecdsa } from "../../src/constants/mockCertificates";
|
||||
|
||||
const sampleMRZ =
|
||||
'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02';
|
||||
const signatureAlgorithm = 'ecdsa-with-SHA256';
|
||||
const hashLen = 32;
|
||||
const ec = new elliptic.ec('p256');
|
||||
|
||||
export function genMockPassportData_sha256WithECDSA(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
sampleDataHashes_large.unshift([1, mrzHash]);
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
33
|
||||
);
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const privateKeyDer = Buffer.from(mock_dsc_key_sha256_ecdsa.replace(/-----BEGIN EC PRIVATE KEY-----|\n|-----END EC PRIVATE KEY-----/g, ''), 'base64');
|
||||
const asn1Data = asn1.fromBER(privateKeyDer);
|
||||
const privateKeyBuffer = (asn1Data.result.valueBlock as any).value[1].valueBlock.valueHexView;
|
||||
|
||||
const keyPair = ec.keyFromPrivate(privateKeyBuffer);
|
||||
|
||||
const eContentHash = hash(signatureAlgorithm, eContent);
|
||||
const signature = keyPair.sign(eContentHash);
|
||||
const signatureBytes = signature.toDER();
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
dsc: mock_dsc_sha256_ecdsa,
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, dsc, dataGroupHashes, eContent, encryptedDigest } =
|
||||
passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash);
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes);
|
||||
assert(
|
||||
arraysAreEqual(concatHash, eContent.slice(eContent.length - concatHash.length)),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const certBuffer = Buffer.from(dsc.replace(/(-----(BEGIN|END) CERTIFICATE-----|\n)/g, ''), 'base64');
|
||||
const asn1Data = asn1.fromBER(certBuffer);
|
||||
const cert = new Certificate({ schema: asn1Data.result });
|
||||
const publicKeyInfo = cert.subjectPublicKeyInfo;
|
||||
const publicKeyBuffer = publicKeyInfo.subjectPublicKey.valueBlock.valueHexView;
|
||||
|
||||
const key = ec.keyFromPublic(publicKeyBuffer);
|
||||
|
||||
const eContentHash = hash(signatureAlgorithm, eContent);
|
||||
const signature = Buffer.from(encryptedDigest).toString('hex');
|
||||
|
||||
return key.verify(eContentHash, signature);
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha256WithECDSA();
|
||||
console.log('Passport Data:', JSON.stringify(mockPassportData, null, 2));
|
||||
console.log('Signature valid:', verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,81 +0,0 @@
|
||||
import assert from "assert";
|
||||
import { PassportData } from "../../src/utils/types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, hexToDecimal, arraysAreEqual, findSubarrayIndex } from "../../src/utils/utils";
|
||||
import * as forge from 'node-forge';
|
||||
import { writeFileSync, readFileSync } from "fs";
|
||||
import { mock_dsc_key_sha256_rsa_4096 } from "../../src/constants/mockCertificates";
|
||||
import { sampleDataHashes_large } from "../../src/constants/sampleDataHashes";
|
||||
|
||||
const sampleMRZ = "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02"
|
||||
const signatureAlgorithm = 'sha256WithRSAEncryption'
|
||||
const hashLen = 32
|
||||
|
||||
export function genMockPassportData_sha256WithRSAEncryption_65537(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
31
|
||||
);
|
||||
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const privKey = forge.pki.privateKeyFromPem(mock_dsc_key_sha256_rsa_4096);
|
||||
const modulus = privKey.n.toString(16);
|
||||
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = privKey.sign(md)
|
||||
const signatureBytes = Array.from(signature, (c: string) => c.charCodeAt(0));
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
modulus: hexToDecimal(modulus),
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - hashLen)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const modulus = new forge.jsbn.BigInteger(pubKey.modulus, 10);
|
||||
const exponent = new forge.jsbn.BigInteger(pubKey.exponent, 10);
|
||||
const rsaPublicKey = forge.pki.rsa.setPublicKey(modulus, exponent);
|
||||
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString(
|
||||
'binary',
|
||||
);
|
||||
|
||||
return rsaPublicKey.verify(md.digest().bytes(), signature);
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha256WithRSAEncryption_65537();
|
||||
console.log("Passport Data:", JSON.stringify(mockPassportData, null, 2));
|
||||
console.log("Signature valid:", verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,103 +0,0 @@
|
||||
import assert from "assert";
|
||||
import { PassportData } from "../../src/utils/types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, arraysAreEqual, findSubarrayIndex } from "../../src/utils/utils";
|
||||
import * as forge from 'node-forge';
|
||||
import crypto from 'crypto';
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { mock_dsc_key_sha256_rsapss_2048 } from "../../src/constants/mockCertificates";
|
||||
import { mock_dsc_sha256_rsapss_2048 } from "../../src/constants/mockCertificates";
|
||||
import { sampleDataHashes_large } from "../../src/constants/sampleDataHashes";
|
||||
|
||||
const sampleMRZ = "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02"
|
||||
const signatureAlgorithm = 'sha256WithRSASSAPSS'
|
||||
const hashLen = 32
|
||||
|
||||
export function genMockPassportData_sha256WithRSASSAPSS_65537(): PassportData {
|
||||
const privateKeyPem = forge.pki.privateKeyFromPem(mock_dsc_key_sha256_rsapss_2048);
|
||||
const privateKeyPemString = forge.pki.privateKeyToPem(privateKeyPem);
|
||||
const certificate = forge.pki.certificateFromPem(mock_dsc_sha256_rsapss_2048);
|
||||
|
||||
const publicKey = certificate.publicKey as forge.pki.rsa.PublicKey;
|
||||
|
||||
const modulus = (publicKey as any).n.toString(10);
|
||||
const exponent = (publicKey as any).e.toString(10);
|
||||
const salt = Buffer.from('dee959c7e06411361420ff80185ed57f3e6776afdee959c7e064113614201420', 'hex');
|
||||
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
30
|
||||
);
|
||||
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const my_message = Buffer.from(eContent);
|
||||
const hash_algorithm = 'sha256';
|
||||
|
||||
const private_key = {
|
||||
key: privateKeyPemString,
|
||||
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
||||
saltLength: salt.length,
|
||||
};
|
||||
|
||||
const signature = crypto.sign(hash_algorithm, my_message, private_key);
|
||||
const signatureArray = Array.from(signature, byte => byte < 128 ? byte : byte - 256);
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
modulus: modulus,
|
||||
exponent: exponent,
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureArray,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - concatHash.length)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const modulus = new forge.jsbn.BigInteger(pubKey.modulus, 10);
|
||||
const exponent = new forge.jsbn.BigInteger(pubKey.exponent, 10);
|
||||
const publicKey = forge.pki.setRsaPublicKey(modulus, exponent);
|
||||
const pem = forge.pki.publicKeyToPem(publicKey);
|
||||
const rsa_public = Buffer.from(pem);
|
||||
|
||||
const message = Buffer.from(eContent);
|
||||
const signature = Buffer.from(encryptedDigest);
|
||||
const hash_algorithm = "sha256";
|
||||
|
||||
const public_key = {
|
||||
key: rsa_public,
|
||||
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
||||
saltLength: 32,
|
||||
};
|
||||
|
||||
const isVerified = crypto.verify(hash_algorithm, message, public_key, signature);
|
||||
|
||||
return isVerified;
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha256WithRSASSAPSS_65537();
|
||||
console.log("Passport Data:", JSON.stringify(mockPassportData, null, 2));
|
||||
console.log("Signature valid:", verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,81 +0,0 @@
|
||||
import assert from "assert";
|
||||
import { PassportData } from "../../src/utils/types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, hexToDecimal, arraysAreEqual, findSubarrayIndex } from "../../src/utils/utils";
|
||||
import * as forge from 'node-forge';
|
||||
import { writeFileSync, readFileSync } from "fs";
|
||||
import { mock_dsc_key_sha256_rsa_4096 } from "../../src/constants/mockCertificates";
|
||||
import { sampleDataHashes_large } from "../../src/constants/sampleDataHashes";
|
||||
|
||||
const sampleMRZ = "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02"
|
||||
const signatureAlgorithm = 'sha256WithRSAEncryption'
|
||||
const hashLen = 32
|
||||
|
||||
export function genMockPassportData_sha256WithRSAEncryption_sha1MRZ_65537(): PassportData {
|
||||
const mrzHash = hash("sha1WithRSAEncryption", formatMrz(sampleMRZ));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
25
|
||||
);
|
||||
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const privKey = forge.pki.privateKeyFromPem(mock_dsc_key_sha256_rsa_4096);
|
||||
const modulus = privKey.n.toString(16);
|
||||
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = privKey.sign(md)
|
||||
const signatureBytes = Array.from(signature, (c: string) => c.charCodeAt(0));
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
modulus: hexToDecimal(modulus),
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash("sha1WithRSAEncryption", formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - hashLen)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const modulus = new forge.jsbn.BigInteger(pubKey.modulus, 10);
|
||||
const exponent = new forge.jsbn.BigInteger(pubKey.exponent, 10);
|
||||
const rsaPublicKey = forge.pki.rsa.setPublicKey(modulus, exponent);
|
||||
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString(
|
||||
'binary',
|
||||
);
|
||||
|
||||
return rsaPublicKey.verify(md.digest().bytes(), signature);
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha256WithRSAEncryption_sha1MRZ_65537();
|
||||
console.log("Passport Data:", JSON.stringify(mockPassportData, null, 2));
|
||||
console.log("Signature valid:", verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,88 +0,0 @@
|
||||
import assert from "assert";
|
||||
import { PassportData } from "../../src/utils/types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, arraysAreEqual, findSubarrayIndex } from "../../src/utils/utils";
|
||||
import * as forge from 'node-forge';
|
||||
import { writeFileSync } from "fs";
|
||||
import elliptic from 'elliptic';
|
||||
import * as crypto from 'crypto';
|
||||
import { sampleDataHashes_large } from "../../src/constants/sampleDataHashes";
|
||||
|
||||
const sampleMRZ = "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02"
|
||||
const signatureAlgorithm = 'SHA384withECDSA'
|
||||
const hashLen = 46
|
||||
|
||||
export function genMockPassportData_SHA384withECDSA(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
sampleDataHashes_large.unshift([1, mrzHash]);
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
33
|
||||
);
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const ec = new elliptic.ec('p384');
|
||||
const keyPair = ec.genKeyPair();
|
||||
const pubKey = keyPair.getPublic();
|
||||
|
||||
const md = forge.md.sha384.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const signature = keyPair.sign(md.digest().toHex(), 'hex');
|
||||
const signatureBytes = Array.from(Buffer.from(signature.toDER(), 'hex'));
|
||||
|
||||
const Qx = pubKey.getX().toString(16);
|
||||
const Qy = pubKey.getY().toString(16);
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
publicKeyQ: `(${Qx},${Qy},1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)`
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - concatHash.length)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const cleanPublicKeyQ = pubKey.publicKeyQ.replace(/[()]/g, '').split(',');
|
||||
const Qx = cleanPublicKeyQ[0];
|
||||
const Qy = cleanPublicKeyQ[1];
|
||||
|
||||
const ec = new elliptic.ec('p384');
|
||||
const key = ec.keyFromPublic({ x: Qx, y: Qy }, 'hex');
|
||||
|
||||
const messageBuffer = Buffer.from(eContent);
|
||||
const msgHash = crypto.createHash('sha384').update(messageBuffer).digest();
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString('hex');
|
||||
|
||||
const isValid = key.verify(msgHash, signature);
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
const mockPassportData = genMockPassportData_SHA384withECDSA();
|
||||
console.log("Passport Data:", JSON.stringify(mockPassportData, null, 2));
|
||||
console.log("Signature valid:", verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -1,93 +0,0 @@
|
||||
import assert from 'assert';
|
||||
import { PassportData } from '../../../common/src/utils/types';
|
||||
import {
|
||||
hash,
|
||||
assembleEContent,
|
||||
formatAndConcatenateDataHashes,
|
||||
formatMrz,
|
||||
arraysAreEqual,
|
||||
findSubarrayIndex,
|
||||
} from '../../../common/src/utils/utils';
|
||||
import * as forge from 'node-forge';
|
||||
import { writeFileSync } from 'fs';
|
||||
import elliptic from 'elliptic';
|
||||
import * as crypto from 'crypto';
|
||||
import { sampleDataHashes_large } from '../../src/constants/sampleDataHashes';
|
||||
|
||||
const sampleMRZ =
|
||||
'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02';
|
||||
const signatureAlgorithm = 'ecdsa-with-SHA512';
|
||||
const hashLen = 64;
|
||||
|
||||
export function genMockPassportData_sha512WithECDSA(): PassportData {
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(sampleMRZ));
|
||||
sampleDataHashes_large.unshift([1, mrzHash]);
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes_large],
|
||||
hashLen,
|
||||
33
|
||||
);
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
|
||||
const ec = new elliptic.ec('p256');
|
||||
const keyPair = ec.genKeyPair();
|
||||
const pubKey = keyPair.getPublic();
|
||||
|
||||
const md = forge.md.sha512.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const signature = keyPair.sign(md.digest().toHex(), 'hex');
|
||||
const signatureBytes = Array.from(Buffer.from(signature.toDER(), 'hex'));
|
||||
|
||||
const Qx = pubKey.getX().toString(16);
|
||||
const Qy = pubKey.getY().toString(16);
|
||||
|
||||
return {
|
||||
mrz: sampleMRZ,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
publicKeyQ: `(${Qx},${Qy},1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)`,
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
}
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } =
|
||||
passportData;
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash);
|
||||
console.log('dg1HashOffset', dg1HashOffset);
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes);
|
||||
assert(
|
||||
arraysAreEqual(concatHash, eContent.slice(eContent.length - concatHash.length)),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const cleanPublicKeyQ = pubKey.publicKeyQ.replace(/[()]/g, '').split(',');
|
||||
const Qx = cleanPublicKeyQ[0];
|
||||
const Qy = cleanPublicKeyQ[1];
|
||||
|
||||
const ec = new elliptic.ec('p256');
|
||||
const key = ec.keyFromPublic({ x: Qx, y: Qy }, 'hex');
|
||||
|
||||
const messageBuffer = Buffer.from(eContent);
|
||||
const msgHash = crypto.createHash('sha512').update(messageBuffer).digest();
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString('hex');
|
||||
|
||||
const isValid = key.verify(msgHash, signature);
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
const mockPassportData = genMockPassportData_sha512WithECDSA();
|
||||
console.log('Passport Data:', JSON.stringify(mockPassportData, null, 2));
|
||||
console.log('Signature valid:', verify(mockPassportData));
|
||||
|
||||
writeFileSync(__dirname + '/passportData.json', JSON.stringify(mockPassportData, null, 2));
|
||||
@@ -20,22 +20,13 @@ export const RPC_URL = "https://opt-mainnet.g.alchemy.com/v2/Mjj_SdklUaCdR6EPfVK
|
||||
export const DEVELOPMENT_MODE = true
|
||||
export const DEFAULT_MAJORITY = "18"
|
||||
|
||||
export enum SignatureAlgorithm {
|
||||
sha256WithRSAEncryption_65537 = 1,
|
||||
sha256WithRSAEncryption_3 = 2,
|
||||
sha1WithRSAEncryption_65537 = 3,
|
||||
sha256WithRSASSAPSS_65537 = 4,
|
||||
sha256WithRSASSAPSS_3 = 5,
|
||||
ecdsa_with_SHA384 = 6,
|
||||
ecdsa_with_SHA1 = 7,
|
||||
ecdsa_with_SHA256 = 8,
|
||||
ecdsa_with_SHA512 = 9,
|
||||
sha512WithRSAEncryption_65537 = 10
|
||||
}
|
||||
|
||||
export const signatureOidToName = {
|
||||
"1.2.840.113549.1.1.11": "sha256_rsa",
|
||||
"1.2.840.113549.1.1.5": "sha1_rsa"
|
||||
export enum SignatureAlgorithmIndex {
|
||||
rsa_sha256 = 1,
|
||||
rsa_sha1 = 3,
|
||||
rsapss_sha256 = 4,
|
||||
ecdsa_sha1 = 7,
|
||||
ecdsa_sha256 = 8,
|
||||
ecdsa_sha384 = 9,
|
||||
}
|
||||
|
||||
export const attributeToPosition = {
|
||||
@@ -52,6 +43,8 @@ export const attributeToPosition = {
|
||||
export const MAX_DATAHASHES_LEN = 320; // max formatted and concatenated datagroup hashes length in bytes
|
||||
export const n_dsc = 64;
|
||||
export const k_dsc = 32;
|
||||
export const n_dsc_ecdsa = 43; // 43 * 6 = 258 > 254 Cirom field size
|
||||
export const k_dsc_ecdsa = 6;
|
||||
export const n_csca = 121;
|
||||
export const k_csca = 34;
|
||||
export const max_cert_bytes = 1664;
|
||||
|
||||
@@ -470,4 +470,51 @@ xncatW0Ixvl73iXA6WG45093oyEwHzAdBgNVHQ4EFgQUUa6p5iCBqbhslwC79LHX
|
||||
EyYTiP0wCgYIKoZIzj0EAwIDSAAwRQIhAP6XA1AWr8v6f7EJz3u5GuudyCKqiuBY
|
||||
mDhB0W8OhhR2AiAMTm++57YJkbQNxzL75nypXSdZmBfiQXSNM0NFpHEuIQ==
|
||||
-----END CERTIFICATE-----
|
||||
`
|
||||
|
||||
export const mock_dsc_key_sha1_ecdsa = `-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIK2wRGm6xnmTnHhOtyUxp/PFPTySoaD+f2JNXy9JAmRVoAoGCCqGSM49
|
||||
AwEHoUQDQgAEzqM5vQEv7vhD7ZXecfkSvC/vfDffjuEyUK3DLlvjbxUIXeaJ+dUg
|
||||
zb8+rYwVh+Ai/DDxCLuSy2wn4gbOFwzOGA==
|
||||
-----END EC PRIVATE KEY-----
|
||||
`
|
||||
|
||||
export const mock_dsc_sha1_ecdsa = `-----BEGIN CERTIFICATE-----
|
||||
MIICBDCCAaygAwIBAgIULaL4N+BRrqV1D8UeefZegXfkWogwCQYHKoZIzj0EATBy
|
||||
MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFU3RhdGUxDTALBgNVBAcMBENpdHkxFTAT
|
||||
BgNVBAoMDE9yZ2FuaXphdGlvbjETMBEGA1UECwwKRGVwYXJ0bWVudDEYMBYGA1UE
|
||||
AwwPd3d3LmV4YW1wbGUuY29tMB4XDTI0MDkxMzEyNTgzNVoXDTI1MDkxMzEyNTgz
|
||||
NVowcjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5
|
||||
MRUwEwYDVQQKDAxPcmdhbml6YXRpb24xEzARBgNVBAsMCkRlcGFydG1lbnQxGDAW
|
||||
BgNVBAMMD3d3dy5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
|
||||
BM6jOb0BL+74Q+2V3nH5Erwv73w3347hMlCtwy5b428VCF3mifnVIM2/Pq2MFYfg
|
||||
Ivww8Qi7kstsJ+IGzhcMzhijITAfMB0GA1UdDgQWBBTRmLBSAQr3AAI4didYznX/
|
||||
mEvuzDAJBgcqhkjOPQQBA0cAMEQCIB25iNcA7Y3D3E0fv8GIaV0Ei8Ydu4AVuTJW
|
||||
C8tZvjhWAiBqAuBYm104bRLWaT2uSZexQJgvTPB6j6SdUi0SmR0acw==
|
||||
-----END CERTIFICATE-----
|
||||
`
|
||||
|
||||
export const mock_dsc_key_sha384_ecdsa = `-----BEGIN EC PRIVATE KEY-----
|
||||
MIGkAgEBBDAw/8AnnGTU8TWWt+SDVr2Gi3TEruQ5tkZ9PObCFtW1nQZaId/f/UFk
|
||||
nJgnT7zm72qgBwYFK4EEACKhZANiAARBQCmC0UscKfL8KkVMtO69SU17NIrpLsw5
|
||||
ibVLxHqcnKMm0FLy0gwU3DFqFF9gPD64EmyoxyE+mo+I3l5rEZPWMqVZOoxCRSww
|
||||
f6GeHkgco/zGFxnEaklZL7g6gwyUNp8=
|
||||
-----END EC PRIVATE KEY-----
|
||||
`
|
||||
|
||||
export const mock_dsc_sha384_ecdsa = `-----BEGIN CERTIFICATE-----
|
||||
MIICRDCCAcqgAwIBAgIUDWqj4BMk0L+D4RpvoSSyc6Lz3mswCgYIKoZIzj0EAwMw
|
||||
cjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRUw
|
||||
EwYDVQQKDAxPcmdhbml6YXRpb24xEzARBgNVBAsMCkRlcGFydG1lbnQxGDAWBgNV
|
||||
BAMMD3d3dy5leGFtcGxlLmNvbTAeFw0yNDA5MTMxMzA4MTdaFw0yNTA5MTMxMzA4
|
||||
MTdaMHIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
|
||||
eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRMwEQYDVQQLDApEZXBhcnRtZW50MRgw
|
||||
FgYDVQQDDA93d3cuZXhhbXBsZS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARB
|
||||
QCmC0UscKfL8KkVMtO69SU17NIrpLsw5ibVLxHqcnKMm0FLy0gwU3DFqFF9gPD64
|
||||
EmyoxyE+mo+I3l5rEZPWMqVZOoxCRSwwf6GeHkgco/zGFxnEaklZL7g6gwyUNp+j
|
||||
ITAfMB0GA1UdDgQWBBTalDCeljqgJiT5+YCzAq1vS0zaFDAKBggqhkjOPQQDAwNo
|
||||
ADBlAjAu9tM+LZ8PB90F3Wd+mg//Eia6oTM9APo2+E9isiV/sgRwy3HFfAbYnH7c
|
||||
xy29Ef4CMQCiGvLgkcYMSx3J1bWcq8nuxPBywf440ruiFf95wzm/erjDRFG3u7Dh
|
||||
d+9Msdsovrc=
|
||||
-----END CERTIFICATE-----
|
||||
`
|
||||
@@ -1,985 +0,0 @@
|
||||
// Sample passport data used for testing
|
||||
|
||||
export const mockPassportData_sha256_rsa_65537 = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'sha256WithRSAEncryption',
|
||||
pubKey: {
|
||||
modulus:
|
||||
'27722120859333796503211640489272106120482551309704222232072105246845695714472954540683236867192299062797225680861251026190519870822156282999820409388675151765188628354552148938026850533650560867351408820412089579679221235019315835956735754682911229932082922199789065846580784551244478494045799922879186142888909932141440466887670680548782372812836055118025224108859421921417110274504449719569511693219364768629052062228602555209299817554923972956312358490198380965414649591746119573796271477447999603941176493312445059119331560661900807731353542415313085750811411021804391084707844781744245549952173517229880392612399',
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
3, 95, 94, -122, -120, -117, 30, 88, -99, -9, 10, -41, 113, -100, 57, -14, 2, 19, -10, -55, 9,
|
||||
25, 33, -64, -52, 17, 23, 113, 97, 76, 115, -80, -33, 31, -123, 108, 84, -98, 102, 70, 11, -91,
|
||||
-81, -60, 12, -55, -126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99, -92, -121, -120,
|
||||
-36, 78, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120, -114, 35, 116, -32, 6, -14, -100, -115,
|
||||
-128, -8, 10, 61, 98, 86, -8, 45, -49, -46, 90, -24, -81, 38, 0, -62, 104, 108, -19, -10, 97,
|
||||
-26, 116, -58, 69, 110, 26, 87, 17, 89, 110, -57, 108, -6, 36, 21, 39, 87, 110, 102, -6, -43,
|
||||
-82, -125, -85, -82, -120, -101, 87, -112, 111, 15, -104, 127, 85, 25, -102, 81, 20, 58, 51, 75,
|
||||
-63, 116, -22, 0, 60, 30, 29, 30, -73, -115, 72, -9, -1, -53, 100, 124, 41, -22, 106, 78, 31,
|
||||
11, 114, -119, -19, 17, 92, 71, -122, 47, 62, 78, -67, -23, -55, -42, 53, 4, 47, -67, -55, -123,
|
||||
6, 121, 34, -125, 64, -114, 91, -34, -46, -63, 62, -34, 104, 82, 36, 41, -118, -3, 70, 15, -108,
|
||||
-48, -100, 45, 105, -85, -15, -61, -71, 43, -39, -94, -110, -55, -34, 89, -18, 38, 76, 123, -40,
|
||||
13, 51, -29, 72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85, -68, -62, -59, -100, -69, -7,
|
||||
28, -58, 95, 69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, 21,
|
||||
-10, 113, -103, 22, -127, -61, -86, -10, -112, 85, 124, -41, -61, 112, -45, 117, -61, -79, 50,
|
||||
82, 93, 104, -124, -119, -52, -54, -87, -5, -76, -113, -71,
|
||||
],
|
||||
encryptedDigest: [
|
||||
66, 138, 97, 83, 112, 69, 182, 37, 178, 101, 190, 43, 153, 239, 204, 201, 218, 113, 200, 10,
|
||||
105, 131, 41, 75, 85, 72, 161, 223, 52, 93, 74, 73, 82, 159, 108, 66, 152, 88, 226, 44, 153,
|
||||
166, 11, 66, 49, 154, 15, 236, 5, 151, 84, 194, 172, 226, 57, 132, 139, 228, 119, 222, 186, 60,
|
||||
99, 248, 160, 250, 157, 160, 177, 17, 48, 117, 58, 104, 6, 74, 19, 115, 229, 248, 150, 0, 49,
|
||||
72, 47, 6, 244, 173, 226, 16, 129, 208, 218, 22, 187, 101, 0, 126, 66, 125, 192, 4, 101, 194,
|
||||
255, 111, 238, 86, 150, 239, 235, 75, 231, 78, 51, 92, 3, 87, 43, 224, 105, 8, 37, 86, 222, 75,
|
||||
123, 45, 128, 121, 185, 181, 18, 172, 88, 108, 4, 18, 195, 224, 113, 94, 182, 220, 193, 47, 192,
|
||||
169, 88, 57, 87, 218, 228, 27, 173, 155, 58, 86, 109, 201, 49, 202, 151, 0, 173, 41, 84, 118,
|
||||
228, 8, 197, 88, 84, 191, 70, 115, 126, 68, 234, 25, 120, 228, 98, 186, 90, 187, 150, 165, 194,
|
||||
127, 19, 96, 159, 116, 217, 135, 122, 215, 26, 149, 10, 252, 87, 247, 130, 113, 52, 128, 176,
|
||||
126, 156, 5, 114, 135, 252, 104, 121, 5, 128, 48, 144, 230, 80, 113, 21, 214, 110, 130, 49, 223,
|
||||
55, 150, 210, 116, 70, 151, 33, 93, 166, 197, 160, 234, 228, 197, 131, 71, 248, 228, 170, 206,
|
||||
17, 89, 172, 74, 167, 5,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha256_sha1MRZ_rsa_65537 = {
|
||||
"mrz": "P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02",
|
||||
"signatureAlgorithm": "sha256WithRSAEncryption",
|
||||
"pubKey": {
|
||||
"modulus": "27722120859333796503211640489272106120482551309704222232072105246845695714472954540683236867192299062797225680861251026190519870822156282999820409388675151765188628354552148938026850533650560867351408820412089579679221235019315835956735754682911229932082922199789065846580784551244478494045799922879186142888909932141440466887670680548782372812836055118025224108859421921417110274504449719569511693219364768629052062228602555209299817554923972956312358490198380965414649591746119573796271477447999603941176493312445059119331560661900807731353542415313085750811411021804391084707844781744245549952173517229880392612399",
|
||||
"exponent": "65537"
|
||||
},
|
||||
"dataGroupHashes": [
|
||||
28, 76, -100, 59, 66, 120, 89, -69, -43, -105, -52, 112, -51, -97, -87, 43, 70, 38, 124, -14,
|
||||
-101, -82, 11, -86, 55, -96, 114, -93, 25, 75, 70, 94, 85, 95, 40, -11, -101, 88, -85, -108,
|
||||
-10, -44, 104, -62, -117, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120, -114, 35, 116, -32, 6,
|
||||
-14, -100, -115, -128, -8, 10, 61, 98, 86, -8, 45, -49, -46, 90, -24, -81, 38, 0, -62, 104, 108,
|
||||
-19, -10, 97, -26, 116, -58, 69, 110, 26, 87, 17, 89, 110, -57, 108, -6, 36, 21, 39, 87, 110,
|
||||
102, -6, -43, -82, -125, -85, -82, -120, -101, 87, -112, 111, 15, -104, 127, 85, 25, -102, 81,
|
||||
20, 58, 51, 75, -63, 116, -22, 0, 60, 30, 29, 30, -73, -115, 72, -9, -1, -53, 100, 124, 41, -22,
|
||||
106, 78, 31, 11, 114, -119, -19, 17, 92, 71, -122, 47, 62, 78, -67, -23, -55, -42, 53, 4, 47,
|
||||
-67, -55, -123, 6, 121, 34, -125, 64, -114, 91, -34, -46, -63, 62, -34, 104, 82, 36, 41, -118,
|
||||
-3, 70, 15, -108, -48, -100, 45, 105, -85, -15, -61, -71, 43, -39, -94, -110, -55, -34, 89, -18,
|
||||
38, 76, 123, -40, 13, 51, -29, 72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85, -68, -62, -59,
|
||||
-100, -69, -7, 28, -58, 95, 69, 15, -74, 56, 54, 38
|
||||
],
|
||||
"eContent": [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -106,
|
||||
-48, 111, 42, -56, -31, -10, 49, -55, -94, 3, 22, 26, 32, -12, 12, -68, 7, 60, -106, 94, -61,
|
||||
-94, 123, 70, 48, 76, -92, -58, 16, 67, -43
|
||||
],
|
||||
"encryptedDigest": [
|
||||
167, 166, 158, 72, 114, 46, 63, 61, 225, 67, 113, 130, 245, 238, 181, 23, 112, 117, 69, 171, 30,
|
||||
222, 180, 22, 245, 137, 239, 157, 46, 7, 234, 178, 45, 4, 67, 234, 225, 148, 126, 214, 99, 107,
|
||||
34, 109, 199, 229, 32, 233, 11, 151, 172, 106, 60, 99, 155, 63, 191, 74, 205, 156, 217, 108,
|
||||
228, 75, 64, 250, 209, 209, 37, 78, 22, 235, 81, 31, 146, 255, 138, 40, 68, 147, 160, 190, 4,
|
||||
88, 211, 224, 183, 236, 67, 85, 25, 138, 232, 112, 241, 39, 2, 2, 240, 15, 25, 248, 78, 193, 54,
|
||||
255, 154, 16, 128, 77, 217, 52, 52, 227, 179, 121, 133, 131, 3, 232, 114, 88, 19, 133, 163, 150,
|
||||
139, 180, 68, 69, 129, 185, 53, 138, 177, 169, 245, 224, 74, 216, 57, 79, 214, 248, 208, 86, 89,
|
||||
145, 25, 25, 42, 210, 159, 249, 171, 183, 13, 230, 214, 57, 182, 111, 228, 3, 170, 41, 170, 99,
|
||||
62, 64, 67, 44, 81, 200, 111, 13, 115, 160, 140, 241, 97, 198, 62, 101, 106, 230, 65, 46, 184,
|
||||
101, 230, 74, 44, 6, 126, 75, 180, 110, 68, 218, 17, 199, 177, 123, 131, 14, 186, 20, 83, 222,
|
||||
2, 179, 114, 70, 252, 119, 112, 216, 196, 111, 51, 43, 103, 113, 196, 42, 197, 233, 71, 103,
|
||||
138, 45, 238, 10, 215, 123, 32, 164, 178, 47, 233, 102, 94, 213, 74, 170, 56, 240, 40, 97, 40,
|
||||
218, 191, 70, 12, 44
|
||||
],
|
||||
"photoBase64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
|
||||
export const mockPassportData_sha1_rsa_65537 = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'sha1WithRSAEncryption',
|
||||
pubKey: {
|
||||
modulus:
|
||||
'22480969390802826527612289605322373709607796204484082125179082202842187594030746274096990975473157470353260434866140253775617322614317842584277684263273085398758828719210973208632246906520027587934588291311922909505699040207707335541543985272384000014886820430286901756121253512285729673528629390257652494355569005906835585173481884916905337685920438573395012275370654528706928278300240972594792647459747106552104398149544784541159688532413072278844759518831349873260668156132419311110193685220374735679580093984854335187305593318372186076577084719489194525709637470310818679179550246249200552494360645496955029908931',
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
-61, 4, -9, 98, -10, 124, -107, -13, 99, -85, 101, 34, -3, 68, -76, -30, -21, -73, -32, -90, 17,
|
||||
118, 17, 46, 54, -23, 38, 124, -108, -32, 51, -96, 114, -93, 25, 75, 70, 94, 85, 95, 40, -11,
|
||||
-101, 88, -85, -108, -10, -44, 104, -62, -117, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120,
|
||||
-114, 35, 116, -32, 6, -14, -100, -115, -128, -8, 0, -62, 104, 108, -19, -10, 97, -26, 116, -58,
|
||||
69, 110, 26, 87, 17, 89, 110, -57, 108, -6, 76, 123, -40, 13, 51, -29, 72, -11, 59, -63, -18,
|
||||
-90, 103, 49, 23, -92, -85, -68, -62, -59,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -6,
|
||||
-44, 21, -78, 98, -48, -53, -39, 97, 118, 16, -66, 24, 81, -77, 123, 104, -122, -110, 44,
|
||||
],
|
||||
encryptedDigest: [
|
||||
107, 231, 253, 155, 109, 139, 12, 122, 241, 208, 45, 161, 10, 169, 244, 255, 191, 235, 196, 237,
|
||||
70, 177, 233, 6, 83, 164, 238, 203, 156, 72, 64, 188, 57, 156, 212, 95, 248, 150, 240, 221, 244,
|
||||
132, 162, 113, 43, 21, 131, 101, 254, 115, 204, 199, 195, 241, 149, 96, 221, 109, 239, 125, 161,
|
||||
232, 166, 176, 222, 35, 231, 254, 22, 14, 8, 217, 204, 55, 78, 178, 9, 144, 92, 177, 230, 125,
|
||||
225, 149, 25, 254, 52, 202, 43, 113, 91, 217, 238, 186, 110, 11, 140, 45, 58, 96, 245, 172, 22,
|
||||
44, 57, 124, 177, 133, 168, 157, 105, 176, 124, 26, 127, 237, 176, 128, 250, 123, 193, 215, 78,
|
||||
143, 162, 21, 248, 120, 133, 46, 37, 254, 221, 220, 82, 190, 64, 13, 204, 180, 172, 242, 132,
|
||||
128, 207, 96, 86, 109, 105, 124, 37, 206, 240, 79, 111, 29, 157, 32, 246, 115, 207, 250, 251,
|
||||
125, 204, 174, 66, 254, 20, 146, 119, 8, 124, 30, 47, 24, 239, 99, 228, 38, 162, 90, 105, 193,
|
||||
51, 9, 33, 168, 211, 223, 154, 96, 38, 229, 54, 119, 194, 140, 222, 86, 0, 58, 117, 120, 208,
|
||||
77, 63, 77, 31, 10, 234, 157, 22, 10, 3, 244, 31, 81, 143, 108, 103, 95, 204, 73, 107, 136, 230,
|
||||
194, 185, 214, 86, 233, 53, 41, 7, 143, 239, 31, 29, 103, 250, 26, 26, 120, 144, 6, 159, 78,
|
||||
152, 57, 126, 210, 92, 208, 191, 24,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha256_rsapss_65537 = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'sha256WithRSASSAPSS',
|
||||
pubKey: {
|
||||
modulus:
|
||||
'24462187253413274681146293990014601117483150253485750502784042435672184694412963307122026240846907391312882376801424642119473345751861224453041335405750030091821974208795494089279845074559882616814677854700627123408815125641207116387150180075958682953326415376187334908428885389819481874887447587379894859906385655519567588675165038354987379327125622417796020195813417774532495071662150990707566936780047952622227454986438290561518433120591444215515025611804148686981931860883842745085825036432179109865379231910853752492302597965268640127145219080386320748404798990484447108886155687702517815916586904444799519356177',
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
-114, -118, -62, 50, 66, 9, -21, -98, -47, -62, -12, -83, 77, 111, 103, 117, -85, -35, -96, 21,
|
||||
-11, -19, -27, -99, -119, 62, -62, -36, -103, 117, -80, -33, 31, -123, 108, 84, -98, 102, 70,
|
||||
11, -91, -81, -60, 12, -55, -126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99, -92,
|
||||
-121, -120, -36, 78, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120, -114, 35, 116, -32, 6, -14,
|
||||
-100, -115, -128, -8, 10, 61, 98, 86, -8, 45, -49, -46, 90, -24, -81, 38, 0, -62, 104, 108, -19,
|
||||
-10, 97, -26, 116, -58, 69, 110, 26, 87, 17, 89, 110, -57, 108, -6, 36, 21, 39, 87, 110, 102,
|
||||
-6, -43, -82, -125, -85, -82, -120, -101, 87, -112, 111, 15, -104, 127, 85, 25, -102, 81, 20,
|
||||
58, 51, 75, -63, 116, -22, 0, 60, 30, 29, 30, -73, -115, 72, -9, -1, -53, 100, 124, 41, -22,
|
||||
106, 78, 31, 11, 114, -119, -19, 17, 92, 71, -122, 47, 62, 78, -67, -23, -55, -42, 53, 4, 47,
|
||||
-67, -55, -123, 6, 121, 34, -125, 64, -114, 91, -34, -46, -63, 62, -34, 104, 82, 36, 41, -118,
|
||||
-3, 70, 15, -108, -48, -100, 45, 105, -85, -15, -61, -71, 43, -39, -94, -110, -55, -34, 89, -18,
|
||||
38, 76, 123, -40, 13, 51, -29, 72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85, -68, -62, -59,
|
||||
-100, -69, -7, 28, -58, 95, 69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -122,
|
||||
-17, -90, -50, -85, -36, 1, -60, 98, 23, 122, 117, -121, -30, 85, 120, 53, 83, -125, -57, -15,
|
||||
70, 39, -114, 64, 123, 39, -78, -76, -122, -50, -17,
|
||||
],
|
||||
encryptedDigest: [
|
||||
87, 20, 96, -119, -78, 21, 117, -35, 91, 41, 86, -58, -21, 72, -36, 58, -79, -29, 74, -103, -98,
|
||||
-46, -58, -84, 110, 29, -89, -15, 127, 121, 92, 125, 106, 81, -16, -96, -9, 112, -33, -36, -52,
|
||||
-114, -14, -80, -61, -59, 33, -104, 120, -8, 8, -29, -56, 14, -79, -122, 60, -23, -100, 72, 51,
|
||||
-31, -68, -70, 37, 18, -91, 47, -19, -40, -4, -59, -66, 88, 103, 32, -108, -77, -15, -44, -100,
|
||||
13, 46, -45, -41, 115, -18, 110, -3, 12, -17, 85, 111, -51, 12, 6, 114, 0, 92, 58, -26, -13,
|
||||
-40, 34, 43, 11, 87, -72, -1, -119, -86, 13, 79, -1, -72, 16, -89, 109, 79, -99, -26, -110, -17,
|
||||
79, -2, -37, -59, -61, -3, -50, 57, 121, -10, -19, 106, -76, -43, -33, -68, -1, 5, 22, -5, -39,
|
||||
-13, -10, 73, 33, 28, -48, -24, -119, -49, 127, -115, -99, 59, 10, -62, -47, -33, 99, 54, 112,
|
||||
116, 62, 99, 68, -87, -78, 104, -84, -105, 61, 104, -56, -11, -56, -102, -39, -70, 81, -58, -7,
|
||||
98, 30, 29, -116, 6, -127, -103, -5, 98, -64, -83, 84, -4, 100, 70, 112, 29, 114, 109, -3, -72,
|
||||
-13, -4, -10, -14, -82, 14, -38, 112, -112, 15, -10, -101, 87, 23, 77, -31, 101, 121, -6, -125,
|
||||
117, 126, 103, 100, 10, 95, -90, -103, -92, -118, 32, 124, -115, -116, 4, 73, -15, 60, -16, -23,
|
||||
110, 30, -122, 42, -28, 57, -59, -60, 118, 53, 122,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha384_ecdsa = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA04021111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'SHA384withECDSA',
|
||||
pubKey: {
|
||||
publicKeyQ:
|
||||
'(1719bfd10ce41b5015348e588fcf43fa1970c019593444097bf52e96f6793ae3ae351a43619faff892e0e53947365e4a,131ad96fb34330662ad88ec50227be0cbff1586cb50f258de2a1312869b17743e04fb7afa1ee0d7d8b2f5cfada6c36f2,1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
31, -31, 126, 52, -48, 58, 7, 73, -30, -28, -67, -32, 70, 102, -20, -16, -27, 38, -93, 33, 74,
|
||||
-16, -45, 10, -7, -124, -102, -8, -124, -42, 7, 67, -36, -106, 120, -70, 115, 70, -106, -117,
|
||||
-119, 124, 6, -12, -6, -19, -27, -124, 58, -35, 118, -20, 31, 14, -27, 22, -82, 41, 15, -81,
|
||||
-97, 10, 72, 77, -94, -40, -104, -104, 69, 90, -121, 96, -32, 110, 6, -107, -16, 108, 44, -99,
|
||||
19, -106, 120, -70, 115, 70, -106, -117, -119, 124, 6, -12, -6, -19, -27, -124, 58, -35, 118,
|
||||
-20, 31, 14, -27, 22, -82, 41, 15, -81, -97, 10, 72, 77, -94, -40, -104, -104, 69, 90, -121, 96,
|
||||
-32, 110, 6, -107, -16, 108, 44, -99, 19, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120, -114,
|
||||
35, 116, -32, 6, -14, -100, -115, -128, -8, 10, 61, 98, 86, -8, 45, -49, -46, 90, -24, -81, 38,
|
||||
0, -62, 104, 108, -19, -10, 97, -26, 116, -58, 69, 110, 26, 87, 17, 89, 110, -57, 108, -6, 36,
|
||||
21, 39, 87, 110, 102, -6, -43, -82, -125, -85, -82, -120, -101, 87, -112, 111, 15, -104, 127,
|
||||
85, 25, -102, 81, 20, 58, 51, 75, -63, 116, -22, 0, 60, 30, 29, 30, -73, -115, 72, -9, -1, -53,
|
||||
100, 124, 41, -22, 106, 78, 31, 11, 114, -119, -19, 17, 92, 71, -122, 47, 62, 78, -67, -23, -55,
|
||||
-42, 53, 4, 47, -67, -55, -123, 6, 121, 34, -125, 64, -114, 91, -34, -46, -63, 62, -34, 104, 82,
|
||||
36, 41, -118, -3, 70, 15, -108, -48, -100, 45, 105, -85, -15, -61, -71, 43, -39, -94, -110, -55,
|
||||
-34, 89, -18, 38, 76, 123, -40, 13, 51, -29, 72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85,
|
||||
-68, -62, -59, -100, -69, -7, 28, -58, 95, 69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -45,
|
||||
96, -72, -87, -124, 47, 73, 76, 108, 63, 79, 21, -6, -55, 100, 72, 71, 110, -95, -29, -59, -58,
|
||||
31, -51, 76, -73, 59, 18, -84, -121, 95, -17, -108, 26, 104, -15, -79, 68, -23, -103, 125, -108,
|
||||
116, 9, -41, 122, 71, -80,
|
||||
],
|
||||
encryptedDigest: [
|
||||
48, 101, 2, 49, 0, 198, 4, 121, 91, 198, 158, 111, 155, 136, 175, 38, 200, 25, 115, 89, 239, 50,
|
||||
211, 183, 112, 32, 158, 249, 40, 236, 209, 216, 105, 25, 40, 66, 111, 226, 67, 241, 189, 58, 1,
|
||||
21, 53, 192, 120, 205, 37, 27, 231, 65, 160, 2, 48, 28, 49, 174, 170, 106, 38, 181, 252, 3, 84,
|
||||
206, 50, 58, 135, 94, 170, 187, 61, 187, 80, 55, 137, 84, 118, 27, 232, 180, 183, 205, 65, 70,
|
||||
202, 131, 84, 174, 154, 7, 216, 174, 215, 94, 53, 84, 146, 112, 26, 254, 49,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha1_ecdsa = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'ecdsa-with-SHA1',
|
||||
pubKey: {
|
||||
publicKeyQ:
|
||||
'(4a43aa53ec47c5ae156a60b78b5c696f6b311abe90d3564ce0801e08e59a89ba,44a7a04ad97057b79d0e839dd353b49094e6f6cb870633c9b9da16dee31781f7,1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
20, -74, 1, -24, 42, 71, 11, -118, -39, 103, -4, 111, -15, 52, -122, 33, 17, -81, -2, 32, 9, 82,
|
||||
-7, 81, -31, -6, -30, 86, 105, -87, 43, 33, 42, -96, 114, -93, 25, 75, 70, 94, 85, 95, 40, -11,
|
||||
-101, 88, -85, -108, -10, -44, 104, -62, -117, -96, 114, -93, 25, 75, 70, 94, 85, 95, 40, -11,
|
||||
-101, 88, -85, -108, -10, -44, 104, -62, -117, -66, 82, -76, -21, -34, 33, 79, 50, -104, -120,
|
||||
-114, 35, 116, -32, 6, -14, -100, -115, -128, -8, 10, 61, 98, 86, -8, 45, -49, -46, 90, -24,
|
||||
-81, 38, 0, -62, 104, 108, -19, -10, 97, -26, 116, -58, 69, 110, 26, 87, 17, 89, 110, -57, 108,
|
||||
-6, 36, 21, 39, 87, 110, 102, -6, -43, -82, -125, -85, -82, -120, -101, 87, -112, 111, 15, -104,
|
||||
127, 85, 25, -102, 81, 20, 58, 51, 75, -63, 116, -22, 0, 60, 30, 29, 30, -73, -115, 72, -9, -1,
|
||||
-53, 100, 124, 41, -22, 106, 78, 31, 11, 114, -119, -19, 17, 92, 71, -122, 47, 62, 78, -67, -23,
|
||||
-55, -42, 53, 4, 47, -67, -55, -123, 6, 121, 34, -125, 64, -114, 91, -34, -46, -63, 62, -34,
|
||||
104, 82, 36, 41, -118, -3, 70, 15, -108, -48, -100, 45, 105, -85, -15, -61, -71, 43, -39, -94,
|
||||
-110, -55, -34, 89, -18, 38, 76, 123, -40, 13, 51, -29, 72, -11, 59, -63, -18, -90, 103, 49, 23,
|
||||
-92, -85, -68, -62, -59, -100, -69, -7, 28, -58, 95, 69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -105,
|
||||
9, -25, -7, 38, -22, 108, 77, 115, 46, 68, 30, 39, 117, -101, 8, 109, 44, -60, 92,
|
||||
],
|
||||
encryptedDigest: [
|
||||
48, 69, 2, 33, 0, 222, 191, 241, 181, 247, 75, 185, 183, 85, 119, 18, 145, 171, 100, 208, 237,
|
||||
75, 147, 230, 196, 103, 166, 24, 140, 76, 19, 240, 68, 171, 125, 48, 55, 2, 32, 33, 123, 109,
|
||||
246, 29, 121, 171, 5, 250, 159, 117, 151, 88, 162, 251, 240, 167, 240, 120, 189, 237, 179, 81,
|
||||
162, 241, 91, 35, 169, 54, 14, 157, 253,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha256_ecdsa = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'ecdsa-with-SHA256',
|
||||
pubKey: {
|
||||
publicKeyQ:
|
||||
'(c2dde105812e7ac90276580863b72e200194bee6c0145bb10f360ad0101247c,186968cff675afbe7d0de40b4d6125052b0673b1c5b83e8c35723b5a2ca82f3d,1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
-115, -102, 91, -38, 101, -27, 94, -120, 17, 6, 84, -54, 43, -28, 65, -90, -30, -29, 115, -110,
|
||||
96, -73, -26, -62, 30, -44, 75, 15, 119, -25, -71, 65, -20, -80, -33, 31, -123, 108, 84, -98,
|
||||
102, 70, 11, -91, -81, -60, 12, -55, -126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99,
|
||||
-92, -121, -120, -36, 78, -80, -33, 31, -123, 108, 84, -98, 102, 70, 11, -91, -81, -60, 12, -55,
|
||||
-126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99, -92, -121, -120, -36, 78, -66, 82,
|
||||
-76, -21, -34, 33, 79, 50, -104, -120, -114, 35, 116, -32, 6, -14, -100, -115, -128, -8, 10, 61,
|
||||
98, 86, -8, 45, -49, -46, 90, -24, -81, 38, 0, -62, 104, 108, -19, -10, 97, -26, 116, -58, 69,
|
||||
110, 26, 87, 17, 89, 110, -57, 108, -6, 36, 21, 39, 87, 110, 102, -6, -43, -82, -125, -85, -82,
|
||||
-120, -101, 87, -112, 111, 15, -104, 127, 85, 25, -102, 81, 20, 58, 51, 75, -63, 116, -22, 0,
|
||||
60, 30, 29, 30, -73, -115, 72, -9, -1, -53, 100, 124, 41, -22, 106, 78, 31, 11, 114, -119, -19,
|
||||
17, 92, 71, -122, 47, 62, 78, -67, -23, -55, -42, 53, 4, 47, -67, -55, -123, 6, 121, 34, -125,
|
||||
64, -114, 91, -34, -46, -63, 62, -34, 104, 82, 36, 41, -118, -3, 70, 15, -108, -48, -100, 45,
|
||||
105, -85, -15, -61, -71, 43, -39, -94, -110, -55, -34, 89, -18, 38, 76, 123, -40, 13, 51, -29,
|
||||
72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85, -68, -62, -59, -100, -69, -7, 28, -58, 95,
|
||||
69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -124,
|
||||
41, -84, -127, 60, 19, -74, -34, -10, 69, 90, 85, 50, -85, -22, -121, -72, 81, 84, 71, -21, -54,
|
||||
-92, -54, 110, -106, -93, 61, -123, 62, -39, 48,
|
||||
],
|
||||
encryptedDigest: [
|
||||
48, 69, 2, 33, 0, 189, 118, 34, 64, 213, 7, 43, 206, 200, 119, 96, 49, 147, 25, 44, 198, 25, 21,
|
||||
141, 111, 179, 76, 122, 199, 255, 194, 209, 141, 9, 132, 127, 229, 2, 32, 16, 87, 189, 34, 33,
|
||||
37, 1, 127, 181, 26, 218, 218, 145, 226, 6, 217, 236, 190, 169, 153, 101, 150, 81, 222, 170, 95,
|
||||
137, 81, 0, 33, 55, 152,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData_sha512_ecdsa = {
|
||||
mrz: 'P<FRADUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324FRA0402111M3111115<<<<<<<<<<<<<<02',
|
||||
signatureAlgorithm: 'ecdsa-with-SHA512',
|
||||
pubKey: {
|
||||
publicKeyQ:
|
||||
'(46d9da7329996229cf9c1e909c2aeed8ffd7807e22cdbf4515384bed751c8f5,ceef948f919cbc35ccdde5644e45ffad3beeea13ee3989578bdc050bfb29b383,1,fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc)',
|
||||
},
|
||||
dataGroupHashes: [
|
||||
-22, 14, -29, 91, 116, -119, 40, 81, 33, 80, 127, 110, 97, -67, 41, -3, 29, -102, -34, -78, 112,
|
||||
-126, -22, 13, -8, 28, -77, 42, -16, 26, -12, -32, 90, -80, -33, 31, -123, 108, 84, -98, 102,
|
||||
70, 11, -91, -81, -60, 12, -55, -126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99, -92,
|
||||
-121, -120, -36, 78, -80, -33, 31, -123, 108, 84, -98, 102, 70, 11, -91, -81, -60, 12, -55,
|
||||
-126, 25, -125, 46, 125, -100, -62, 28, 23, 55, -123, -99, -92, -121, -120, -36, 78, -66, 82,
|
||||
-76, -21, -34, 33, 79, 50, -104, -120, -114, 35, 116, -32, 6, -14, -100, -115, -128, -8, 10, 61,
|
||||
98, 86, -8, 45, -49, -46, 90, -24, -81, 38, 0, -62, 104, 108, -19, -10, 97, -26, 116, -58, 69,
|
||||
110, 26, 87, 17, 89, 110, -57, 108, -6, 36, 21, 39, 87, 110, 102, -6, -43, -82, -125, -85, -82,
|
||||
-120, -101, 87, -112, 111, 15, -104, 127, 85, 25, -102, 81, 20, 58, 51, 75, -63, 116, -22, 0,
|
||||
60, 30, 29, 30, -73, -115, 72, -9, -1, -53, 100, 124, 41, -22, 106, 78, 31, 11, 114, -119, -19,
|
||||
17, 92, 71, -122, 47, 62, 78, -67, -23, -55, -42, 53, 4, 47, -67, -55, -123, 6, 121, 34, -125,
|
||||
64, -114, 91, -34, -46, -63, 62, -34, 104, 82, 36, 41, -118, -3, 70, 15, -108, -48, -100, 45,
|
||||
105, -85, -15, -61, -71, 43, -39, -94, -110, -55, -34, 89, -18, 38, 76, 123, -40, 13, 51, -29,
|
||||
72, -11, 59, -63, -18, -90, 103, 49, 23, -92, -85, -68, -62, -59, -100, -69, -7, 28, -58, 95,
|
||||
69, 15, -74, 56, 54, 38,
|
||||
],
|
||||
eContent: [
|
||||
49, 102, 48, 21, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 8, 6, 6, 103, -127, 8, 1, 1, 1,
|
||||
48, 28, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 49, 57, 49, 50, 49, 54, 49,
|
||||
55, 50, 50, 51, 56, 90, 48, 47, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 34, 4, 32, -118,
|
||||
-61, -56, 122, 54, 60, -47, 97, -19, -37, 53, -64, 19, 19, 54, 88, 53, 46, 10, -66, 82, -38,
|
||||
-96, -32, 78, 72, -18, 89, -125, -87, -73, -61,
|
||||
],
|
||||
encryptedDigest: [
|
||||
48, 68, 2, 32, 78, 69, 30, 9, 49, 167, 95, 72, 76, 210, 67, 67, 124, 148, 148, 50, 130, 144,
|
||||
180, 20, 121, 84, 156, 41, 223, 13, 107, 130, 127, 66, 108, 77, 2, 32, 39, 165, 167, 214, 64,
|
||||
138, 97, 119, 221, 209, 167, 63, 45, 219, 195, 148, 94, 180, 165, 152, 2, 90, 47, 16, 193, 29,
|
||||
82, 132, 17, 76, 157, 11,
|
||||
],
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3...',
|
||||
};
|
||||
|
||||
export const mockPassportData2_sha256_rsa_65537 = {
|
||||
"mrz": "P<FRATESTIN<<ABCDEFGH<ABCDEF<ABCDEF<<<<<<<<<42GH123454FRA0001011M4022225<<<<<<<<<<<<<<22",
|
||||
"signatureAlgorithm": "sha256WithRSASSAPSS",
|
||||
"pubKey": {
|
||||
"modulus": "24462187253413274681146293990014601117483150253485750502784042435672184694412963307122026240846907391312882376801424642119473345751861224453041335405750030091821974208795494089279845074559882616814677854700627123408815125641207116387150180075958682953326415376187334908428885389819481874887447587379894859906385655519567588675165038354987379327125622417796020195813417774532495071662150990707566936780047952622227454986438290561518433120591444215515025611804148686981931860883842745085825036432179109865379231910853752492302597965268640127145219080386320748404798990484447108886155687702517815916586904444799519356177",
|
||||
"exponent": "65537"
|
||||
},
|
||||
"dataGroupHashes": [
|
||||
-108,
|
||||
31,
|
||||
-26,
|
||||
62,
|
||||
-36,
|
||||
-36,
|
||||
113,
|
||||
-93,
|
||||
88,
|
||||
-94,
|
||||
90,
|
||||
-108,
|
||||
70,
|
||||
-11,
|
||||
-101,
|
||||
1,
|
||||
76,
|
||||
-53,
|
||||
60,
|
||||
-106,
|
||||
63,
|
||||
-124,
|
||||
-107,
|
||||
-28,
|
||||
111,
|
||||
97,
|
||||
47,
|
||||
66,
|
||||
120,
|
||||
-9,
|
||||
123,
|
||||
-5,
|
||||
-13,
|
||||
-49,
|
||||
82,
|
||||
60,
|
||||
28,
|
||||
116,
|
||||
89,
|
||||
-6,
|
||||
-96,
|
||||
-67,
|
||||
123,
|
||||
28,
|
||||
36,
|
||||
-4,
|
||||
-68,
|
||||
75,
|
||||
-15,
|
||||
-20,
|
||||
119,
|
||||
91,
|
||||
50,
|
||||
-33,
|
||||
-2,
|
||||
-2,
|
||||
-38,
|
||||
-16,
|
||||
44,
|
||||
-13,
|
||||
112,
|
||||
102,
|
||||
-66,
|
||||
82,
|
||||
-76,
|
||||
-21,
|
||||
-34,
|
||||
33,
|
||||
79,
|
||||
50,
|
||||
-104,
|
||||
-120,
|
||||
-114,
|
||||
35,
|
||||
116,
|
||||
-32,
|
||||
6,
|
||||
-14,
|
||||
-100,
|
||||
-115,
|
||||
-128,
|
||||
-8,
|
||||
10,
|
||||
61,
|
||||
98,
|
||||
86,
|
||||
-8,
|
||||
45,
|
||||
-49,
|
||||
-46,
|
||||
90,
|
||||
-24,
|
||||
-81,
|
||||
38,
|
||||
0,
|
||||
-62,
|
||||
104,
|
||||
108,
|
||||
-19,
|
||||
-10,
|
||||
97,
|
||||
-26,
|
||||
116,
|
||||
-58,
|
||||
69,
|
||||
110,
|
||||
26,
|
||||
87,
|
||||
17,
|
||||
89,
|
||||
110,
|
||||
-57,
|
||||
108,
|
||||
-6,
|
||||
36,
|
||||
21,
|
||||
39,
|
||||
87,
|
||||
110,
|
||||
102,
|
||||
-6,
|
||||
-43,
|
||||
-82,
|
||||
-125,
|
||||
-85,
|
||||
-82,
|
||||
-120,
|
||||
-101,
|
||||
87,
|
||||
-112,
|
||||
111,
|
||||
15,
|
||||
-104,
|
||||
127,
|
||||
85,
|
||||
25,
|
||||
-102,
|
||||
81,
|
||||
20,
|
||||
58,
|
||||
51,
|
||||
75,
|
||||
-63,
|
||||
116,
|
||||
-22,
|
||||
0,
|
||||
60,
|
||||
30,
|
||||
29,
|
||||
30,
|
||||
-73,
|
||||
-115,
|
||||
72,
|
||||
-9,
|
||||
-1,
|
||||
-53,
|
||||
100,
|
||||
124,
|
||||
41,
|
||||
-22,
|
||||
106,
|
||||
78,
|
||||
31,
|
||||
11,
|
||||
114,
|
||||
-119,
|
||||
-19,
|
||||
17,
|
||||
92,
|
||||
71,
|
||||
-122,
|
||||
47,
|
||||
62,
|
||||
78,
|
||||
-67,
|
||||
-23,
|
||||
-55,
|
||||
-42,
|
||||
53,
|
||||
4,
|
||||
47,
|
||||
-67,
|
||||
-55,
|
||||
-123,
|
||||
6,
|
||||
121,
|
||||
34,
|
||||
-125,
|
||||
64,
|
||||
-114,
|
||||
91,
|
||||
-34,
|
||||
-46,
|
||||
-63,
|
||||
62,
|
||||
-34,
|
||||
104,
|
||||
82,
|
||||
36,
|
||||
41,
|
||||
-118,
|
||||
-3,
|
||||
70,
|
||||
15,
|
||||
-108,
|
||||
-48,
|
||||
-100,
|
||||
45,
|
||||
105,
|
||||
-85,
|
||||
-15,
|
||||
-61,
|
||||
-71,
|
||||
43,
|
||||
-39,
|
||||
-94,
|
||||
-110,
|
||||
-55,
|
||||
-34,
|
||||
89,
|
||||
-18,
|
||||
38,
|
||||
76,
|
||||
123,
|
||||
-40,
|
||||
13,
|
||||
51,
|
||||
-29,
|
||||
72,
|
||||
-11,
|
||||
59,
|
||||
-63,
|
||||
-18,
|
||||
-90,
|
||||
103,
|
||||
49,
|
||||
23,
|
||||
-92,
|
||||
-85,
|
||||
-68,
|
||||
-62,
|
||||
-59,
|
||||
-100,
|
||||
-69,
|
||||
-7,
|
||||
28,
|
||||
-58,
|
||||
95,
|
||||
69,
|
||||
15,
|
||||
-74,
|
||||
56,
|
||||
54,
|
||||
38
|
||||
],
|
||||
"eContent": [
|
||||
49,
|
||||
102,
|
||||
48,
|
||||
21,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
3,
|
||||
49,
|
||||
8,
|
||||
6,
|
||||
6,
|
||||
103,
|
||||
-127,
|
||||
8,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
48,
|
||||
28,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
5,
|
||||
49,
|
||||
15,
|
||||
23,
|
||||
13,
|
||||
49,
|
||||
57,
|
||||
49,
|
||||
50,
|
||||
49,
|
||||
54,
|
||||
49,
|
||||
55,
|
||||
50,
|
||||
50,
|
||||
51,
|
||||
56,
|
||||
90,
|
||||
48,
|
||||
47,
|
||||
6,
|
||||
9,
|
||||
42,
|
||||
-122,
|
||||
72,
|
||||
-122,
|
||||
-9,
|
||||
13,
|
||||
1,
|
||||
9,
|
||||
4,
|
||||
49,
|
||||
34,
|
||||
4,
|
||||
32,
|
||||
-5,
|
||||
100,
|
||||
-110,
|
||||
-122,
|
||||
97,
|
||||
101,
|
||||
57,
|
||||
83,
|
||||
-95,
|
||||
14,
|
||||
7,
|
||||
14,
|
||||
-63,
|
||||
83,
|
||||
-57,
|
||||
-104,
|
||||
-21,
|
||||
114,
|
||||
-31,
|
||||
45,
|
||||
-31,
|
||||
74,
|
||||
-60,
|
||||
58,
|
||||
-37,
|
||||
-106,
|
||||
-113,
|
||||
-80,
|
||||
-49,
|
||||
-112,
|
||||
83,
|
||||
77
|
||||
],
|
||||
"encryptedDigest": [
|
||||
-97,
|
||||
-108,
|
||||
-50,
|
||||
54,
|
||||
29,
|
||||
77,
|
||||
47,
|
||||
-128,
|
||||
26,
|
||||
-86,
|
||||
6,
|
||||
43,
|
||||
103,
|
||||
77,
|
||||
54,
|
||||
-105,
|
||||
-112,
|
||||
116,
|
||||
63,
|
||||
75,
|
||||
-127,
|
||||
9,
|
||||
68,
|
||||
112,
|
||||
-55,
|
||||
-91,
|
||||
-9,
|
||||
-17,
|
||||
24,
|
||||
55,
|
||||
-31,
|
||||
-31,
|
||||
76,
|
||||
-82,
|
||||
79,
|
||||
117,
|
||||
-15,
|
||||
46,
|
||||
59,
|
||||
-111,
|
||||
-33,
|
||||
-93,
|
||||
-46,
|
||||
-82,
|
||||
116,
|
||||
-35,
|
||||
70,
|
||||
-4,
|
||||
-41,
|
||||
-39,
|
||||
-34,
|
||||
-94,
|
||||
99,
|
||||
76,
|
||||
22,
|
||||
-62,
|
||||
96,
|
||||
106,
|
||||
-118,
|
||||
41,
|
||||
-2,
|
||||
-7,
|
||||
-103,
|
||||
-125,
|
||||
-74,
|
||||
-66,
|
||||
111,
|
||||
-5,
|
||||
-120,
|
||||
-76,
|
||||
-108,
|
||||
-106,
|
||||
-59,
|
||||
25,
|
||||
-124,
|
||||
-109,
|
||||
57,
|
||||
-108,
|
||||
76,
|
||||
0,
|
||||
80,
|
||||
-106,
|
||||
-23,
|
||||
116,
|
||||
64,
|
||||
35,
|
||||
-79,
|
||||
-93,
|
||||
-3,
|
||||
99,
|
||||
-61,
|
||||
-15,
|
||||
-41,
|
||||
-104,
|
||||
-17,
|
||||
-116,
|
||||
-67,
|
||||
-39,
|
||||
42,
|
||||
-34,
|
||||
100,
|
||||
61,
|
||||
-66,
|
||||
28,
|
||||
46,
|
||||
63,
|
||||
118,
|
||||
46,
|
||||
59,
|
||||
70,
|
||||
124,
|
||||
76,
|
||||
74,
|
||||
-38,
|
||||
-43,
|
||||
-73,
|
||||
62,
|
||||
-39,
|
||||
-99,
|
||||
58,
|
||||
-53,
|
||||
-56,
|
||||
81,
|
||||
-26,
|
||||
43,
|
||||
-6,
|
||||
-93,
|
||||
52,
|
||||
-37,
|
||||
-66,
|
||||
-40,
|
||||
-95,
|
||||
70,
|
||||
-118,
|
||||
-67,
|
||||
-55,
|
||||
-8,
|
||||
56,
|
||||
48,
|
||||
52,
|
||||
75,
|
||||
-5,
|
||||
16,
|
||||
64,
|
||||
-85,
|
||||
29,
|
||||
37,
|
||||
32,
|
||||
40,
|
||||
26,
|
||||
-13,
|
||||
7,
|
||||
-61,
|
||||
-49,
|
||||
-48,
|
||||
93,
|
||||
-29,
|
||||
-18,
|
||||
-12,
|
||||
-31,
|
||||
89,
|
||||
39,
|
||||
-45,
|
||||
-103,
|
||||
-26,
|
||||
-12,
|
||||
5,
|
||||
-29,
|
||||
-88,
|
||||
102,
|
||||
-107,
|
||||
-122,
|
||||
15,
|
||||
-43,
|
||||
-57,
|
||||
-44,
|
||||
83,
|
||||
100,
|
||||
7,
|
||||
116,
|
||||
-125,
|
||||
-78,
|
||||
-6,
|
||||
32,
|
||||
46,
|
||||
115,
|
||||
106,
|
||||
-81,
|
||||
90,
|
||||
-40,
|
||||
99,
|
||||
55,
|
||||
-128,
|
||||
41,
|
||||
-20,
|
||||
93,
|
||||
-58,
|
||||
71,
|
||||
50,
|
||||
-90,
|
||||
-52,
|
||||
-16,
|
||||
112,
|
||||
60,
|
||||
97,
|
||||
-84,
|
||||
7,
|
||||
-22,
|
||||
-23,
|
||||
-105,
|
||||
78,
|
||||
105,
|
||||
3,
|
||||
34,
|
||||
-105,
|
||||
-33,
|
||||
112,
|
||||
122,
|
||||
-43,
|
||||
24,
|
||||
-34,
|
||||
87,
|
||||
24,
|
||||
-95,
|
||||
-51,
|
||||
-81,
|
||||
-29,
|
||||
-31,
|
||||
18,
|
||||
-36,
|
||||
-38,
|
||||
-32,
|
||||
-64,
|
||||
-115,
|
||||
13,
|
||||
88,
|
||||
-85,
|
||||
6,
|
||||
-77,
|
||||
-122,
|
||||
-36,
|
||||
94,
|
||||
-106,
|
||||
-122,
|
||||
97,
|
||||
-43,
|
||||
-110,
|
||||
36,
|
||||
41,
|
||||
54,
|
||||
91,
|
||||
18,
|
||||
16,
|
||||
105,
|
||||
-124,
|
||||
-86
|
||||
],
|
||||
"photoBase64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIw3..."
|
||||
}
|
||||
|
||||
export const mockPassportDatas = [
|
||||
mockPassportData_sha256_rsa_65537,
|
||||
mockPassportData_sha256_sha1MRZ_rsa_65537,
|
||||
mockPassportData_sha1_rsa_65537,
|
||||
mockPassportData_sha256_rsapss_65537,
|
||||
mockPassportData2_sha256_rsa_65537,
|
||||
mockPassportData_sha1_ecdsa,
|
||||
mockPassportData_sha256_ecdsa,
|
||||
mockPassportData_sha512_ecdsa,
|
||||
// mockPassportData_SHA384withECDSA, // temp cause formatting of ecdsa key is not done well now
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIK2wRGm6xnmTnHhOtyUxp/PFPTySoaD+f2JNXy9JAmRVoAoGCCqGSM49
|
||||
AwEHoUQDQgAEzqM5vQEv7vhD7ZXecfkSvC/vfDffjuEyUK3DLlvjbxUIXeaJ+dUg
|
||||
zb8+rYwVh+Ai/DDxCLuSy2wn4gbOFwzOGA==
|
||||
-----END EC PRIVATE KEY-----
|
||||
@@ -0,0 +1,13 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICBDCCAaygAwIBAgIULaL4N+BRrqV1D8UeefZegXfkWogwCQYHKoZIzj0EATBy
|
||||
MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFU3RhdGUxDTALBgNVBAcMBENpdHkxFTAT
|
||||
BgNVBAoMDE9yZ2FuaXphdGlvbjETMBEGA1UECwwKRGVwYXJ0bWVudDEYMBYGA1UE
|
||||
AwwPd3d3LmV4YW1wbGUuY29tMB4XDTI0MDkxMzEyNTgzNVoXDTI1MDkxMzEyNTgz
|
||||
NVowcjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5
|
||||
MRUwEwYDVQQKDAxPcmdhbml6YXRpb24xEzARBgNVBAsMCkRlcGFydG1lbnQxGDAW
|
||||
BgNVBAMMD3d3dy5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
|
||||
BM6jOb0BL+74Q+2V3nH5Erwv73w3347hMlCtwy5b428VCF3mifnVIM2/Pq2MFYfg
|
||||
Ivww8Qi7kstsJ+IGzhcMzhijITAfMB0GA1UdDgQWBBTRmLBSAQr3AAI4didYznX/
|
||||
mEvuzDAJBgcqhkjOPQQBA0cAMEQCIB25iNcA7Y3D3E0fv8GIaV0Ei8Ydu4AVuTJW
|
||||
C8tZvjhWAiBqAuBYm104bRLWaT2uSZexQJgvTPB6j6SdUi0SmR0acw==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,9 @@
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BgUrgQQAIg==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MIGkAgEBBDAw/8AnnGTU8TWWt+SDVr2Gi3TEruQ5tkZ9PObCFtW1nQZaId/f/UFk
|
||||
nJgnT7zm72qgBwYFK4EEACKhZANiAARBQCmC0UscKfL8KkVMtO69SU17NIrpLsw5
|
||||
ibVLxHqcnKMm0FLy0gwU3DFqFF9gPD64EmyoxyE+mo+I3l5rEZPWMqVZOoxCRSww
|
||||
f6GeHkgco/zGFxnEaklZL7g6gwyUNp8=
|
||||
-----END EC PRIVATE KEY-----
|
||||
@@ -0,0 +1,15 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICRDCCAcqgAwIBAgIUDWqj4BMk0L+D4RpvoSSyc6Lz3mswCgYIKoZIzj0EAwMw
|
||||
cjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRUw
|
||||
EwYDVQQKDAxPcmdhbml6YXRpb24xEzARBgNVBAsMCkRlcGFydG1lbnQxGDAWBgNV
|
||||
BAMMD3d3dy5leGFtcGxlLmNvbTAeFw0yNDA5MTMxMzA4MTdaFw0yNTA5MTMxMzA4
|
||||
MTdaMHIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
|
||||
eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRMwEQYDVQQLDApEZXBhcnRtZW50MRgw
|
||||
FgYDVQQDDA93d3cuZXhhbXBsZS5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARB
|
||||
QCmC0UscKfL8KkVMtO69SU17NIrpLsw5ibVLxHqcnKMm0FLy0gwU3DFqFF9gPD64
|
||||
EmyoxyE+mo+I3l5rEZPWMqVZOoxCRSwwf6GeHkgco/zGFxnEaklZL7g6gwyUNp+j
|
||||
ITAfMB0GA1UdDgQWBBTalDCeljqgJiT5+YCzAq1vS0zaFDAKBggqhkjOPQQDAwNo
|
||||
ADBlAjAu9tM+LZ8PB90F3Wd+mg//Eia6oTM9APo2+E9isiV/sgRwy3HFfAbYnH7c
|
||||
xy29Ef4CMQCiGvLgkcYMSx3J1bWcq8nuxPBywf440ruiFf95wzm/erjDRFG3u7Dh
|
||||
d+9Msdsovrc=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,12 +1,13 @@
|
||||
import { sha1Pad, sha256Pad } from "./shaPad";
|
||||
import * as forge from "node-forge";
|
||||
import { splitToWords } from "./utils";
|
||||
import { CSCA_AKI_MODULUS, CSCA_TREE_DEPTH, MODAL_SERVER_ADDRESS, signatureOidToName } from "../constants/constants";
|
||||
import { CSCA_AKI_MODULUS, CSCA_TREE_DEPTH, MODAL_SERVER_ADDRESS } from "../constants/constants";
|
||||
import { poseidon16, poseidon2, poseidon4 } from "poseidon-lite";
|
||||
import { IMT } from "@zk-kit/imt";
|
||||
import serialized_csca_tree from "../../pubkeys/serialized_csca_tree.json"
|
||||
import { createHash } from "crypto";
|
||||
import axios from "axios";
|
||||
import { getSignatureAlgorithmDetails } from "./handleCertificate";
|
||||
|
||||
export function findStartIndex(modulus: string, messagePadded: Uint8Array): number {
|
||||
const modulusNumArray = [];
|
||||
@@ -53,7 +54,7 @@ export function getCSCAInputs(dscSecret: string, dscCertificate: any, cscaCertif
|
||||
const csca_modulus = rsaPublicKey.n.toString(16).toLowerCase();
|
||||
//console.log('csca_modulus', csca_modulus);
|
||||
csca_modulus_bigint = BigInt(`0x${csca_modulus}`);
|
||||
csca_modulus_formatted = splitToWords(csca_modulus_bigint, BigInt(n_csca), BigInt(k_csca));
|
||||
csca_modulus_formatted = splitToWords(csca_modulus_bigint, n_csca, k_csca);
|
||||
//console.log('csca_modulus_formatted', csca_modulus_formatted);
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ export function getCSCAInputs(dscSecret: string, dscCertificate: any, cscaCertif
|
||||
const csca_modulus = CSCA_AKI_MODULUS[formattedValueAdjusted as keyof typeof CSCA_AKI_MODULUS];
|
||||
const csca_modulus_cleaned = csca_modulus.replace(/:/g, '');
|
||||
csca_modulus_bigint = BigInt(`0x${csca_modulus_cleaned}`);
|
||||
csca_modulus_formatted = splitToWords(csca_modulus_bigint, BigInt(n_csca), BigInt(k_csca));
|
||||
csca_modulus_formatted = splitToWords(csca_modulus_bigint, n_csca, k_csca);
|
||||
//console.log('CSCA modulus as bigint:', csca_modulus_bigint);
|
||||
//console.log('CSCA modulus extracted from json:', csca_modulus_formatted);
|
||||
}
|
||||
@@ -90,12 +91,12 @@ export function getCSCAInputs(dscSecret: string, dscCertificate: any, cscaCertif
|
||||
//console.log('dsc_modulus_bytes_array', dsc_modulus_bytes_array);
|
||||
const dsc_modulus_bytes_array_formatted = dsc_modulus_bytes_array.map(byte => byte.toString());
|
||||
const dsc_modulus_number = BigInt(`0x${dsc_modulus}`);
|
||||
const dsc_modulus_formatted = splitToWords(dsc_modulus_number, BigInt(n_dsc), BigInt(k_dsc));
|
||||
const dsc_modulus_formatted = splitToWords(dsc_modulus_number, n_dsc, k_dsc);
|
||||
|
||||
const dsc_signature = dscCertificate.signature;
|
||||
const dsc_signature_hex = Buffer.from(dsc_signature, 'binary').toString('hex');
|
||||
const dsc_signature_bigint = BigInt('0x' + dsc_signature_hex);
|
||||
const dsc_signature_formatted = splitToWords(dsc_signature_bigint, BigInt(n_csca), BigInt(k_csca));
|
||||
const dsc_signature_formatted = splitToWords(dsc_signature_bigint, n_csca, k_csca);
|
||||
|
||||
|
||||
//const formatted_dsc_signature = dsc_signature.map(byte => byte.toString(16).padStart(2, '0').toUpperCase()).join(':');
|
||||
@@ -126,12 +127,10 @@ export function getCSCAInputs(dscSecret: string, dscCertificate: any, cscaCertif
|
||||
// merkle tree saga
|
||||
const leaf = computeLeafFromModulusBigInt(csca_modulus_bigint);
|
||||
const [root, proof] = getCSCAModulusProof(leaf, n_csca, k_csca);
|
||||
|
||||
|
||||
|
||||
const { signatureAlgorithm: signatureAlgorithmName, hashFunction } = getSignatureAlgorithmDetails(signatureAlgorithm);
|
||||
|
||||
return {
|
||||
"signature_algorithm": signatureOidToName[signatureAlgorithm],
|
||||
"signature_algorithm": `${hashFunction}_${signatureAlgorithmName}`, // this is the opposite order as in the other files?
|
||||
"inputs":
|
||||
{
|
||||
"raw_dsc_cert": dsc_message_padded_formatted,
|
||||
@@ -188,7 +187,7 @@ export function computeLeafFromModulusFormatted(modulus_formatted: string[]) {
|
||||
}
|
||||
export function computeLeafFromModulusBigInt(modulus_bigint: bigint) {
|
||||
if (modulus_bigint <= BigInt(2n ** 4096n - 1n)) {
|
||||
const modulus_formatted = splitToWords(modulus_bigint, BigInt(64), BigInt(64));
|
||||
const modulus_formatted = splitToWords(modulus_bigint, 64, 64);
|
||||
const hashInputs = new Array(4);
|
||||
for (let i = 0; i < 4; i++) {
|
||||
hashInputs[i] = new Array(16).fill(BigInt(0));
|
||||
@@ -232,7 +231,7 @@ export function getTBSHash(cert: forge.pki.Certificate, hashAlgorithm: 'sha1' |
|
||||
const tbsCertificateHashHex = Buffer.from(tbsCertificateHashString, 'binary').toString('hex');
|
||||
const tbsCertificateHashBigint = BigInt(`0x${tbsCertificateHashHex}`);
|
||||
console.log('tbsCertificateHashBigint', tbsCertificateHashBigint);
|
||||
return splitToWords(tbsCertificateHashBigint, BigInt(n), BigInt(k));
|
||||
return splitToWords(tbsCertificateHashBigint, n, k);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
// we use the sig alg / hash function names returned in modulus extractor and the OID reference
|
||||
// Example for https://oidref.com/1.2.840.113549.1.1.11: sha256WithRSAEncryption
|
||||
// the jmrtd lib returns other names (ex: SHA256withRSA), see this page: https://github.com/E3V3A/JMRTD/blob/master/jmrtd/src/org/jmrtd/lds/SODFile.java
|
||||
// Sometimesm, iOS module too (ex rsaEncryption instead of sha256WithRSAEncryption)
|
||||
// So we translate here
|
||||
|
||||
export function toStandardName(jmrtdName: string): string {
|
||||
switch (jmrtdName) {
|
||||
|
||||
// hash functions
|
||||
case "SHA-1":
|
||||
case "SHA1":
|
||||
return "sha1";
|
||||
case "SHA-224":
|
||||
case "SHA224":
|
||||
return "sha224";
|
||||
case "SHA-256":
|
||||
case "SHA256":
|
||||
return "sha256";
|
||||
case "SHA-384":
|
||||
case "SHA384":
|
||||
return "sha384";
|
||||
case "SHA-512":
|
||||
case "SHA512":
|
||||
return "sha512";
|
||||
|
||||
// sig algs
|
||||
case "SHA1withECDSA":
|
||||
return "ecdsa-with-SHA1";
|
||||
case "SHA224withECDSA":
|
||||
return "ecdsa-with-SHA224";
|
||||
case "SHA256withECDSA":
|
||||
return "ecdsa-with-SHA256";
|
||||
case "SHA384withECDSA":
|
||||
return "ecdsa-with-SHA384";
|
||||
case "SHA512withECDSA":
|
||||
return "ecdsa-with-SHA512";
|
||||
case "MD2withRSA":
|
||||
return "md2WithRSAEncryption";
|
||||
case "MD4withRSA":
|
||||
return "md4WithRSAEncryption";
|
||||
case "MD5withRSA":
|
||||
return "md5WithRSAEncryption";
|
||||
case "SHA1withRSA":
|
||||
return "sha1WithRSAEncryption";
|
||||
case "SHA224withRSA":
|
||||
return "sha224WithRSAEncryption";
|
||||
case "SHA256withRSA":
|
||||
return "sha256WithRSAEncryption";
|
||||
case "SHA384withRSA":
|
||||
return "sha384WithRSAEncryption";
|
||||
case "SHA512withRSA":
|
||||
return "sha512WithRSAEncryption";
|
||||
|
||||
case "SAwithRSA/PSS":
|
||||
case "SSAwithRSA/PSS":
|
||||
case "RSASSA-PSS":
|
||||
case "rsassa-pss":
|
||||
case "rsassaPss":
|
||||
case "rsassapss":
|
||||
case "rsapss":
|
||||
case "SHA256withRSAandMGF1":
|
||||
case "id-mgf1":
|
||||
return "sha256WithRSASSAPSS";
|
||||
// we call it sha256WithRSASSAPSS even if specs says rsassaPss because there are multiple hash functions used
|
||||
// e.g. Italy uses sha512 with it
|
||||
|
||||
|
||||
// added this one for iOS
|
||||
case "RSA":
|
||||
case "rsaEncryption":
|
||||
// for security
|
||||
case "SHA256WITHRSA":
|
||||
case "SHA256withRSA":
|
||||
case "sha256withRSA":
|
||||
case "sha256withrsa":
|
||||
case "sha256WithRSAEncryption":
|
||||
case "SHA256WITHRSAENCRYPTION":
|
||||
return "sha256WithRSAEncryption";
|
||||
default:
|
||||
console.log(`JMRTD sig alg or hash function ${jmrtdName} not found in mapping, returning it as it is`);
|
||||
return jmrtdName;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +1,151 @@
|
||||
import { PassportData } from "./types";
|
||||
import { hash, assembleEContent, formatAndConcatenateDataHashes, formatMrz, hexToDecimal } from "./utils";
|
||||
import { PassportData } from './types';
|
||||
import {
|
||||
hash,
|
||||
assembleEContent,
|
||||
formatAndConcatenateDataHashes,
|
||||
formatMrz,
|
||||
} from './utils';
|
||||
import * as forge from 'node-forge';
|
||||
import { mock_dsc_key_sha1_rsa_4096, mock_dsc_key_sha256_rsa_4096, mock_dsc_key_sha256_rsapss_2048, mock_dsc_key_sha256_rsapss_4096, mock_dsc_sha1_rsa_4096, mock_dsc_sha256_rsa_4096, mock_dsc_sha256_rsapss_2048, mock_dsc_sha256_rsapss_4096 } from "../constants/mockCertificates";
|
||||
import { sampleDataHashes_small, sampleDataHashes_large } from "../constants/sampleDataHashes";
|
||||
import { countryCodes } from "../constants/constants";
|
||||
import * as asn1 from 'asn1js';
|
||||
import elliptic from 'elliptic';
|
||||
import {
|
||||
mock_dsc_key_sha1_rsa_4096,
|
||||
mock_dsc_key_sha256_ecdsa,
|
||||
mock_dsc_key_sha256_rsa_4096,
|
||||
mock_dsc_key_sha256_rsapss_2048,
|
||||
mock_dsc_key_sha256_rsapss_4096,
|
||||
mock_dsc_sha1_rsa_4096,
|
||||
mock_dsc_sha256_ecdsa,
|
||||
mock_dsc_sha256_rsa_4096,
|
||||
mock_dsc_sha256_rsapss_2048,
|
||||
mock_dsc_sha256_rsapss_4096,
|
||||
mock_dsc_key_sha1_ecdsa,
|
||||
mock_dsc_sha1_ecdsa,
|
||||
mock_dsc_key_sha384_ecdsa,
|
||||
mock_dsc_sha384_ecdsa,
|
||||
} from '../constants/mockCertificates';
|
||||
import { sampleDataHashes_small, sampleDataHashes_large } from '../constants/sampleDataHashes';
|
||||
import { countryCodes } from '../constants/constants';
|
||||
import { parseDSC } from './handleCertificate';
|
||||
|
||||
export function genMockPassportData(
|
||||
signatureType: 'rsa_sha1' | 'rsa_sha256' | 'rsapss_sha256',
|
||||
nationality: keyof typeof countryCodes,
|
||||
birthDate: string,
|
||||
expiryDate: string,
|
||||
signatureType: 'rsa_sha1' | 'rsa_sha256' | 'rsapss_sha256' | 'ecdsa_sha256' | 'ecdsa_sha1' | 'ecdsa_sha384',
|
||||
nationality: keyof typeof countryCodes,
|
||||
birthDate: string,
|
||||
expiryDate: string,
|
||||
passportNumber: string = "24HB81832",
|
||||
lastName: string = "DUPONT"
|
||||
): PassportData {
|
||||
if (birthDate.length !== 6 || expiryDate.length !== 6) {
|
||||
throw new Error("birthdate and expiry date have to be in the \"YYMMDD\" format");
|
||||
}
|
||||
if (birthDate.length !== 6 || expiryDate.length !== 6) {
|
||||
throw new Error('birthdate and expiry date have to be in the "YYMMDD" format');
|
||||
}
|
||||
|
||||
const mrz = `P<${nationality}DUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324${nationality}${birthDate}1M${expiryDate}5<<<<<<<<<<<<<<02`;
|
||||
let signatureAlgorithm: string;
|
||||
let hashLen: number;
|
||||
let sampleDataHashes: [number, number[]][];
|
||||
let privateKeyPem: string;
|
||||
let dsc: string;
|
||||
const mrz = `P<${nationality}${lastName}<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<${passportNumber}4${nationality}${birthDate}1M${expiryDate}5<<<<<<<<<<<<<<02`;
|
||||
|
||||
switch (signatureType) {
|
||||
case 'rsa_sha1':
|
||||
signatureAlgorithm = 'sha1WithRSAEncryption';
|
||||
hashLen = 20;
|
||||
sampleDataHashes = sampleDataHashes_small;
|
||||
privateKeyPem = mock_dsc_key_sha1_rsa_4096;
|
||||
dsc = mock_dsc_sha1_rsa_4096;
|
||||
break;
|
||||
case 'rsa_sha256':
|
||||
signatureAlgorithm = 'sha256WithRSAEncryption';
|
||||
hashLen = 32;
|
||||
sampleDataHashes = sampleDataHashes_large;
|
||||
privateKeyPem = mock_dsc_key_sha256_rsa_4096;
|
||||
dsc = mock_dsc_sha256_rsa_4096;
|
||||
break;
|
||||
case 'rsapss_sha256':
|
||||
signatureAlgorithm = 'sha256WithRSASSAPSS';
|
||||
hashLen = 32;
|
||||
sampleDataHashes = sampleDataHashes_large;
|
||||
privateKeyPem = mock_dsc_key_sha256_rsapss_4096;
|
||||
dsc = mock_dsc_sha256_rsapss_4096;
|
||||
break;
|
||||
}
|
||||
let privateKeyPem: string;
|
||||
let dsc: string;
|
||||
let sampleDataHashes: [number, number[]][];
|
||||
|
||||
const mrzHash = hash(signatureAlgorithm, formatMrz(mrz));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes],
|
||||
hashLen,
|
||||
30
|
||||
);
|
||||
switch (signatureType) {
|
||||
case 'rsa_sha1':
|
||||
sampleDataHashes = sampleDataHashes_small;
|
||||
privateKeyPem = mock_dsc_key_sha1_rsa_4096;
|
||||
dsc = mock_dsc_sha1_rsa_4096;
|
||||
break;
|
||||
case 'rsa_sha256':
|
||||
sampleDataHashes = sampleDataHashes_large;
|
||||
privateKeyPem = mock_dsc_key_sha256_rsa_4096;
|
||||
dsc = mock_dsc_sha256_rsa_4096;
|
||||
break;
|
||||
case 'rsapss_sha256':
|
||||
sampleDataHashes = sampleDataHashes_large;
|
||||
privateKeyPem = mock_dsc_key_sha256_rsapss_4096;
|
||||
dsc = mock_dsc_sha256_rsapss_4096;
|
||||
break;
|
||||
case 'ecdsa_sha256':
|
||||
sampleDataHashes = sampleDataHashes_large;
|
||||
privateKeyPem = mock_dsc_key_sha256_ecdsa;
|
||||
dsc = mock_dsc_sha256_ecdsa;
|
||||
break;
|
||||
case 'ecdsa_sha1':
|
||||
sampleDataHashes = sampleDataHashes_small;
|
||||
privateKeyPem = mock_dsc_key_sha1_ecdsa;
|
||||
dsc = mock_dsc_sha1_ecdsa;
|
||||
break;
|
||||
case 'ecdsa_sha384':
|
||||
sampleDataHashes = sampleDataHashes_small;
|
||||
privateKeyPem = mock_dsc_key_sha384_ecdsa;
|
||||
dsc = mock_dsc_sha384_ecdsa;
|
||||
break;
|
||||
}
|
||||
|
||||
const eContent = assembleEContent(hash(signatureAlgorithm, concatenatedDataHashes));
|
||||
const { hashFunction, hashLen } = parseDSC(dsc);
|
||||
|
||||
const privKey = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||
const modulus = privKey.n.toString(16);
|
||||
const mrzHash = hash(hashFunction, formatMrz(mrz));
|
||||
const concatenatedDataHashes = formatAndConcatenateDataHashes(
|
||||
[[1, mrzHash], ...sampleDataHashes],
|
||||
hashLen,
|
||||
30
|
||||
);
|
||||
|
||||
let signature: number[];
|
||||
if (signatureType === 'rsapss_sha256') {
|
||||
const privateKey = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const pss = forge.pss.create({
|
||||
md: forge.md.sha256.create(),
|
||||
mgf: forge.mgf.mgf1.create(forge.md.sha256.create()),
|
||||
saltLength: 32
|
||||
});
|
||||
const signatureBytes = privateKey.sign(md, pss);
|
||||
signature = Array.from(signatureBytes, (c: string) => c.charCodeAt(0));
|
||||
} else {
|
||||
const md = signatureType === 'rsa_sha1' ? forge.md.sha1.create() : forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const forgeSignature = privKey.sign(md);
|
||||
signature = Array.from(forgeSignature, (c: string) => c.charCodeAt(0));
|
||||
}
|
||||
const eContent = assembleEContent(hash(hashFunction, concatenatedDataHashes));
|
||||
|
||||
const signatureBytes = Array.from(signature, byte => byte < 128 ? byte : byte - 256);
|
||||
const signature = sign(privateKeyPem, dsc, eContent);
|
||||
const signatureBytes = Array.from(signature, (byte) => (byte < 128 ? byte : byte - 256));
|
||||
|
||||
return {
|
||||
dsc: dsc,
|
||||
mrz: mrz,
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
pubKey: {
|
||||
modulus: hexToDecimal(modulus),
|
||||
exponent: '65537',
|
||||
},
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIy3...",
|
||||
mockUser: true
|
||||
};
|
||||
return {
|
||||
dsc: dsc,
|
||||
mrz: mrz,
|
||||
dataGroupHashes: concatenatedDataHashes,
|
||||
eContent: eContent,
|
||||
encryptedDigest: signatureBytes,
|
||||
photoBase64: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mL8//8/AyUYiBQYmIy3...',
|
||||
mockUser: true,
|
||||
};
|
||||
}
|
||||
|
||||
function sign(
|
||||
privateKeyPem: string,
|
||||
dsc: string,
|
||||
eContent: number[]
|
||||
): number[] {
|
||||
const { signatureAlgorithm, hashFunction, curve } = parseDSC(dsc);
|
||||
|
||||
if (signatureAlgorithm === 'rsapss') {
|
||||
const privateKey = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||
const md = forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const pss = forge.pss.create({
|
||||
md: forge.md.sha256.create(),
|
||||
mgf: forge.mgf.mgf1.create(forge.md.sha256.create()),
|
||||
saltLength: 32,
|
||||
});
|
||||
const signatureBytes = privateKey.sign(md, pss);
|
||||
return Array.from(signatureBytes, (c: string) => c.charCodeAt(0));
|
||||
} else if (signatureAlgorithm === 'ecdsa') {
|
||||
const curveForElliptic = curve === 'secp256r1' ? 'p256' : 'p384';
|
||||
const ec = new elliptic.ec(curveForElliptic);
|
||||
|
||||
const privateKeyDer = Buffer.from(
|
||||
privateKeyPem.replace(/-----BEGIN EC PRIVATE KEY-----|\n|-----END EC PRIVATE KEY-----/g, ''),
|
||||
'base64'
|
||||
);
|
||||
const asn1Data = asn1.fromBER(privateKeyDer);
|
||||
const privateKeyBuffer = (asn1Data.result.valueBlock as any).value[1].valueBlock.valueHexView;
|
||||
|
||||
const keyPair = ec.keyFromPrivate(privateKeyBuffer);
|
||||
|
||||
const md = hashFunction === 'sha1' ? forge.md.sha1.create() : forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const signature = keyPair.sign(md.digest().toHex(), 'hex');
|
||||
const signatureBytes = Array.from(Buffer.from(signature.toDER(), 'hex'));
|
||||
|
||||
return signatureBytes;
|
||||
} else {
|
||||
const privKey = forge.pki.privateKeyFromPem(privateKeyPem);
|
||||
const md = hashFunction === 'sha1' ? forge.md.sha1.create() : forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const forgeSignature = privKey.sign(md);
|
||||
return Array.from(forgeSignature, (c: string) => c.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,11 @@ import {
|
||||
hash,
|
||||
splitToWords,
|
||||
toUnsignedByte,
|
||||
getHashLen,
|
||||
getCurrentDateYYMMDD,
|
||||
generateMerkleProof,
|
||||
generateSMTProof,
|
||||
findSubarrayIndex,
|
||||
hexToDecimal,
|
||||
BigintToArray,
|
||||
extractRSFromSignature,
|
||||
castFromUUID,
|
||||
castFromScope,
|
||||
@@ -26,10 +24,8 @@ import { getNameLeaf, getNameDobLeaf, getPassportNumberLeaf } from "./ofacTree";
|
||||
import { poseidon6 } from "poseidon-lite";
|
||||
import { packBytes } from "../utils/utils";
|
||||
import { getCSCAModulusMerkleTree } from "./csca";
|
||||
import {
|
||||
mockPassportDatas,
|
||||
} from "../constants/mockPassportData";
|
||||
import { SMT } from "@ashpect/smt"
|
||||
import { parseDSC } from './handleCertificate';
|
||||
|
||||
export function generateCircuitInputsRegister(
|
||||
secret: string,
|
||||
@@ -38,62 +34,45 @@ export function generateCircuitInputsRegister(
|
||||
passportData: PassportData,
|
||||
n_dsc: number,
|
||||
k_dsc: number,
|
||||
mocks: PassportData[] = mockPassportDatas
|
||||
// mocks: PassportData[] = mockPassportDatas
|
||||
mocks?: PassportData[]
|
||||
) {
|
||||
const { mrz, signatureAlgorithm, pubKey, dataGroupHashes, eContent, encryptedDigest } =
|
||||
passportData;
|
||||
const { mrz, dsc, dataGroupHashes, eContent, encryptedDigest } =
|
||||
passportData;
|
||||
|
||||
// const tree = getCSCAModulusMerkleTree();
|
||||
const { signatureAlgorithm, hashFunction, hashLen, x, y, modulus } = parseDSC(dsc);
|
||||
|
||||
// if (DEVELOPMENT_MODE) {
|
||||
// for (const mockPassportData of mocks) {
|
||||
// tree.insert(getLeaf(mockPassportData).toString());
|
||||
// }
|
||||
// }
|
||||
// const tree = getCSCAModulusMerkleTree(DEVELOPMENT_MODE);
|
||||
|
||||
if (
|
||||
![
|
||||
'sha256WithRSAEncryption',
|
||||
'sha1WithRSAEncryption',
|
||||
'sha256WithRSASSAPSS',
|
||||
'ecdsa-with-SHA1',
|
||||
'ecdsa-with-SHA256',
|
||||
].includes(signatureAlgorithm)
|
||||
) {
|
||||
console.error(`${signatureAlgorithm} has not been implemented.`);
|
||||
throw new Error(`${signatureAlgorithm} has not been implemented.`);
|
||||
const supportedAlgorithms = [
|
||||
{ signatureAlgorithm: 'rsa', hashFunction: 'sha1' },
|
||||
{ signatureAlgorithm: 'rsa', hashFunction: 'sha256' },
|
||||
{ signatureAlgorithm: 'rsapss', hashFunction: 'sha256' },
|
||||
{ signatureAlgorithm: 'ecdsa', hashFunction: 'sha1' },
|
||||
{ signatureAlgorithm: 'ecdsa', hashFunction: 'sha256' },
|
||||
];
|
||||
|
||||
const isSupported = supportedAlgorithms.some(
|
||||
(alg) => alg.signatureAlgorithm === signatureAlgorithm && alg.hashFunction === hashFunction
|
||||
);
|
||||
|
||||
if (!isSupported) {
|
||||
throw new Error(`Verification of ${signatureAlgorithm} with ${hashFunction} has not been implemented.`);
|
||||
}
|
||||
|
||||
const hashLen = getHashLen(signatureAlgorithm);
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(signatureAlgorithm, formattedMrz);
|
||||
const mrzHash = hash(hashFunction, formattedMrz);
|
||||
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash);
|
||||
// console.log('dg1HashOffset', dg1HashOffset);
|
||||
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(signatureAlgorithm, dataGroupHashes);
|
||||
const concatHash = hash(hashFunction, dataGroupHashes);
|
||||
|
||||
assert(
|
||||
arraysAreEqual(concatHash, eContent.slice(eContent.length - hashLen)),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
const leaf = getLeaf({
|
||||
signatureAlgorithm: signatureAlgorithm,
|
||||
...pubKey,
|
||||
}).toString();
|
||||
|
||||
// const index = tree.indexOf(leaf);
|
||||
// console.log(`Index of pubkey in the registry: ${index}`);
|
||||
// if (index === -1) {
|
||||
// throw new Error('Your public key was not found in the registry');
|
||||
// }
|
||||
|
||||
// const proof = tree.createProof(index);
|
||||
// console.log('verifyProof', tree.verifyProof(proof));
|
||||
|
||||
if (dataGroupHashes.length > MAX_DATAHASHES_LEN) {
|
||||
throw new Error(
|
||||
`This length of datagroups (${dataGroupHashes.length} bytes) is currently unsupported. Please contact us so we add support!`
|
||||
@@ -109,33 +88,32 @@ export function generateCircuitInputsRegister(
|
||||
let signatureComponents: any;
|
||||
let dscModulusComponents: any;
|
||||
|
||||
if (signatureAlgorithm.startsWith('ecdsa-with-')) {
|
||||
const curve_params = pubKey.publicKeyQ.replace(/[()]/g, '').split(',');
|
||||
const { r, s } = extractRSFromSignature(passportData.encryptedDigest);
|
||||
if (signatureAlgorithm === 'ecdsa') {
|
||||
const { r, s } = extractRSFromSignature(encryptedDigest);
|
||||
|
||||
signatureComponents = {
|
||||
signature_r: BigintToArray(n_dsc, k_dsc, BigInt(hexToDecimal(r))),
|
||||
signature_s: BigintToArray(n_dsc, k_dsc, BigInt(hexToDecimal(s)))
|
||||
signature_r: splitToWords(BigInt(hexToDecimal(r)), n_dsc, k_dsc),
|
||||
signature_s: splitToWords(BigInt(hexToDecimal(s)), n_dsc, k_dsc)
|
||||
};
|
||||
|
||||
dscModulusComponents = {
|
||||
dsc_modulus_x: BigintToArray(n_dsc, k_dsc, BigInt(hexToDecimal(curve_params[0]))),
|
||||
dsc_modulus_y: BigintToArray(n_dsc, k_dsc, BigInt(hexToDecimal(curve_params[1])))
|
||||
dsc_modulus_x: splitToWords(BigInt(hexToDecimal(x)), n_dsc, k_dsc),
|
||||
dsc_modulus_y: splitToWords(BigInt(hexToDecimal(y)), n_dsc, k_dsc)
|
||||
};
|
||||
} else {
|
||||
signatureComponents = {
|
||||
signature: splitToWords(
|
||||
BigInt(bytesToBigDecimal(passportData.encryptedDigest)),
|
||||
BigInt(n_dsc),
|
||||
BigInt(k_dsc)
|
||||
BigInt(bytesToBigDecimal(encryptedDigest)),
|
||||
n_dsc,
|
||||
k_dsc
|
||||
)
|
||||
};
|
||||
|
||||
dscModulusComponents = {
|
||||
dsc_modulus: splitToWords(
|
||||
BigInt(passportData.pubKey.modulus as string),
|
||||
BigInt(n_dsc),
|
||||
BigInt(k_dsc)
|
||||
BigInt(hexToDecimal(modulus)),
|
||||
n_dsc,
|
||||
k_dsc
|
||||
)
|
||||
};
|
||||
}
|
||||
@@ -164,11 +142,7 @@ export function generateCircuitInputsDisclose(
|
||||
scope: string,
|
||||
user_identifier: string
|
||||
) {
|
||||
const pubkey_leaf = getLeaf({
|
||||
signatureAlgorithm: passportData.signatureAlgorithm,
|
||||
modulus: passportData.pubKey.modulus,
|
||||
exponent: passportData.pubKey.exponent,
|
||||
});
|
||||
const pubkey_leaf = getLeaf(passportData);
|
||||
|
||||
const formattedMrz = formatMrz(passportData.mrz);
|
||||
const mrz_bytes = packBytes(formattedMrz);
|
||||
|
||||
@@ -1,14 +1,40 @@
|
||||
import * as asn1 from 'asn1js';
|
||||
import { Certificate } from 'pkijs';
|
||||
import { vkey_prove_rsa_65537_sha256 } from '../constants/vkey';
|
||||
import { getHashLen } from './utils';
|
||||
import { getNamedCurve } from '../../../registry/src/utils/curves';
|
||||
import elliptic from 'elliptic';
|
||||
|
||||
export const getSignatureAlgorithm = (pemContent: string) => {
|
||||
export const parseDSC = (pemContent: string) => {
|
||||
const certBuffer = Buffer.from(pemContent.replace(/(-----(BEGIN|END) CERTIFICATE-----|\n)/g, ''), 'base64');
|
||||
const asn1Data = asn1.fromBER(certBuffer);
|
||||
const cert = new Certificate({ schema: asn1Data.result });
|
||||
const signatureAlgorithmOid = cert.signatureAlgorithm.algorithmId;
|
||||
const { signatureAlgorithm, hashFunction } = getSignatureAlgorithmDetails(signatureAlgorithmOid);
|
||||
return { signatureAlgorithm, hashFunction };
|
||||
const hashLen = getHashLen(hashFunction);
|
||||
|
||||
let publicKeyDetails;
|
||||
if (signatureAlgorithm === 'ecdsa') {
|
||||
const subjectPublicKeyInfo = cert.subjectPublicKeyInfo;
|
||||
const algorithmParams = subjectPublicKeyInfo.algorithm.algorithmParams;
|
||||
const curveOid = asn1.fromBER(algorithmParams.valueBeforeDecode).result.valueBlock.toString();
|
||||
const curve = getNamedCurve(curveOid);
|
||||
|
||||
const publicKeyBuffer = subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView;
|
||||
const curveForElliptic = curve === 'secp256r1' ? 'p256' : 'p384';
|
||||
const ec = new elliptic.ec(curveForElliptic);
|
||||
const key = ec.keyFromPublic(publicKeyBuffer);
|
||||
const x = key.getPublic().getX().toString('hex');
|
||||
const y = key.getPublic().getY().toString('hex');
|
||||
publicKeyDetails = { curve, x, y };
|
||||
} else {
|
||||
const publicKey = cert.subjectPublicKeyInfo.subjectPublicKey;
|
||||
const asn1PublicKey = asn1.fromBER(publicKey.valueBlock.valueHexView);
|
||||
const rsaPublicKey = asn1PublicKey.result.valueBlock;
|
||||
const modulus = Buffer.from((rsaPublicKey as any).value[0].valueBlock.valueHexView).toString('hex');
|
||||
const exponent = Buffer.from((rsaPublicKey as any).value[1].valueBlock.valueHexView).toString('hex');
|
||||
publicKeyDetails = { modulus, exponent };
|
||||
}
|
||||
return { signatureAlgorithm, hashFunction, hashLen, ...publicKeyDetails };
|
||||
}
|
||||
|
||||
export const getCircuitName = (circuitType: string, signatureAlgorithm: string, hashFunction: string) => {
|
||||
|
||||
@@ -1,98 +1,34 @@
|
||||
import { SignatureAlgorithm, PUBKEY_TREE_DEPTH, COMMITMENT_TREE_TRACKER_URL } from "../constants/constants";
|
||||
import { IMT, LeanIMT } from '@zk-kit/imt'
|
||||
import { formatSigAlgNameForCircuit } from "./utils";
|
||||
import { toStandardName } from "./formatNames";
|
||||
import { PUBKEY_TREE_DEPTH, COMMITMENT_TREE_TRACKER_URL, SignatureAlgorithmIndex } from "../constants/constants";
|
||||
import { LeanIMT } from '@zk-kit/imt'
|
||||
import axios from "axios";
|
||||
import { poseidon10, poseidon2, poseidon3, poseidon5, poseidon6, poseidon8 } from 'poseidon-lite';
|
||||
import { BigintToArray, hexToDecimal, splitToWords } from './utils';
|
||||
import { poseidon10, poseidon2, poseidon3, poseidon6 } from 'poseidon-lite';
|
||||
import { hexToDecimal, splitToWords } from './utils';
|
||||
import { PassportData } from "./types";
|
||||
import { parseDSC } from "./handleCertificate";
|
||||
|
||||
export function buildPubkeyTree(pubkeys: any[]) {
|
||||
let leaves: bigint[] = [];
|
||||
let startTime = performance.now();
|
||||
export function getLeaf(passportData: PassportData): bigint {
|
||||
const { signatureAlgorithm, hashFunction, modulus, x, y } = parseDSC(passportData.dsc);
|
||||
const sigAlgIndex = SignatureAlgorithmIndex[`${signatureAlgorithm}_${hashFunction}`]
|
||||
|
||||
for (let i = 0; i < pubkeys.length; i++) {
|
||||
const pubkey = pubkeys[i];
|
||||
if (signatureAlgorithm === 'ecdsa') {
|
||||
let qx = splitToWords(BigInt(hexToDecimal(x)), 43, 6);
|
||||
let qy = splitToWords(BigInt(hexToDecimal(y)), 43, 6);
|
||||
|
||||
if (i % 3000 === 0 && i !== 0) {
|
||||
console.log('Processing pubkey number', i, 'over', pubkeys.length);
|
||||
}
|
||||
let x_hash = poseidon6(qx);
|
||||
let y_hash = poseidon6(qy);
|
||||
|
||||
const leaf = getLeaf(pubkey, i);
|
||||
return poseidon3([
|
||||
sigAlgIndex,
|
||||
x_hash,
|
||||
y_hash,
|
||||
]);
|
||||
} else {
|
||||
const pubkeyChunked = splitToWords(BigInt(hexToDecimal(modulus)), 230, 9);
|
||||
|
||||
if (!leaf) {
|
||||
// console.log('no leaf for this weird signature:', i, formatSigAlgNameForCircuit(pubkey.signatureAlgorithm, pubkey.exponent))
|
||||
continue;
|
||||
}
|
||||
leaves.push(leaf);
|
||||
}
|
||||
|
||||
const tree = new IMT(poseidon2, PUBKEY_TREE_DEPTH, 0, 2, leaves);
|
||||
console.log('pubkey tree built in', performance.now() - startTime, 'ms');
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
export function getLeaf(pubkey: any, i?: number): bigint {
|
||||
if (!pubkey?.modulus && pubkey?.pubKey?.modulus) {
|
||||
pubkey.modulus = pubkey.pubKey.modulus;
|
||||
pubkey.exponent = pubkey.pubKey.exponent;
|
||||
}
|
||||
if (!pubkey?.publicKeyQ && pubkey?.pubKey?.publicKeyQ) {
|
||||
pubkey.publicKeyQ = pubkey.pubKey.publicKeyQ;
|
||||
}
|
||||
const sigAlgFormatted = toStandardName(pubkey.signatureAlgorithm);
|
||||
const sigAlgFormattedForCircuit = formatSigAlgNameForCircuit(sigAlgFormatted, pubkey.exponent);
|
||||
if (
|
||||
sigAlgFormattedForCircuit === 'sha256WithRSAEncryption_65537' ||
|
||||
sigAlgFormattedForCircuit === 'sha256WithRSAEncryption_3' ||
|
||||
sigAlgFormattedForCircuit === 'sha1WithRSAEncryption_65537' ||
|
||||
sigAlgFormattedForCircuit === 'sha256WithRSASSAPSS_65537' ||
|
||||
sigAlgFormattedForCircuit === 'sha256WithRSASSAPSS_3' ||
|
||||
sigAlgFormattedForCircuit === 'sha512WithRSAEncryption_65537'
|
||||
) {
|
||||
const pubkeyChunked = splitToWords(BigInt(pubkey.modulus), BigInt(230), BigInt(9));
|
||||
const leaf = poseidon10([SignatureAlgorithm[sigAlgFormattedForCircuit], ...pubkeyChunked]);
|
||||
try {
|
||||
return leaf;
|
||||
} catch (err) {
|
||||
console.log('err', err, i, sigAlgFormattedForCircuit, pubkey);
|
||||
}
|
||||
} else if (
|
||||
sigAlgFormattedForCircuit === 'ecdsa_with_SHA1' ||
|
||||
sigAlgFormattedForCircuit === 'ecdsa_with_SHA224' ||
|
||||
sigAlgFormattedForCircuit === 'ecdsa_with_SHA384' ||
|
||||
sigAlgFormattedForCircuit === 'ecdsa_with_SHA256' ||
|
||||
sigAlgFormattedForCircuit === 'ecdsa_with_SHA512'
|
||||
) {
|
||||
try {
|
||||
if (!pubkey.publicKeyQ) {
|
||||
throw new Error('publicKeyQ is undefined');
|
||||
}
|
||||
|
||||
const [x, y, a, p] = pubkey.publicKeyQ.replace(/[()]/g, '').split(',');
|
||||
|
||||
if (!x || !y) {
|
||||
throw new Error('Invalid publicKeyQ format');
|
||||
}
|
||||
|
||||
let qx = BigintToArray(43, 6, BigInt(hexToDecimal(x)));
|
||||
let qy = BigintToArray(43, 6, BigInt(hexToDecimal(y)));
|
||||
|
||||
let poseidon_hasher_dsc_modules_x = poseidon6(qx);
|
||||
let poseidon_hasher_dsc_modules_y = poseidon6(qy);
|
||||
|
||||
return poseidon3([
|
||||
SignatureAlgorithm[sigAlgFormattedForCircuit],
|
||||
poseidon_hasher_dsc_modules_x, // pub.x
|
||||
poseidon_hasher_dsc_modules_y, // pub.y
|
||||
// pubkey.b ? pubkey.b : BigInt(0), // null then 0
|
||||
// pubkey.generator ? pubkey.generator : BigInt(0), // null then 0
|
||||
// pubkey.order ? pubkey.order : BigInt(0), // null then 0
|
||||
// pubkey.cofactor ? pubkey.cofactor : BigInt(0), // null then 0
|
||||
]);
|
||||
} catch (err) {
|
||||
console.log('err', err, i, sigAlgFormattedForCircuit, pubkey);
|
||||
}
|
||||
return poseidon10([
|
||||
sigAlgIndex,
|
||||
...pubkeyChunked
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
export type PassportData = {
|
||||
mrz: string;
|
||||
signatureAlgorithm: string;
|
||||
dsc?: string;
|
||||
pubKey?: { modulus?: string, exponent?: string, curveName?: string, publicKeyQ?: string };
|
||||
dsc: string;
|
||||
dataGroupHashes: number[];
|
||||
eContent: number[];
|
||||
encryptedDigest: number[];
|
||||
@@ -10,6 +8,8 @@ export type PassportData = {
|
||||
mockUser?: boolean;
|
||||
};
|
||||
|
||||
export type SignatureAlgorithm = 'rsa_sha1' | 'rsa_sha256' | 'rsapss_sha256' | 'ecdsa_sha256' | 'ecdsa_sha1' | 'ecdsa_sha384';
|
||||
|
||||
export type Proof = {
|
||||
proof: {
|
||||
a: [string, string],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LeanIMT } from '@zk-kit/lean-imt';
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { sha1 } from 'js-sha1';
|
||||
import { sha384 } from 'js-sha512';
|
||||
import { sha384, sha512_256 } from 'js-sha512';
|
||||
import { SMT } from '@ashpect/smt';
|
||||
import forge from 'node-forge';
|
||||
|
||||
@@ -16,23 +16,6 @@ export function formatMrz(mrz: string) {
|
||||
return mrzCharcodes;
|
||||
}
|
||||
|
||||
export function parsePubKeyString(pubKeyString: string) {
|
||||
const modulusMatch = pubKeyString.match(/modulus: ([\w\d]+)\s*public/);
|
||||
const publicExponentMatch = pubKeyString.match(/public exponent: (\w+)/);
|
||||
|
||||
const modulus = modulusMatch ? modulusMatch[1] : null;
|
||||
const exponent = publicExponentMatch ? publicExponentMatch[1] : null;
|
||||
|
||||
if (!modulus || !exponent) {
|
||||
throw new Error('Could not parse public key string');
|
||||
}
|
||||
|
||||
return {
|
||||
modulus,
|
||||
exponent,
|
||||
};
|
||||
}
|
||||
|
||||
export function formatAndConcatenateDataHashes(
|
||||
dataHashes: [number, number[]][],
|
||||
hashLen: number,
|
||||
@@ -156,14 +139,14 @@ export const toBinaryString = (byte: any) => {
|
||||
return binary;
|
||||
};
|
||||
|
||||
export function splitToWords(number: bigint, wordsize: bigint, numberElement: bigint) {
|
||||
export function splitToWords(number: bigint, wordsize: number, numberElement: number) {
|
||||
let t = number;
|
||||
const words: string[] = [];
|
||||
for (let i = BigInt(0); i < numberElement; ++i) {
|
||||
for (let i = 0; i < numberElement; ++i) {
|
||||
const baseTwo = BigInt(2);
|
||||
|
||||
words.push(`${t % BigInt(Math.pow(Number(baseTwo), Number(wordsize)))}`);
|
||||
t = BigInt(t / BigInt(Math.pow(Number(BigInt(2)), Number(wordsize))));
|
||||
words.push(`${t % BigInt(Math.pow(Number(baseTwo), wordsize))}`);
|
||||
t = BigInt(t / BigInt(Math.pow(Number(BigInt(2)), wordsize)));
|
||||
}
|
||||
if (!(t == BigInt(0))) {
|
||||
throw `Number ${number} does not fit in ${(wordsize * numberElement).toString()} bits`;
|
||||
@@ -184,26 +167,22 @@ export function hexToDecimal(hex: string): string {
|
||||
}
|
||||
|
||||
// hash logic here because the one in utils.ts only works with node
|
||||
|
||||
export function hash(signatureAlgorithm: string, bytesArray: number[]): number[] {
|
||||
export function hash(hasFunction: string, bytesArray: number[]): number[] {
|
||||
const unsignedBytesArray = bytesArray.map((byte) => byte & 0xff);
|
||||
let hashResult: string;
|
||||
|
||||
switch (signatureAlgorithm) {
|
||||
case 'sha1WithRSAEncryption':
|
||||
switch (hasFunction) {
|
||||
case 'sha1':
|
||||
hashResult = sha1(unsignedBytesArray);
|
||||
break;
|
||||
case 'SHA384withECDSA':
|
||||
case 'sha256':
|
||||
hashResult = sha256(unsignedBytesArray);
|
||||
break;
|
||||
case 'sha384':
|
||||
hashResult = sha384(unsignedBytesArray);
|
||||
break;
|
||||
case 'sha256WithRSAEncryption':
|
||||
hashResult = sha256(unsignedBytesArray);
|
||||
break;
|
||||
case 'sha256WithRSASSAPSS':
|
||||
hashResult = sha256(unsignedBytesArray);
|
||||
break;
|
||||
case 'ecdsa-with-SHA1':
|
||||
hashResult = sha1(unsignedBytesArray);
|
||||
case 'sha512':
|
||||
hashResult = sha512_256(unsignedBytesArray);
|
||||
break;
|
||||
default:
|
||||
hashResult = sha256(unsignedBytesArray); // Default to sha256
|
||||
@@ -224,13 +203,6 @@ export function toUnsignedByte(signedByte: number) {
|
||||
return signedByte < 0 ? signedByte + 256 : signedByte;
|
||||
}
|
||||
|
||||
export function formatSigAlgNameForCircuit(sigAlg: string, exponent?: string) {
|
||||
// replace - by _, for instance for ecdsa-with-SHA256
|
||||
sigAlg = sigAlg.replace(/-/g, '_');
|
||||
// add exponent, for instance for sha256WithRSAEncryption
|
||||
return exponent ? `${sigAlg}_${exponent}` : sigAlg;
|
||||
}
|
||||
|
||||
export function bigIntToChunkedBytes(
|
||||
num: BigInt | bigint,
|
||||
bytesPerChunk: number,
|
||||
@@ -273,23 +245,18 @@ export function getCurrentDateYYMMDD(dayDiff: number = 0): number[] {
|
||||
return Array.from(yymmdd).map((char) => parseInt(char));
|
||||
}
|
||||
|
||||
export function getHashLen(signatureAlgorithm: string) {
|
||||
switch (signatureAlgorithm) {
|
||||
case 'sha1WithRSAEncryption':
|
||||
case 'ecdsa-with-SHA1':
|
||||
export function getHashLen(hashFunction: string) {
|
||||
switch (hashFunction) {
|
||||
case 'sha1':
|
||||
return 20;
|
||||
case 'sha256WithRSAEncryption':
|
||||
case 'rsassaPss':
|
||||
case 'ecdsa-with-SHA256':
|
||||
case 'sha256':
|
||||
return 32;
|
||||
case 'sha384WithRSAEncryption':
|
||||
case 'ecdsa-with-SHA384':
|
||||
case 'sha384':
|
||||
return 48;
|
||||
case 'sha512WithRSAEncryption':
|
||||
case 'ecdsa-with-SHA512':
|
||||
case 'sha512':
|
||||
return 64;
|
||||
default:
|
||||
console.log(`${signatureAlgorithm} not found in getHashLen`);
|
||||
console.log(`${hashFunction} not found in getHashLen`);
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
@@ -400,28 +367,8 @@ export function extractRSFromSignature(signatureBytes: number[]): { r: string; s
|
||||
return { r, s };
|
||||
}
|
||||
|
||||
export function BigintToArray(n: number, k: number, x: bigint) {
|
||||
let mod: bigint = 1n;
|
||||
for (var idx = 0; idx < n; idx++) {
|
||||
mod = mod * 2n;
|
||||
}
|
||||
|
||||
let ret: bigint[] = [];
|
||||
var x_temp: bigint = x;
|
||||
for (var idx = 0; idx < k; idx++) {
|
||||
ret.push(x_temp % mod);
|
||||
x_temp = x_temp / mod;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// UUID
|
||||
|
||||
function stringToHex(str: string): string {
|
||||
return Buffer.from(str).toString('hex');
|
||||
}
|
||||
|
||||
|
||||
function hexToBigInt(hex: string): bigint {
|
||||
return BigInt(`0x${hex}`);
|
||||
}
|
||||
@@ -547,7 +494,6 @@ const getMaxLenght = (idType: UserIdType) => {
|
||||
}
|
||||
|
||||
export const parseUIDToBigInt = (user_identifier: string, user_identifier_type: UserIdType): string => {
|
||||
|
||||
if (!validateUserId(user_identifier, user_identifier_type)) {
|
||||
throw new Error(`User identifier of type ${user_identifier_type} is not valid`);
|
||||
}
|
||||
|
||||
86
common/tests/genMockPassportData.test.ts
Normal file
86
common/tests/genMockPassportData.test.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { assert, expect } from 'chai';
|
||||
import { describe, it } from 'mocha';
|
||||
import { genMockPassportData } from '../src/utils/genMockPassportData';
|
||||
import * as forge from 'node-forge';
|
||||
import { PassportData, SignatureAlgorithm } from '../src/utils/types';
|
||||
import { formatMrz, hash, arraysAreEqual, findSubarrayIndex } from '../src/utils/utils';
|
||||
import { parseDSC } from '../src/utils/handleCertificate';
|
||||
import * as asn1 from 'asn1js';
|
||||
import { Certificate } from 'pkijs';
|
||||
import elliptic from 'elliptic';
|
||||
|
||||
const sigAlgs: SignatureAlgorithm[] = [
|
||||
'rsa_sha1',
|
||||
'rsa_sha256',
|
||||
'rsapss_sha256',
|
||||
'ecdsa_sha256',
|
||||
'ecdsa_sha1',
|
||||
'ecdsa_sha384',
|
||||
];
|
||||
|
||||
describe('Mock Passport Data Generator', function () {
|
||||
this.timeout(0);
|
||||
|
||||
sigAlgs.forEach(sigAlg => {
|
||||
it(`should generate valid passport data for ${sigAlg}`, () => {
|
||||
const passportData = genMockPassportData(sigAlg, 'FRA', '000101', '300101');
|
||||
expect(passportData).to.exist;
|
||||
expect(verify(passportData)).to.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function verify(passportData: PassportData): boolean {
|
||||
const { mrz, dsc, dataGroupHashes, eContent, encryptedDigest } = passportData;
|
||||
const { signatureAlgorithm, hashFunction, hashLen, curve } = parseDSC(dsc);
|
||||
const formattedMrz = formatMrz(mrz);
|
||||
const mrzHash = hash(hashFunction, formattedMrz);
|
||||
const dg1HashOffset = findSubarrayIndex(dataGroupHashes, mrzHash)
|
||||
assert(dg1HashOffset !== -1, 'MRZ hash index not found in dataGroupHashes');
|
||||
|
||||
const concatHash = hash(hashFunction, dataGroupHashes)
|
||||
assert(
|
||||
arraysAreEqual(
|
||||
concatHash,
|
||||
eContent.slice(eContent.length - hashLen)
|
||||
),
|
||||
'concatHash is not at the right place in eContent'
|
||||
);
|
||||
|
||||
if (signatureAlgorithm === 'ecdsa') {
|
||||
const certBuffer = Buffer.from(dsc.replace(/(-----(BEGIN|END) CERTIFICATE-----|\n)/g, ''), 'base64');
|
||||
const asn1Data = asn1.fromBER(certBuffer);
|
||||
const cert = new Certificate({ schema: asn1Data.result });
|
||||
const publicKeyInfo = cert.subjectPublicKeyInfo;
|
||||
const publicKeyBuffer = publicKeyInfo.subjectPublicKey.valueBlock.valueHexView;
|
||||
const curveForElliptic = curve === 'secp256r1' ? 'p256' : 'p384';
|
||||
const ec = new elliptic.ec(curveForElliptic);
|
||||
|
||||
const key = ec.keyFromPublic(publicKeyBuffer);
|
||||
const md = hashFunction === 'sha1' ? forge.md.sha1.create() : forge.md.sha256.create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
const msgHash = md.digest().toHex()
|
||||
const signature_crypto = Buffer.from(encryptedDigest).toString('hex');
|
||||
|
||||
return key.verify(msgHash, signature_crypto);
|
||||
} else {
|
||||
const cert = forge.pki.certificateFromPem(dsc);
|
||||
const publicKey = cert.publicKey as forge.pki.rsa.PublicKey;
|
||||
|
||||
const md = forge.md[hashFunction].create();
|
||||
md.update(forge.util.binary.raw.encode(new Uint8Array(eContent)));
|
||||
|
||||
const signature = Buffer.from(encryptedDigest).toString('binary');
|
||||
|
||||
if (signatureAlgorithm === 'rsapss') {
|
||||
const pss = forge.pss.create({
|
||||
md: forge.md[hashFunction].create(),
|
||||
mgf: forge.mgf.mgf1.create(forge.md[hashFunction].create()),
|
||||
saltLength: hashLen
|
||||
});
|
||||
return publicKey.verify(md.digest().bytes(), signature, pss);
|
||||
} else {
|
||||
return publicKey.verify(md.digest().bytes(), signature);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
Arguments:
|
||||
/Users/remicolin/.nvm/versions/node/v20.11.1/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js add path jrrsasign asn1.js
|
||||
|
||||
PATH:
|
||||
/Users/remicolin/.nvm/versions/node/v20.11.1/bin:/Users/remicolin/.gem/ruby/3.1.3/bin:/Users/remicolin/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin:/Users/remicolin/.rubies/ruby-3.1.3/bin:/Users/remicolin/.jenv/shims:/Users/remicolin/.jenv/bin:/Users/remicolin/.cairo/target/release:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/remicolin/.nvm/versions/node/v20.11.1/bin:/Users/remicolin/.jenv/shims:/Users/remicolin/.jenv/bin:/Users/remicolin/.cairo/target/release:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/remicolin/.cargo/bin:/Users/remicolin/.foundry/bin:/Users/remicolin/Library/Android/sdk/platform-tools:/Users/remicolin/.foundry/bin:/Users/remicolin/Library/Android/sdk/platform-tools
|
||||
|
||||
Yarn version:
|
||||
1.22.19
|
||||
|
||||
Node version:
|
||||
20.11.1
|
||||
|
||||
Platform:
|
||||
darwin arm64
|
||||
|
||||
Trace:
|
||||
Error: https://registry.yarnpkg.com/jrrsasign: Not found
|
||||
at params.callback [as _callback] (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:66145:18)
|
||||
at self.callback (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:140890:22)
|
||||
at Request.emit (node:events:518:28)
|
||||
at Request.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141862:10)
|
||||
at Request.emit (node:events:518:28)
|
||||
at IncomingMessage.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141784:12)
|
||||
at Object.onceWrapper (node:events:632:28)
|
||||
at IncomingMessage.emit (node:events:530:35)
|
||||
at endReadableNT (node:internal/streams/readable:1696:12)
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
|
||||
|
||||
npm manifest:
|
||||
{
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.23.4",
|
||||
"@zk-kit/imt": "https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675",
|
||||
"@zk-kit/lean-imt": "^2.0.1",
|
||||
"fs": "^0.0.1-security",
|
||||
"js-sha1": "^0.7.0",
|
||||
"js-sha256": "^0.10.1",
|
||||
"js-sha512": "^0.9.0",
|
||||
"node-forge": "^1.3.1",
|
||||
"poseidon-lite": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-forge": "^1.3.10"
|
||||
}
|
||||
}
|
||||
|
||||
yarn manifest:
|
||||
No manifest
|
||||
|
||||
Lockfile:
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@babel/runtime@^7.23.4":
|
||||
version "7.23.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.4.tgz#36fa1d2b36db873d25ec631dcc4923fdc1cf2e2e"
|
||||
integrity sha512-2Yv65nlWnWlSpe3fXEyX5i7fx5kIKo4Qbcj+hMO0odwaneFjfXw5fdum+4yL20O0QiaHpia0cYQ9xpNMqrBwHg==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.14.0"
|
||||
|
||||
"@types/node-forge@^1.3.10":
|
||||
version "1.3.10"
|
||||
resolved "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.10.tgz"
|
||||
integrity sha512-y6PJDYN4xYBxwd22l+OVH35N+1fCYWiuC3aiP2SlXVE6Lo7SS+rSx9r89hLxrP4pn6n1lBGhHJ12pj3F3Mpttw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/node@*":
|
||||
version "20.10.0"
|
||||
resolved "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz"
|
||||
integrity sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ==
|
||||
dependencies:
|
||||
undici-types "~5.26.4"
|
||||
|
||||
"@zk-kit/imt@https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675":
|
||||
version "2.0.0-beta.1"
|
||||
resolved "https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675#38244ea6eef75dc1ad7fff3ff2a22dd5f1a2593a"
|
||||
|
||||
"@zk-kit/lean-imt@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@zk-kit/lean-imt/-/lean-imt-2.0.1.tgz#78af48b384b083e4a3f003036a40a4ea3cb102c0"
|
||||
integrity sha512-yc0rh9BCY6VvvKrZUNejfucuWscy1iRb9JrppuJktsiA9HcEukB3oX9CB7N/CUmCtqzmdwybet6N2aglGL/SUQ==
|
||||
dependencies:
|
||||
"@zk-kit/utils" "1.0.0"
|
||||
|
||||
"@zk-kit/utils@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@zk-kit/utils/-/utils-1.0.0.tgz#db1af01a4e60f5290734a26c2fd9e863bff049e3"
|
||||
integrity sha512-v5UjrZiaRNAN2UJmTFHvlMktaA2Efc2qN1Mwd4060ExX12yRhY8ZhzdlDODhnuHkvW5zPukuBHgQhHMScNP3Pg==
|
||||
dependencies:
|
||||
buffer "^6.0.3"
|
||||
|
||||
base64-js@^1.3.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||
|
||||
buffer@^6.0.3:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
|
||||
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
|
||||
dependencies:
|
||||
base64-js "^1.3.1"
|
||||
ieee754 "^1.2.1"
|
||||
|
||||
fs@^0.0.1-security:
|
||||
version "0.0.1-security"
|
||||
resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4"
|
||||
integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==
|
||||
|
||||
ieee754@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||
|
||||
js-sha1@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/js-sha1/-/js-sha1-0.7.0.tgz#fecaf5f36bb09a51b01da46b43a207c8452c9c1e"
|
||||
integrity sha512-oQZ1Mo7440BfLSv9TX87VNEyU52pXPVG19F9PL3gTgNt0tVxlZ8F4O6yze3CLuLx28TxotxvlyepCNaaV0ZjMw==
|
||||
|
||||
js-sha256@^0.10.1:
|
||||
version "0.10.1"
|
||||
resolved "https://registry.npmjs.org/js-sha256/-/js-sha256-0.10.1.tgz"
|
||||
integrity sha512-5obBtsz9301ULlsgggLg542s/jqtddfOpV5KJc4hajc9JV8GeY2gZHSVpYBn4nWqAUTJ9v+xwtbJ1mIBgIH5Vw==
|
||||
|
||||
js-sha512@^0.9.0:
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.9.0.tgz#ed569aa1e4bdaf0b83363c29db1ab87b1192d9ae"
|
||||
integrity sha512-mirki9WS/SUahm+1TbAPkqvbCiCfOAAsyXeHxK1UkullnJVVqoJG2pL9ObvT05CN+tM7fxhfYm0NbXn+1hWoZg==
|
||||
|
||||
node-forge@^1.3.1:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz"
|
||||
integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==
|
||||
|
||||
poseidon-lite@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/poseidon-lite/-/poseidon-lite-0.2.0.tgz#dbc242ebd9c10c32d507a533fa497231d168fd72"
|
||||
integrity sha512-vivDZnGmz8W4G/GzVA72PXkfYStjilu83rjjUfpL4PueKcC8nfX6hCPh2XhoC5FBgC6y0TA3YuUeUo5YCcNoig==
|
||||
|
||||
regenerator-runtime@^0.14.0:
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
|
||||
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==
|
||||
|
||||
undici-types@~5.26.4:
|
||||
version "5.26.5"
|
||||
resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz"
|
||||
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
|
||||
645
common/yarn.lock
645
common/yarn.lock
@@ -18,6 +18,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426"
|
||||
integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==
|
||||
|
||||
"@types/json5@^0.0.29":
|
||||
version "0.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
|
||||
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
|
||||
|
||||
"@types/node-forge@^1.3.10":
|
||||
version "1.3.10"
|
||||
resolved "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.10.tgz"
|
||||
@@ -57,6 +62,36 @@
|
||||
dependencies:
|
||||
buffer "^6.0.3"
|
||||
|
||||
ansi-colors@^4.1.3:
|
||||
version "4.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b"
|
||||
integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==
|
||||
|
||||
ansi-regex@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||
|
||||
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
anymatch@~3.1.2:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e"
|
||||
integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==
|
||||
dependencies:
|
||||
normalize-path "^3.0.0"
|
||||
picomatch "^2.0.4"
|
||||
|
||||
argparse@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
||||
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||
|
||||
array-buffer-byte-length@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz#1e5583ec16763540a27ae52eed99ff899223568f"
|
||||
@@ -104,6 +139,11 @@ arraybuffer.prototype.slice@^1.0.3:
|
||||
is-array-buffer "^3.0.4"
|
||||
is-shared-array-buffer "^1.0.2"
|
||||
|
||||
arrify@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
|
||||
integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==
|
||||
|
||||
asn1.js@^5.4.1:
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07"
|
||||
@@ -123,6 +163,11 @@ asn1js@^3.0.5:
|
||||
pvutils "^1.1.3"
|
||||
tslib "^2.4.0"
|
||||
|
||||
assertion-error@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
|
||||
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
|
||||
|
||||
asynckit@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
@@ -144,21 +189,55 @@ axios@^1.7.2:
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||
|
||||
base64-js@^1.3.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||
|
||||
binary-extensions@^2.0.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522"
|
||||
integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==
|
||||
|
||||
bn.js@^4.0.0, bn.js@^4.11.9:
|
||||
version "4.12.0"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
|
||||
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
|
||||
|
||||
brace-expansion@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
|
||||
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
|
||||
dependencies:
|
||||
balanced-match "^1.0.0"
|
||||
|
||||
braces@~3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
|
||||
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
|
||||
dependencies:
|
||||
fill-range "^7.1.1"
|
||||
|
||||
brorand@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
|
||||
integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==
|
||||
|
||||
browser-stdout@^1.3.1:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
|
||||
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
|
||||
|
||||
buffer-from@^1.0.0, buffer-from@^1.1.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
|
||||
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
|
||||
|
||||
buffer@^6.0.3:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
|
||||
@@ -183,6 +262,75 @@ call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bin
|
||||
get-intrinsic "^1.2.4"
|
||||
set-function-length "^1.2.1"
|
||||
|
||||
camelcase@^6.0.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
|
||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||
|
||||
chai@^4.3.8:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/chai/-/chai-4.5.0.tgz#707e49923afdd9b13a8b0b47d33d732d13812fd8"
|
||||
integrity sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==
|
||||
dependencies:
|
||||
assertion-error "^1.1.0"
|
||||
check-error "^1.0.3"
|
||||
deep-eql "^4.1.3"
|
||||
get-func-name "^2.0.2"
|
||||
loupe "^2.3.6"
|
||||
pathval "^1.1.1"
|
||||
type-detect "^4.1.0"
|
||||
|
||||
chalk@^4.1.0:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||
dependencies:
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
check-error@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694"
|
||||
integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==
|
||||
dependencies:
|
||||
get-func-name "^2.0.2"
|
||||
|
||||
chokidar@^3.5.3:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b"
|
||||
integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==
|
||||
dependencies:
|
||||
anymatch "~3.1.2"
|
||||
braces "~3.0.2"
|
||||
glob-parent "~5.1.2"
|
||||
is-binary-path "~2.1.0"
|
||||
is-glob "~4.0.1"
|
||||
normalize-path "~3.0.0"
|
||||
readdirp "~3.6.0"
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
cliui@^7.0.2:
|
||||
version "7.0.4"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
|
||||
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
|
||||
dependencies:
|
||||
string-width "^4.2.0"
|
||||
strip-ansi "^6.0.0"
|
||||
wrap-ansi "^7.0.0"
|
||||
|
||||
color-convert@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||
dependencies:
|
||||
color-name "~1.1.4"
|
||||
|
||||
color-name@~1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
combined-stream@^1.0.8:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||
@@ -217,6 +365,25 @@ data-view-byte-offset@^1.0.0:
|
||||
es-errors "^1.3.0"
|
||||
is-data-view "^1.0.1"
|
||||
|
||||
debug@^4.3.5:
|
||||
version "4.3.7"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
|
||||
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
|
||||
dependencies:
|
||||
ms "^2.1.3"
|
||||
|
||||
decamelize@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
|
||||
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
|
||||
|
||||
deep-eql@^4.1.3:
|
||||
version "4.1.4"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.4.tgz#d0d3912865911bb8fac5afb4e3acfa6a28dc72b7"
|
||||
integrity sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==
|
||||
dependencies:
|
||||
type-detect "^4.0.0"
|
||||
|
||||
define-data-property@^1.0.1, define-data-property@^1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e"
|
||||
@@ -240,6 +407,16 @@ delayed-stream@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
|
||||
|
||||
diff@^3.1.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
|
||||
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
|
||||
|
||||
diff@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531"
|
||||
integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==
|
||||
|
||||
elliptic@^6.5.5:
|
||||
version "6.5.5"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded"
|
||||
@@ -253,6 +430,11 @@ elliptic@^6.5.5:
|
||||
minimalistic-assert "^1.0.1"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
emoji-regex@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||
|
||||
es-abstract@^1.17.0-next.1, es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.2:
|
||||
version "1.23.3"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0"
|
||||
@@ -362,6 +544,36 @@ es7-shim@^6.0.0:
|
||||
string.prototype.trimleft "^2.0.0"
|
||||
string.prototype.trimright "^2.0.0"
|
||||
|
||||
escalade@^3.1.1:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
|
||||
integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
|
||||
|
||||
escape-string-regexp@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
|
||||
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
|
||||
|
||||
fill-range@^7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
|
||||
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
|
||||
dependencies:
|
||||
to-regex-range "^5.0.1"
|
||||
|
||||
find-up@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
|
||||
integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
|
||||
dependencies:
|
||||
locate-path "^6.0.0"
|
||||
path-exists "^4.0.0"
|
||||
|
||||
flat@^5.0.2:
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
|
||||
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
|
||||
|
||||
follow-redirects@^1.15.6:
|
||||
version "1.15.6"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
|
||||
@@ -383,11 +595,21 @@ form-data@^4.0.0:
|
||||
combined-stream "^1.0.8"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
||||
|
||||
fs@^0.0.1-security:
|
||||
version "0.0.1-security"
|
||||
resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4"
|
||||
integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==
|
||||
|
||||
fsevents@~2.3.2:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
|
||||
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
|
||||
|
||||
function-bind@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
|
||||
@@ -408,6 +630,16 @@ functions-have-names@^1.2.3:
|
||||
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
|
||||
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
|
||||
|
||||
get-caller-file@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||
|
||||
get-func-name@^2.0.1, get-func-name@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41"
|
||||
integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==
|
||||
|
||||
get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd"
|
||||
@@ -428,6 +660,24 @@ get-symbol-description@^1.0.2:
|
||||
es-errors "^1.3.0"
|
||||
get-intrinsic "^1.2.4"
|
||||
|
||||
glob-parent@~5.1.2:
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
glob@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
|
||||
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^5.0.1"
|
||||
once "^1.3.0"
|
||||
|
||||
globalthis@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236"
|
||||
@@ -448,6 +698,11 @@ has-bigints@^1.0.1, has-bigints@^1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa"
|
||||
integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==
|
||||
|
||||
has-flag@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
|
||||
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
|
||||
|
||||
has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854"
|
||||
@@ -487,6 +742,11 @@ hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2:
|
||||
dependencies:
|
||||
function-bind "^1.1.2"
|
||||
|
||||
he@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
|
||||
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
|
||||
|
||||
hmac-drbg@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
|
||||
@@ -501,16 +761,24 @@ ieee754@^1.2.1:
|
||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
|
||||
dependencies:
|
||||
once "^1.3.0"
|
||||
wrappy "1"
|
||||
|
||||
inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||
|
||||
inherits@2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==
|
||||
|
||||
inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||
|
||||
internal-slot@^1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802"
|
||||
@@ -535,6 +803,13 @@ is-bigint@^1.0.1:
|
||||
dependencies:
|
||||
has-bigints "^1.0.1"
|
||||
|
||||
is-binary-path@~2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
|
||||
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
|
||||
dependencies:
|
||||
binary-extensions "^2.0.0"
|
||||
|
||||
is-boolean-object@^1.1.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719"
|
||||
@@ -562,6 +837,23 @@ is-date-object@^1.0.1:
|
||||
dependencies:
|
||||
has-tostringtag "^1.0.0"
|
||||
|
||||
is-extglob@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
|
||||
|
||||
is-fullwidth-code-point@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||
|
||||
is-glob@^4.0.1, is-glob@~4.0.1:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
|
||||
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
|
||||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-negative-zero@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747"
|
||||
@@ -574,6 +866,16 @@ is-number-object@^1.0.4:
|
||||
dependencies:
|
||||
has-tostringtag "^1.0.0"
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
|
||||
|
||||
is-plain-obj@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
|
||||
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
|
||||
|
||||
is-regex@^1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958"
|
||||
@@ -610,6 +912,11 @@ is-typed-array@^1.1.13:
|
||||
dependencies:
|
||||
which-typed-array "^1.1.14"
|
||||
|
||||
is-unicode-supported@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
|
||||
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
|
||||
|
||||
is-weakref@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2"
|
||||
@@ -637,6 +944,13 @@ js-sha512@^0.9.0:
|
||||
resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.9.0.tgz#ed569aa1e4bdaf0b83363c29db1ab87b1192d9ae"
|
||||
integrity sha512-mirki9WS/SUahm+1TbAPkqvbCiCfOAAsyXeHxK1UkullnJVVqoJG2pL9ObvT05CN+tM7fxhfYm0NbXn+1hWoZg==
|
||||
|
||||
js-yaml@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
|
||||
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
|
||||
dependencies:
|
||||
argparse "^2.0.1"
|
||||
|
||||
json-to-ts@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/json-to-ts/-/json-to-ts-2.1.0.tgz#c68c0b210a811e8dccbe2752e68efbc0ca62bfc5"
|
||||
@@ -646,11 +960,25 @@ json-to-ts@^2.1.0:
|
||||
hash.js "^1.0.3"
|
||||
pluralize "^3.1.0"
|
||||
|
||||
json5@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
|
||||
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
|
||||
dependencies:
|
||||
minimist "^1.2.0"
|
||||
|
||||
jsrsasign@^11.1.0:
|
||||
version "11.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jsrsasign/-/jsrsasign-11.1.0.tgz#195e788102731102fbf3e36b33fde28936f4bf57"
|
||||
integrity sha512-Ov74K9GihaK9/9WncTe1mPmvrO7Py665TUfUKvraXBpu+xcTWitrtuOwcjf4KMU9maPaYn0OuaWy0HOzy/GBXg==
|
||||
|
||||
locate-path@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
|
||||
integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
|
||||
dependencies:
|
||||
p-locate "^5.0.0"
|
||||
|
||||
lodash-es@^4.17.10:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
|
||||
@@ -661,6 +989,26 @@ lodash@^4.17.10:
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
log-symbols@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
|
||||
integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
|
||||
dependencies:
|
||||
chalk "^4.1.0"
|
||||
is-unicode-supported "^0.1.0"
|
||||
|
||||
loupe@^2.3.6:
|
||||
version "2.3.7"
|
||||
resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697"
|
||||
integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==
|
||||
dependencies:
|
||||
get-func-name "^2.0.1"
|
||||
|
||||
make-error@^1.1.1:
|
||||
version "1.3.6"
|
||||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
|
||||
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
|
||||
|
||||
mime-db@1.52.0:
|
||||
version "1.52.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||
@@ -683,10 +1031,65 @@ minimalistic-crypto-utils@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
|
||||
integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==
|
||||
|
||||
minimatch@^5.0.1, minimatch@^5.1.6:
|
||||
version "5.1.6"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
|
||||
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
|
||||
dependencies:
|
||||
brace-expansion "^2.0.1"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.6:
|
||||
version "1.2.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||
|
||||
mkdirp@^0.5.1:
|
||||
version "0.5.6"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
|
||||
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
|
||||
dependencies:
|
||||
minimist "^1.2.6"
|
||||
|
||||
mocha@^10.7.3:
|
||||
version "10.7.3"
|
||||
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752"
|
||||
integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==
|
||||
dependencies:
|
||||
ansi-colors "^4.1.3"
|
||||
browser-stdout "^1.3.1"
|
||||
chokidar "^3.5.3"
|
||||
debug "^4.3.5"
|
||||
diff "^5.2.0"
|
||||
escape-string-regexp "^4.0.0"
|
||||
find-up "^5.0.0"
|
||||
glob "^8.1.0"
|
||||
he "^1.2.0"
|
||||
js-yaml "^4.1.0"
|
||||
log-symbols "^4.1.0"
|
||||
minimatch "^5.1.6"
|
||||
ms "^2.1.3"
|
||||
serialize-javascript "^6.0.2"
|
||||
strip-json-comments "^3.1.1"
|
||||
supports-color "^8.1.1"
|
||||
workerpool "^6.5.1"
|
||||
yargs "^16.2.0"
|
||||
yargs-parser "^20.2.9"
|
||||
yargs-unparser "^2.0.0"
|
||||
|
||||
ms@^2.1.3:
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
|
||||
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
|
||||
|
||||
"node-forge@https://github.com/remicolin/forge":
|
||||
version "1.3.2-0"
|
||||
resolved "https://github.com/remicolin/forge#17a11a632dd0e50343b3b8393245a2696f78afbb"
|
||||
|
||||
normalize-path@^3.0.0, normalize-path@~3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
|
||||
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
|
||||
|
||||
object-inspect@^1.13.1:
|
||||
version "1.13.2"
|
||||
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff"
|
||||
@@ -738,6 +1141,32 @@ object.values@^1.0.3:
|
||||
define-properties "^1.2.1"
|
||||
es-object-atoms "^1.0.0"
|
||||
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
p-limit@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
|
||||
integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
|
||||
dependencies:
|
||||
yocto-queue "^0.1.0"
|
||||
|
||||
p-locate@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
|
||||
integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
|
||||
dependencies:
|
||||
p-limit "^3.0.2"
|
||||
|
||||
path-exists@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||
|
||||
path@^0.12.7:
|
||||
version "0.12.7"
|
||||
resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f"
|
||||
@@ -746,6 +1175,16 @@ path@^0.12.7:
|
||||
process "^0.11.1"
|
||||
util "^0.10.3"
|
||||
|
||||
pathval@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
|
||||
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
|
||||
|
||||
picomatch@^2.0.4, picomatch@^2.2.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
pkijs@^3.2.4:
|
||||
version "3.2.4"
|
||||
resolved "https://registry.yarnpkg.com/pkijs/-/pkijs-3.2.4.tgz#55ed72b363a20fbd42b139ee3b72e54483635171"
|
||||
@@ -773,6 +1212,11 @@ possible-typed-array-names@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f"
|
||||
integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==
|
||||
|
||||
prettier@^3.3.3:
|
||||
version "3.3.3"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
|
||||
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==
|
||||
|
||||
process@^0.11.1:
|
||||
version "0.11.10"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
|
||||
@@ -795,6 +1239,20 @@ pvutils@^1.1.3:
|
||||
resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3"
|
||||
integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==
|
||||
|
||||
randombytes@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
|
||||
integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
|
||||
dependencies:
|
||||
safe-buffer "^5.1.0"
|
||||
|
||||
readdirp@~3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
|
||||
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
|
||||
dependencies:
|
||||
picomatch "^2.2.1"
|
||||
|
||||
regenerator-runtime@^0.14.0:
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
|
||||
@@ -810,6 +1268,11 @@ regexp.prototype.flags@^1.5.2:
|
||||
es-errors "^1.3.0"
|
||||
set-function-name "^2.0.1"
|
||||
|
||||
require-directory@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
|
||||
|
||||
safe-array-concat@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.2.tgz#81d77ee0c4e8b863635227c721278dd524c20edb"
|
||||
@@ -820,6 +1283,11 @@ safe-array-concat@^1.1.2:
|
||||
has-symbols "^1.0.3"
|
||||
isarray "^2.0.5"
|
||||
|
||||
safe-buffer@^5.1.0:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||
|
||||
safe-regex-test@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377"
|
||||
@@ -834,6 +1302,13 @@ safer-buffer@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
|
||||
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
|
||||
|
||||
serialize-javascript@^6.0.2:
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2"
|
||||
integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==
|
||||
dependencies:
|
||||
randombytes "^2.1.0"
|
||||
|
||||
set-function-length@^1.2.1:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449"
|
||||
@@ -866,6 +1341,19 @@ side-channel@^1.0.4:
|
||||
get-intrinsic "^1.2.4"
|
||||
object-inspect "^1.13.1"
|
||||
|
||||
source-map-support@^0.5.6:
|
||||
version "0.5.21"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
|
||||
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
|
||||
dependencies:
|
||||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map@^0.6.0:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
string-at@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/string-at/-/string-at-1.1.0.tgz#332e090c5724418266a27a09394924b9fad41275"
|
||||
@@ -874,6 +1362,15 @@ string-at@^1.0.1:
|
||||
define-properties "^1.1.3"
|
||||
es-abstract "^1.17.0-next.1"
|
||||
|
||||
string-width@^4.1.0, string-width@^4.2.0:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||
dependencies:
|
||||
emoji-regex "^8.0.0"
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.1"
|
||||
|
||||
string.prototype.padend@^3.0.0:
|
||||
version "3.1.6"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz#ba79cf8992609a91c872daa47c6bb144ee7f62a5"
|
||||
@@ -940,6 +1437,77 @@ string.prototype.trimstart@^1.0.3, string.prototype.trimstart@^1.0.8:
|
||||
define-properties "^1.2.1"
|
||||
es-object-atoms "^1.0.0"
|
||||
|
||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||
dependencies:
|
||||
ansi-regex "^5.0.1"
|
||||
|
||||
strip-bom@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
|
||||
integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==
|
||||
|
||||
strip-json-comments@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
||||
|
||||
supports-color@^7.1.0:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
|
||||
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
|
||||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
supports-color@^8.1.1:
|
||||
version "8.1.1"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
|
||||
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
|
||||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
to-regex-range@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
|
||||
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
ts-mocha@^10.0.0:
|
||||
version "10.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-10.0.0.tgz#41a8d099ac90dbbc64b06976c5025ffaebc53cb9"
|
||||
integrity sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==
|
||||
dependencies:
|
||||
ts-node "7.0.1"
|
||||
optionalDependencies:
|
||||
tsconfig-paths "^3.5.0"
|
||||
|
||||
ts-node@7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.1.tgz#9562dc2d1e6d248d24bc55f773e3f614337d9baf"
|
||||
integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==
|
||||
dependencies:
|
||||
arrify "^1.0.0"
|
||||
buffer-from "^1.1.0"
|
||||
diff "^3.1.0"
|
||||
make-error "^1.1.1"
|
||||
minimist "^1.2.0"
|
||||
mkdirp "^0.5.1"
|
||||
source-map-support "^0.5.6"
|
||||
yn "^2.0.0"
|
||||
|
||||
tsconfig-paths@^3.5.0:
|
||||
version "3.15.0"
|
||||
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
|
||||
integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==
|
||||
dependencies:
|
||||
"@types/json5" "^0.0.29"
|
||||
json5 "^1.0.2"
|
||||
minimist "^1.2.6"
|
||||
strip-bom "^3.0.0"
|
||||
|
||||
tslib@^1.9.3:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||
@@ -950,6 +1518,11 @@ tslib@^2.4.0, tslib@^2.6.1, tslib@^2.6.3:
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
|
||||
integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==
|
||||
|
||||
type-detect@^4.0.0, type-detect@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c"
|
||||
integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==
|
||||
|
||||
typed-array-buffer@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3"
|
||||
@@ -1052,3 +1625,65 @@ which-typed-array@^1.1.14, which-typed-array@^1.1.15:
|
||||
for-each "^0.3.3"
|
||||
gopd "^1.0.1"
|
||||
has-tostringtag "^1.0.2"
|
||||
|
||||
workerpool@^6.5.1:
|
||||
version "6.5.1"
|
||||
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
|
||||
integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==
|
||||
|
||||
wrap-ansi@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
||||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
||||
dependencies:
|
||||
ansi-styles "^4.0.0"
|
||||
string-width "^4.1.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
||||
|
||||
y18n@^5.0.5:
|
||||
version "5.0.8"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
|
||||
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
|
||||
|
||||
yargs-parser@^20.2.2, yargs-parser@^20.2.9:
|
||||
version "20.2.9"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
|
||||
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
|
||||
|
||||
yargs-unparser@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"
|
||||
integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==
|
||||
dependencies:
|
||||
camelcase "^6.0.0"
|
||||
decamelize "^4.0.0"
|
||||
flat "^5.0.2"
|
||||
is-plain-obj "^2.1.0"
|
||||
|
||||
yargs@^16.2.0:
|
||||
version "16.2.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
|
||||
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
|
||||
dependencies:
|
||||
cliui "^7.0.2"
|
||||
escalade "^3.1.1"
|
||||
get-caller-file "^2.0.5"
|
||||
require-directory "^2.1.1"
|
||||
string-width "^4.2.0"
|
||||
y18n "^5.0.5"
|
||||
yargs-parser "^20.2.2"
|
||||
|
||||
yn@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"
|
||||
integrity sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==
|
||||
|
||||
yocto-queue@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
|
||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||
|
||||
@@ -2,7 +2,7 @@ import { expect, assert } from "chai";
|
||||
import { ethers } from "hardhat";
|
||||
// import { describe } from "mocha";
|
||||
import { mockPassportData_sha256_rsa_65537, mockPassportData_sha1_rsa_65537, } from "../../common/src/constants/mockPassportData";
|
||||
import { countryCodes, PASSPORT_ATTESTATION_ID, SignatureAlgorithm } from "../../common/src/constants/constants";
|
||||
import { countryCodes, PASSPORT_ATTESTATION_ID, SignatureAlgorithmIndex } from "../../common/src/constants/constants";
|
||||
import { formatRoot } from "../../common/src/utils/utils";
|
||||
import { groth16 } from 'snarkjs'
|
||||
import { time } from "@nomicfoundation/hardhat-toolbox/network-helpers";
|
||||
@@ -211,10 +211,10 @@ describe("OpenPassport - Contracts - Register & Disclose flow", function () {
|
||||
await verifier_disclose.waitForDeployment();
|
||||
console.log('\x1b[34m%s\x1b[0m', `Verifier_disclose deployed to ${verifier_disclose.target}`);
|
||||
|
||||
await register.addSignatureAlgorithm(SignatureAlgorithm["sha256WithRSAEncryption_65537"], verifier_register_sha256WithRSAEncryption_65537.target);
|
||||
await register.addCSCAVerifier(SignatureAlgorithm["sha256WithRSAEncryption_65537"], verifier_dsc_sha256_rsa_4096.target);
|
||||
await register.addSignatureAlgorithm(SignatureAlgorithm["sha1WithRSAEncryption_65537"], verifier_register_sha1WithRSAEncryption_65537.target);
|
||||
await register.addCSCAVerifier(SignatureAlgorithm["sha1WithRSAEncryption_65537"], verifier_dsc_sha1_rsa_4096.target);
|
||||
await register.addSignatureAlgorithm(SignatureAlgorithmIndex.rsa_sha256, verifier_register_sha256WithRSAEncryption_65537.target);
|
||||
await register.addCSCAVerifier(SignatureAlgorithmIndex.rsa_sha256, verifier_dsc_sha256_rsa_4096.target);
|
||||
await register.addSignatureAlgorithm(SignatureAlgorithmIndex.rsa_sha1, verifier_register_sha1WithRSAEncryption_65537.target);
|
||||
await register.addCSCAVerifier(SignatureAlgorithmIndex.rsa_sha1, verifier_dsc_sha1_rsa_4096.target);
|
||||
|
||||
const SBT = await ethers.getContractFactory("SBT");
|
||||
sbt = await SBT.deploy(
|
||||
@@ -311,7 +311,7 @@ describe("OpenPassport - Contracts - Register & Disclose flow", function () {
|
||||
for (const sigAlgName of sigAlgNames) {
|
||||
const sigAlgArtifacts_register = register_circuits[sigAlgName];
|
||||
const sigAlgArtifacts_dsc = dsc_circuits[sigAlgName];
|
||||
const sigAlgIndex = SignatureAlgorithm[sigAlgName as keyof typeof SignatureAlgorithm]
|
||||
const sigAlgIndex = SignatureAlgorithmIndex[sigAlgName as keyof typeof SignatureAlgorithmIndex]
|
||||
|
||||
it(`Verifier contract verifies a correct proof - Register - ${sigAlgName}`, async function () {
|
||||
expect(
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import { buildPubkeyTree } from '../../../common/src/utils/pubkeyTree'
|
||||
import { computeLeafFromModulus, getCSCAModulusMerkleTree } from '../../../common/src/utils/csca'
|
||||
import { CSCA_AKI_MODULUS, CSCA_TREE_DEPTH, k_csca, n_csca } from '../../../common/src/constants/constants';
|
||||
import { IMT } from '@zk-kit/imt';
|
||||
import { poseidon1, poseidon2 } from 'poseidon-lite';
|
||||
import { splitToWords } from '../../../common/src/utils/utils';
|
||||
|
||||
async function serialize_old_dsc_modulus_tree() {
|
||||
const pubkeys = JSON.parse(fs.readFileSync("../common/pubkeys/public_keys_parsed.json") as unknown as string)
|
||||
const tree = buildPubkeyTree(pubkeys);
|
||||
const serializedTree = tree.nodes.map(layer => layer.map(node => node.toString()));
|
||||
fs.writeFileSync("outputs/serialized_tree.json", JSON.stringify(serializedTree));
|
||||
fs.copyFileSync("outputs/serialized_tree.json", "../common/pubkeys/serialized_tree.json");
|
||||
console.log("serialized_tree.json written and copied in common/pubkeys!")
|
||||
}
|
||||
|
||||
|
||||
serialize_old_dsc_modulus_tree()
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
splitToWords,
|
||||
UserIdType,
|
||||
} from '../../common/src/utils/utils';
|
||||
import { getSignatureAlgorithm } from '../../common/src/utils/handleCertificate';
|
||||
import { parseDSC } from '../../common/src/utils/handleCertificate';
|
||||
|
||||
export class OpenPassport1StepVerifier {
|
||||
scope: string;
|
||||
@@ -49,7 +49,7 @@ export class OpenPassport1StepVerifier {
|
||||
async verify(
|
||||
openPassport1StepInputs: OpenPassport1StepInputs
|
||||
): Promise<OpenPassportVerifierReport> {
|
||||
const { signatureAlgorithm, hashFunction } = getSignatureAlgorithm(openPassport1StepInputs.dsc);
|
||||
const { signatureAlgorithm, hashFunction } = parseDSC(openPassport1StepInputs.dsc);
|
||||
const vkey = getVkey(openPassport1StepInputs.circuit, signatureAlgorithm, hashFunction);
|
||||
const parsedPublicSignals = parsePublicSignals1Step(
|
||||
openPassport1StepInputs.dscProof.publicSignals
|
||||
@@ -130,7 +130,7 @@ export class OpenPassport1StepVerifier {
|
||||
|
||||
// @ts-ignore
|
||||
const dsc_modulus = BigInt(dscCertificate.publicKey.n);
|
||||
const dsc_modulus_words = splitToWords(dsc_modulus, BigInt(64), BigInt(32));
|
||||
const dsc_modulus_words = splitToWords(dsc_modulus, 64, 32);
|
||||
const modulus_from_proof = parsedPublicSignals.pubKey;
|
||||
|
||||
const areArraysEqual = (arr1: string[], arr2: string[]) =>
|
||||
|
||||
Reference in New Issue
Block a user