| 45 | } |
| 46 | |
| 47 | func (p *Prover) Prove(witnessData []byte) ([]byte, error) { |
| 48 | if is_url(p.filename) { |
| 49 | proveReq, err := http.NewRequest("POST", p.filename+"/prove", bytes.NewBuffer(witnessData)) |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | proveReq.Header.Set("Content-Type", "application/octet-stream") |
| 54 | proveReq.Header.Set("Content-Length", fmt.Sprintf("%d", len(witnessData))) |
| 55 | client := &http.Client{} |
| 56 | proveResp, err := client.Do(proveReq) |
| 57 | if err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | defer proveResp.Body.Close() |
| 61 | |
| 62 | proof_and_claim, err := io.ReadAll(proveResp.Body) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | return proof_and_claim, nil |
| 67 | } |
| 68 | return rust.ProveFile(p.circuitDir, witnessData), nil |
| 69 | } |
| 70 | |
| 71 | func (p *Prover) Verify(witnessData []byte, proof_and_claim []byte) (bool, error) { |
| 72 | if is_url(p.filename) { |