...
This commit is contained in:
114
www/index.html
Normal file
114
www/index.html
Normal file
@@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Rust WebAssembly Crypto Example</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.container {
|
||||
border: 1px solid #ddd;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
button {
|
||||
background-color: #4CAF50;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
margin: 4px 2px;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
input, textarea {
|
||||
padding: 8px;
|
||||
margin: 5px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
width: 80%;
|
||||
}
|
||||
.result {
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.key-display {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.note {
|
||||
font-style: italic;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Rust WebAssembly Crypto Example</h1>
|
||||
|
||||
<div class="container">
|
||||
<h2>Keypair Generation</h2>
|
||||
<div>
|
||||
<button id="keypair-button">Generate Keypair</button>
|
||||
</div>
|
||||
<div class="result" id="keypair-result">Result will appear here</div>
|
||||
<div class="key-display" id="pubkey-display"></div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>Message Signing</h2>
|
||||
<div>
|
||||
<textarea id="sign-message" placeholder="Enter message to sign" rows="3">Hello, this is a test message to sign</textarea>
|
||||
<button id="sign-button">Sign Message</button>
|
||||
</div>
|
||||
<div class="result" id="signature-result">Signature will appear here</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>Signature Verification</h2>
|
||||
<div>
|
||||
<textarea id="verify-message" placeholder="Enter message to verify" rows="3"></textarea>
|
||||
<textarea id="verify-signature" placeholder="Enter signature to verify" rows="3"></textarea>
|
||||
<button id="verify-button">Verify Signature</button>
|
||||
</div>
|
||||
<div class="result" id="verify-result">Verification result will appear here</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>Symmetric Encryption</h2>
|
||||
<div>
|
||||
<textarea id="encrypt-message" placeholder="Enter message to encrypt" rows="3">This is a secret message that will be encrypted</textarea>
|
||||
<button id="encrypt-button">Generate Key & Encrypt</button>
|
||||
</div>
|
||||
<div class="key-display" id="sym-key-display"></div>
|
||||
<div class="note" id="nonce-display">Note: Nonce is handled internally</div>
|
||||
<div class="result" id="encrypt-result">Encrypted data will appear here</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>Symmetric Decryption</h2>
|
||||
<div>
|
||||
<input type="text" id="decrypt-key" placeholder="Enter key (hex)" />
|
||||
<div class="note">Note: Nonce is now extracted automatically from the ciphertext</div>
|
||||
<textarea id="decrypt-ciphertext" placeholder="Enter ciphertext (hex)" rows="3"></textarea>
|
||||
<button id="decrypt-button">Decrypt</button>
|
||||
</div>
|
||||
<div class="result" id="decrypt-result">Decrypted data will appear here</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user