@moki-chat/core
v0.1.3
Published
Core SDK for Moki Chat - Web3 messaging and chat protocol
Maintainers
Readme
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.
