feat(firebase-auth): support Hono v3 (#60)

* feat(firebase-auth): support Hono v3

* add changeset
pull/61/head
Yusuke Wada 2023-03-06 20:24:49 +09:00 committed by GitHub
parent 64045051d3
commit a798c307e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 11 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/firebase-auth': minor
---
feat: support Hono v3

View File

@ -31,13 +31,13 @@
"firebase-auth-cloudflare-workers": "^1.0.0" "firebase-auth-cloudflare-workers": "^1.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"hono": "^2.7.2" "hono": "3.*"
}, },
"devDependencies": { "devDependencies": {
"hono": "^2.7.2",
"@cloudflare/workers-types": "^3.14.1", "@cloudflare/workers-types": "^3.14.1",
"@types/jest": "^28.1.4", "@types/jest": "^28.1.4",
"firebase-tools": "^11.4.0", "firebase-tools": "^11.4.0",
"hono": "^3.0.3",
"jest": "^28.1.2", "jest": "^28.1.2",
"jest-environment-miniflare": "^2.6.0", "jest-environment-miniflare": "^2.6.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",

View File

@ -1,10 +1,11 @@
import type { EmulatorEnv, KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers' import type { KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers'
import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers' import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers'
import type { Context, MiddlewareHandler } from 'hono' import type { Context, MiddlewareHandler } from 'hono'
export interface VerifyFirebaseAuthEnv extends EmulatorEnv { export type VerifyFirebaseAuthEnv = {
PUBLIC_JWK_CACHE_KEY?: string | undefined PUBLIC_JWK_CACHE_KEY?: string | undefined
PUBLIC_JWK_CACHE_KV?: KVNamespace | undefined PUBLIC_JWK_CACHE_KV?: KVNamespace | undefined
FIREBASE_AUTH_EMULATOR_HOST: string | undefined
} }
export interface VerifyFirebaseAuthConfig { export interface VerifyFirebaseAuthConfig {
@ -24,12 +25,6 @@ const defaultKeyStoreInitializer = (c: Context): KeyStorer => {
) )
} }
type Env = {
Bindings: {
FIREBASE_AUTH_EMULATOR_HOST: string
}
}
export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): MiddlewareHandler => { export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): MiddlewareHandler => {
const config = { const config = {
projectId: userConfig.projectId, projectId: userConfig.projectId,

View File

@ -5232,6 +5232,11 @@ hono@^3.0.2:
resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.2.tgz#807a1b0514c6563917d8c278e6da7101bdac1d19" resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.2.tgz#807a1b0514c6563917d8c278e6da7101bdac1d19"
integrity sha512-jhb0eCiUTOzbOXZyXQCOk1gf3MKjV4ZXY3PRT6lzma0XPsnnHuDOHYF7RCMHYe7jhl4Y0IAzrmWXneXhOMHypA== integrity sha512-jhb0eCiUTOzbOXZyXQCOk1gf3MKjV4ZXY3PRT6lzma0XPsnnHuDOHYF7RCMHYe7jhl4Y0IAzrmWXneXhOMHypA==
hono@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.3.tgz#26b62bece753941dd3d290d03ff3338f71535017"
integrity sha512-6Lb/TPH7Me1GAjFR7k/duzTcHS5y+rxFyL6Ky0kYQQlu92l99t53CFMVcdNUpHeStarPOs4Uzl413zIvxaI15A==
hosted-git-info@^2.1.4: hosted-git-info@^2.1.4:
version "2.8.9" version "2.8.9"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"