antarctic 0.3.0 → 0.5.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 (98) hide show
  1. package/dist/auth.d.ts +1 -0
  2. package/dist/client.d.ts +1 -1
  3. package/dist/client.js +2 -2
  4. package/dist/oauth2.d.ts +1 -1
  5. package/dist/oauth2.js +4 -4
  6. package/dist/providers/42.js +2 -1
  7. package/dist/providers/amazon-cognito.d.ts +1 -1
  8. package/dist/providers/amazon-cognito.js +5 -4
  9. package/dist/providers/anilist.js +2 -1
  10. package/dist/providers/apple.js +2 -1
  11. package/dist/providers/atlassian.js +2 -1
  12. package/dist/providers/auth0.d.ts +1 -1
  13. package/dist/providers/auth0.js +5 -4
  14. package/dist/providers/authentik.d.ts +1 -1
  15. package/dist/providers/authentik.js +5 -4
  16. package/dist/providers/autodesk.d.ts +1 -1
  17. package/dist/providers/autodesk.js +5 -4
  18. package/dist/providers/battlenet.js +2 -1
  19. package/dist/providers/bitbucket.js +2 -1
  20. package/dist/providers/box.js +2 -1
  21. package/dist/providers/bungie.js +2 -1
  22. package/dist/providers/coinbase.js +2 -1
  23. package/dist/providers/discord.d.ts +1 -1
  24. package/dist/providers/discord.js +5 -4
  25. package/dist/providers/donation-alerts.js +2 -1
  26. package/dist/providers/dribbble.js +2 -1
  27. package/dist/providers/dropbox.js +2 -1
  28. package/dist/providers/epicgames.js +2 -1
  29. package/dist/providers/etsy.d.ts +1 -1
  30. package/dist/providers/etsy.js +5 -4
  31. package/dist/providers/facebook.js +2 -1
  32. package/dist/providers/figma.js +2 -1
  33. package/dist/providers/gitea.d.ts +1 -1
  34. package/dist/providers/gitea.js +5 -4
  35. package/dist/providers/github.js +2 -1
  36. package/dist/providers/gitlab.js +2 -1
  37. package/dist/providers/google.d.ts +1 -1
  38. package/dist/providers/google.js +5 -4
  39. package/dist/providers/intuit.js +2 -1
  40. package/dist/providers/kakao.js +2 -1
  41. package/dist/providers/keycloak.d.ts +1 -1
  42. package/dist/providers/keycloak.js +5 -4
  43. package/dist/providers/kick.d.ts +1 -1
  44. package/dist/providers/kick.js +5 -4
  45. package/dist/providers/lichess.d.ts +1 -1
  46. package/dist/providers/lichess.js +5 -4
  47. package/dist/providers/line.d.ts +1 -1
  48. package/dist/providers/line.js +5 -4
  49. package/dist/providers/linear.js +2 -1
  50. package/dist/providers/linkedin.js +2 -1
  51. package/dist/providers/mastodon.d.ts +1 -1
  52. package/dist/providers/mastodon.js +5 -4
  53. package/dist/providers/mercadolibre.d.ts +1 -1
  54. package/dist/providers/mercadolibre.js +5 -4
  55. package/dist/providers/mercadopago.d.ts +1 -1
  56. package/dist/providers/mercadopago.js +5 -4
  57. package/dist/providers/microsoft-entra-id.d.ts +1 -1
  58. package/dist/providers/microsoft-entra-id.js +5 -4
  59. package/dist/providers/myanimelist.d.ts +1 -1
  60. package/dist/providers/myanimelist.js +5 -4
  61. package/dist/providers/naver.js +2 -1
  62. package/dist/providers/notion.js +2 -1
  63. package/dist/providers/okta.d.ts +1 -1
  64. package/dist/providers/okta.js +5 -4
  65. package/dist/providers/osu.js +2 -1
  66. package/dist/providers/patreon.js +2 -1
  67. package/dist/providers/polar.d.ts +1 -1
  68. package/dist/providers/polar.js +5 -4
  69. package/dist/providers/reddit.js +2 -1
  70. package/dist/providers/roblox.d.ts +1 -1
  71. package/dist/providers/roblox.js +5 -4
  72. package/dist/providers/salesforce.d.ts +1 -1
  73. package/dist/providers/salesforce.js +5 -4
  74. package/dist/providers/shikimori.js +2 -1
  75. package/dist/providers/slack.js +2 -1
  76. package/dist/providers/spotify.d.ts +1 -1
  77. package/dist/providers/spotify.js +5 -4
  78. package/dist/providers/startgg.js +2 -1
  79. package/dist/providers/strava.js +2 -1
  80. package/dist/providers/synology.d.ts +1 -1
  81. package/dist/providers/synology.js +2 -2
  82. package/dist/providers/tiktok.d.ts +1 -1
  83. package/dist/providers/tiktok.js +5 -4
  84. package/dist/providers/tiltify.js +2 -1
  85. package/dist/providers/tumblr.js +2 -1
  86. package/dist/providers/twitch.js +2 -1
  87. package/dist/providers/twitter.d.ts +1 -1
  88. package/dist/providers/twitter.js +5 -4
  89. package/dist/providers/vk.js +2 -1
  90. package/dist/providers/withings.js +2 -1
  91. package/dist/providers/workos.d.ts +1 -1
  92. package/dist/providers/workos.js +5 -4
  93. package/dist/providers/yahoo.js +2 -1
  94. package/dist/providers/yandex.js +2 -1
  95. package/dist/providers/zoom.d.ts +1 -1
  96. package/dist/providers/zoom.js +5 -4
  97. package/package.json +1 -4
  98. package/readme.md +1 -1
