Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@simplewebauthn/server
Advanced tools
@simplewebauthn/server is a Node.js library that provides server-side functionality for WebAuthn, a web standard for secure authentication using public key cryptography. It helps in implementing registration and authentication flows for WebAuthn, making it easier to integrate strong, passwordless authentication into web applications.
Registration
This feature allows you to generate registration options for a new user and verify the registration response from the client. It ensures that the registration process is secure and follows the WebAuthn protocol.
const { generateRegistrationOptions, verifyRegistrationResponse } = require('@simplewebauthn/server');
// Generate registration options
const options = generateRegistrationOptions({
rpName: 'Example Corp',
rpID: 'example.com',
userID: 'user-id',
userName: 'user@example.com',
attestationType: 'indirect',
authenticatorSelection: {
userVerification: 'preferred',
},
});
// Verify registration response
const verification = verifyRegistrationResponse({
credential: response,
expectedChallenge: options.challenge,
expectedOrigin: 'https://example.com',
expectedRPID: 'example.com',
});
Authentication
This feature allows you to generate authentication options for an existing user and verify the authentication response from the client. It ensures that the authentication process is secure and follows the WebAuthn protocol.
const { generateAuthenticationOptions, verifyAuthenticationResponse } = require('@simplewebauthn/server');
// Generate authentication options
const options = generateAuthenticationOptions({
rpID: 'example.com',
userVerification: 'preferred',
});
// Verify authentication response
const verification = verifyAuthenticationResponse({
credential: response,
expectedChallenge: options.challenge,
expectedOrigin: 'https://example.com',
expectedRPID: 'example.com',
authenticator: authenticator,
});
fido2-lib is a library for implementing FIDO2 and WebAuthn server functionality. It provides similar features to @simplewebauthn/server, such as registration and authentication flows, but may require more manual setup and configuration.
webauthn is another library for implementing WebAuthn server functionality. It offers a straightforward API for handling registration and authentication, similar to @simplewebauthn/server, but with a different approach to configuration and usage.
This package is available on npm:
npm install @simplewebauthn/server
You can find in-depth documentation on this package here: https://simplewebauthn.dev/docs/packages/server
SimpleWebAuthn supports all six WebAuthn attestation formats, including:
v0.10.0 - The one you can use your face with
Packages:
Changes:
allowCredentials
and
excludeCredentials
transports
in response from
startAttestation()
AuthenticatorAttestationResponseFuture
type for better typing of
credential response methods (getTransports()
, getAuthenticatorData()
, etc...)generateAttestationOptions()
and
generateAssertionOptions()
must be updated to specify credentials with their own transports:generateAttestationOptions()
// OLD
const options = generateAttestationOptions({
excludedCredentialIDs: devices.map((dev) => dev.credentialID),
suggestedTransports: ['usb', 'ble', 'nfc', 'internal'],
});
// NEW
const options = generateAttestationOptions({
excludeCredentials: devices.map((dev) => ({
id: dev.credentialID,
type: 'public-key',
transports: dev.transports,
})),
});
generateAssertionOptions()
// OLD
const options = generateAssertionOptions({
allowedCredentialIDs: user.devices.map((dev) => dev.credentialID),
suggestedTransports: ['usb', 'ble', 'nfc', 'internal'],
});
// NEW
const options = generateAssertionOptions({
allowCredentials: devices.map((dev) => ({
id: dev.credentialID,
type: 'public-key',
transports: dev.transports,
})),
});
FAQs
SimpleWebAuthn for Servers
The npm package @simplewebauthn/server receives a total of 106,101 weekly downloads. As such, @simplewebauthn/server popularity was classified as popular.
We found that @simplewebauthn/server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.