Repository navigation
Sign in with CoinPay (bound by sub) + Connect/Disconnect - #134
Merged
Merged
Conversation
…/Disconnect on the account page - Provider "coinpay" through Better Auth's generic OAuth: OIDC discovery, PKCE S256, state, nonce bound to the id_token, id_token verified against CoinPay's JWKS (RS256), account bound to the CoinPay sub (accounts provider_id=coinpay, account_id=sub). Callback /api/v1/auth/callback/coinpay. - The profile maps to an unverified placeholder email (<sub>@coinpay.nightcell7.invalid), implicit linking by email is off, and nobody can sign up with the placeholder domain. CoinPay-only accounts are unverified, so multiplayer stays locked for them (PRD §23.1 unchanged). - Connect via link-social (needs the session); Disconnect via DELETE /api/v1/me/coinpay, refused when CoinPay is the only way in. - Sign in and register show the CoinPay button first; env COINPAY_OAUTH_CLIENT_ID/SECRET (both unset: no CoinPay sign-in). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| providerId: "credential", | ||
| accountId: "u1", | ||
| userId: "u1", | ||
| password: "salt:hash", |
ThreatCrush Security Scan2 finding(s) MEDIUM: 1 | LOW: 1
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Sign in with CoinPay to nightcell7.com.
coinpayvia Better Auth'sgenericOAuth(1.7.13): OIDC discovery, PKCE S256,state,noncebound to the id_token, id_token verified against CoinPay's JWKS (the new client is RS256), confidential client secret on the exchange. Callback (Better Auth convention):https://nightcell7.com/api/v1/auth/callback/coinpay.accounts(provider_id='coinpay', account_id=<sub>). The CoinPay profile maps to an unverified placeholderusers.email<sub>@coinpay.nightcell7.invalid;accountLinking.disableImplicitLinkingis on, so no sign-in ever joins an account by email; signing up (password or magic link) with the placeholder domain is refused. No admin/role is derived from CoinPay.link-social, which needs the session (trustedProviders: ['coinpay'],allowDifferentEmails: trueonly make explicit linking possible). Disconnect:DELETE /api/v1/me/coinpay, refused when CoinPay is the only way in (placeholder email, no password, no passkey).COINPAY_OAUTH_CLIENT_ID/SECRETare unset.Tests:
packages/auth/src/coinpay.test.tsruns the whole flow against a fake CoinPay (discovery, JWKS, token, userinfo) on Better Auth's memory adapter: a CoinPay login carrying a victim's email gets its own account bound to the sub; forged state refused; wrong nonce refused; link-social without a session is 401; the placeholder domain cannot sign up.services/apidisconnect tests. Full suite 534+4 pass,bun run typecheckclean.🤖 Generated with Claude Code