@octane-xplat/auth 0.0.1 → 0.9.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/dist/native/AppleSignInButton.tsrx.js +63 -0
  4. package/dist/native/GoogleSignInButton.tsrx.js +35 -0
  5. package/dist/native/apple.js +63 -0
  6. package/dist/native/google.js +50 -0
  7. package/dist/native/index.js +5 -0
  8. package/dist/native/octane-client-build.json +8 -0
  9. package/dist/web/AppleSignInButton.web.tsrx.js +71 -0
  10. package/dist/web/GoogleSignInButton.web.tsrx.js +47 -0
  11. package/dist/web/apple.web.js +86 -0
  12. package/dist/web/google.web.js +130 -0
  13. package/dist/web/index.js +5 -0
  14. package/dist/web/octane-client-build.json +8 -0
  15. package/package.json +77 -10
  16. package/src/AppleSignInButton.macos.tsrx +36 -0
  17. package/src/AppleSignInButton.tsrx +46 -0
  18. package/src/AppleSignInButton.web.tsrx +54 -0
  19. package/src/GoogleSignInButton.macos.tsrx +7 -0
  20. package/src/GoogleSignInButton.tsrx +31 -0
  21. package/src/GoogleSignInButton.web.tsrx +23 -0
  22. package/src/apple.macos.ts +320 -0
  23. package/src/apple.ts +95 -0
  24. package/src/apple.web.ts +114 -0
  25. package/src/google.macos.ts +18 -0
  26. package/src/google.ts +61 -0
  27. package/src/google.web.ts +167 -0
  28. package/src/index.macos.ts +19 -0
  29. package/src/index.ts +21 -0
  30. package/src/index.web.ts +21 -0
  31. package/src/native-elements.d.ts +10 -0
  32. package/src/types.ts +147 -0
  33. package/types/generated/.tsrx-typegen-manifest.json +16 -0
  34. package/types/generated/AppleSignInButton.d.ts +5 -0
  35. package/types/generated/AppleSignInButton.web.d.ts +6 -0
  36. package/types/generated/GoogleSignInButton.d.ts +5 -0
  37. package/types/generated/GoogleSignInButton.web.d.ts +6 -0
  38. package/types/generated/apple.d.ts +2 -0
  39. package/types/generated/apple.web.d.ts +2 -0
  40. package/types/generated/google.d.ts +2 -0
  41. package/types/generated/google.web.d.ts +8 -0
  42. package/types/generated/index.d.ts +5 -0
  43. package/types/generated/index.web.d.ts +5 -0
  44. package/types/generated/types.d.ts +133 -0
  45. package/types/index.macos.d.ts +36 -0
  46. package/index.d.ts +0 -1
  47. package/index.js +0 -2
