diff --git a/app/(app)/dashboard/settings/profile-card.tsx b/app/(app)/dashboard/settings/profile-card.tsx index fdbb809f..3f2ed769 100644 --- a/app/(app)/dashboard/settings/profile-card.tsx +++ b/app/(app)/dashboard/settings/profile-card.tsx @@ -59,6 +59,7 @@ export function ProfileCard() { onChange={setValues} errors={errors} disabled={!loaded} + importOpenProfile /> {error &&

{error}

}
diff --git a/app/api/v1/coinpay/oauth/callback/route.ts b/app/api/v1/coinpay/oauth/callback/route.ts index 02f942be..418d807d 100644 --- a/app/api/v1/coinpay/oauth/callback/route.ts +++ b/app/api/v1/coinpay/oauth/callback/route.ts @@ -1,4 +1,6 @@ import { saveGlobalWalletProfile } from "@/lib/coinpay-wallets"; +import { saveOpenProfileContact } from "@profullstack/profile"; +import { profileStore } from "@/lib/profile"; import type { GlobalCoinpayWallet } from "@/lib/coinpay-wallet-data"; import { NextResponse, type NextRequest } from "next/server"; import { createClient } from "@/lib/supabase/server"; @@ -72,6 +74,10 @@ export async function GET(req: NextRequest) { return back(failPath, "CoinPay sign-in failed. Try again."); } if (!resolved.ok) return back(failPath, resolved.error); + if (pending.mode === "connect" && claims.openprofile_url) { + try { await saveOpenProfileContact(profileStore(), resolved.userId, claims.openprofile_url); } + catch { console.warn("[coinpay-signin] OpenProfile import skipped"); } + } if (wallets) { try { await saveGlobalWalletProfile(sb, resolved.userId, claims.sub, wallets); } catch { return back(pending.next, "Could not save CoinPay wallets. Reconnect to try again."); } diff --git a/bun.lock b/bun.lock index 01f91a0a..acca0b7b 100644 --- a/bun.lock +++ b/bun.lock @@ -16,7 +16,7 @@ "@profullstack/fleetbar": "0.2.0", "@profullstack/footer": "latest", "@profullstack/hqtui": "^0.11.0", - "@profullstack/profile": "0.1.6", + "@profullstack/profile": "0.1.7", "@profullstack/redeem-credits": "^0.2.0", "@profullstack/referrals": "^0.1.0", "@profullstack/stack": "^0.5.0", @@ -334,7 +334,9 @@ "@profullstack/keys": ["@profullstack/keys@0.1.0", "", {}, "sha512-Vys47LvS5ivhdZu4SYOxh9Le3DEmWhjP0+CtrU45RhXAbY0ZFG/2Dk9V1bIIUGDp8UWMJqctvUD21JrNjfh04w=="], - "@profullstack/profile": ["@profullstack/profile@0.1.6", "", { "peerDependencies": { "@libsql/client": ">=0.6.0", "postgres": "^3.4.0", "react": ">=18" }, "optionalPeers": ["@libsql/client", "postgres", "react"], "bin": { "profile": "src/cli.js" } }, "sha512-xkn0P3ANz151QJdlBwcBXkHk813qW9qAmuTZKcuvpEZYkyHDC9J9KfvpVSRepfjECzz4ONGHWO5Zwc4BHpfK8g=="], + "@profullstack/openprofile": ["@profullstack/openprofile@0.2.0", "", {}, "sha512-cdFsBbfRXurvy5KqHDNcKXxurK2s/YlfVgnILFRpVl2hq3860rExqDee8IfsFGxw5cPdqGv2fxUxtek1Xy2U5Q=="], + + "@profullstack/profile": ["@profullstack/profile@0.1.7", "", { "dependencies": { "@profullstack/openprofile": "^0.2.0" }, "peerDependencies": { "@libsql/client": ">=0.6.0", "postgres": "^3.4.0", "react": ">=18" }, "optionalPeers": ["@libsql/client", "postgres", "react"], "bin": { "profile": "src/cli.js" } }, "sha512-N7UkypkkY2JkSBKzmdmyy6+DCoxI048qUZQksEjSRwSIyy4mjU9H1qW4yhZD+LJBhTEupgJv//Uxwhiy2FuGmA=="], "@profullstack/redeem-credits": ["@profullstack/redeem-credits@0.2.0", "", { "bin": { "redeem-credits": "dist/cli.js" } }, "sha512-JLowb7mWYfouIK7O522tuPPhvLjQjhdEfm6g3xEYrlNLGzLhrIADDhrYldBlGHfiVBWUFX7wefLuCSLF9fnyog=="], diff --git a/lib/coinpay-signin.ts b/lib/coinpay-signin.ts index 812539f2..e396af30 100644 --- a/lib/coinpay-signin.ts +++ b/lib/coinpay-signin.ts @@ -119,7 +119,7 @@ export function stateMatches(expected: string | null | undefined, got: string | return a.length === b.length && timingSafeEqual(a, b); } -export type CoinpayClaims = { sub: string; email: string | null; name: string | null }; +export type CoinpayClaims = { sub: string; email: string | null; name: string | null; openprofile_url?: string }; /** * Check the ID token that came straight back from the token endpoint over TLS @@ -187,6 +187,7 @@ export async function fetchCoinpayClaims( sub: info.sub, email: typeof info.email === "string" && info.email.includes("@") ? info.email.slice(0, 320) : null, name: typeof info.name === "string" && info.name.trim() ? info.name.trim().slice(0, 200) : null, + ...(typeof info.openprofile_url === "string" ? { openprofile_url: info.openprofile_url } : {}), }, }; } diff --git a/package.json b/package.json index 2f8d0898..78eff40f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@profullstack/fleetbar": "0.2.0", "@profullstack/footer": "latest", "@profullstack/hqtui": "^0.11.0", - "@profullstack/profile": "0.1.6", + "@profullstack/profile": "0.1.7", "@profullstack/redeem-credits": "^0.2.0", "@profullstack/referrals": "^0.1.0", "@profullstack/stack": "^0.5.0",