Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused codepaths for bundle versions #60

Merged
merged 1 commit into from
Jan 21, 2025
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
28 changes: 0 additions & 28 deletions export/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -1067,34 +1067,6 @@ <h2>Message log</h2>
// Parse the import bundle
const bundleObj = JSON.parse(bundle);
switch (bundleObj.version) {
case undefined:
// Validate fields exist
if (!bundleObj.encappedPublic) {
throw new Error('missing "encappedPublic" in bundle');
}

if (!bundleObj.encappedPublicSignature) {
throw new Error('missing "encappedPublicSignature" in bundle');
}

// Verify enclave signature
if (!TKHQ.verifyEnclaveSignature) {
throw new Error("method not loaded");
}
verified = await TKHQ.verifyEnclaveSignature(
bundleObj.enclaveQuorumPublic,
bundleObj.encappedPublicSignature,
bundleObj.encappedPublic
);
if (!verified) {
throw new Error(`failed to verify enclave signature: ${bundle}`);
}

encappedKeyBuf = TKHQ.uint8arrayFromHexString(
bundleObj.encappedPublic
);
ciphertextBuf = TKHQ.uint8arrayFromHexString(bundleObj.ciphertext);
break;
case "v1.0.0":
// Validate fields exist
if (!bundleObj.data) {
Expand Down
25 changes: 0 additions & 25 deletions import/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -681,31 +681,6 @@
const bundleObj = JSON.parse(bundle);

switch (bundleObj.version) {
case undefined:
// Validate fields exist
if (!bundleObj.targetPublic) {
throw new Error('missing "targetPublic" in bundle');
}

if (!bundleObj.targetPublicSignature) {
throw new Error('missing "targetPublicSignature" in bundle');
}

// Verify enclave signature
verified = await TKHQ.verifyEnclaveSignature(
bundleObj.enclaveQuorumPublic,
bundleObj.targetPublicSignature,
bundleObj.targetPublic
);
if (!verified) {
throw new Error("failed to verify enclave signature");
}

// Load target public key generated from enclave and set in local storage
targetPublicBuf = TKHQ.uint8arrayFromHexString(
bundleObj.targetPublic
);
break;
case "v1.0.0":
// Validate fields exist
if (!bundleObj.data) {
Expand Down
25 changes: 0 additions & 25 deletions import/standalone.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -620,31 +620,6 @@ <h2>Message log</h2>
const bundleObj = JSON.parse(bundle);

switch (bundleObj.version) {
case undefined:
// Validate fields exist
if (!bundleObj.targetPublic) {
throw new Error('missing "targetPublic" in bundle');
}

if (!bundleObj.targetPublicSignature) {
throw new Error('missing "targetPublicSignature" in bundle');
}

// Verify enclave signature
verified = await TKHQ.verifyEnclaveSignature(
bundleObj.enclaveQuorumPublic,
bundleObj.targetPublicSignature,
bundleObj.targetPublic
);
if (!verified) {
throw new Error("failed to verify enclave signature");
}

// Load target public key generated from enclave and set in local storage
targetPublicBuf = TKHQ.uint8arrayFromHexString(
bundleObj.targetPublic
);
break;
case "v1.0.0":
// Validate fields exist
if (!bundleObj.data) {
Expand Down
Loading