@@ -53,7 +53,8 @@ export class Slack {
53
53
  id: profileId(claims.sub),
54
54
  name: profileString(claims.name),
55
55
  email: profileString(claims.email),
56
- image: profileString(claims.picture)
56
+ image: profileString(claims.picture),
57
+ raw: claims
57
58
  };
58
59
  }
59
60
  }
@@ -7,7 +7,7 @@ export declare class Spotify {
7
7
  private auth;
8
8
  constructor(options: SpotifyOptions);
9
9
  constructor(clientId: string, clientSecret: string | null, redirectURI: string);
10
- createAuthorizationURL(state: string, codeVerifier: string | null, scopes: string[]): URL;
10
+ createAuthorizationURL(state: string, codeVerifier: string | null, scopes: string[]): Promise<URL>;
11
11
  validateAuthorizationCode(code: string, codeVerifier: string | null): Promise<OAuth2Tokens>;
12
12
  refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens>;
13
13
  getAuthorizationURL(scopes?: string[]): Promise<URL>;
@@ -17,10 +17,10 @@ export class Spotify {
17
17
  this.client = new OAuth2Client(clientIdOrOptions, clientSecret ?? null, redirectURI ?? "");
18
18
  }
19
19
  }
20
- createAuthorizationURL(state, codeVerifier, scopes) {
20
+ async createAuthorizationURL(state, codeVerifier, scopes) {
21
21
  let url;
22
22
  if (codeVerifier !== null) {
23
- url = this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
23
+ url = await this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
24
24
  }
25
25
  else {
26
26
  url = this.client.createAuthorizationURL(authorizationEndpoint, state, scopes);
@@ -39,7 +39,7 @@ export class Spotify {
39
39
  const auth = requireAuthConfig(this.auth);
40
40
  const state = generateOAuthState();
41
41
  const codeVerifier = generateOAuthCodeVerifier();
42
- const url = this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
42
+ const url = await this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
43
43
  await saveOAuthState(auth.store, state, { codeVerifier });
44
44
  return url;
45
45
  }
@@ -61,7 +61,8 @@ export class Spotify {
61
61
  id: profileId(profile.id),
62
62
  name: profileString(profile.display_name),
63
63
  email: profileString(profile.email),
64
- image
64
+ image,
65
+ raw: profile
65
66
  };
66
67
  }
67
68
  }
@@ -137,7 +137,8 @@ export class StartGG {
137
137
  id: profileId(profile.id),
138
138
  name: profileString(profile.name),
139
139
  email: profileString(profile.email),
140
- image
140
+ image,
141
+ raw: profile
141
142
  };
142
143
  }
143
144
  }
@@ -79,7 +79,8 @@ export class Strava {
79
79
  id: profileId(profile.id),
80
80
  name: name !== "" ? name : null,
81
81
  email: null,
82
- image: profileString(profile.profile)
82
+ image: profileString(profile.profile),
83
+ raw: profile
83
84
  };
