update sdk

This commit is contained in:
turnoffthiscomputer
2024-09-27 17:01:57 +02:00
parent 0c0c6dc2a9
commit b68d510c48
9 changed files with 404 additions and 58 deletions

View File

@@ -1146,4 +1146,290 @@ export const vkey_prove_rsapss_65537_sha256 = {
"1"
]
]
}
}
export const vkey_dsc_rsa_65537_sha256 = {
"protocol": "groth16",
"curve": "bn128",
"nPublic": 1,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
[
"1",
"0"
]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
[
"1",
"0"
]
],
"vk_delta_2": [
[
"15265460912814019261598356149083010693553306200088788691872939143139965811757",
"14728119800824743232160353814184196493611710395357197806992649117307993215169"
],
[
"19542663794834248834895458372920431866814244072484070058650454392334655214304",
"9614552540833710452304889133460031712004891172221785081274270612177806078881"
],
[
"1",
"0"
]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"16231288969314859968324689058413762096922845561563844884666690734569347763082",
"5910239835236935696830364945179549816839705839711095023727334010208312533092",
"1"
],
[
"6260576084748320398294355533743833076081106851106584793995576172400792840042",
"21319331746978162427565186170902229291674424766799571029877219503610111212711",
"1"
]
]
}
export const vkey_dsc_rsa_65537_sha1 = {
"protocol": "groth16",
"curve": "bn128",
"nPublic": 1,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
[
"1",
"0"
]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
[
"1",
"0"
]
],
"vk_delta_2": [
[
"7157873844514231518123648442854857067192138049695650281682343264174761051395",
"4029485152563416121115364420018531469967267623611523920345284968134090692096"
],
[
"7438435437647529811982102624225358793882835492628538310043045475331942385086",
"20138418790395189475202532559767804536140663145783932008030369725764144665659"
],
[
"1",
"0"
]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"8080423910694661461576427977746141048179131345871564682235127365538915251175",
"15077260046277123685110202133518064301144478802752095822556731494534324607918",
"1"
],
[
"16011015387972163546219334947336021918538394305813640145299036166236111586389",
"19422172264639146231714658451804174650252945098828793769061895536286758622279",
"1"
]
]
}
export const vkey_dsc_rsapss_65537_sha256 = {
"protocol": "groth16",
"curve": "bn128",
"nPublic": 1,
"vk_alpha_1": [
"20491192805390485299153009773594534940189261866228447918068658471970481763042",
"9383485363053290200918347156157836566562967994039712273449902621266178545958",
"1"
],
"vk_beta_2": [
[
"6375614351688725206403948262868962793625744043794305715222011528459656738731",
"4252822878758300859123897981450591353533073413197771768651442665752259397132"
],
[
"10505242626370262277552901082094356697409835680220590971873171140371331206856",
"21847035105528745403288232691147584728191162732299865338377159692350059136679"
],
[
"1",
"0"
]
],
"vk_gamma_2": [
[
"10857046999023057135944570762232829481370756359578518086990519993285655852781",
"11559732032986387107991004021392285783925812861821192530917403151452391805634"
],
[
"8495653923123431417604973247489272438418190587263600148770280649306958101930",
"4082367875863433681332203403145435568316851327593401208105741076214120093531"
],
[
"1",
"0"
]
],
"vk_delta_2": [
[
"7869870708174811955096678304548839007154287258190413617003681688289998544363",
"13895167442092445119345474371877881914902771726759258389545317775164948560905"
],
[
"20200825746679840433042883936581680153594933665848454517284389398796563819348",
"4506300078076551050020769122684099845250830429303573895173907811984513760915"
],
[
"1",
"0"
]
],
"vk_alphabeta_12": [
[
[
"2029413683389138792403550203267699914886160938906632433982220835551125967885",
"21072700047562757817161031222997517981543347628379360635925549008442030252106"
],
[
"5940354580057074848093997050200682056184807770593307860589430076672439820312",
"12156638873931618554171829126792193045421052652279363021382169897324752428276"
],
[
"7898200236362823042373859371574133993780991612861777490112507062703164551277",
"7074218545237549455313236346927434013100842096812539264420499035217050630853"
]
],
[
[
"7077479683546002997211712695946002074877511277312570035766170199895071832130",
"10093483419865920389913245021038182291233451549023025229112148274109565435465"
],
[
"4595479056700221319381530156280926371456704509942304414423590385166031118820",
"19831328484489333784475432780421641293929726139240675179672856274388269393268"
],
[
"11934129596455521040620786944827826205713621633706285934057045369193958244500",
"8037395052364110730298837004334506829870972346962140206007064471173334027475"
]
]
],
"IC": [
[
"8938477176893632284539660223582989287068454472173218831171935317066824606917",
"9409256007408490215082527289125535503645664704563806461206465772769775389099",
"1"
],
[
"9406714425071299321475031445293798140218018985951799864352153321364734136304",
"16190677786472274760082919772279780726948507745938757138812410377304364738549",
"1"
]
]
}

