md文件完善
MoonBit supply chain security toolchain.
MoonGuard is a lightweight security toolchain for MoonBit packages, focusing on:
moon_guard/ ├── lib/ │ ├── manifest/ # Package manifest + SHA-256 hash calculation │ ├── crypto/ # Ed25519 sign/verify (field arithmetic, SHA-512) │ ├── trust/ # Trusted key store (in-memory, JSON serialization) │ ├── verify/ # Package verification + typosquat detection │ └── report/ # JSON security report generation ├── cmd/main/ # CLI entry point ├── moon.mod.json # Module manifest ├── README.md # This file ├── CLAUDE.md # AI agent guidance └── AGENTS.md # Project agent instructions
Package manifest and file hashing with full SHA-256 implementation.
FileHash
Manifest
sha256()
generate_manifest()
verify_manifest()
manifest_to_json()
Ed25519 cryptographic operations.
KeyPair
Signature
generate_keypair(seed)
sign(message, keypair)
verify(message, signature, public_key)
Trusted key store management.
TrustLevel
TrustedKey
TrustStore
add_key()
remove_key()
get_key()
is_trusted()
trust_store_to_json()
Package verification and typosquat detection.
VerifyResult
verify_package()
detect_typosquat()
batch_typosquat_check()
Security report generation.
RiskLevel
Finding
SecurityReport
summary()
report_to_json()
CLI tool with commands:
moon_guard keygen Generate Ed25519 keypair moon_guard sign <msg> <seed> Sign a message moon_guard verify <msg> <sig> <pubkey> Verify signature moon_guard trust <add|list|remove> ... Manage trust store moon_guard typosquat <name> <known...> Check typosquatting moon_guard manifest <gen|verify|hash> ... Package manifest ops moon_guard hash <content> Compute SHA-256 hash moon_guard audit <pkg> <ver> Full security audit with report
# Build moon build # Run CLI moon run -- keygen moon run -- sign "Hello" <seed> moon run -- verify "Hello" <signature> <pubkey> moon run -- audit my_package 1.0.0
moonbitlang/async
Apache-2.0
MoonBit 供应链安全工具链
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
MoonGuard
MoonBit supply chain security toolchain.
Overview
MoonGuard is a lightweight security toolchain for MoonBit packages, focusing on:
Project Structure
Modules
lib/manifest
Package manifest and file hashing with full SHA-256 implementation.
FileHash- File path, hash, size tupleManifest- Package manifest with metadata and file listsha256()- Pure MoonBit SHA-256 implementationgenerate_manifest()- Create manifest from file entriesverify_manifest()- Verify files against manifestmanifest_to_json()- Serialize manifest to JSONlib/crypto
Ed25519 cryptographic operations.
KeyPair- Public/secret key pairSignature- Ed25519 signature (r, s components)generate_keypair(seed)- Generate keypair from seedsign(message, keypair)- Sign a messageverify(message, signature, public_key)- Verify signaturelib/trust
Trusted key store management.
TrustLevel- Full, Partial, UntrustedTrustedKey- Key entry with metadataTrustStore- In-memory key storeadd_key(),remove_key(),get_key(),is_trusted()trust_store_to_json()- Export to JSONlib/verify
Package verification and typosquat detection.
VerifyResult- Verification result with errors/warningsverify_package()- Verify package signaturedetect_typosquat()- Levenshtein-based typosquat detectionbatch_typosquat_check()- Batch typosquat checkinglib/report
Security report generation.
RiskLevel- Critical, High, Medium, Low, InfoFinding- Individual security findingSecurityReport- Full security reportsummary()- Human-readable reportreport_to_json()- JSON exportcmd/main
CLI tool with commands:
Key Design Decisions
Quick Start
Dependencies
moonbitlang/asyncv0.10.0 (for async runtime support)License
Apache-2.0