Constructors

Accessors

Methods

  • Connect to L2PS messaging server and register

    Returns Promise<{
        l2psUid: string;
        onlinePeers: string[];
        publicKey: string;
        success: boolean;
    }>

    Registration response with online peers

  • Get conversation history with a peer

    Parameters

    • peerKey: string

      Peer's public key

    • options: {
          before?: number;
          limit?: number;
      } = {}

      Pagination options

      • Optionalbefore?: number
      • Optionallimit?: number

    Returns Promise<{
        hasMore: boolean;
        messages: StoredMessage[];
    }>

    Message history with pagination info

  • Request a peer's public key

    Parameters

    • targetId: string

      Target peer identifier

    Returns Promise<string>

    Public key hex string or null if not found

  • Send an encrypted message to a peer

    Parameters

    • to: string

      Recipient's public key (hex)

    • encrypted: SerializedEncryptedMessage

      E2E encrypted message

    • messageHash: string

      SHA256 hash for dedup

    Returns Promise<{
        l2psStatus: "failed" | "submitted";
        messageHash: string;
    } | {
        messageHash: string;
        status: "queued";
    }>

    Delivery confirmation (sent or queued)