TypeScript type definitions and interfaces for the WalletConnect Protocol v2, enabling type-safe development across the WalletConnect ecosystem
70
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.
@generates
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>;Provides TypeScript interfaces for WalletConnect cryptographic operations including key pair generation, encryption, and decryption.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-walletconnect--typesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10