UNPKG

next-auth-pubkey

Version:

A light-weight Lightning and Nostr auth provider for your Next.js app that's entirely self-hosted and plugs seamlessly into the next-auth framework.

25 lines (24 loc) 632 B
export function pickFirstQueryParam(queryParam) { if (Array.isArray(queryParam)) { return queryParam[0] || ""; } return queryParam || ""; } export function paramsToObject(params) { if (!params) return {}; const entries = params.entries(); const result = {}; for (const [key, value] of entries) { result[key] = pickFirstQueryParam(value); } return result; } export function cleanParams(params) { if (!params) return {}; return Object.entries(params).reduce((acc, [key, value]) => ({ ...acc, [key]: pickFirstQueryParam(value), }), {}); }