@spfn/auth 0.2.0-beta.66 → 0.2.0-beta.67

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/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _spfn_core_nextjs from '@spfn/core/nextjs';
2
- import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, U as UserProfile, c as ProfileInfo, m as mainAuthRouter } from './authenticate-DKGNvSsH.js';
3
- export { i as AuthInitOptions, A as AuthSession, g as PERMISSION_CATEGORIES, h as PermissionCategory, f as VERIFICATION_PURPOSES, e as VERIFICATION_TARGET_TYPES, d as VerificationPurpose, V as VerificationTargetType } from './authenticate-DKGNvSsH.js';
2
+ import { R as RoleConfig, P as PermissionConfig, C as CheckAccountExistsResult, S as SendVerificationCodeResult, a as RegisterResult, L as LoginResult, b as RotateKeyResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, c as OAuthNativeResult, U as UserProfile, d as ProfileInfo, m as mainAuthRouter } from './authenticate-Cn5krz5U.js';
3
+ export { j as AuthInitOptions, A as AuthSession, h as PERMISSION_CATEGORIES, i as PermissionCategory, g as VERIFICATION_PURPOSES, f as VERIFICATION_TARGET_TYPES, e as VerificationPurpose, V as VerificationTargetType } from './authenticate-Cn5krz5U.js';
4
4
  import * as _spfn_core_route from '@spfn/core/route';
5
5
  import { HttpMethod } from '@spfn/core/route';
6
- export { I as INVITATION_STATUSES, b as InvitationStatus, a as KEY_ALGORITHM, K as KeyAlgorithmType, S as SOCIAL_PROVIDERS, d as SocialProvider, U as USER_STATUSES, c as UserStatus } from './types-B4auHIax.js';
6
+ export { I as INVITATION_STATUSES, b as InvitationStatus, a as KEY_ALGORITHM, K as KeyAlgorithmType, S as SOCIAL_PROVIDERS, d as SocialProvider, U as USER_STATUSES, c as UserStatus } from './types-BtksCI9X.js';
7
7
  import * as _sinclair_typebox from '@sinclair/typebox';
8
8
  import '@spfn/auth/server';
9
9
 
@@ -195,7 +195,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
195
195
  }, {}, Response>;
196
196
  oauthStart: _spfn_core_route.RouteDef<{
197
197
  body: _sinclair_typebox.TObject<{
198
- provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver" | "superself">[]>;
198
+ provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
199
199
  returnUrl: _sinclair_typebox.TString;
200
200
  publicKey: _sinclair_typebox.TString;
201
201
  keyId: _sinclair_typebox.TString;
@@ -205,7 +205,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
205
205
  }>;
206
206
  }, {}, OAuthStartResult>;
207
207
  oauthProviders: _spfn_core_route.RouteDef<{}, {}, {
208
- providers: ("google" | "github" | "kakao" | "naver" | "superself")[];
208
+ providers: ("google" | "apple" | "github" | "kakao" | "naver" | "superself")[];
209
209
  }>;
