CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-walletconnect--types

tessl install tessl/npm-walletconnect--types@2.21.0

TypeScript type definitions and interfaces for the WalletConnect Protocol v2, enabling type-safe development across the WalletConnect ecosystem

Agent Success

Agent success rate when using this tile

70%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

59%

task.mdevals/scenario-2/

Secure Message Exchange System

Build a simple secure message exchange system that allows two peers to communicate securely using public-key cryptography. The system should generate cryptographic key pairs, establish a shared encryption key, and encrypt/decrypt messages between peers.

Requirements

Key Generation

  • Generate unique key pairs for each peer (public and private keys)
  • Each peer should have a unique identifier derived from their public key

Secure Communication

  • Establish a shared encryption key between two peers using their key pairs
  • Encrypt messages before sending using the shared key
  • Decrypt received messages using the shared key
  • Support base64-encoded encrypted message format

Message Exchange

  • Create a function to send a secure message from one peer to another
  • Create a function to receive and decrypt a message
  • Handle the complete flow: encryption by sender, decryption by receiver

Test Cases

  • Generates unique key pairs with public and private keys for a peer @test
  • Creates unique client identifiers from public keys @test
  • Establishes shared encryption key between two peers @test
  • Encrypts a message successfully using shared key @test
  • Decrypts an encrypted message successfully using shared key @test
  • Completes full message exchange: encrypt by sender, decrypt by receiver with original message preserved @test

Implementation

@generates

API

export interface Peer {
  clientId: string;
  publicKey: string;
  privateKey: string;
}

export interface EncryptedMessage {
  encryptedData: string;
  senderPublicKey: string;
}

/**
 * Generates a new peer with cryptographic key pair and client identifier
 */
export function generatePeer(): Promise<Peer>;

/**
 * Establishes a shared encryption key between two peers
 */
export function establishSharedKey(
  myPrivateKey: string,
  theirPublicKey: string
): Promise<string>;

/**
 * Encrypts a message for a specific recipient
 */
export function encryptMessage(
  message: string,
  myPrivateKey: string,
  theirPublicKey: string
): Promise<EncryptedMessage>;

/**
 * Decrypts a received encrypted message
 */
export function decryptMessage(
  encrypted: EncryptedMessage,
  myPrivateKey: string
): Promise<string>;

Dependencies { .dependencies }

@walletconnect/types { .dependency }

Provides TypeScript interfaces for WalletConnect cryptographic operations including key pair generation, encryption, and decryption.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@walletconnect/types@2.21.x
tile.json