84
85
  }
85
86
  }
@@ -4,6 +4,6 @@ export declare class Synology {
4
4
  private tokenEndpoint;
5
5
  private client;
6
6
  constructor(baseURL: string, applicationId: string, applicationSecret: string, redirectURI: string);
7
- createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): URL;
7
+ createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): Promise<URL>;
8
8
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<OAuth2Tokens>;
9
9
  }
@@ -9,8 +9,8 @@ export class Synology {
9
9
  this.tokenEndpoint = joinURIAndPath(baseURL, "/webman/sso/SSOAccessToken.cgi");
10
10
  this.client = new OAuth2Client(applicationId, applicationSecret, redirectURI);
11
11
  }
12
- createAuthorizationURL(state, codeVerifier, scopes) {
13
- const url = this.client.createAuthorizationURLWithPKCE(this.authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
12
+ async createAuthorizationURL(state, codeVerifier, scopes) {
13
+ const url = await this.client.createAuthorizationURLWithPKCE(this.authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
14
14
  return url;
15
15
  }
16
16
  async validateAuthorizationCode(code, codeVerifier) {
@@ -9,7 +9,7 @@ export declare class TikTok {
9
9
  private auth;
10
10
  constructor(options: TikTokOptions);
11
11
  constructor(clientKey: string, clientSecret: string, redirectURI: string);
12
- createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): URL;
12
+ createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): Promise<URL>;
13
13
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<OAuth2Tokens>;
14
14
  refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens>;
15
15
  revokeToken(token: string): Promise<void>;
@@ -28,12 +28,12 @@ export class TikTok {
28
28
  this.redirectURI = redirectURI ?? "";
29
29
  }
30
30
  }
31
- createAuthorizationURL(state, codeVerifier, scopes) {
31
+ async createAuthorizationURL(state, codeVerifier, scopes) {
32
32
  const url = new URL(authorizationEndpoint);
33
33
  url.searchParams.set("response_type", "code");
34
34
  url.searchParams.set("client_key", this.clientKey);
35
35
  url.searchParams.set("state", state);
36
- const codeChallenge = createS256CodeChallenge(codeVerifier);
36
+ const codeChallenge = await createS256CodeChallenge(codeVerifier);
37
37
  url.searchParams.set("code_challenge_method", "S256");
38
38
  url.searchParams.set("code_challenge", codeChallenge);
39
39
  if (scopes.length > 0) {
@@ -76,7 +76,7 @@ export class TikTok {
76
76
  const auth = requireAuthConfig(this.auth);
77
77
  const state = generateOAuthState();
78
78
  const codeVerifier = generateOAuthCodeVerifier();
79
- const url = this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
79
+ const url = await this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
80
80
  await saveOAuthState(auth.store, state, { codeVerifier });
81
81
  return url;
82
82
  }
@@ -103,7 +103,8 @@ export class TikTok {
103
103
  id: profileId(user.open_id),
104
104
  name: profileString(user.display_name),
105
105
  email: null,
106
- image: profileString(user.avatar_url)
106
+ image: profileString(user.avatar_url),
107
+ raw: user
107
108
  };
108
109
  }
109
110
  }
@@ -84,7 +84,8 @@ export class Tiltify {
84
84
  id: profileId(user.id),
85
85
  name: profileString(user.username),
86
86
  email: null,
87
- image
87
+ image,
88
+ raw: user
88
89
  };
89
90
  }
90
91
  }
@@ -57,7 +57,8 @@ export class Tumblr {
57
57
  id: profileId(user.name),
58
58
  name: profileString(user.name),
59
59
  email: null,
60
- image: null
60
+ image: null,
61
+ raw: user
61
62
  };
62
63
  }
63
64
  }
@@ -85,7 +85,8 @@ export class Twitch {
85
85
  id: profileId(user.id),
86
86
  name: profileString(user.display_name) ?? profileString(user.login),
87
87
  email: profileString(user.email),
88
- image: profileString(user.profile_image_url)
88
+ image: profileString(user.profile_image_url),
89
+ raw: user
89
90
  };
90
91
  }
91
92
  }
