Skip to content

feat(firebase): add shared email lookup and account status metadata - #52

Merged
rdlabo merged 2 commits into
mainfrom
feat/firebase-email-lookup
Oct 15, 2026
Merged

rdlabo merged 2 commits into
mainfrom
feat/firebase-email-lookup

Conversation

@rdlabo

@rdlabo rdlabo commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Add FirebaseVerifier.getUserByEmail() and FirebaseUserRecord so consuming applications can look up Firebase accounts by email without implementing their own client. UID and email lookups share the Identity Toolkit transport and OAuth token cache, and return disabled metadata. Account eligibility remains an application policy.

UID lookups now throw on provider failures instead of treating them as missing users. Email lookups treat only INVALID_EMAIL as no match. The API documentation describes this behavior change.

Validation

  • Type checking, lint, build, and all 521 tests pass locally. CI is rerunning for the review fixes.
  • Added regression coverage for email lookup, disabled metadata, shared OAuth caching, provider failures, malformed responses, and the global fetch receiver.
  • Independent supervisory and third-party acceptance reviews passed with no required implementation changes.
  • Verified integration in AirLec using a local package tarball, including read-only queries to Firebase from a local Worker.

Release considerations

Existing custom FirebaseVerifier implementations must add getUserByEmail().

After publishing a new package version, AirLec must update its dependency and lockfile and repeat validation from npm ci. This PR does not publish the package.


Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Comment thread packages/hono-kit/src/testing/fakes.ts Outdated
Comment on lines +36 to +40
/** Find a registered fake account by its primary email. */
async getUserByEmail(email: string): Promise<{ uid: string; email?: string } | null> {
const normalized = email.trim().toLowerCase();
const record = [...this.tokens.values()].find((user) => user.email?.toLowerCase() === normalized);
return record ? { uid: record.uid, email: record.email } : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 テスト用メール検索はトークン内の古いメールを参照する

本番は現在のアカウントを検索しますが、この Fake は登録済みトークンの email を検索し、disabled も返しません。メール変更やアカウント状態を扱うテストに使う場合、別途アカウント属性を登録できる仕組みが必要か確認してください。

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.


// firebase
export type { DecodedIdToken, FirebaseVerifier } from './firebase/firebase-verifier.js';
export type { DecodedIdToken, FirebaseVerifier, FirebaseUserRecord } from './firebase/firebase-verifier.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 公開 API 一覧にメール検索が載っていない

API 一覧には getUserByEmail と FirebaseUserRecord がありません。公開 API を一覧から探す利用者のため、更新対象か確認してください。

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@rdlabo rdlabo changed the title feat(firebase): メール検索とアカウント状態の取得を共有kitへ追加 feat(firebase): add shared email lookup and account status metadata Oct 15, 2026
@rdlabo
rdlabo merged commit 918fcc9 into main Oct 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant