From 479fff49df3e3865cb4a8da1be33c011b9ad082e Mon Sep 17 00:00:00 2001 From: maniapulai <159218046+maniapulai@users.noreply.github.com> Date: Sat, 24 Jan 2026 11:54:47 +0000 Subject: [PATCH] fix: remove broken @aptos-labs/ace-sdk dependency The @aptos-labs/ace-sdk@0.1.0 package is not available in the npm registry, causing installation failures. This commit: - Removes the unavailable dependency from package.json - Replaces ace-sdk implementations with placeholder functions that throw descriptive errors indicating the package is unavailable - Updates both the main app and examples duplicate These placeholder functions can be replaced with an alternative threshold encryption library or restored when the package becomes available in npm. --- apps/solana/token-gated/app/lib/encryption.ts | 76 ++++--------------- apps/solana/token-gated/package.json | 1 - examples | 1 + pnpm-lock.yaml | 17 ----- 4 files changed, 14 insertions(+), 81 deletions(-) create mode 160000 examples diff --git a/apps/solana/token-gated/app/lib/encryption.ts b/apps/solana/token-gated/app/lib/encryption.ts index 922873d..9ca064b 100644 --- a/apps/solana/token-gated/app/lib/encryption.ts +++ b/apps/solana/token-gated/app/lib/encryption.ts @@ -1,4 +1,3 @@ -import { ace } from "@aptos-labs/ace-sdk"; import { config } from "./config"; // ============================================================================ @@ -85,96 +84,47 @@ export async function decryptFile( // ============================================================================ // ACE Threshold IBE (for key encryption - the "greenBox") // ============================================================================ +// NOTE: These functions are placeholders. The @aptos-labs/ace-sdk package +// is not available in npm registry. Implement these with an alternative +// threshold encryption library or restore when the package is available. /** * Create an ACE committee instance. + * @deprecated - Package @aptos-labs/ace-sdk not available in npm registry */ -export function createAceCommittee(): ace.Committee { - return new ace.Committee({ - workerEndpoints: [...config.ace.workerEndpoints] as string[], - threshold: config.ace.threshold, - }); +export function createAceCommittee() { + throw new Error("ACE committee functionality is not available. @aptos-labs/ace-sdk package is not in npm registry."); } /** * Create an ACE contract ID for Solana. + * @deprecated - Package @aptos-labs/ace-sdk not available in npm registry */ -export function createAceContractId(): ace.ContractID { - return ace.ContractID.newSolana({ - knownChainName: config.ace.solanaChainName, - programId: config.programs.aceHook, - }); +export function createAceContractId() { + throw new Error("ACE contract ID functionality is not available. @aptos-labs/ace-sdk package is not in npm registry."); } /** * Encrypt the redKey into a greenBox using threshold IBE. * This greenBox can only be decrypted by users who have purchased access. + * @deprecated - Package @aptos-labs/ace-sdk not available in npm registry */ export async function encryptRedKey( redKey: Uint8Array, fullBlobNameBytes: Uint8Array ): Promise { - const committee = createAceCommittee(); - const contractId = createAceContractId(); - - // Fetch encryption key from committee - const encryptionKeyResult = await ace.EncryptionKey.fetch({ - committee, - }); - const encryptionKey = encryptionKeyResult.unwrapOrThrow( - "Failed to fetch encryption key" - ); - - // Encrypt the redKey - const encryptResult = ace.encrypt({ - encryptionKey, - contractId, - domain: fullBlobNameBytes, - plaintext: redKey, - }).unwrapOrThrow("Failed to encrypt redKey"); - - return encryptResult.ciphertext.toBytes(); + throw new Error("ACE encryption functionality is not available. @aptos-labs/ace-sdk package is not in npm registry."); } /** * Decrypt the greenBox to recover the redKey using a proof-of-permission transaction. * @param signedTransactionBytes - Serialized signed transaction bytes (from any Solana SDK) + * @deprecated - Package @aptos-labs/ace-sdk not available in npm registry */ export async function decryptGreenBox( greenBoxBytes: Uint8Array, fullBlobNameBytes: Uint8Array, signedTransactionBytes: Uint8Array ): Promise { - const committee = createAceCommittee(); - const contractId = createAceContractId(); - - // Reconstruct the ciphertext from bytes - const greenBox = ace.Ciphertext.fromBytes(greenBoxBytes).unwrapOrThrow( - "Failed to parse greenBox ciphertext" - ); - - // Create proof of permission from the signed transaction bytes - const pop = ace.ProofOfPermission.createSolana({ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - txn: signedTransactionBytes as any, - }); - - // Fetch decryption key from committee - const decryptionKeyResult = await ace.DecryptionKey.fetch({ - committee, - contractId, - domain: fullBlobNameBytes, - proof: pop, - }); - const decryptionKey = decryptionKeyResult.unwrapOrThrow( - "Failed to fetch decryption key" - ); - - // Decrypt the greenBox - const plaintext = ace.decrypt({ - decryptionKey, - ciphertext: greenBox, - }).unwrapOrThrow("Failed to decrypt greenBox"); - - return plaintext; + throw new Error("ACE decryption functionality is not available. @aptos-labs/ace-sdk package is not in npm registry."); } diff --git a/apps/solana/token-gated/package.json b/apps/solana/token-gated/package.json index 1c76114..f13a379 100644 --- a/apps/solana/token-gated/package.json +++ b/apps/solana/token-gated/package.json @@ -35,7 +35,6 @@ "@solana/react-hooks": "^1.1.5", "@solana/web3.js": "^1.98.4", "@tanstack/react-query": "^5.90.16", - "@aptos-labs/ace-sdk": "^0.1.0", "next": "16.0.10", "react": "^19.1.0", "react-dom": "^19.1.0", diff --git a/examples b/examples new file mode 160000 index 0000000..5663b23 --- /dev/null +++ b/examples @@ -0,0 +1 @@ +Subproject commit 5663b2384a5bf1c76367bc85018e3a2f8004553f diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2153ecd..38ee20d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -162,9 +162,6 @@ importers: apps/solana/token-gated: dependencies: - '@aptos-labs/ace-sdk': - specifier: ^0.1.0 - version: 0.1.0(@aptos-labs/ts-sdk@5.2.1(got@11.8.6))(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@5.0.10)) '@coral-xyz/anchor': specifier: ^0.31.1 version: 0.31.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@5.0.10) @@ -385,12 +382,6 @@ packages: '@aptos-labs/wallet-standard': ^0.5.0 '@telegram-apps/bridge': ^1.0.0 - '@aptos-labs/ace-sdk@0.1.0': - resolution: {integrity: sha512-wp3gwgmELU20cF7IWiEx8vVKh8GKK42D0YI+nAf+jBk7b/tYyModMN+wc+/UZQljJdYR+eT4aZmHAN++L/zGuQ==} - peerDependencies: - '@aptos-labs/ts-sdk': ^5.2.0 - '@solana/web3.js': ^1.95.0 - '@aptos-labs/aptos-cli@1.1.1': resolution: {integrity: sha512-sB7CokCM6s76SLJmccysbnFR+MDik6udKfj2+9ZsmTLV0/t73veIeCDKbvWJmbW267ibx4HiGbPI7L+1+yjEbQ==} hasBin: true @@ -4753,14 +4744,6 @@ snapshots: transitivePeerDependencies: - '@wallet-standard/core' - '@aptos-labs/ace-sdk@0.1.0(@aptos-labs/ts-sdk@5.2.1(got@11.8.6))(@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@5.0.10))': - dependencies: - '@aptos-labs/ts-sdk': 5.2.1(got@11.8.6) - '@noble/ciphers': 1.3.0 - '@noble/curves': 1.9.7 - '@noble/hashes': 1.8.0 - '@solana/web3.js': 1.98.4(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@5.0.10) - '@aptos-labs/aptos-cli@1.1.1': dependencies: commander: 12.1.0