(witnessData []byte, proof_and_claim []byte)
| 69 | } |
| 70 | |
| 71 | func (p *Prover) Verify(witnessData []byte, proof_and_claim []byte) (bool, error) { |
| 72 | if is_url(p.filename) { |
| 73 | witnessLen := make([]byte, 8) |
| 74 | binary.LittleEndian.PutUint64(witnessLen, uint64(len(witnessData))) |
| 75 | proofLen := make([]byte, 8) |
| 76 | binary.LittleEndian.PutUint64(proofLen, uint64(len(proof_and_claim))) |
| 77 | verifierInput := append(append(append(witnessLen, proofLen...), witnessData...), proof_and_claim...) |
| 78 | verifyReq, err := http.NewRequest("POST", p.filename+"/verify", bytes.NewBuffer(verifierInput)) |
| 79 | if err != nil { |
| 80 | return false, err |
| 81 | } |
| 82 | verifyReq.Header.Set("Content-Type", "application/octet-stream") |
| 83 | verifyReq.Header.Set("Content-Length", fmt.Sprintf("%d", len(verifierInput))) |
| 84 | client := &http.Client{} |
| 85 | verifyResp, err := client.Do(verifyReq) |
| 86 | if err != nil { |
| 87 | return false, err |
| 88 | } |
| 89 | defer verifyResp.Body.Close() |
| 90 | |
| 91 | verificationResult, err := io.ReadAll(verifyResp.Body) |
| 92 | if err != nil { |
| 93 | return false, err |
| 94 | } |
| 95 | return string(verificationResult) == "success", nil |
| 96 | } |
| 97 | return rust.VerifyFile(p.circuitDir, witnessData, proof_and_claim), nil |
| 98 | } |
no test coverage detected