Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tonconnect/protocol

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tonconnect/protocol

⚠️ TonConnect is currently in beta testing. Use it at your own risk.

  • 0.0.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32K
decreased by-6.32%
Maintainers
3
Weekly downloads
 
Created
Source

TON Connect protocol models

⚠️ TonConnect is currently in beta testing. Use it at your own risk.

ℹ️ If you want to integrate TonConnect to your dApp, you should use @tonconnect/sdk

Summary

Package contains protocol requests, responses and event models and encoding, decoding functions.

You can use it to integrate TonConnect to your wallet app (written with TypeScript).

Get started

Install package

npm i @tonconnect/protocol

Use protocol models in your app

import { AppRequest, RpcMethod, WalletResponse } from '@tonconnect/protocol';

function myWalletAppRequestsHandler<T extends RpcMethod>(request: AppRequest<T>): Promise<WalletResponse<T>> {
    // handle request, ask the user for a confirmation and return WalletResponse
}

Use protocol cryptography in your app

import { SessionCrypto, WalletMessage, Base64, hexToByteArray } from '@tonconnect/protocol';

function encodeIncommingHTTPBridgeRequest(encryptedMessage: string, from: string): WalletMessage {
    const sessionCrypto = new SessionCrypto(yourStoredSessionReypair);

    const decryptedMessage =
        sessionCrypto.decrypt(
            Base64.decode(bridgeIncomingMessage.message).toUint8Array(),
            hexToByteArray(bridgeIncomingMessage.from)
        );
    
    return  JSON.parse(decryptedMessage);
}

Keywords

FAQs

Package last updated on 28 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc