tessl install tessl/npm-crypto-browserify@3.12.0Browser-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%
Implement a secure key exchange system that allows two parties to establish a shared secret over an insecure channel. The system should support key generation, public key exchange, and shared secret computation using elliptic curve cryptography.
Create a module that implements the following functionality:
The implementation should:
Create your implementation in src/keyExchange.js with the following exports:
createKeyPair() - Creates and returns a new key exchange instancegetPublicKey(format) - Returns public key (format: 'compressed' or 'uncompressed')getPrivateKey() - Returns private key as hex stringcomputeSharedSecret(otherPublicKey) - Computes shared secret from other party's public key, returns hex stringimportPrivateKey(privateKeyHex) - Imports a previously exported private keyProvides cryptographic operations including elliptic curve key exchange.
Create a test in src/keyExchange.test.js that:
Expected outcome: Both parties derive the same shared secret value.
Create a test that:
Expected outcome: Compressed public keys work correctly for secret computation.
Create a test that:
Expected outcome: Imported keys produce the same cryptographic behavior as the original keys.