
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.
@honojs/firebase-auth
Advanced tools
Firebase Auth Middleware @honojs/firebase-auth
is renamed to @hono/firebase-auth
.
@honojs/firebase-auth
is not maintained, please use @hono/firebase-auth
.
Also, for Deno, you can use import with npm:
prefix like npm:@hono/firebase-auth
.
This is a Firebase Auth middleware library for Hono which is used firebase-auth-cloudflare-workers.
Currently only Cloudflare Workers are supported officially. However, it may work in other environments as well, so please let us know in an issue if it works.
import { Hono } from "hono";
import { VerifyFirebaseAuthConfig, VerifyFirebaseAuthEnv, verifyFirebaseAuth, getFirebaseToken } from "@hono/firebase-auth";
const config: VerifyFirebaseAuthConfig = {
// specify your firebase project ID.
projectId: "your-project-id",
}
// Or you can specify here the extended VerifyFirebaseAuthEnv type.
const app = new Hono<{ Bindings: VerifyFirebaseAuthEnv }>()
// set middleware
app.use("*", verifyFirebaseAuth(config));
app.get("/hello", (c) => {
const idToken = getFirebaseToken(c) // get id-token object.
return c.json(idToken)
});
export default app
import { Hono } from "hono";
import { VerifyFirebaseAuthConfig, verifyFirebaseAuth, getFirebaseToken } from "@hono/firebase-auth";
const config: VerifyFirebaseAuthConfig = {
// specify your firebase project ID.
projectId: "your-project-id",
// this is optional. but required in this mode.
keyStore: WorkersKVStoreSingle.getOrInitialize(
PUBLIC_JWK_CACHE_KEY,
PUBLIC_JWK_CACHE_KV
),
// this is also optional. But in this mode, you can only specify here.
firebaseEmulatorHost: FIREBASE_AUTH_EMULATOR_HOST,
}
const app = new Hono()
// set middleware
app.use("*", verifyFirebaseAuth(config));
app.get("/hello", (c) => {
const idToken = getFirebaseToken(c) // get id-token object.
return c.json(idToken)
});
app.fire()
VerifyFirebaseAuthConfig
)projectId: string
(required)This field indicates your firebase project ID.
authorizationHeaderKey?: string
(optional)Based on this configuration, the JWT created by firebase auth is looked for in the HTTP headers. The default is "Authorization".
keyStore?: KeyStorer
(optional)This is used to cache the public key used to validate the Firebase ID token (JWT). This KeyStorer type has been defined in firebase-auth-cloudflare-workers library.
If you don't specify the field, this library uses WorkersKVStoreSingle instead. You must fill in the fields defined in VerifyFirebaseAuthEnv
.
keyStoreInitializer?: (c: Context) => KeyStorer
(optional)Use this when initializing KeyStorer and environment variables, etc. are required.
If you don't specify the field, this library uses WorkersKVStoreSingle instead. You must fill in the fields defined in VerifyFirebaseAuthEnv
.
disableErrorLog?: boolean
(optional)Throws an exception if JWT validation fails. By default, this is output to the error log, but if you don't expect it, use this.
firebaseEmulatorHost?: string
(optional)You can specify a host for the Firebase Auth emulator. This config is mainly used when Service Worker Syntax is used.
If not specified, check the FIREBASE_AUTH_EMULATOR_HOST
environment variable obtained from the request.
codehex https://github.com/Code-Hex
MIT
If you are interested, send me PR would be greatly appreciated!
To test this code in your local environment, execute the following command.
$ yarn test-with-emulator
FAQs
A third-party firebase auth middleware for Hono
We found that @honojs/firebase-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.