JSPM

personal-data-wallet-sdk

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 87
  • Score
    100M100P100Q62323F
  • License MIT

TypeScript SDK for Personal Data Wallet - Decentralized memory system with AI embeddings, HNSW vector search, SEAL encryption, Walrus storage, and React hooks

Package Exports

  • personal-data-wallet-sdk
  • personal-data-wallet-sdk/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (personal-data-wallet-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Personal Data Wallet SDK

TypeScript SDK for building memory-aware applications with decentralized storage, SEAL encryption, and Sui blockchain.

What is it?

Build AI-powered apps that remember user data privately and securely:

  • 🧠 Create & Search Memories - AI embeddings + vector search
  • 🔐 Privacy-First - SEAL encryption + Walrus decentralized storage
  • ⛓️ Blockchain Verified - Sui smart contracts for ownership
  • ⚛️ React Ready - 9 production hooks for instant integration

Installation

npm install personal-data-wallet-sdk @mysten/sui @mysten/dapp-kit @tanstack/react-query

Quick Start

1. Setup Providers (in your root layout/app):

import { SuiClientProvider, WalletProvider } from '@mysten/dapp-kit';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { getFullnodeUrl } from '@mysten/sui/client';

const queryClient = new QueryClient();

export default function RootLayout({ children }) {
  return (
    <QueryClientProvider client={queryClient}>
      <SuiClientProvider networks={{ testnet: { url: getFullnodeUrl('testnet') } }}>
        <WalletProvider>
          {children}
        </WalletProvider>
      </SuiClientProvider>
    </QueryClientProvider>
  );
}

2. Configure Environment Variables:

NEXT_PUBLIC_PACKAGE_ID=0x...
NEXT_PUBLIC_ACCESS_REGISTRY_ID=0x...
NEXT_PUBLIC_WALRUS_AGGREGATOR=https://aggregator.walrus-testnet.walrus.space
NEXT_PUBLIC_GEMINI_API_KEY=your-api-key

3. Use the Hooks:

import { useCreateMemory, useSearchMemories, useMemoryChat } from 'personal-data-wallet-sdk/hooks';
import { useCurrentAccount } from '@mysten/dapp-kit';

function MyApp() {
  const account = useCurrentAccount();

  // Create a memory
  const { mutate: createMemory, isPending } = useCreateMemory();

  // Search memories
  const { data: results } = useSearchMemories(account?.address, 'search query');

  // Memory-aware AI chat
  const { messages, sendMessage } = useMemoryChat(account?.address);

  return (
    <div>
      <button onClick={() => createMemory({ content: 'Hello!', category: 'personal' })}>
        Create Memory
      </button>

      <div>Results: {results?.length}</div>

      <button onClick={() => sendMessage('What do I remember about TypeScript?')}>
        Ask AI
      </button>
    </div>
  );
}

For Non-React Apps

import { ClientMemoryManager } from 'personal-data-wallet-sdk';

const manager = new ClientMemoryManager({
  packageId: process.env.PACKAGE_ID!,
  accessRegistryId: process.env.ACCESS_REGISTRY_ID!,
  walrusAggregator: process.env.WALRUS_AGGREGATOR!,
  geminiApiKey: process.env.GEMINI_API_KEY!,
});

// Create a memory
const blobId = await manager.createMemory({
  content: 'Meeting notes',
  category: 'work',
  account: walletAccount,
  signAndExecute: signTxFunction,
  client: suiClient,
});

// Search memories
const results = await manager.searchMemories({
  query: 'project updates',
  userAddress: '0x...',
  k: 5,
});

Available Hooks

Hook Description
useMemoryManager() Initialize the memory manager
useCreateMemory() Create memories with progress tracking
useSearchMemories() Vector search with auto-debouncing
useWalletMemories() Fetch all user memories
useMemoryChat() AI chat with memory context 🚀

Advanced hooks for direct service access:

  • useMemoryServices() - HNSW, embeddings, graph services
  • useMemorySearch() - Direct vector search
  • useMemoryIndex() - Memory indexing
  • useKnowledgeGraph() - Knowledge graph ops

Example: Memory-Aware Chat

import { useMemoryChat } from 'personal-data-wallet-sdk/hooks';
import { useCurrentAccount } from '@mysten/dapp-kit';

function ChatInterface() {
  const account = useCurrentAccount();
  const { messages, sendMessage, isProcessing } = useMemoryChat(account?.address, {
    systemPrompt: 'You are a helpful assistant with access to user memories.',
    maxContextMemories: 5,
  });

  return (
    <div>
      {messages.map((msg, i) => (
        <div key={i}>
          <strong>{msg.role}:</strong> {msg.content}
          {msg.memories && <span>🧠 {msg.memories.length} memories used</span>}
        </div>
      ))}
      <input onSubmit={(e) => sendMessage(e.target.value)} disabled={isProcessing} />
    </div>
  );
}

Core Concepts

Memory Categories

Organize memories by type: personal, work, health, finance, education, other

AI-powered semantic search using embeddings (768 dimensions via Gemini)

SEAL Encryption

Identity-based encryption ensures only you can decrypt your data

Walrus Storage

Decentralized blob storage with epoch-based data availability

Configuration Options

const manager = new ClientMemoryManager({
  // Required
  packageId: '0x...',              // Your deployed Move package
  accessRegistryId: '0x...',       // Access control registry
  walrusAggregator: 'https://...', // Walrus aggregator URL
  geminiApiKey: 'your-key',        // Google Gemini API key

  // Optional
  network: 'testnet',              // 'testnet' | 'mainnet' | 'devnet'
  sealKeyServer: 'https://...',    // Custom SEAL key server
  cacheEnabled: true,              // Enable local caching
});

Troubleshooting

"Wallet not connected" → Ensure @mysten/dapp-kit providers are configured and wallet is connected

"No package ID" → Set NEXT_PUBLIC_PACKAGE_ID environment variable

"SEAL encryption failed" → Check that SEAL key server is accessible

"Walrus upload failed" → Verify NEXT_PUBLIC_WALRUS_AGGREGATOR is correct for your network

Development

# Install dependencies
npm install

# Generate types from Move contracts
npm run codegen

# Build
npm run build

# Test
npm test

Documentation

License

MIT