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

tinfoil-react-native

v0.6.0

Published

Official Tinfoil secure OpenAI client wrapper for react native

Readme

tinfoil-react-native

Official Tinfoil secure OpenAI client wrapper for React Native


Installation

To use this library in your app, first install the package:

npm install tinfoil-react-native

iOS

You will then need to add these flags in your app's ios/Podfile file:

ENV['RCT_NEW_ARCH_ENABLED'] = '1'
ENV['USE_FRAMEWORKS'] = 'dynamic'

If you're using this library in your app:

cd ios && pod install  # in YOUR app's ios folder

And then build using your favorite Expo, npm or Xcode tool.


Development

If you're developing the library itself:

npm install

Then simply run

cd ..  # go back to example directory
npx react-native run-ios

Note: Make sure you have CocoaPods installed (sudo gem install cocoapods).

Compilation with Xcode

Compiling with Xcode can be useful to access the debugger and other functionalities.

First launch the react native server

npm run start --workspace=tinfoil-react-native-example

Then in a separate terminal:

cd example/ios && pod install  # in the example app's ios folder

Then to build and run the app use, open the workspace in Xcode

open ReactNativeExample.xcworkspace

And use the Xcode interface to build and run your app.


Usage

To get an API Key, sign up on Tinfoil and get an API key from your account dashboard.

1. Initialize the SDK

import Tinfoil from 'tinfoil-react-native';

await Tinfoil.initialize({
  apiKey: 'YOUR_API_KEY',
  githubRepo: 'tinfoilsh/model-repo',
  enclaveURL: 'enclave.example.com',
});

2. Chat Completion

const reply = await Tinfoil.chatCompletion('model', [
  { role: 'user', content: 'Hello!' },
]);
console.log('Assistant:', reply);

3. Secure Verification with Progress Callbacks

import type { VerificationStatus, VerificationResult } from 'tinfoil-react-native';

const verificationResult: VerificationResult = await Tinfoil.verify(
  (codeStatus: VerificationStatus) => {
    // Called when code verification completes
    console.log('Code verification:', codeStatus);
  },
  (runtimeStatus: VerificationStatus) => {
    // Called when runtime verification completes
    console.log('Runtime verification:', runtimeStatus);
  },
  (securityStatus: VerificationStatus) => {
    // Called when security check completes
    console.log('Security check:', securityStatus);
  }
);

if (verificationResult.isMatch) {
  console.log('Verification successful!', verificationResult);
} else {
  console.log('Verification failed:', verificationResult);
}

API

Tinfoil.initialize(config)

  • config: { apiKey?: string, githubRepo: string, enclaveURL: string }
  • Returns: Promise<void>

Tinfoil.chatCompletion(model, messages)

  • model: string
  • messages: { role: 'system' | 'user' | 'assistant', content: string }[]
  • Returns: Promise<string>

Tinfoil.verify(onCode, onRuntime, onSecurity)

  • Each callback receives a VerificationStatus:
    • { status: 'success', digest: string }
    • or { status: 'failure', error: string }
  • Returns: Promise<VerificationResult>
    • { isMatch: boolean, codeDigest: string, runtimeDigest: string, publicKeyFP: string }

Example

See example/App.tsx for a full working demo.


Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library