v0.0.3
RSA Service for Deno
Repository
Current version released
3 years ago
Dependencies
github.com
Versions
RSA
Usage Example
import { RSAService } from "https://raw.githubusercontent.com/deno-microfunctions/rsa/main/src/rsa.ts"
const rsaService = new RSAService()
const newRSAKeyPair = rsaService.generateKeyPair()
const message = "Hello World!" // Message to encrypt
// Generate signature
const signature = rsaService.createSignature(message, newRSAKeyPair.privateKey) // encrypted sha256 hash of signature
// Encrypt
const encryptedMessage = rsaService.encrypt(message, newRSAKeyPair.publicKey) // returns encrypted message
// Decrypt
const decryptedmessage = rsaService.decrypt(encryptedMessage, newRSAKeyPair.privateKey) // returns decrypted message
// Validate with signature
const isAuthentic = rsaService.validateAuthenticity(decryptedmessage, signature, newRSAKeyPair.publicKey)
Execute Usage Example
deno run https://deno.land/x/rsa_service/usage-example.ts
Execute Unit tests
deno test https://github.com/deno-microfunctions/rsa/blob/main/src/rsa.spec.ts