npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koto-react-native

v1.0.0

Published

React Native implementation of Koto SDK with AsyncStorage

Downloads

98

Readme

Koto React Native

Koto (言) — Japanese for "word." Every translation starts with a single word. Koto bridges languages one word at a time.

A React Native implementation of the Koto SDK using AsyncStorage for persistent API key storage.

Installation

npm install koto-react-native @react-native-async-storage/async-storage

For iOS, you'll also need to run:

cd ios && pod install

Usage

1. Wrap your app with HermesProvider

import React from 'react';
import { KotoProvider } from 'koto-react-native';
import { AppContent } from './AppContent';

export default function App() {
  return (
    <KotoProvider config={{ baseUrl: 'https://api.your-service.com' }}>
      <AppContent />
    </KotoProvider>
  );
}

2. Use the useHermes hook in your components

import React, { useState } from 'react';
import { View, Text, TextInput, Button, ActivityIndicator } from 'react-native';
import { useKoto } from 'koto-react-native';

export function AppContent() {
  const { 
    apiKey, 
    setApiKey, 
    removeApiKey, 
    makeRequest, 
    isLoading, 
    isAuthenticated 
  } = useKoto();
  
  const [inputKey, setInputKey] = useState('');
  const [data, setData] = useState(null);

  const handleSetKey = async () => {
    try {
      await setApiKey(inputKey);
      setInputKey('');
    } catch (error) {
      console.error('Failed to set API key:', error);
    }
  };

  const handleLogout = async () => {
    try {
      await removeApiKey();
      setData(null);
    } catch (error) {
      console.error('Failed to remove API key:', error);
    }
  };

  const fetchData = async () => {
    try {
      const response = await makeRequest('/api/data');
      setData(response);
    } catch (error) {
      console.error('Failed to fetch data:', error);
    }
  };

  if (isLoading) {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <ActivityIndicator size="large" />
      </View>
    );
  }

  return (
    <View style={{ flex: 1, padding: 20 }}>
      {!isAuthenticated ? (
        <View>
          <Text>Enter your API Key:</Text>
          <TextInput
            value={inputKey}
            onChangeText={setInputKey}
            placeholder="Your API key"
            secureTextEntry
            style={{ 
              borderWidth: 1, 
              borderColor: '#ccc', 
              padding: 10, 
              marginVertical: 10 
            }}
          />
          <Button title="Set API Key" onPress={handleSetKey} />
        </View>
      ) : (
        <View>
          <Text>You are authenticated!</Text>
          <Button title="Fetch Data" onPress={fetchData} />
          <Button title="Logout" onPress={handleLogout} color="red" />
          
          {data && (
            <View style={{ marginTop: 20 }}>
              <Text>Data:</Text>
              <Text>{JSON.stringify(data, null, 2)}</Text>
            </View>
          )}
        </View>
      )}
    </View>
  );
}

API Reference

KotoProvider

The main provider component that manages the Koto context.

Props:

  • config (optional): Configuration object
    • baseUrl: Base URL for API requests (default: 'https://api.koto.dev')
    • headers: Additional headers to include in requests
    • timeout: Request timeout in milliseconds

useKoto Hook

Returns the Koto context with the following properties:

  • apiKey: Current API key (string | null)
  • setApiKey(key: string): Set the API key (saves to AsyncStorage)
  • removeApiKey(): Remove the API key (clears from AsyncStorage)
  • baseUrl: Current base URL
  • setBaseUrl(url: string): Update the base URL
  • makeRequest<T>(endpoint: string, options?: RequestInit): Make authenticated API requests
  • isLoading: Loading state for initial API key retrieval
  • error: Error message if any
  • isAuthenticated: Boolean indicating if user has an API key

Features

  • Persistent Storage: API keys are automatically saved to AsyncStorage and persist across app sessions
  • Type Safety: Full TypeScript support with type definitions
  • React Native Optimized: Built specifically for React Native with AsyncStorage integration
  • Simple API: Easy to use hooks and context API
  • Secure: API keys are stored securely in AsyncStorage

Requirements

  • React Native >= 0.60.0
  • React >= 16.8.0
  • @react-native-async-storage/async-storage >= 1.0.0

License

MIT