Features
BorgSMSG
Decrypt SMSG content: all versions, chunked, ABR streaming
BorgSTMF
Encrypt/decrypt form submissions with X25519
Metadata Extraction
Read SMSG headers without decryption
~6MB Module
Full Go crypto stack compiled to WASM
Installation
<script src="wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch('stmf.wasm'), go.importObject)
.then(result => {
go.run(result.instance);
// BorgSMSG and BorgSTMF now available
});
</script>
Usage
BorgSMSG API
// Decrypt content
const decrypted = await BorgSMSG.decrypt(encrypted, password);
// Get metadata without decrypting
const meta = BorgSMSG.getMetadata(encrypted);
console.log(meta.title, meta.contentType, meta.size);
BorgSTMF API
// Encrypt form data
const encrypted = await BorgSTMF.encrypt(formData, serverPublicKey);
// Server-side decryption
const decrypted = await BorgSTMF.decrypt(encrypted, serverPrivateKey);
Ready Event
document.addEventListener('borgstmf:ready', (event) => {
console.log('WASM ready, version:', event.detail.version);
});
Quick Links
More from Lethean R&D Labs
Fancy helping out?
Spotted a bug? Got an idea? We'd love to hear from you.
Read the contributing guide →