210
210
  getGoogleOAuthUrl: _spfn_core_route.RouteDef<{
211
211
  body: _sinclair_typebox.TObject<{
@@ -229,7 +229,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
229
229
  }>;
230
230
  oauthProviderStart: _spfn_core_route.RouteDef<{
231
231
  params: _sinclair_typebox.TObject<{
232
- provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver" | "superself">[]>;
232
+ provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
233
233
  }>;
234
234
  query: _sinclair_typebox.TObject<{
235
235
  state: _sinclair_typebox.TString;
@@ -237,7 +237,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
237
237
  }, {}, Response>;
238
238
  oauthProviderCallback: _spfn_core_route.RouteDef<{
239
239
  params: _sinclair_typebox.TObject<{
240
- provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver" | "superself">[]>;
240
+ provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
241
241
  }>;
242
242
  query: _sinclair_typebox.TObject<{
243
243
  code: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
@@ -248,7 +248,7 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
248
248
  }, {}, Response>;
249
249
  getProviderOAuthUrl: _spfn_core_route.RouteDef<{
250
250
  params: _sinclair_typebox.TObject<{
251
- provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "github" | "kakao" | "naver" | "superself">[]>;
251
+ provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
252
252
  }>;
253
253
  body: _sinclair_typebox.TObject<{
254
254
  returnUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
@@ -257,6 +257,23 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
257
257
  }, {}, {
258
258
  authUrl: string;
259
259
  }>;
260
+ oauthNative: _spfn_core_route.RouteDef<{
261
+ params: _sinclair_typebox.TObject<{
262
+ provider: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"google" | "apple" | "github" | "kakao" | "naver" | "superself">[]>;
263
+ }>;
264
+ body: _sinclair_typebox.TObject<{
265
+ idToken: _sinclair_typebox.TString;
266
+ nonce: _sinclair_typebox.TString;
267
+ publicKey: _sinclair_typebox.TString;
268
+ keyId: _sinclair_typebox.TString;
269
+ fingerprint: _sinclair_typebox.TString;
270
+ algorithm: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"ES256" | "RS256">[]>;
271
+ profile: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
272
+ name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
273
+ }>>;
274
+ metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TUnknown>>;
275
+ }>;
276
+ }, {}, OAuthNativeResult>;
260
277
  getInvitation: _spfn_core_route.RouteDef<{
261
278
  params: _sinclair_typebox.TObject<{
262
279
  token: _sinclair_typebox.TString;
package/dist/index.js CHANGED
@@ -29,6 +29,12 @@ var InvalidTokenError = class extends UnauthorizedError {
29
29
  this.name = "InvalidTokenError";
30
30
  }
31
31
  };
32
+ var InvalidSocialTokenError = class extends UnauthorizedError {
33
+ constructor(data = {}) {
34
+ super({ message: data.message || "Invalid social id_token", details: data.details });
35
+ this.name = "InvalidSocialTokenError";
36
+ }
37
+ };
32
38
  var TokenExpiredError = class extends UnauthorizedError {
33
39
  constructor(data = {}) {
34
40
  super({ message: data.message || "Authentication token has expired", details: data.details });
@@ -146,6 +152,7 @@ var authErrorRegistry = new ErrorRegistry();
146
152
  authErrorRegistry.append([
147
153
  InvalidCredentialsError,
148
154
  InvalidTokenError,
155
+ InvalidSocialTokenError,
149
156
  TokenExpiredError,
150
157
  KeyExpiredError,
151
158
  AccountDisabledError,
@@ -194,6 +201,7 @@ var routeMap = {
194
201
  oauthProviderStart: { method: "GET", path: "/_auth/oauth/:provider" },
195
202
  oauthProviderCallback: { method: "GET", path: "/_auth/oauth/:provider/callback" },
196
203
  getProviderOAuthUrl: { method: "POST", path: "/_auth/oauth/:provider/url" },
204
+ oauthNative: { method: "POST", path: "/_auth/oauth/:provider/native" },
197
205
  listRoles: { method: "GET", path: "/_auth/admin/roles" },
198
206
  createAdminRole: { method: "POST", path: "/_auth/admin/roles" },
199
207
  updateAdminRole: { method: "PATCH", path: "/_auth/admin/roles/:id" },
@@ -336,7 +344,7 @@ var BUILTIN_ROLE_PERMISSIONS = {
336
344
  var KEY_ALGORITHM = ["ES256", "RS256"];
337
345
  var INVITATION_STATUSES = ["pending", "accepted", "expired", "cancelled"];
338
346
  var USER_STATUSES = ["active", "inactive", "suspended"];
339
- var SOCIAL_PROVIDERS = ["google", "github", "kakao", "naver", "superself"];
347
+ var SOCIAL_PROVIDERS = ["google", "apple", "github", "kakao", "naver", "superself"];
340
348
 
341
349
  // ../../node_modules/.pnpm/@sinclair+typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
342
350
  var value_exports = {};