@aiveth/nextjs 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +11 -0
- package/dist/client.d.ts +16 -4
- package/dist/client.js +20 -7
- package/dist/handlers.js +4 -0
- package/dist/oidc.d.ts +9 -2
- package/dist/oidc.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0 — unreleased
|
|
4
|
+
|
|
5
|
+
- `/auth/login` passes `invitation` on to Aiveth. Set your app's sign-in page to `https://your-app/auth/login` in the Aiveth console, and invitations made for the app work with no code of yours.
|
|
6
|
+
- `loginHint` now opens Aiveth's page on that address's ways in, skipping the address screen.
|
|
7
|
+
|
|
8
|
+
## 0.10.0 — 2026-11-28
|
|
9
|
+
|
|
10
|
+
- `/auth/login` passes `connection`, `login_hint`, `ui_locales` and `screen_hint=sign-up` to Aiveth (`login_hint` was sent before but Aiveth ignored it; it now fills in the address). `<SignInButton>` / `<AivethButton>` take the same options as `@aiveth/react`; `signInHref()` builds the link.
|
|
11
|
+
|
|
3
12
|
## 0.9.1 — 2026-11-28
|
|
4
13
|
|
|
5
14
|
- Package details only: a clearer description, the author is Aiveth team, and the README names the product as Aiveth. No change in behaviour.
|
package/README.md
CHANGED
|
@@ -64,6 +64,17 @@ import { SignedIn, SignedOut, SignInButton, UserButton, useUser } from '@aiveth/
|
|
|
64
64
|
<SignedIn><UserButton /></SignedIn>
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
## Your own sign-in buttons
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<SignInButton connection="github">Continue with GitHub</SignInButton> {/* straight to GitHub */}
|
|
71
|
+
<SignInButton screenHint="sign-up">Create an account</SignInButton>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The buttons and `/auth/login` take `connection` (`google`, `microsoft`, `github`, `sso` — when your
|
|
75
|
+
organization has it on), `loginHint` (`login_hint`), `locale` (`ui_locales`) and
|
|
76
|
+
`screenHint: 'sign-up'`. `signInHref(options)` builds the link.
|
|
77
|
+
|
|
67
78
|
## Sign in in your organization's own look
|
|
68
79
|
|
|
69
80
|
```tsx
|
package/dist/client.d.ts
CHANGED
|
@@ -18,16 +18,28 @@ export declare function SignedOut({ children }: {
|
|
|
18
18
|
children: ReactNode;
|
|
19
19
|
}): import("react").JSX.Element | null;
|
|
20
20
|
/** `returnTo`: where to come back after signing in (a path on this site). */
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** What a sign-in link may ask of Aiveth — the same names as `@aiveth/react`'s `signIn`. */
|
|
22
|
+
export interface SignInLinkOptions {
|
|
23
23
|
returnTo?: string;
|
|
24
|
+
/** Straight to Google, Microsoft, GitHub or your single sign-on — when your organization has it on. */
|
|
25
|
+
connection?: 'google' | 'microsoft' | 'github' | 'sso';
|
|
26
|
+
/** The address you already know: Aiveth's page opens on its ways in. */
|
|
27
|
+
loginHint?: string;
|
|
28
|
+
/** The sign-in page's language, e.g. `'hi'`. */
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** `'sign-up'`: the sign-up page, where your organization lets people join. */
|
|
31
|
+
screenHint?: 'sign-in' | 'sign-up';
|
|
32
|
+
}
|
|
33
|
+
/** `/auth/login` with these options (the proxy passes them to Aiveth). */
|
|
34
|
+
export declare function signInHref({ returnTo, connection, loginHint, locale, screenHint }?: SignInLinkOptions): string;
|
|
35
|
+
export declare function SignInButton({ children, className, ...options }: SignInLinkOptions & {
|
|
36
|
+
children?: ReactNode;
|
|
24
37
|
className?: string;
|
|
25
38
|
}): import("react").JSX.Element;
|
|
26
39
|
/** "Sign in" in the organization's own look (Aiveth → Branding: colours, corners, font, filled
|
|
27
40
|
* or outlined), so this page and Aiveth's sign-in page look the same. */
|
|
28
|
-
export declare function AivethButton({ children,
|
|
41
|
+
export declare function AivethButton({ children, showLogo, className, style, ...options }: SignInLinkOptions & {
|
|
29
42
|
children?: ReactNode;
|
|
30
|
-
returnTo?: string;
|
|
31
43
|
showLogo?: boolean;
|
|
32
44
|
className?: string;
|
|
33
45
|
style?: CSSProperties;
|
package/dist/client.js
CHANGED
|
@@ -42,17 +42,30 @@ export function SignedOut({ children }) {
|
|
|
42
42
|
const { user, loading } = useUser();
|
|
43
43
|
return !loading && !user ? _jsx(_Fragment, { children: children }) : null;
|
|
44
44
|
}
|
|
45
|
-
/** `
|
|
46
|
-
export function
|
|
47
|
-
const
|
|
48
|
-
|
|
45
|
+
/** `/auth/login` with these options (the proxy passes them to Aiveth). */
|
|
46
|
+
export function signInHref({ returnTo, connection, loginHint, locale, screenHint } = {}) {
|
|
47
|
+
const q = new URLSearchParams();
|
|
48
|
+
if (returnTo)
|
|
49
|
+
q.set('returnTo', returnTo);
|
|
50
|
+
if (connection)
|
|
51
|
+
q.set('connection', connection);
|
|
52
|
+
if (loginHint)
|
|
53
|
+
q.set('login_hint', loginHint);
|
|
54
|
+
if (locale)
|
|
55
|
+
q.set('ui_locales', locale);
|
|
56
|
+
if (screenHint === 'sign-up')
|
|
57
|
+
q.set('screen_hint', 'sign-up');
|
|
58
|
+
const query = q.toString();
|
|
59
|
+
return query ? `${ROUTES.login}?${query}` : ROUTES.login;
|
|
60
|
+
}
|
|
61
|
+
export function SignInButton({ children = 'Sign in', className, ...options }) {
|
|
62
|
+
return _jsx("a", { href: signInHref(options), className: className, children: children });
|
|
49
63
|
}
|
|
50
64
|
/** "Sign in" in the organization's own look (Aiveth → Branding: colours, corners, font, filled
|
|
51
65
|
* or outlined), so this page and Aiveth's sign-in page look the same. */
|
|
52
|
-
export function AivethButton({ children = 'Sign in',
|
|
66
|
+
export function AivethButton({ children = 'Sign in', showLogo, className, style, ...options }) {
|
|
53
67
|
const look = useBrandLook(ROUTES.branding);
|
|
54
|
-
|
|
55
|
-
return _jsx(BrandedButton, { look: look, href: href, showLogo: showLogo, className: className, style: style, children: children });
|
|
68
|
+
return _jsx(BrandedButton, { look: look, href: signInHref(options), showLogo: showLogo, className: className, style: style, children: children });
|
|
56
69
|
}
|
|
57
70
|
export function SignOutButton({ children = 'Sign out', className }) {
|
|
58
71
|
return _jsx("a", { href: ROUTES.logout, className: className, children: children });
|
package/dist/handlers.js
CHANGED
|
@@ -22,7 +22,11 @@ export async function login(req, c) {
|
|
|
22
22
|
};
|
|
23
23
|
const to = await authorizeUrl(c, {
|
|
24
24
|
state: tx.state, nonce: tx.nonce, challenge: await challengeOf(tx.verifier),
|
|
25
|
+
connection: req.nextUrl.searchParams.get('connection') ?? undefined,
|
|
25
26
|
loginHint: req.nextUrl.searchParams.get('login_hint') ?? undefined,
|
|
27
|
+
locale: req.nextUrl.searchParams.get('ui_locales') ?? undefined,
|
|
28
|
+
screenHint: req.nextUrl.searchParams.get('screen_hint') ?? undefined,
|
|
29
|
+
invitation: req.nextUrl.searchParams.get('invitation') ?? undefined,
|
|
26
30
|
workspace: req.nextUrl.searchParams.get('workspace') ?? undefined,
|
|
27
31
|
});
|
|
28
32
|
return write(NextResponse.redirect(to), [txCookie(await seal(tx, c.cookieSecret, TX_SECONDS), secureFor(c))]);
|
package/dist/oidc.d.ts
CHANGED
|
@@ -23,11 +23,18 @@ export declare function discover(c: AivethNextConfig): Promise<Discovery>;
|
|
|
23
23
|
export declare function forgetAiveth(): void;
|
|
24
24
|
export declare function randomValue(): string;
|
|
25
25
|
export declare function challengeOf(verifier: string): Promise<string>;
|
|
26
|
-
|
|
26
|
+
/** The `/oauth/authorize` hints, by the same names as `@aiveth/react`'s `signIn` options. */
|
|
27
|
+
export interface SignInHints {
|
|
28
|
+
connection?: string;
|
|
29
|
+
loginHint?: string;
|
|
30
|
+
locale?: string;
|
|
31
|
+
screenHint?: string;
|
|
32
|
+
invitation?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function authorizeUrl(c: AivethNextConfig, a: SignInHints & {
|
|
27
35
|
state: string;
|
|
28
36
|
nonce: string;
|
|
29
37
|
challenge: string;
|
|
30
|
-
loginHint?: string;
|
|
31
38
|
workspace?: string;
|
|
32
39
|
}): Promise<string>;
|
|
33
40
|
/** The ID token's claims: signed by Aiveth, for this app, live — and, on sign-in, this nonce. */
|
package/dist/oidc.js
CHANGED
|
@@ -52,8 +52,16 @@ export async function authorizeUrl(c, a) {
|
|
|
52
52
|
response_type: 'code', client_id: c.clientId, redirect_uri: redirectUri(c), scope: c.scope,
|
|
53
53
|
state: a.state, nonce: a.nonce, code_challenge: a.challenge, code_challenge_method: 'S256',
|
|
54
54
|
});
|
|
55
|
+
if (a.connection)
|
|
56
|
+
q.set('connection', a.connection); // straight to that way in (google, microsoft, github, sso)
|
|
55
57
|
if (a.loginHint)
|
|
56
|
-
q.set('login_hint', a.loginHint);
|
|
58
|
+
q.set('login_hint', a.loginHint); // the card opens on that address's ways in
|
|
59
|
+
if (a.locale)
|
|
60
|
+
q.set('ui_locales', a.locale); // the sign-in page's language
|
|
61
|
+
if (a.screenHint === 'sign-up')
|
|
62
|
+
q.set('prompt', 'create'); // the sign-up page, where people may join
|
|
63
|
+
if (a.invitation)
|
|
64
|
+
q.set('invitation', a.invitation); // an invitation email's: join, then back here
|
|
57
65
|
if (a.workspace)
|
|
58
66
|
q.set('workspace', a.workspace); // signed in to that workspace (a member's only)
|
|
59
67
|
if (c.audience)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiveth/nextjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Official Aiveth SDK for Next.js: sign in on Aiveth's page, an encrypted session cookie, and the signed-in user on the server and in the browser.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Aiveth team",
|