@@ -7,7 +7,7 @@ export declare class Twitter {
7
7
  private auth;
8
8
  constructor(options: TwitterOptions);
9
9
  constructor(clientId: string, clientSecret: string | null, redirectURI: string);
10
- createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): URL;
10
+ createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): Promise<URL>;
11
11
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<OAuth2Tokens>;
12
12
  refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens>;
13
13
  revokeToken(token: string): Promise<void>;
@@ -18,8 +18,8 @@ export class Twitter {
18
18
  this.client = new OAuth2Client(clientIdOrOptions, clientSecret ?? null, redirectURI ?? null);
19
19
  }
20
20
  }
21
- createAuthorizationURL(state, codeVerifier, scopes) {
22
- const url = this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
21
+ async createAuthorizationURL(state, codeVerifier, scopes) {
22
+ const url = await this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
23
23
  return url;
24
24
  }
25
25
  async validateAuthorizationCode(code, codeVerifier) {
@@ -37,7 +37,7 @@ export class Twitter {
37
37
  const auth = requireAuthConfig(this.auth);
38
38
  const state = generateOAuthState();
39
39
  const codeVerifier = generateOAuthCodeVerifier();
40
- const url = this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
40
+ const url = await this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
41
41
  await saveOAuthState(auth.store, state, { codeVerifier });
42
42
  return url;
43
43
  }
@@ -61,7 +61,8 @@ export class Twitter {
61
61
  id: profileId(user.id),
62
62
  name: profileString(user.name) ?? profileString(user.username),
63
63
  email: null,
64
- image: profileString(user.profile_image_url)
64
+ image: profileString(user.profile_image_url),
65
+ raw: user
65
66
  };
66
67
  }
67
68
  }
@@ -76,7 +76,8 @@ export class VK {
76
76
  id: profileId(user.id),
77
77
  name: nameParts.length > 0 ? nameParts.join(" ") : null,
78
78
  email,
79
- image: profileString(user.photo_200)
79
+ image: profileString(user.photo_200),
80
+ raw: user
80
81
  };
81
82
  }
82
83
  }
@@ -69,7 +69,8 @@ export class Withings {
69
69
  id: profileId(data.userid),
70
70
  name: null,
71
71
  email: null,
72
- image: null
72
+ image: null,
73
+ raw: data
73
74
  };
74
75
  }
75
76
  }
@@ -9,7 +9,7 @@ export declare class WorkOS {
9
9
  private auth;
10
10
  constructor(options: WorkOSOptions);
11
11
  constructor(clientId: string, clientSecret: string | null, redirectURI: string);
12
- createAuthorizationURL(state: string, codeVerifier: string | null): URL;
12
+ createAuthorizationURL(state: string, codeVerifier: string | null): Promise<URL>;
13
13
  validateAuthorizationCode(code: string, codeVerifier: string | null): Promise<OAuth2Tokens>;
14
14
  getAuthorizationURL(): Promise<URL>;
15
15
  getUser(query: OAuthCallbackQuery): Promise<OAuthUser>;
@@ -23,14 +23,14 @@ export class WorkOS {
23
23
  this.redirectURI = redirectURI ?? "";
24
24
  }
25
25
  }
26
- createAuthorizationURL(state, codeVerifier) {
26
+ async createAuthorizationURL(state, codeVerifier) {
27
27
  const url = new URL(authorizationEndpoint);
28
28
  url.searchParams.set("response_type", "code");
29
29
  url.searchParams.set("client_id", this.clientId);
30
30
  url.searchParams.set("state", state);
31
31
  url.searchParams.set("redirect_uri", this.redirectURI);
32
32
  if (codeVerifier !== null) {
33
- const codeChallenge = createS256CodeChallenge(codeVerifier);
33
+ const codeChallenge = await createS256CodeChallenge(codeVerifier);
34
34
  url.searchParams.set("code_challenge_method", "S256");
35
35
  url.searchParams.set("code_challenge", codeChallenge);
36
36
  }
@@ -56,7 +56,7 @@ export class WorkOS {
56
56
  const auth = requireAuthConfig(this.auth);
57
57
  const state = generateOAuthState();
58
58
  const codeVerifier = generateOAuthCodeVerifier();
59
- const url = this.createAuthorizationURL(state, codeVerifier);
59
+ const url = await this.createAuthorizationURL(state, codeVerifier);
60
60
  await saveOAuthState(auth.store, state, { codeVerifier });
61
61
  return url;
62
62
  }
@@ -76,7 +76,8 @@ export class WorkOS {
76
76
  id: profileId(profile.id),
77
77
  name: profileString(profile.name) ?? (fullName !== "" ? fullName : null),
78
78
  email: profileString(profile.email),
79
- image: profileString(profile.profile_picture_url)
79
+ image: profileString(profile.profile_picture_url),
80
+ raw: profile
80
81
  };
81
82
  }
82
83
  }
