teddi-x
Version:
Teddi (teddi-x) is a Node package that extends security to vertical agents., applications, and tooling built on, for, or with AI.
149 lines (93 loc) • 4.62 kB
Markdown
# Security as a Service (SaaS) Package - Teddi
This Node package allows you to easily integrate security into your application using our Security as a Service API.
## Installation
```bash
npm install teddi-x
```
## Recommended Usage Pattern
We recommend creating a dedicated teddi configuration file in your project:
**teddi.js/ts**:
```javascript
import { createClient } from "teddi-x";
const teddiHash = import.meta.env.VITE_TEDDI_HASH;
if (!teddiHash) {
throw new Error(
"You need to get your project hash config from the teddi dashboard. Navigate to https://teddi.app and login. Click on your project, add the Supabase integration and then proceed to add your configs. You should then see the config hash. Copy and paste it in your env."
);
}
const teddi = await createClient(teddiHash);
export { teddi };
```
**Using in your application**:
```javascript
import { teddi } from "./teddi";
const supabase = await teddi.supabase();
export default supabase;
```
## Getting Started with AI-Assisted Setup
Copy and paste this prompt into an AI coding assistant like Bolt.new or Cursor:
I want to set up teddi-x in my project for secure API integrations. Help me with these steps:
1. Install the package:
npm install teddi-x
2. Create a new file called teddi.ts (or teddi.js if not using TypeScript) with this content:
```javascript
import { createClient } from "teddi-x";
// Replace with your framework's environment variable syntax
const teddiHash = process.env.TEDDI_HASH || import.meta.env.TEDDI_HASH;
if (!teddiHash) {
throw new Error(
"You need to get your project hash from the teddi dashboard. Visit https://teddi.app, login, add your project, select an integration, and copy your hash."
);
}
const teddi = await createClient(teddiHash);
export { teddi };
```
3. Add my teddi hash to environment variables:
- For Next.js: In .env.local add TEDDI_HASH=my-hash-from-teddi-dashboard
- For Vite: In .env add VITE_TEDDI_HASH=my-hash-from-teddi-dashboard
- For Create React App: In .env add REACT_APP_TEDDI_HASH=my-hash-from-teddi-dashboard
- Add the appropriate .env file to .gitignore
4. Show me how to use teddi with Supabase by creating a supabase.ts file:
```javascript
import { teddi } from "./teddi";
const supabase = await teddi.supabase();
export default supabase;
```
5. Now show me an example of using this secure Supabase instance in my project.
## Getting Your Teddi Hash
To use this package, you'll need a Teddi Hash:
1. Navigate to [teddi.app](https://teddi.app)
2. Create an account or sign in
3. Add a new project
4. Select the integration you want to use
5. Complete the setup process
6. Copy your project hash and store it in your environment variables as `TEDDI_HASH`, `VITE_TEDDI_HASH`, `NEXT_PUBLIC_TEDDI_HASH`, etc.
## Why Teddi Is More Secure Than API Keys in .env Files
Storing unsecured API keys in your environment files leaves them vulnerable to bad actors. The teddi hash, by contrast, is only decryptable using our proprietary algorithm, meaning only our backend can understand and relay requests between services.
**What if someone gets my teddi hash?**
Even if your teddi hash is compromised, our security features provide multiple layers of protection:
- **Development vs Production Channels**: Testing in development mode gives you 500 daily requests. To unlock production rates, you must add your production URL to your project. Without this verification, we limit API usage.
- **Request Monitoring**: Easily browse connections, requests, and more through your dashboard. You can block suspicious IPs if you detect unusual activity.
- **Active Threat Detection**: Our in-house AI actively monitors requests to prevent bad actors from abusing your services by implementing advanced schema learning and detection.
These measures ensure that even if your teddi hash is exposed, your services remain protected against unauthorized use.
## Supported Integrations
Currently supported integrations:
- Supabase
Coming soon:
- OpenAI
- Claude
- AWS
- Maps
- Have an integration need? Let us know at [teddi.app/integrations/store#request](teddi.app/integrations/store#request) or ping the founders on LinkedIn.
## Compatibility
You can use this package with your existing implementations without any changes. As long as the instance is coming from Teddi, your implementation will work as normal - no need to learn anything new.
## Beta Installation
```bash
npm install teddi-x@beta
```
## Legacy Usage
```javascript
const teddi = require("teddi-x");
```