Skip to content

Commit

Permalink
feat: release
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmd5 committed Jun 24, 2023
1 parent c156b32 commit 7d979d0
Show file tree
Hide file tree
Showing 9 changed files with 1,894 additions and 0 deletions.
180 changes: 180 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Created by https://www.toptal.com/developers/gitignore/api/node,visualstudiocode,yarn
# Edit at https://www.toptal.com/developers/gitignore?templates=node,visualstudiocode,yarn

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache

# and uncomment the following lines
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/node,visualstudiocode,yarn
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# @tempojs/fs-credential-storage

This library provides a credential storage implementation for the [Tempo](https://tempo.im) clients that uses the local file system.

## Installation

```bash
npm install @tempojs/fs-credential-storage
```
or
```bash
yarn add @tempojs/fs-credential-storage
```

## Usage

```typescript
const storage = new FileSystemStorageStrategy("namespace", "optional-encryption-key");
```

### Namespace
A namespace is essentially a directory name. It is used to separate credentials from other processes that may use this storage strategy. Use a namespace that is unique to your application.

### Encryption
The second parameter is an optional encryption key. If provided, the credentials will be encrypted using AES-256-GCM. The key must be 32 bytes long. If you do not provide a key, the credentials will be stored in plain text.

If your application is a desktop application, you should consider encrypting the credentials to prevent other applications from reading them from the file system. If your application is running in an environment you control (e.g. a server), you may not need to encrypt the credentials.

### Example
```typescript
import { FileSystemStorageStrategy } from "@tempojs/fs-credential-storage";
const storage = new FileSystemStorageStrategy("my-app", "my-secret-key");
await storage.storeCredential("credential.json", testCredential);
const credential = await storage.getCredential("credential.json");
await storage.removeCredential("credential.json");
```

The use of 'credential.json' as the credential name is arbitrary. You can use any name you want. The name is used as the file name in the file system; if your application needs to store multiple credentials, you can use different names for each credential. Just make sure the name is something deterministic so you can retrieve the credential later.


For more information, check out the [Tempo documentation](https://tempo.im/).
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@tempojs/fs-credential-storage",
"version": "1.0.0",
"description": "a file-system credential storage strategy for Tempo clients",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsup"
},
"license": "MIT",
"devDependencies": {
"@types/mock-fs": "^4.13.1",
"mock-fs": "^5.2.0",
"tsup": "^7.0.0",
"vitest": "^0.32.2"
},
"dependencies": {
"@tempojs/client": "^0.0.6"
}
}
Loading

0 comments on commit 7d979d0

Please sign in to comment.