Vault DB 概要
Vault は Speakeasy の認証データを管理する PostgreSQL データベースです。better-auth のプラグインが生成するテーブルと、Speakeasy 独自のカスタムテーブルで構成されています。パッケージ @speakeasy/vault として提供されます。
テーブル一覧
Section titled “テーブル一覧”| # | テーブル名 | 説明 | 由来 | ドキュメント |
|---|---|---|---|---|
| 1 | user | ユーザー | better-auth core | ユーザー |
| 2 | session | セッション | better-auth core | ユーザー |
| 3 | account | OAuth アカウント連携 | better-auth core | ユーザー |
| 4 | verification | 認証トークン | better-auth core | ユーザー |
| 5 | organization | 組織 | organization plugin | 組織 |
| 6 | member | 組織メンバー | organization plugin | 組織 |
| 7 | organizationRole | カスタムロール | organization plugin | 組織 |
| 8 | memberRole | メンバーロール割当 | organization plugin | 組織 |
| 9 | invitation | 招待 | organization plugin | 組織 |
| 10 | apikey | API キー | apiKey plugin | APIキー・パスキー |
| 11 | passkey | パスキー (WebAuthn) | passkey plugin | APIキー・パスキー |
| 12 | oauthApplication | OAuth アプリ | oidcProvider plugin | OAuth |
| 13 | oauthAccessToken | OAuth アクセストークン | oidcProvider plugin | OAuth |
| 14 | oauthConsent | OAuth 同意 | oidcProvider plugin | OAuth |
| 15 | scimProvider | SCIM プロバイダー | custom | OAuth |
| 16 | outerMail | 外部メールアドレス | custom | カスタム |
| 17 | outerPhone | 外部電話番号 | custom | カスタム |
Enum 型
Section titled “Enum 型”| 名前 | 値 |
|---|---|
OrganizationType | 'individual', 'group' |
import { createVaultClient } from '@speakeasy/vault/client';
// Hyperdrive 経由でクライアント作成const db = createVaultClient(env.VAULT_HYPERDRIVE.connectionString);使用サービス
Section titled “使用サービス”| サービス | Hyperdrive バインディング | 用途 |
|---|---|---|
| Proof | VAULT_HYPERDRIVE | 認証・セッション・組織管理 |
| Bell | VAULT_HYPERDRIVE | ユーザー情報参照 |
| Vintage | PROOF_HYPERDRIVE | ユーザー情報参照 |
| Fizz | PROOF_HYPERDRIVE | ユーザー情報参照 |
| Base | PROOF_HYPERDRIVE | ユーザー情報参照 |
注意:
VAULT_HYPERDRIVEとPROOF_HYPERDRIVEは同じ Vault DB を指します。
better-auth との関係
Section titled “better-auth との関係”Vault の多くのテーブルは better-auth が管理するスキーマです。テーブルの追加・変更は better-auth のプラグイン設定に依存します。
| プラグイン | 生成テーブル |
|---|---|
| core | user, session, account, verification |
| organization | organization, member, invitation, + custom roles |
| apiKey | apikey |
| passkey | passkey |
| oidcProvider | oauthApplication, oauthAccessToken, oauthConsent |
カスタムテーブル(outerMail, outerPhone, scimProvider, organizationRole, memberRole)は Speakeasy 独自の拡張です。