View File

@@ -25,8 +25,8 @@ export interface ArgumentsProve {
}
export interface ArgumentsRegister {
attestation_id: string,
merkleTreeUrl: string,
modalServerUrl: string,
}
export interface ArgumentsDisclose {
@@ -48,7 +48,7 @@ export function reconstructAppType(json: any): AppType {
throw new Error('Invalid or missing name');
}
if (json.circuit !== 'register' && (!json.scope || typeof json.scope !== 'string')) {
if (!json.scope || typeof json.scope !== 'string') {
throw new Error('Invalid or missing scope');
}
@@ -75,7 +75,6 @@ export function reconstructAppType(json: any): AppType {
let circuitArgs: ArgumentsProve | ArgumentsRegister | ArgumentsDisclose;
switch (json.circuit) {
case 'prove':
case 'disclose':
if (!json.arguments.disclosureOptions || typeof json.arguments.disclosureOptions !== 'object') {
throw new Error('Invalid or missing disclosureOptions for prove/disclose');
@@ -97,17 +96,33 @@ export function reconstructAppType(json: any): AppType {
(circuitArgs as ArgumentsDisclose).merkletree_size = json.arguments.merkletree_size;
}
break;
case 'register':
if (!json.arguments.attestation_id || typeof json.arguments.attestation_id !== 'string') {
throw new Error('Invalid or missing attestation_id for register circuit');
case 'prove':
if (json.circuitMode === 'register') {
// if (!json.arguments.attestation_id || typeof json.arguments.attestation_id !== 'string') {
// throw new Error('Invalid or missing attestation_id for register circuit');
// }
// if (!json.arguments.merkleTreeUrl || typeof json.arguments.merkleTreeUrl !== 'string') {
// throw new Error('Invalid or missing merkleTreeUrl for register circuit');
// }
if (!json.arguments.modalServerUrl) {
throw new Error('Invalid or missing modalServerUrl');
}
circuitArgs = {
merkleTreeUrl: json.arguments.merkleTreeUrl,
modalServerUrl: json.arguments.modalServerUrl,
};
}
if (!json.arguments.merkleTreeUrl || typeof json.arguments.merkleTreeUrl !== 'string') {
throw new Error('Invalid or missing merkleTreeUrl for register circuit');
else {
if (!json.arguments.disclosureOptions || typeof json.arguments.disclosureOptions !== 'object') {
throw new Error('Invalid or missing disclosureOptions for prove/disclose');
}
circuitArgs = {
disclosureOptions: {
older_than: json.arguments.disclosureOptions.older_than,
nationality: json.arguments.disclosureOptions.nationality,
},
}
}
circuitArgs = {
attestation_id: json.arguments.attestation_id,
merkleTreeUrl: json.arguments.merkleTreeUrl,
};
break;
default:
throw new Error('Unexpected circuit type');