šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@keepkey/connection-indicator

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keepkey/connection-indicator

Connection status indicator for KeepKey Desktop

0.1.0
latest
Source
npm
Version published
Weekly downloads
2
-33.33%
Maintainers
0
Weekly downloads
Ā 
Created
Source

@keepkey/connection-indicator

A React component for displaying the connection status of KeepKey Desktop.

Features

  • Real-time status monitoring of KeepKey Desktop
  • Customizable appearance
  • Automatic polling
  • Launch KeepKey Desktop functionality

Installation

npm install @keepkey/connection-indicator
# or
yarn add @keepkey/connection-indicator
# or
pnpm add @keepkey/connection-indicator

Usage

Basic Usage

import { ConnectionIndicator } from '@keepkey/connection-indicator';

function App() {
  return (
    <div>
      <h1>My KeepKey App</h1>
      <ConnectionIndicator />
    </div>
  );
}

With Custom Options

import { ConnectionIndicator } from '@keepkey/connection-indicator';

function App() {
  return (
    <div>
      <h1>My KeepKey App</h1>
      <ConnectionIndicator 
        connectionOptions={{
          pollingInterval: 5000, // Check every 5 seconds
          timeout: 1000, // 1 second timeout
        }}
        showTooltip={true}
        onClick={(e, isConnected) => {
          if (!isConnected) {
            console.log('Launching KeepKey Desktop...');
          }
        }}
      />
    </div>
  );
}

Using the Hook Directly

import { useDesktopConnection } from '@keepkey/connection-indicator';

function CustomIndicator() {
  const { isConnected, checkConnection, launchDesktop } = useDesktopConnection();
  
  return (
    <button 
      style={{ 
        backgroundColor: isConnected ? 'green' : 'red',
        color: 'white',
        padding: '8px 16px',
        borderRadius: '4px'
      }}
      onClick={() => !isConnected && launchDesktop()}
    >
      {isConnected ? 'Connected to KeepKey' : 'Launch KeepKey Desktop'}
    </button>
  );
}

API

ConnectionIndicator Props

PropTypeDefaultDescription
classNamestring''Custom class name for the indicator
styleCSSPropertiesundefinedCustom style for the indicator
connectionOptionsUseDesktopConnectionOptions{}Options for the useDesktopConnection hook
showTooltipbooleantrueWhether to show a tooltip with connection status
connectedIndicatorReactNodeundefinedCustom connected indicator component
disconnectedIndicatorReactNodeundefinedCustom disconnected indicator component
tooltipComponentReactNodeundefinedCustom tooltip component
onClickfunctionundefinedCallback for when the indicator is clicked

UseDesktopConnectionOptions

OptionTypeDefaultDescription
pollingIntervalnumber15000Polling interval in milliseconds
timeoutnumber2000Timeout for connection check in milliseconds
endpointstring'http://localhost:1646/docs'Endpoint to check for KeepKey Desktop

License

MIT

Keywords

keepkey

FAQs

Package last updated on 06 Mar 2025

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