-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-wasm.sh
More file actions
80 lines (70 loc) · 1.79 KB
/
build-wasm.sh
File metadata and controls
80 lines (70 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# Quantum ARK WASM Build Script
# Compiles Rust code to WebAssembly and generates npm package
set -e
echo "🔨 Building Quantum ARK for WebAssembly..."
# Create output directory
mkdir -p pkg
# Compile to WASM
echo "📦 Compiling to wasm32-unknown-unknown..."
cargo build --target wasm32-unknown-unknown --release
# Copy WASM binary
echo "📋 Copying WASM binary..."
cp target/wasm32-unknown-unknown/release/quantum_ark.wasm pkg/
# Generate JavaScript bindings using wasm-bindgen
echo "🔗 Generating JavaScript bindings..."
wasm-bindgen pkg/quantum_ark.wasm --out-dir pkg --target web
# Create package.json for npm
echo "📝 Creating package.json..."
cat > pkg/package.json << 'EOF'
{
"name": "quantum_ark",
"version": "0.3.0",
"description": "Post-quantum cryptographic hashing library with neural network chaos and lattice-based security",
"main": "quantum_ark.js",
"types": "quantum_ark.d.ts",
"files": [
"quantum_ark.js",
"quantum_ark_bg.wasm",
"quantum_ark_bg.wasm.d.ts",
"quantum_ark.d.ts",
"README.md"
],
"keywords": [
"quantum",
"cryptography",
"hashing",
"post-quantum",
"wasm",
"security",
"encryption",
"crypto"
],
"author": "Quantum ARK Contributors",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/yourusername/quantum_ark"
},
"bugs": {
"url": "https://github.com/yourusername/quantum_ark/issues"
},
"homepage": "https://github.com/yourusername/quantum_ark",
"engines": {
"node": ">=14.0.0"
}
}
EOF
# Copy README
echo "📄 Copying README..."
cp README.md pkg/
echo "✅ Build complete!"
echo ""
echo "📦 Package ready in ./pkg/"
echo ""
echo "To publish to npm:"
echo " cd pkg"
echo " npm publish"
echo ""
echo "To use locally:"
echo " npm install ./pkg"