Skip to content

Commit ab85b37

Browse files
committed
renaming suffix of export to Pubkey
1 parent c47b8da commit ab85b37

File tree

15 files changed

+39
-41
lines changed

15 files changed

+39
-41
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ This API will handle all of the Lightning auth API requests, such as generating
7171
```typescript
7272
// @/pages/api/pubkey/[...pubkey].ts
7373

74-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
74+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
7575
import generateQr from "next-auth-pubkey/generators/qr";
7676

77-
const config: NextAuthLightningConfig = {
77+
const config: NextAuthPubkeyConfig = {
7878
baseUrl: process.env.NEXTAUTH_URL,
7979
secret: process.env.NEXTAUTH_SECRET,
8080
storage: {
@@ -94,7 +94,7 @@ const config: NextAuthLightningConfig = {
9494
generateQr,
9595
};
9696

97-
const { lightningProvider, nostrProvider, handler } = NextAuthLightning(config);
97+
const { lightningProvider, nostrProvider, handler } = NextAuthPubkey(config);
9898

9999
export { lightningProvider, nostrProvider };
100100

@@ -145,7 +145,7 @@ There are various configurations available to you. Some are required, some are o
145145
###
146146

147147
```typescript
148-
const config: NextAuthLightningConfig = {
148+
const config: NextAuthPubkeyConfig = {
149149
/**
150150
* @param {string} baseUrl
151151
*
@@ -500,7 +500,7 @@ Data can be stored in a medium of your choice. For example: a database, a docume
500500
```typescript
501501
import { kv } from "@vercel/kv";
502502

503-
const config: NextAuthLightningConfig = {
503+
const config: NextAuthPubkeyConfig = {
504504
// ...
505505
storage: {
506506
async set({ k1, session }) {

examples/app-router/utils/nextauth.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AuthOptions } from "next-auth";
22

3-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
3+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
44
import generateQr from "next-auth-pubkey/generators/qr";
55

66
import { env } from "@/env.mjs";
@@ -9,7 +9,7 @@ import storage from "node-persist"; // ⚠️ WARNING using node-persist is not
99

1010
await storage.init();
1111

12-
const config: NextAuthLightningConfig = {
12+
const config: NextAuthPubkeyConfig = {
1313
// required
1414
baseUrl: env.NEXTAUTH_URL,
1515
secret: env.NEXTAUTH_SECRET,
@@ -32,8 +32,7 @@ const config: NextAuthLightningConfig = {
3232
generateQr,
3333
};
3434

35-
const { lightningProvider, nostrProvider, GET, POST } =
36-
NextAuthLightning(config);
35+
const { lightningProvider, nostrProvider, GET, POST } = NextAuthPubkey(config);
3736

3837
export const authOptions: AuthOptions = {
3938
providers: [lightningProvider, nostrProvider],

examples/drizzle/pages/api/pubkey/[...pubkey].ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
1+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
22
import generateQr from "next-auth-pubkey/generators/qr";
33

44
import { eq } from "drizzle-orm";
@@ -7,7 +7,7 @@ import { pubkeyTable, PubKey } from "@/schema/db";
77
import db from "@/utils/db";
88
import { env } from "@/env.mjs";
99

10-
const config: NextAuthLightningConfig = {
10+
const config: NextAuthPubkeyConfig = {
1111
// required
1212
baseUrl: env.NEXTAUTH_URL,
1313
secret: env.NEXTAUTH_SECRET,
@@ -37,7 +37,7 @@ const config: NextAuthLightningConfig = {
3737
generateQr,
3838
};
3939

40-
const { lightningProvider, nostrProvider, handler } = NextAuthLightning(config);
40+
const { lightningProvider, nostrProvider, handler } = NextAuthPubkey(config);
4141

4242
export { lightningProvider, nostrProvider };
4343

examples/kv/pages/api/pubkey/[...pubkey].ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
1+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
22
import generateQr from "next-auth-pubkey/generators/qr";
33

44
import { kv } from "@vercel/kv";
55

66
import { env } from "@/env.mjs";
77

8-
const config: NextAuthLightningConfig = {
8+
const config: NextAuthPubkeyConfig = {
99
// required
1010
baseUrl: env.NEXTAUTH_URL,
1111
secret: env.NEXTAUTH_SECRET,
@@ -28,7 +28,7 @@ const config: NextAuthLightningConfig = {
2828
generateQr,
2929
};
3030

31-
const { lightningProvider, nostrProvider, handler } = NextAuthLightning(config);
31+
const { lightningProvider, nostrProvider, handler } = NextAuthPubkey(config);
3232

3333
export { lightningProvider, nostrProvider };
3434

examples/plain-js/pages/api/pubkey/[...pubkey].js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import NextAuthLightning from "next-auth-pubkey";
1+
import NextAuthPubkey from "next-auth-pubkey";
22
import generateQr from "next-auth-pubkey/generators/qr";
33

44
import storage from "node-persist"; // ⚠️ WARNING using node-persist is not recommended in lambda or edge environments.
@@ -28,7 +28,7 @@ const config = {
2828
generateQr,
2929
};
3030

31-
const { lightningProvider, nostrProvider, handler } = NextAuthLightning(config);
31+
const { lightningProvider, nostrProvider, handler } = NextAuthPubkey(config);
3232

3333
export { lightningProvider, nostrProvider };
3434

examples/ui-app-router/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ export default async function SignIn({
5252
"use client";
5353

5454
import { useLightningPolling } from "next-auth-pubkey/hooks";
55-
import { NextAuthLightningClientSession } from "next-auth-pubkey/server";
55+
import { NextAuthPubkeyClientSession } from "next-auth-pubkey/server";
5656

5757
export default function LightningAuth({
5858
session,
5959
}: {
60-
session: NextAuthLightningClientSession;
60+
session: NextAuthPubkeyClientSession;
6161
}) {
6262
const { lnurl, qr, button } = useLightningPolling(session);
6363

examples/ui-app-router/app/components/LightningAuth.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"use client";
22

33
import { useLightningPolling } from "next-auth-pubkey/hooks";
4-
import { NextAuthLightningClientSession } from "next-auth-pubkey/server";
4+
import { NextAuthPubkeyClientSession } from "next-auth-pubkey/server";
55

66
export default function LightningAuth({
77
session,
88
}: {
9-
session: NextAuthLightningClientSession;
9+
session: NextAuthPubkeyClientSession;
1010
}) {
1111
const { lnurl, qr, button } = useLightningPolling(session);
1212

examples/ui-app-router/utils/nextauth.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AuthOptions } from "next-auth";
22

3-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
3+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
44
import generateQr from "next-auth-pubkey/generators/qr";
55

66
import { env } from "@/env.mjs";
@@ -9,7 +9,7 @@ import storage from "node-persist"; // ⚠️ WARNING using node-persist is not
99

1010
await storage.init();
1111

12-
const config: NextAuthLightningConfig = {
12+
const config: NextAuthPubkeyConfig = {
1313
// required
1414
baseUrl: env.NEXTAUTH_URL,
1515
secret: env.NEXTAUTH_SECRET,
@@ -43,8 +43,7 @@ const config: NextAuthLightningConfig = {
4343
},
4444
};
4545

46-
const { lightningProvider, nostrProvider, GET, POST } =
47-
NextAuthLightning(config);
46+
const { lightningProvider, nostrProvider, GET, POST } = NextAuthPubkey(config);
4847

4948
export const authOptions: AuthOptions = {
5049
providers: [lightningProvider, nostrProvider],

examples/ui-pages-router/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function SignIn() {
5050
```tsx
5151
import { GetServerSidePropsContext } from "next";
5252
import {
53-
NextAuthLightningClientSession,
53+
NextAuthPubkeyClientSession,
5454
createLightningAuth,
5555
} from "next-auth-pubkey/server";
5656
import { useLightningPolling } from "next-auth-pubkey/hooks";
@@ -71,7 +71,7 @@ export const getServerSideProps = async (
7171
};
7272
};
7373

74-
function SignIn({ session }: { session: NextAuthLightningClientSession }) {
74+
function SignIn({ session }: { session: NextAuthPubkeyClientSession }) {
7575
const { lnurl, qr, button } = useLightningPolling(session);
7676

7777
return (
@@ -92,7 +92,7 @@ export default function SignInPage({
9292
s: session,
9393
e: error,
9494
}: {
95-
s: NextAuthLightningClientSession | null;
95+
s: NextAuthPubkeyClientSession | null;
9696
e: string | null;
9797
}) {
9898
if (error || !session) {

examples/ui-pages-router/pages/api/pubkey/[...pubkey].ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import NextAuthLightning, { NextAuthLightningConfig } from "next-auth-pubkey";
1+
import NextAuthPubkey, { NextAuthPubkeyConfig } from "next-auth-pubkey";
22
import generateQr from "next-auth-pubkey/generators/qr";
33

44
import { env } from "@/env.mjs";
@@ -7,7 +7,7 @@ import storage from "node-persist"; // ⚠️ WARNING using node-persist is not
77

88
await storage.init();
99

10-
const config: NextAuthLightningConfig = {
10+
const config: NextAuthPubkeyConfig = {
1111
// required
1212
baseUrl: env.NEXTAUTH_URL,
1313
secret: env.NEXTAUTH_SECRET,
@@ -37,7 +37,7 @@ const config: NextAuthLightningConfig = {
3737
},
3838
};
3939

40-
const { lightningProvider, nostrProvider, handler } = NextAuthLightning(config);
40+
const { lightningProvider, nostrProvider, handler } = NextAuthPubkey(config);
4141

4242
export { lightningProvider, nostrProvider };
4343

examples/ui-pages-router/pages/lightning-signin-ssr.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { GetServerSidePropsContext } from "next";
44
import {
5-
NextAuthLightningClientSession,
5+
NextAuthPubkeyClientSession,
66
createLightningAuth,
77
} from "next-auth-pubkey/server";
88
import { useLightningPolling } from "next-auth-pubkey/hooks";
@@ -23,7 +23,7 @@ export const getServerSideProps = async (
2323
};
2424
};
2525

26-
function SignIn({ session }: { session: NextAuthLightningClientSession }) {
26+
function SignIn({ session }: { session: NextAuthPubkeyClientSession }) {
2727
const { lnurl, qr, button } = useLightningPolling(session);
2828

2929
return (
@@ -101,7 +101,7 @@ export default function SignInPage({
101101
s: session,
102102
e: error,
103103
}: {
104-
s: NextAuthLightningClientSession | null;
104+
s: NextAuthPubkeyClientSession | null;
105105
e: string | null;
106106
}) {
107107
if (error || !session) {

src/hooks/useLightningPolling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useEffect } from "react";
44
import { useRouter } from "next/navigation";
55

66
import { hardConfig } from "../main/config/hard";
7-
import { NextAuthLightningClientSession } from "../server";
7+
import { NextAuthPubkeyClientSession } from "../server";
88
import { formatLightningAuth } from "../utils/lnurl";
99
import { maxNetworkRequestsFailures } from "./constants";
1010

@@ -22,7 +22,7 @@ import { maxNetworkRequestsFailures } from "./constants";
2222
* @returns {String} qr - a url pointing the lnurl-auth QR Code image, should be used in the src prop of img tags
2323
* @returns {String} button - a deep-link that will open in Lightning enabled wallets, should be used in the href prop of anchor tags
2424
*/
25-
export function useLightningPolling(session: NextAuthLightningClientSession): {
25+
export function useLightningPolling(session: NextAuthPubkeyClientSession): {
2626
lnurl: string | null;
2727
qr: string;
2828
button: string;

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export type {
2-
StorageSession as NextAuthLightningStorageSession,
3-
UserConfig as NextAuthLightningConfig,
2+
StorageSession as NextAuthPubkeyStorageSession,
3+
UserConfig as NextAuthPubkeyConfig,
44
} from "./main/config/types";
5-
export type { NextAuthLightningClientSession } from "./server/index";
5+
export type { NextAuthPubkeyClientSession } from "./server/index";
66

77
export { default } from "./main/index";
88
export { HandlerErrorCodes as ErrorCodes } from "./main/utils/handlers";

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface PubKeyAuthProfile
5252
* @returns {String} provider - a provider that can be added to the `next-auth` config's providerArray
5353
* @returns {String} handler - an API handler to be exported in the pages/api/pubkey/[...pubkey] folder
5454
*/
55-
export default function NextAuthLightning(userConfig: UserConfig) {
55+
export default function NextAuthPubkey(userConfig: UserConfig) {
5656
const config = formatConfig(userConfig);
5757

5858
const lightningProvider: OAuthConfig<PubKeyAuthProfile> = {

src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type {
2-
LightningClientSession as NextAuthLightningClientSession,
2+
LightningClientSession as NextAuthPubkeyClientSession,
33
NostrClientSession as NextAuthNostrClientSession,
44
} from "./types";
55

0 commit comments

Comments
 (0)