Skip to content

Commit

Permalink
Include tuple entries in proof config
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Sep 30, 2024
1 parent 19567a8 commit 0cc537e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-starfishes-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@parcnet-js/podspec": patch
---

Add entries to config if included in tuples
10 changes: 8 additions & 2 deletions packages/podspec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"types": "src/index.ts",
"exports": {
".": {
"import": { "types": "./src/index.ts", "import": "./dist/index.js" },
"import": {
"types": "./src/index.ts",
"import": "./dist/index.js"
},
"require": {
"types": "./src/index.ts",
"require": "./dist/index.cjs"
Expand Down Expand Up @@ -53,7 +56,10 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"import": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
"import": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"require": "./dist/index.cjs"
Expand Down
16 changes: 15 additions & 1 deletion packages/podspec/src/gpc/proof_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ function makeProofRequest<P extends NamedPODs>(
entrySchema.isNotMemberOf;
}
}
pods[podName] = podConfig;

for (const entriesTupleSchema of podSchema.tuples ?? []) {
const tupleName = `tuple_${podName}_entries_${entriesTupleSchema.entries.join(
Expand All @@ -206,7 +205,22 @@ function makeProofRequest<P extends NamedPODs>(
membershipLists[`blocklist_${tupleName}`] =
entriesTupleSchema.isNotMemberOf;
}
// Tuples may contain entries which are not revealed or subject to any
// membership rules or constraints, in which case we need to add them to
// the proof config so that they are included.
for (const entry of entriesTupleSchema.entries) {
if (entry === "$signerPublicKey") {
continue;
}
if (!(entry in podConfig.entries)) {
podConfig.entries[entry] = {
isRevealed: false
};
}
}
}

pods[podName] = podConfig;
}

return {
Expand Down

0 comments on commit 0cc537e

Please sign in to comment.