Skip to content

Commit

Permalink
chore(wip): correct sandbox and add coep and coop (not working yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmoro committed Sep 25, 2024
1 parent fe679b2 commit 89590a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
10 changes: 8 additions & 2 deletions browser-extension/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
"service_worker": "background.js"
},
"sandbox": {
"pages": ["sandbox.html"]
"pages": ["proof/sandbox.html"]
},
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'",
"sandbox": "sandbox allow-scripts allow-forms allow-popups allow-modals; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; child-src 'self'"
"sandbox": "sandbox allow-scripts allow-forms allow-popups allow-modals; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; worker-src blob: 'self'; child-src blob: 'self'"
},
"cross_origin_embedder_policy": {
"value": "require-corp"
},
"cross_origin_opener_policy": {
"value": "same-origin"
}
}
6 changes: 2 additions & 4 deletions browser-extension/src/proof/sandbox.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'wasm-eval';"
/>
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp" />
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin" />
<script type="module" src="sandbox.js"></script>
</head>
<body></body>
Expand Down
8 changes: 0 additions & 8 deletions browser-extension/src/proof/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ const zkProgram = ZkProgram({
verifyAge: {
privateInputs: [Field, PublicKey, Signature],
async method(minAge, age, issuerPubKey, signature) {
console.log('verifyAge method called with:', {
minAge,
age,
issuerPubKey,
signature,
});
const validSignature = signature.verify(issuerPubKey, [age]);
console.log('Signature verification result:', validSignature);
validSignature.assertTrue();
console.log('Asserting age >= minAge');
age.assertGreaterThanOrEqual(minAge);
return issuerPubKey;
},
Expand Down

0 comments on commit 89590a5

Please sign in to comment.