CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-crypto-browserify

tessl install tessl/npm-crypto-browserify@3.12.0

Browser-compatible implementation of Node.js crypto module providing cryptographic operations in web environments.

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1x

Baseline

Agent success rate without this tile

100%

task.mdevals/scenario-3/

Secure Message Exchange System

A library that implements two distinct patterns of RSA encryption for different security goals: confidential messaging and authenticated messaging.

Capabilities

Confidential Messaging

  • Encrypts a message so that only the intended recipient (who holds the private key) can decrypt it. @test
  • Returns a Buffer containing the encrypted data when encrypting confidential messages. @test
  • Successfully decrypts messages that were encrypted for confidentiality. @test

Authenticated Messaging

  • Encrypts a message with a sender's private key to prove authenticity (sender verification). @test
  • Returns a Buffer containing the encrypted data when creating authenticated messages. @test
  • Successfully decrypts authenticated messages using the sender's public key. @test

Implementation

@generates

API

/**
 * Encrypts a message for confidentiality. Only the holder of the corresponding
 * private key can decrypt this message.
 *
 * @param {string|Buffer} publicKey - PEM-encoded RSA public key
 * @param {Buffer} message - The message to encrypt
 * @returns {Buffer} The encrypted message
 */
function encryptConfidential(publicKey, message) {
  // IMPLEMENTATION HERE
}

/**
 * Decrypts a confidentially encrypted message using the recipient's private key.
 *
 * @param {string|Buffer} privateKey - PEM-encoded RSA private key
 * @param {Buffer} encryptedMessage - The encrypted message
 * @returns {Buffer} The decrypted message
 */
function decryptConfidential(privateKey, encryptedMessage) {
  // IMPLEMENTATION HERE
}

/**
 * Encrypts a message for authenticity verification. This proves the sender
 * owns the private key. Anyone with the public key can decrypt and verify.
 *
 * @param {string|Buffer} privateKey - PEM-encoded RSA private key
 * @param {Buffer} message - The message to encrypt
 * @returns {Buffer} The encrypted message
 */
function encryptAuthenticated(privateKey, message) {
  // IMPLEMENTATION HERE
}

/**
 * Decrypts an authenticated message using the sender's public key.
 * Successful decryption proves the message came from the private key holder.
 *
 * @param {string|Buffer} publicKey - PEM-encoded RSA public key
 * @param {Buffer} encryptedMessage - The encrypted message
 * @returns {Buffer} The decrypted message
 */
function decryptAuthenticated(publicKey, encryptedMessage) {
  // IMPLEMENTATION HERE
}

module.exports = {
  encryptConfidential,
  decryptConfidential,
  encryptAuthenticated,
  decryptAuthenticated,
};

Dependencies { .dependencies }

crypto-browserify { .dependency }

Provides cryptographic operations including RSA encryption and decryption.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/crypto-browserify@3.12.x
tile.json