Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export function verifyCommandLayerReceipt(
errors.push("ERR_MISSING_SIGNATURE_KID");
}

const allowed = opts.allowedCanonicals ?? [CANONICAL_METHOD, "erc8211.merkle.v1"];
const allowed = opts.allowedCanonicals ?? [CANONICAL_METHOD, "erc8211.composable.v1"];
if (typeof proof.canonicalization === "string" && !allowed.includes(proof.canonicalization)) {
errors.push("ERR_UNSUPPORTED_CANONICALIZATION");
}
Expand Down Expand Up @@ -221,8 +221,10 @@ export function verifyCommandLayerReceipt(

let canonical = "";
if (checks.schema) {
if (proof.canonicalization === "erc8211.merkle.v1") {
errors.push("ERR_UNSUPPORTED_MERKLE_VERIFICATION");
if (proof.canonicalization === "erc8211.composable.v1") {
// ERC-8211 composable execution canonicalization recognized.
// Merkle authorization verification is deferred pending the companion Merkle authorization ERC.
errors.push("ERR_MERKLE_AUTHORIZATION_DEFERRED");
return { ok: false, status: "INVALID", checks, errors };
}
canonical = buildCanonicalProof(receipt);
Expand Down
6 changes: 3 additions & 3 deletions test/compat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ describe("canonical CLAS proof envelope", () => {
assert.ok(result.errors.includes("ERR_MALFORMED_SIGNATURE_ARRAY"));
});

test("erc8211 canonicalization is recognized but not falsely verified", () => {
test("erc8211 composable canonicalization is recognized, Merkle authorization verification deferred", () => {
const signed = signCommandLayerReceipt(baseReceipt, { privateKeyPem: kp.privateKeyPem, kid: "testKid" });
const recognized = verifyCommandLayerReceipt(
{ ...signed, metadata: { ...signed.metadata!, proof: { ...signed.metadata!.proof!, canonicalization: "erc8211.merkle.v1" } } },
{ ...signed, metadata: { ...signed.metadata!, proof: { ...signed.metadata!.proof!, canonicalization: "erc8211.composable.v1" } } },
{ publicKeyPemOrDer: kp.publicKeyPem }
);
assert.equal(recognized.status, "INVALID");
assert.ok(recognized.errors.includes("ERR_UNSUPPORTED_MERKLE_VERIFICATION"));
assert.ok(recognized.errors.includes("ERR_MERKLE_AUTHORIZATION_DEFERRED"));
assert.ok(!recognized.errors.includes("ERR_UNSUPPORTED_CANONICALIZATION"));

const unsupported = verifyCommandLayerReceipt(
Expand Down
Loading