New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

summon-ts

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

summon-ts

TypeScript build of the Summon compiler (via wasm).

latest
Source
npmnpm
Version
0.6.2
Version published
Maintainers
1
Created
Source

summon-ts

TypeScript build of the Summon compiler (via wasm).

Usage

npm install summon-ts
import * as summon from "summon-ts";

async function main() {
  await summon.init();

  const { circuit, diagnostics } = summon.compile({
    path: "/src/main.ts",
    // for boolean circuits:
    // boolifyWidth: 8, // (replace 8 with your desired uint precision)
    // if your circuit uses io.inputPublic(..) then provide the values like
    // this:
    // publicInputs: { N: 5 },
    files: {
      // In a real project you should be able to include these as regular files,
      // but how those files find their way into this format depends on your build
      // tool.
      // Example: https://github.com/privacy-scaling-explorations/mpc-hello/blob/c1c8092/src/getCircuitFiles.ts

      "/src/main.ts": `
        export default (io: Summon.IO) {
          const a = io.input('alice', 'a', summon.number());
          const b = io.input('bob', 'b', summon.number());

          io.outputPublic('res', a + b);
        }
      `,
    },
  });

  console.log(circuit);
  // {
  //   bristol: '...',
  //   info: { ... },
  //   mpcSettings: [...],
  // }

  // May include non-error diagnostics.
  // (If there are errors, summon.compile will throw instead.)
  console.log(diagnostics);
  // { './circuit/main.ts': [] }

  // See mpc-framework for doing MPC with your circuits.
  // https://github.com/privacy-scaling-explorations/mpc-framework
}

// When summon.compile throws, the error message will be the first error
// diagnostic. The remaining diagnostics are also available as error.diagnostics
// and the compiled circuit might also be available as .circuit.
main().catch(console.error);

When providing files to the API, you can also provide a readFile function instead:

summon.compile({
  path: "./path/to/main.ts",
  readFile: (filePath) => fs.readFileSync(filePath),
});

Development

Build with npm run build. This will compile the wasm subproject and also transpile typescript into javascript. Rust toolchain required.

Test with npm test.

Example Projects

Keywords

MPC

FAQs

Package last updated on 09 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts