Giter Site home page Giter Site logo

enclaive / enclaive-docker-nodejs-sgx Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 46 KB

SGX-ready Enclaive Docker Image for Node

Dockerfile 50.38% JavaScript 49.62%
cloudsec confidential-computing container container-escape cybersecurity devops docker gdpr javascript kubernetes

enclaive-docker-nodejs-sgx's Issues

WebAssembly can not allocate memory properly

Problem:

I'm trying to run a simple snarkjs sample in sgx enclave, but process can not start up normally.
It seems that process fail to request WebAssembly memory allocation.
Expanding enclave size to 16G still does't work.
image

CPU:

Intel(R) Xeon(R) Gold 5318Y CPU

Snarkjs Sample:

const snarkjs = require("snarkjs")
const express = require('express')
const morgan = require('morgan')
const fs = require('fs')

const app = express()
const port = 3000

// create a write stream (in append mode)
const accessLogStream = fs.createWriteStream('/data/access.log', { flags: 'a' })

app.use(morgan('combined', { stream: accessLogStream }))

app.get('/hello', (req, res) => {
    res.send(run())
})

app.get('/shutdown', (req, res) => {
    process.exit()
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

async function run() {
    const { proof, publicSignals } = await snarkjs.plonk.fullProve({a: 3, b: 11}, "/app/demo/circuit_js/circuit.wasm", "/app/demo/circuit_final.zkey");

    console.log("Proof: ");
    console.log(JSON.stringify(proof, null, 1));

    const vKey = JSON.parse(fs.readFileSync("/app/demo/verification_key.json"));

    const res = await snarkjs.plonk.verify(vKey, publicSignals, proof);

    if (res === true) {
        console.log("Verification OK");
    } else {
        console.log("Invalid proof");
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.