@@ -0,0 +1,5 @@
1
+ import type { AppleSignInButtonProps } from './types.js';
2
+ /** Sign in with Apple button — the platform-authentic
3
+ * ASAuthorizationAppleIDButton on iOS, a plain fallback button elsewhere.
4
+ * A tap starts `appleAuth.signIn()`; `onResult` reports the outcome. */
5
+ export declare function AppleSignInButton(props: AppleSignInButtonProps): unknown;
@@ -0,0 +1,6 @@
1
+ import type { AppleSignInButtonProps } from './types.js';
2
+ /** Sign in with Apple button — web leaf. Apple's JS API renders official
3
+ * markup only through its own stylesheet hooks, so this is a styled fallback
4
+ * matching Apple's published button spec; the click runs the popup flow via
5
+ * `appleAuth.signIn()` and reports through `onResult`. */
6
+ export declare function AppleSignInButton(props: AppleSignInButtonProps): import("octane/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { GoogleSignInButtonProps } from './types.js';
2
+ /** Google Sign-In button — the provider's button view on iOS/Android. A tap
3
+ * starts `googleAuth.signIn()`; `onResult` reports the outcome. Requires a
4
+ * `googleAuth.configure()` call first where the platform needs it. */
5
+ export declare function GoogleSignInButton(props: GoogleSignInButtonProps): unknown;
@@ -0,0 +1,6 @@
1
+ import type { GoogleSignInButtonProps } from './types.js';
2
+ /** Google Sign-In button — web leaf. Renders the official GIS button via
3
+ * `renderButton` when a `clientId` is configured; without one it falls back
4
+ * to a plain button that runs `googleAuth.signIn()` (One Tap). `onResult`
5
+ * reports the outcome either way. */
6
+ export declare function GoogleSignInButton(props: GoogleSignInButtonProps): import("octane/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { AppleAuth } from './types.js';
2
+ export declare const appleAuth: AppleAuth;
@@ -0,0 +1,2 @@
1
+ import type { AppleAuth } from './types.js';
2
+ export declare const appleAuth: AppleAuth;
@@ -0,0 +1,2 @@
1
+ import type { GoogleAuth } from './types.js';
2
+ export declare const googleAuth: GoogleAuth;
@@ -0,0 +1,8 @@
1
+ import type { GoogleAuth, SignInResult } from './types.js';
2
+ /** Internal — the button leaf renders the official GIS button into `host`. */
3
+ export declare function renderGoogleButton(host: HTMLElement, options: {
4
+ theme?: 'dark' | 'light' | 'auto';
5
+ variant?: 'standard' | 'wide' | 'icon';
6
+ width?: number;
7
+ }, onResult: (result: SignInResult) => void): Promise<void>;
8
+ export declare const googleAuth: GoogleAuth;
@@ -0,0 +1,5 @@
1
+ export { appleAuth } from './apple.js';
2
+ export { googleAuth } from './google.js';
3
+ export { AppleSignInButton } from './AppleSignInButton.js';
4
+ export { GoogleSignInButton } from './GoogleSignInButton.js';
5
+ export type { AppleAuth, AppleAuthConfig, AppleCredentialState, AppleScope, AppleSignInButtonProps, AppleSignInOptions, AuthCredential, AuthUser, GoogleAuth, GoogleAuthConfig, GoogleSignInButtonProps, GoogleSignInOptions, SignInResult, } from './types.js';
@@ -0,0 +1,5 @@
1
+ export { appleAuth } from './apple.web.js';
2
+ export { googleAuth } from './google.web.js';
3
+ export { AppleSignInButton } from './AppleSignInButton.web.js';
4
+ export { GoogleSignInButton } from './GoogleSignInButton.web.js';
5
+ export type { AppleAuth, AppleAuthConfig, AppleCredentialState, AppleScope, AppleSignInButtonProps, AppleSignInOptions, AuthCredential, AuthUser, GoogleAuth, GoogleAuthConfig, GoogleSignInButtonProps, GoogleSignInOptions, SignInResult, } from './types.js';
@@ -0,0 +1,133 @@
1
+ /** The account the provider authenticated. */
2
+ export interface AuthUser {
3
+ /** Stable subject id — Apple `user`, Google `id` (id-token `sub`). */
4
+ id: string;
5
+ email?: string;
6
+ /**
7
+ * Best-effort display name. Apple only returns name parts on the first
8
+ * authorization for an account — expect `undefined` on repeat sign-ins.
9
+ */
10
+ name?: string;
11
+ givenName?: string;
12
+ familyName?: string;
13
+ /** Google only. */
14
+ photoUrl?: string;
15
+ }
16
+ /** The provider credential — hand it to your backend for verification. */
17
+ export interface AuthCredential {
18
+ provider: 'apple' | 'google';
19
+ /** OIDC ID token (JWT). Apple `identityToken`; Google `idToken` / GIS `credential`. */
20
+ idToken?: string;
21
+ /**
22
+ * Server-side exchange code — Apple `authorizationCode`; Google
23
+ * `serverAuthCode` (requires `serverClientId` in `GoogleAuthConfig`).
24
+ */
25
+ authorizationCode?: string;
26
+ /** Google only — short-lived API access token. */
27
+ accessToken?: string;
28
+ /** Granted scopes where the provider reports them. */
29
+ scopes: string[];
30
+ user: AuthUser;
31
+ }
32
+ export type SignInResult = {
33
+ status: 'success';
34
+ credential: AuthCredential;
35
+ }
36
+ /** The user dismissed the flow, or it ended without a credential. */
37
+ | {
38
+ status: 'cancelled';
39
+ } | {
40
+ status: 'error';
41
+ message: string;
42
+ };
43
+ export type AppleScope = 'email' | 'name';
44
+ export interface AppleAuthConfig {
45
+ /**
46
+ * Web only — the Services ID registered in the Apple developer portal
47
+ * (e.g. `com.example.app.web`). Required on web; ignored natively, where
48
+ * the app id + `com.apple.developer.applesignin` entitlement is the client.
49
+ */
50
+ clientId?: string;
51
+ /** Web only — a return URL registered on the Services ID. */
52
+ redirectURI?: string;
53
+ /** Web only — run the flow in a popup instead of a full-page redirect (default true). */
54
+ usePopup?: boolean;
55
+ }
56
+ export interface AppleSignInOptions {
57
+ /** Apple data to request — maps to `EMAIL`/`FULL_NAME` native scopes. */
58
+ scopes?: AppleScope[];
59
+ /** Nonce bound into the credential — pass the value your backend issued. */
60
+ nonce?: string;
61
+ }
62
+ export type AppleCredentialState = 'authorized' | 'revoked' | 'notFound' | 'transferred'
63
+ /** Anywhere the state check can't run — Android, web. */
64
+ | 'unknown';
65
+ export interface AppleAuth {
66
+ /**
67
+ * Whether the provider's native SDK can run here — iOS 13+ and the macOS
68
+ * AppKit host (AuthenticationServices via the ObjC bridge; the packaged
69
+ * app needs the applesignin entitlement for the sheet to complete).
70
+ * False on Android. On web it reports whether a browser runtime exists;
71
+ * `configure` still needs a `clientId` before `signIn` will succeed.
72
+ */
73
+ readonly supported: boolean;
74
+ /** Store configuration; the platform SDK loads lazily on first use. */
75
+ configure(config: AppleAuthConfig): void;
76
+ signIn(options?: AppleSignInOptions): Promise<SignInResult>;
77
+ /** iOS and macOS — credential state for a prior `user.id`. */
78
+ getCredentialState(userId: string): Promise<AppleCredentialState>;
79
+ }
80
+ export interface GoogleAuthConfig {
81
+ /**
82
+ * OAuth client id — the web client id on web (required there). On iOS it
83
+ * is optional when `GIDClientID` is in the app's Info.plist; on Android the
84
+ * id comes from the google-services resources.
85
+ */
86
+ clientId?: string;
87
+ /** Your backend's web client id — makes credentials carry `authorizationCode` (server auth code). */
88
+ serverClientId?: string;
89
+ scopes?: string[];
90
+ /** Restrict to a Google Workspace domain. */
91
+ hostedDomain?: string;
92
+ }
93
+ export interface GoogleSignInOptions {
94
+ /**
95
+ * Web only — nonce bound into the id token. Scope requests go through
96
+ * `GoogleAuthConfig.scopes`; neither provider SDK takes per-call scopes.
97
+ */
98
+ nonce?: string;
99
+ }
100
+ export interface GoogleAuth {
101
+ /**
102
+ * Whether the provider SDK can run here — iOS/Android + browsers. False on
103
+ * macOS (use a hosted `authSession` flow instead). Android devices without
104
+ * Play services still report true — the sign-in call surfaces the failure.
105
+ */
106
+ readonly supported: boolean;
107
+ configure(config?: GoogleAuthConfig): Promise<void>;
108
+ signIn(options?: GoogleSignInOptions): Promise<SignInResult>;
109
+ /** Clear the SDK's account selection so the next `signIn` re-prompts. */
110
+ signOut(): Promise<void>;
111
+ }
112
+ interface SignInButtonBaseProps {
113
+ id?: string;
114
+ className?: any;
115
+ style?: any;
116
+ disabled?: boolean;
117
+ /** Tap hook — fires alongside the sign-in flow (not a gate). */
118
+ onPress?: () => void;
119
+ /** Called with the outcome of the flow the button started. */
120
+ onResult?: (result: SignInResult) => void;
121
+ }
122
+ export interface AppleSignInButtonProps extends SignInButtonBaseProps {
123
+ /** Label variant — 'default' is "Sign in with Apple". */
124
+ type?: 'default' | 'signUp' | 'continue';
125
+ theme?: 'black' | 'white' | 'whiteOutline';
126
+ }
127
+ export interface GoogleSignInButtonProps extends SignInButtonBaseProps {
128
+ /** Native button color scheme — 'dark'/'light'/'auto'. */
129
+ theme?: 'dark' | 'light' | 'auto';
130
+ /** 'wide' and 'icon' are native-only shapes; web renders 'standard'. */
131
+ variant?: 'standard' | 'wide' | 'icon';
132
+ }
133
+ export {};
@@ -0,0 +1,36 @@
1
+ import type {
2
+ AppleAuth,
3
+ AppleAuthConfig,
4
+ AppleCredentialState,
5
+ AppleScope,
6
+ AppleSignInButtonProps,
7
+ AppleSignInOptions,
8
+ AuthCredential,
9
+ AuthUser,
10
+ GoogleAuth,
11
+ GoogleAuthConfig,
12
+ GoogleSignInButtonProps,
13
+ GoogleSignInOptions,
14
+ SignInResult,
15
+ } from './generated/types.js'
16
+
17
+ export type {
18
+ AppleAuth,
19
+ AppleAuthConfig,
20
+ AppleCredentialState,
21
+ AppleScope,
22
+ AppleSignInButtonProps,
23
+ AppleSignInOptions,
24
+ AuthCredential,
25
+ AuthUser,
26
+ GoogleAuth,
27
+ GoogleAuthConfig,
28
+ GoogleSignInButtonProps,
29
+ GoogleSignInOptions,
30
+ SignInResult,
31
+ } from './generated/types.js'
32
+
33
+ export declare const appleAuth: AppleAuth
34
+ export declare const googleAuth: GoogleAuth
35
+ export declare function AppleSignInButton(props: AppleSignInButtonProps): unknown
36
+ export declare function GoogleSignInButton(props: GoogleSignInButtonProps): unknown
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- // Reservation stub; implementation will arrive in a later release.
2
- module.exports = {}