mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
use randomness to generate throw away dsc secret
This commit is contained in:
@@ -37,7 +37,7 @@ export function findStartIndex(modulus: string, messagePadded: Uint8Array): numb
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
export function getCSCAInputs(dscCertificate: any, cscaCertificate: any = null, n_dsc: number, k_dsc: number, n_csca: number, k_csca: number, max_cert_bytes: number, devmod: boolean = false) {
|
||||
export function getCSCAInputs(dscSecret: string, dscCertificate: any, cscaCertificate: any = null, n_dsc: number, k_dsc: number, n_csca: number, k_csca: number, max_cert_bytes: number, devmod: boolean = false) {
|
||||
let csca_modulus_formatted;
|
||||
let csca_modulus_bigint;
|
||||
// the purpose of devmode is to get the csca modulus from the mock_csca certificate instead of using the registry which parses aki to csca modulus
|
||||
@@ -117,6 +117,8 @@ export function getCSCAInputs(dscCertificate: any, cscaCertificate: any = null,
|
||||
const [root, proof] = getCSCAModulusProof(leaf, n_csca, k_csca);
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
"raw_dsc_cert": dsc_message_padded_formatted,
|
||||
"raw_dsc_cert_padded_bytes": [dsc_messagePaddedLen_formatted],
|
||||
@@ -124,7 +126,7 @@ export function getCSCAInputs(dscCertificate: any, cscaCertificate: any = null,
|
||||
"dsc_signature": dsc_signature_formatted,
|
||||
"dsc_modulus": dsc_modulus_formatted,
|
||||
"start_index": [startIndex_formatted],
|
||||
"secret": [BigInt(0).toString()],
|
||||
"secret": [dscSecret],
|
||||
"merkle_root": [BigInt(root).toString()],
|
||||
"path": proof.pathIndices.map(index => index.toString()),
|
||||
"siblings": proof.siblings.flat().map(sibling => sibling.toString())
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
|
||||
export function generateCircuitInputsRegister(
|
||||
secret: string,
|
||||
dscSecret: string,
|
||||
attestation_id: string,
|
||||
passportData: PassportData,
|
||||
n_dsc: number,
|
||||
@@ -105,7 +106,7 @@ export function generateCircuitInputsRegister(
|
||||
BigInt(k_dsc)
|
||||
),
|
||||
attestation_id: [attestation_id],
|
||||
dsc_secret: [BigInt(0).toString()]
|
||||
dsc_secret: [dscSecret]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user