
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@blureffect/oauth2-storage-postgres
Advanced tools
PostgreSQL storage adapter for OAuth2 Manager using TypeORM
A TypeORM-based PostgreSQL storage adapter for the OAuth2 Manager library.
npm install @your-org/oauth2-storage-postgres
import { OAuth2Client } from '@your-org/oauth2-manager';
import { PostgresStorageFactory } from '@your-org/oauth2-storage-postgres';
// Create storage adapter
const storage = await PostgresStorageFactory.create({
host: 'localhost',
port: 5432,
username: 'oauth2_user',
password: 'secure_password',
database: 'oauth2_db',
ssl: process.env.NODE_ENV === 'production',
});
// Use with OAuth2Client
const oauth = new OAuth2Client({ storage });
const storage = await PostgresStorageFactory.create({
host: process.env.DB_HOST,
port: parseInt(process.env.DB_PORT || '5432'),
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
ssl: {
rejectUnauthorized: false, // For self-signed certificates
},
synchronize: false, // Don't auto-sync in production
logging: process.env.NODE_ENV === 'development',
poolSize: 20,
});
// Create named connections for multi-tenant scenarios
const tenantStorage = await PostgresStorageFactory.getOrCreate('tenant-123', tenantDbConfig);
// Close when done
await PostgresStorageFactory.close('tenant-123');
// Or close all connections
await PostgresStorageFactory.closeAll();
npm run typeorm migration:generate -- -n YourMigrationName
npm run typeorm migration:run
npm run typeorm migration:revert
The adapter creates the following tables:
oauth2_systems
- OAuth2 systems/applicationsoauth2_scopes
- Permission scopesoauth2_users
- Users within systemsoauth2_user_tokens
- Stored OAuth2 tokensoauth2_authorization_states
- Temporary authorization statesimport { DataSource } from 'typeorm';
import { PostgresStorageAdapter } from '@your-org/oauth2-storage-postgres';
const dataSource = new DataSource({
type: 'postgres',
url: process.env.DATABASE_URL,
entities: ['dist/entities/*.js'],
migrations: ['dist/migrations/*.js'],
extra: {
max: 30, // connection pool size
idleTimeoutMillis: 30000,
},
});
await dataSource.initialize();
const storage = new PostgresStorageAdapter(dataSource);
await dataSource.transaction(async (manager) => {
const storage = new PostgresStorageAdapter(manager);
// All operations within transaction
const system = await storage.createSystem({ name: 'System' });
const user = await storage.createUser({ systemId: system.id });
// If any operation fails, all are rolled back
});
The adapter includes indexes for common queries:
// Use pagination for large datasets
const systems = await dataSource.getRepository(SystemEntity).find({
skip: 0,
take: 100,
order: { createdAt: 'DESC' },
});
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
MIT
FAQs
PostgreSQL storage adapter for OAuth2 Manager using TypeORM
The npm package @blureffect/oauth2-storage-postgres receives a total of 2 weekly downloads. As such, @blureffect/oauth2-storage-postgres popularity was classified as not popular.
We found that @blureffect/oauth2-storage-postgres demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.