@@ -59,7 +59,8 @@ export class Yahoo {
59
59
  id: profileId(claims.sub),
60
60
  name: profileString(claims.name) ?? (fullName !== "" ? fullName : null),
61
61
  email: profileString(claims.email),
62
- image: profileString(claims.picture)
62
+ image: profileString(claims.picture),
63
+ raw: claims
63
64
  };
64
65
  }
65
66
  }
@@ -60,7 +60,8 @@ export class Yandex {
60
60
  profileString(profile.display_name) ??
61
61
  profileString(profile.login),
62
62
  email: profileString(profile.default_email),
63
- image
63
+ image,
64
+ raw: profile
64
65
  };
65
66
  }
66
67
  }
@@ -7,7 +7,7 @@ export declare class Zoom {
7
7
  private auth;
8
8
  constructor(options: ZoomOptions);
9
9
  constructor(clientId: string, clientSecret: string, redirectURI: string);
10
- createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): URL;
10
+ createAuthorizationURL(state: string, codeVerifier: string, scopes: string[]): Promise<URL>;
11
11
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<OAuth2Tokens>;
12
12
  refreshAccessToken(refreshToken: string): Promise<OAuth2Tokens>;
13
13
  revokeToken(token: string): Promise<void>;
@@ -21,8 +21,8 @@ export class Zoom {
21
21
  this.client = new OAuth2Client(clientIdOrOptions, clientSecret ?? "", redirectURI ?? "");
22
22
  }
23
23
  }
24
- createAuthorizationURL(state, codeVerifier, scopes) {
25
- const url = this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
24
+ async createAuthorizationURL(state, codeVerifier, scopes) {
25
+ const url = await this.client.createAuthorizationURLWithPKCE(authorizationEndpoint, state, CodeChallengeMethod.S256, codeVerifier, scopes);
26
26
  return url;
27
27
  }
28
28
  async validateAuthorizationCode(code, codeVerifier) {
@@ -40,7 +40,7 @@ export class Zoom {
40
40
  const auth = requireAuthConfig(this.auth);
41
41
  const state = generateOAuthState();
42
42
  const codeVerifier = generateOAuthCodeVerifier();
43
- const url = this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
43
+ const url = await this.createAuthorizationURL(state, codeVerifier, resolveScopes(scopes, auth, defaultScopes));
44
44
  await saveOAuthState(auth.store, state, { codeVerifier });
45
45
  return url;
46
46
  }
@@ -60,7 +60,8 @@ export class Zoom {
60
60
  id: profileId(profile.id),
61
61
  name: profileString(profile.display_name) ?? (fullName !== "" ? fullName : null),
62
62
  email: profileString(profile.email),
63
- image: profileString(profile.pic_url)
63
+ image: profileString(profile.pic_url),
64
+ raw: profile
64
65
  };
65
66
  }
66
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antarctic",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "High-level OAuth 2.0 clients for popular providers, forked from Arctic",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,8 +33,5 @@
33
33
  "prettier": "^3.0.3",
34
34
  "typescript": "^5.2.2",
35
35
  "vitest": "1.6.0"
36
- },
37
- "dependencies": {
38
- "@oslojs/crypto": "1.0.1"
39
36
  }
40
37
  }
package/readme.md CHANGED
@@ -57,7 +57,7 @@ Sessions, cookies, and your user database remain your responsibility: take the r
57
57
 
58
58
  ## Low-level API
59
59
 
60
- The original Arctic API is unchanged and remains available on the same objects, including the positional constructors:
60
+ Arctic's low level API remains available on the same objects, including the positional constructors. It is unchanged except that PKCE providers build the URL asynchronously, so `createAuthorizationURL()` returns a promise for them:
61
61
 
62
62
  ```ts
63
63
  import * as arctic from "antarctic";