Skip to content

Web3Dave/moki-sdk

Repository files navigation

moki logo

Fast, Light-weight, SDK for Web3 chat

Features

  • Lightweight & Fast - Only 2.2 kB minified + compressed (brotli), or 10.6 kB compiled source (tree-shakeable)
  • End-to-End Encryption - Secure messaging with AES-GCM encryption
  • EVM Wallet Native - Built specifically for Ethereum-based wallets
  • No Browser Wallet Required - Generate temporary wallets in localStorage for temporary visitors
  • Delegate Wallet Support - Keep your main wallet safe, use a delegate for message signing
  • Simple Integration - Easy to integrate into existing applications

Overview

Moki SDK can be used with a localStorage key (for example: temporary web users)

// 1. Import modules.
import { privateKeyToMokiAccount } from '@moki/core/accounts'
import { createMessageClient } from '@moki/core/messaging'
import { createProvider } from '@moki/core/provider'

// 2. Set up your message client.
const provider = createProvider("https://moki-node.pingify.io");
const account = privateKeyToMokiAccount("0xe3F...") // Generate a temporary localStorage key here
const messageClient = createMessageClient(provider, {
            account,
            dangerouslyUseAccountAsDelegate: true
})

// 3. Send a message!
await messageClient.sendMessage(username, "Hello World!");

Browser wallet support coming soon...

Try out the Example

The easiest way to currently test the message functionality of this SDK is by downloading the Pingify app and communicating directly with your Pingify @username using the SDK Example Chat

Documentation

Head over to the docs to get started and learn more about Moki.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published