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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@stochain/secure-storage

v1.0.0

Published

Secure storage utilities for React Native with encryption

Readme

@stochain/secure-storage

Encrypted storage wrapper for React Native applications with key-value persistence.

Installation

npm install @stochain/secure-storage
npm install react-native-sensitive-info

iOS Setup

cd ios && pod install

Android Setup

No additional setup required.

Features

  • AES-256 encryption by default
  • Keychain (iOS) / Keystore (Android) integration
  • Simple key-value storage interface
  • TypeScript support
  • Automatic JSON serialization
  • Biometric authentication support

Usage

Basic Operations

import { SecureStorage } from '@stochain/secure-storage';

const storage = new SecureStorage();

// Store data
await storage.setItem('user', { id: 1, name: 'John' });
await storage.setItem('token', 'abc123');

// Retrieve data
const user = await storage.getItem<{ id: number; name: string }>('user');
const token = await storage.getItem<string>('token');

// Delete data
await storage.removeItem('token');

// Clear all data
await storage.clear();

Check if Key Exists

const hasToken = await storage.hasItem('token'); // true or false

Get All Keys

const keys = await storage.getAllKeys(); // ['user', 'token', ...]

Security Features

Encryption

All data is encrypted using:

  • iOS: AES-256 encryption with Keychain storage
  • Android: AES-256 encryption with Keystore system

Access Control

const storage = new SecureStorage({
  sharedPreferencesName: 'myAppPrefs',
  keychainService: 'myAppKeychain'
});

Biometric Authentication

// Require biometric authentication for access
const sensitiveData = await storage.getItem('privateKey', {
  touchID: true,
  showModal: true
});

API Reference

Constructor

new SecureStorage(options?: SecureStorageOptions)

Methods

  • setItem<T>(key: string, value: T): Promise<void> - Store encrypted data
  • getItem<T>(key: string): Promise<T | null> - Retrieve decrypted data
  • removeItem(key: string): Promise<void> - Delete specific key
  • hasItem(key: string): Promise<boolean> - Check if key exists
  • getAllKeys(): Promise<string[]> - Get all stored keys
  • clear(): Promise<void> - Delete all stored data

TypeScript Types

interface SecureStorageOptions {
  sharedPreferencesName?: string;
  keychainService?: string;
}

Use Cases

Wallet Private Keys

const storage = new SecureStorage();

// Store private key securely
await storage.setItem('wallet_private_key', privateKey);

// Retrieve with biometric auth
const key = await storage.getItem<string>('wallet_private_key');

User Credentials

await storage.setItem('credentials', {
  username: '[email protected]',
  refreshToken: 'xyz789'
});

const creds = await storage.getItem<{
  username: string;
  refreshToken: string;
}>('credentials');

App Settings

await storage.setItem('settings', {
  darkMode: true,
  notifications: false,
  language: 'en'
});

Security Best Practices

  1. Never log sensitive data: Avoid console.log with encrypted values
  2. Use TypeScript: Type safety prevents accidental data exposure
  3. Clear on logout: Remove sensitive data when user logs out
  4. Biometric protection: Enable for highly sensitive operations
  5. Key naming: Use descriptive, non-obvious key names

Platform Support

  • iOS 10.0+
  • Android API 21+

License

MIT

Repository

https://github.com/stochain/packages