LCOV - code coverage report
Current view: top level - adapter/gateway/firebase - auth.go Coverage Total Hit
Test: coverage.lcov Lines: 0.0 % 7 0
Test Date: 2026-04-14 06:42:22 Functions: - 0 0

            Line data    Source code
       1              : // Package firebase provides factories and interfaces for Firebase Admin Auth.
       2              : package firebase
       3              : 
       4              : import (
       5              :         "context"
       6              : 
       7              :         fb "firebase.google.com/go/v4/auth"
       8              : )
       9              : 
      10              : // Auth は Firebase Authentication のラッパーインターフェースです。
      11              : // アクセストークンの検証や、Firebaseユーザー情報の取得など、
      12              : // 認証関連の操作を抽象化して提供します。
      13              : type Auth interface {
      14              :         VerifyIDToken(ctx context.Context, idToken string) (*fb.Token, error)
      15              :         GetUser(ctx context.Context, uid string) (*fb.UserRecord, error)
      16              : }
      17              : 
      18              : type authWrapper struct{ c *fb.Client }
      19              : 
      20              : // NewAuth は *auth.Client をアプリ用の Auth インターフェースでラップする。
      21            0 : func NewAuth(c *fb.Client) Auth { return &authWrapper{c: c} }
      22              : 
      23              : // VerifyIDToken は、Firebase が発行した ID トークンの署名と有効期限を検証し、トークン内のクレーム情報を返します
      24            0 : func (w *authWrapper) VerifyIDToken(ctx context.Context, t string) (*fb.Token, error) {
      25            0 :         return w.c.VerifyIDToken(ctx, t)
      26            0 : }
      27              : 
      28              : // GetUser は、VerifyTokenで得られた UID を元にFirebaseのユーザーを取得します
      29            0 : func (w *authWrapper) GetUser(ctx context.Context, uid string) (*fb.UserRecord, error) {
      30            0 :         return w.c.GetUser(ctx, uid)
      31            0 : }
        

Generated by: LCOV version 2.3.1-1