
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
@galaxy-stack/orbit-auth
Advanced tools
Part of the Orbit framework — a NestJS-style backend framework for Bun.
bun add @galaxy-stack/orbit-auth
Module xác thực cho Orbit với JWT support sử dụng thư viện jose và password hashing với Bun native API.
import { JwtService } from '@galaxy-stack/orbit-auth';
const jwt = new JwtService({
secret: 'your-secret-key',
expiresIn: '1h',
});
// Tạo token
const token = await jwt.sign({ userId: 1, role: 'admin' });
// Verify token
const payload = await jwt.verify(token);
// Decode (không verify)
const decoded = jwt.decode(token);
import { PasswordService } from '@galaxy-stack/orbit-auth';
const password = new PasswordService();
// Hash password (sử dụng Bun.password)
const hash = await password.hash('my-password');
// Verify password
const isValid = await password.verify('my-password', hash);
import { AuthGuard, UseGuards } from '@galaxy-stack/orbit-auth';
@Controller('protected')
@UseGuards(AuthGuard)
class ProtectedController {
@Get()
getProtectedData() {
return { secret: 'data' };
}
}
import { AuthModule } from '@galaxy-stack/orbit-auth';
@Module({
imports: [
AuthModule.forRoot({
jwt: {
secret: process.env.JWT_SECRET,
expiresIn: '7d',
},
password: {
algorithm: 'argon2id', // hoặc 'bcrypt'
},
}),
],
})
class AppModule {}
AuthModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
jwt: {
secret: config.get('JWT_SECRET'),
expiresIn: config.get('JWT_EXPIRES_IN'),
},
}),
})
interface JwtOptions {
secret: string; // Secret key
publicKey?: string; // Public key (RS256)
privateKey?: string; // Private key (RS256)
algorithm?: string; // HS256, RS256, ES256, etc.
expiresIn?: string; // '1h', '7d', '30m'
issuer?: string; // Token issuer
audience?: string; // Token audience
}
argon2id (recommended)argon2iargon2dbcryptimport { AuthGuard as BaseAuthGuard, JwtService } from '@galaxy-stack/orbit-auth';
class CustomAuthGuard extends BaseAuthGuard {
async canActivate(context: ExecutionContext): Promise<boolean> {
const request = context.switchToHttp().getRequest();
const token = this.extractToken(request);
if (!token) return false;
try {
const payload = await this.jwtService.verify(token);
request.user = payload;
return true;
} catch {
return false;
}
}
}
FAQs
Authentication module for Orbit framework
We found that @galaxy-stack/orbit-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.