@draftlab/auth 0.16.0 → 0.17.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/dist/esm/allow.js +1 -1
- package/dist/esm/client.js +2 -2
- package/dist/esm/core.js +10 -10
- package/dist/esm/index.js +1 -1
- package/dist/esm/keys.js +3 -3
- package/dist/esm/provider/apple.js +1 -1
- package/dist/esm/provider/code.js +1 -1
- package/dist/esm/provider/discord.js +1 -1
- package/dist/esm/provider/facebook.js +1 -1
- package/dist/esm/provider/github.js +1 -1
- package/dist/esm/provider/gitlab.js +1 -1
- package/dist/esm/provider/google.js +1 -1
- package/dist/esm/provider/linkedin.js +1 -1
- package/dist/esm/provider/magiclink.js +1 -1
- package/dist/esm/provider/microsoft.js +1 -1
- package/dist/esm/provider/oauth2.js +4 -4
- package/dist/esm/provider/password.js +4 -4
- package/dist/esm/provider/reddit.js +1 -1
- package/dist/esm/provider/slack.js +1 -1
- package/dist/esm/provider/spotify.js +1 -1
- package/dist/esm/provider/twitch.js +1 -1
- package/dist/esm/provider/vercel.js +1 -1
- package/dist/esm/revocation.js +1 -1
- package/dist/esm/storage/memory.js +1 -1
- package/dist/esm/storage/turso.js +1 -1
- package/dist/esm/storage/unstorage.js +1 -1
- package/dist/esm/toolkit/client.js +3 -3
- package/dist/esm/toolkit/index.js +7 -7
- package/dist/esm/ui/code.js +4 -4
- package/dist/esm/ui/magiclink.js +4 -4
- package/dist/esm/ui/password.js +3 -3
- package/dist/esm/ui/select.js +2 -2
- package/package.json +2 -1
package/dist/esm/allow.js
CHANGED
package/dist/esm/client.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
InvalidAuthorizationCodeError,
|
|
6
6
|
InvalidRefreshTokenError,
|
|
7
7
|
InvalidSubjectError
|
|
8
|
-
} from "./error";
|
|
9
|
-
import { generatePKCE } from "./pkce";
|
|
8
|
+
} from "./error.js";
|
|
9
|
+
import { generatePKCE } from "./pkce.js";
|
|
10
10
|
var createClient = (input) => {
|
|
11
11
|
const jwksCache = new Map;
|
|
12
12
|
const issuerCache = new Map;
|
package/dist/esm/core.js
CHANGED
|
@@ -3,21 +3,21 @@ import { Hono } from "hono";
|
|
|
3
3
|
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
4
4
|
import { cors } from "hono/cors";
|
|
5
5
|
import { CompactEncrypt, compactDecrypt, SignJWT } from "jose";
|
|
6
|
-
import { defaultAllowCheck } from "./allow";
|
|
6
|
+
import { defaultAllowCheck } from "./allow.js";
|
|
7
7
|
import {
|
|
8
8
|
MissingParameterError,
|
|
9
9
|
OauthError,
|
|
10
10
|
UnauthorizedClientError,
|
|
11
11
|
UnknownStateError
|
|
12
|
-
} from "./error";
|
|
13
|
-
import { encryptionKeys, signingKeys } from "./keys";
|
|
14
|
-
import { validatePKCE } from "./pkce";
|
|
15
|
-
import { generateSecureToken } from "./random";
|
|
16
|
-
import { Revocation } from "./revocation";
|
|
17
|
-
import { Storage } from "./storage/storage";
|
|
18
|
-
import { setTheme } from "./themes/theme";
|
|
19
|
-
import { Select } from "./ui/select";
|
|
20
|
-
import { getRelativeUrl, lazy } from "./util";
|
|
12
|
+
} from "./error.js";
|
|
13
|
+
import { encryptionKeys, signingKeys } from "./keys.js";
|
|
14
|
+
import { validatePKCE } from "./pkce.js";
|
|
15
|
+
import { generateSecureToken } from "./random.js";
|
|
16
|
+
import { Revocation } from "./revocation.js";
|
|
17
|
+
import { Storage } from "./storage/storage.js";
|
|
18
|
+
import { setTheme } from "./themes/theme.js";
|
|
19
|
+
import { Select } from "./ui/select.js";
|
|
20
|
+
import { getRelativeUrl, lazy } from "./util.js";
|
|
21
21
|
var normalizeTimingAsync = async (fn, minTimeMs = 100) => {
|
|
22
22
|
const startTime = performance.now();
|
|
23
23
|
const result = await fn();
|
package/dist/esm/index.js
CHANGED
package/dist/esm/keys.js
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
importPKCS8,
|
|
8
8
|
importSPKI
|
|
9
9
|
} from "jose";
|
|
10
|
-
import { Mutex } from "./mutex";
|
|
11
|
-
import { generateSecureToken } from "./random";
|
|
12
|
-
import { Storage } from "./storage/storage";
|
|
10
|
+
import { Mutex } from "./mutex.js";
|
|
11
|
+
import { generateSecureToken } from "./random.js";
|
|
12
|
+
import { Storage } from "./storage/storage.js";
|
|
13
13
|
var signingAlg = "ES256";
|
|
14
14
|
var encryptionAlg = "RSA-OAEP-512";
|
|
15
15
|
var signingKeyMutex = new Mutex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/provider/code.ts
|
|
2
|
-
import { generateUnbiasedDigits, timingSafeCompare } from "../random";
|
|
2
|
+
import { generateUnbiasedDigits, timingSafeCompare } from "../random.js";
|
|
3
3
|
var CodeProvider = (config) => {
|
|
4
4
|
const codeLength = config.length || 6;
|
|
5
5
|
const generateCode = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/provider/magiclink.ts
|
|
2
|
-
import { generateUnbiasedDigits, timingSafeCompare } from "../random";
|
|
2
|
+
import { generateUnbiasedDigits, timingSafeCompare } from "../random.js";
|
|
3
3
|
var MagicLinkProvider = (config) => {
|
|
4
4
|
const generateToken = () => {
|
|
5
5
|
return generateUnbiasedDigits(32);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/provider/oauth2.ts
|
|
2
2
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
3
|
-
import { OauthError } from "../error";
|
|
4
|
-
import { generatePKCE } from "../pkce";
|
|
5
|
-
import { generateSecureToken, timingSafeCompare } from "../random";
|
|
6
|
-
import { getRelativeUrl } from "../util";
|
|
3
|
+
import { OauthError } from "../error.js";
|
|
4
|
+
import { generatePKCE } from "../pkce.js";
|
|
5
|
+
import { generateSecureToken, timingSafeCompare } from "../random.js";
|
|
6
|
+
import { getRelativeUrl } from "../util.js";
|
|
7
7
|
var Oauth2Provider = (config) => {
|
|
8
8
|
const authQuery = config.query || {};
|
|
9
9
|
const handleCallbackLogic = async (c, ctx, provider, code) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/provider/password.ts
|
|
2
|
-
import { UnknownStateError } from "../error";
|
|
3
|
-
import { generateUnbiasedDigits, timingSafeCompare } from "../random";
|
|
4
|
-
import { Storage } from "../storage/storage";
|
|
5
|
-
import { getRelativeUrl } from "../util";
|
|
2
|
+
import { UnknownStateError } from "../error.js";
|
|
3
|
+
import { generateUnbiasedDigits, timingSafeCompare } from "../random.js";
|
|
4
|
+
import { Storage } from "../storage/storage.js";
|
|
5
|
+
import { getRelativeUrl } from "../util.js";
|
|
6
6
|
import { TextEncoder } from "node:util";
|
|
7
7
|
import * as jose from "jose";
|
|
8
8
|
import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
package/dist/esm/revocation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/storage/memory.ts
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { writeFile } from "node:fs/promises";
|
|
4
|
-
import { joinKey, splitKey } from "./storage";
|
|
4
|
+
import { joinKey, splitKey } from "./storage.js";
|
|
5
5
|
var MemoryStorage = (options) => {
|
|
6
6
|
const store = [];
|
|
7
7
|
const isValidStoreData = (data) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/toolkit/client.ts
|
|
2
|
-
import { generatePKCE } from "../pkce";
|
|
3
|
-
import { createSessionStorage } from "./storage";
|
|
4
|
-
import { generateSecureRandom } from "./utils";
|
|
2
|
+
import { generatePKCE } from "../pkce.js";
|
|
3
|
+
import { createSessionStorage } from "./storage.js";
|
|
4
|
+
import { generateSecureRandom } from "./utils.js";
|
|
5
5
|
var createOAuthClient = (config) => {
|
|
6
6
|
const storage = config.storage || (typeof sessionStorage !== "undefined" ? createSessionStorage() : null);
|
|
7
7
|
if (!storage) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/toolkit/index.ts
|
|
2
|
-
import { generatePKCE } from "../pkce";
|
|
3
|
-
import { createOAuthClient } from "./client";
|
|
4
|
-
import { FacebookStrategy } from "./providers/facebook";
|
|
5
|
-
import { GitHubStrategy } from "./providers/github";
|
|
6
|
-
import { GoogleStrategy } from "./providers/google";
|
|
2
|
+
import { generatePKCE } from "../pkce.js";
|
|
3
|
+
import { createOAuthClient } from "./client.js";
|
|
4
|
+
import { FacebookStrategy } from "./providers/facebook.js";
|
|
5
|
+
import { GitHubStrategy } from "./providers/github.js";
|
|
6
|
+
import { GoogleStrategy } from "./providers/google.js";
|
|
7
7
|
import {
|
|
8
8
|
createCookieStorage,
|
|
9
9
|
createLocalStorage,
|
|
10
10
|
createMemoryStorage,
|
|
11
11
|
createSessionStorage
|
|
12
|
-
} from "./storage";
|
|
13
|
-
import { generateSecureRandom } from "./utils";
|
|
12
|
+
} from "./storage.js";
|
|
13
|
+
import { generateSecureRandom } from "./utils.js";
|
|
14
14
|
export {
|
|
15
15
|
generateSecureRandom,
|
|
16
16
|
generatePKCE,
|
package/dist/esm/ui/code.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/ui/code.tsx
|
|
2
|
-
import { UnknownStateError } from "../error";
|
|
3
|
-
import { run } from "../util";
|
|
4
|
-
import { Layout } from "./base";
|
|
5
|
-
import { FormAlert } from "./form";
|
|
2
|
+
import { UnknownStateError } from "../error.js";
|
|
3
|
+
import { run } from "../util.js";
|
|
4
|
+
import { Layout } from "./base.js";
|
|
5
|
+
import { FormAlert } from "./form.js";
|
|
6
6
|
import { jsxDEV } from "hono/jsx/jsx-dev-runtime";
|
|
7
7
|
var DEFAULT_COPY = {
|
|
8
8
|
email_placeholder: "Email",
|
package/dist/esm/ui/magiclink.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/ui/magiclink.tsx
|
|
2
|
-
import { UnknownStateError } from "../error";
|
|
3
|
-
import { run } from "../util";
|
|
4
|
-
import { Layout } from "./base";
|
|
5
|
-
import { FormAlert } from "./form";
|
|
2
|
+
import { UnknownStateError } from "../error.js";
|
|
3
|
+
import { run } from "../util.js";
|
|
4
|
+
import { Layout } from "./base.js";
|
|
5
|
+
import { FormAlert } from "./form.js";
|
|
6
6
|
import { jsxDEV } from "hono/jsx/jsx-dev-runtime";
|
|
7
7
|
var DEFAULT_COPY = {
|
|
8
8
|
email_placeholder: "Email",
|
package/dist/esm/ui/password.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/ui/password.tsx
|
|
2
|
-
import { run } from "../util";
|
|
3
|
-
import { Layout } from "./base";
|
|
4
|
-
import { FormAlert } from "./form";
|
|
2
|
+
import { run } from "../util.js";
|
|
3
|
+
import { Layout } from "./base.js";
|
|
4
|
+
import { FormAlert } from "./form.js";
|
|
5
5
|
import { jsxDEV, Fragment } from "hono/jsx/jsx-dev-runtime";
|
|
6
6
|
var DEFAULT_COPY = {
|
|
7
7
|
error_email_taken: "There is already an account with this email.",
|
package/dist/esm/ui/select.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/ui/select.tsx
|
|
2
|
-
import { Layout } from "./base";
|
|
2
|
+
import { Layout } from "./base.js";
|
|
3
3
|
import {
|
|
4
4
|
ICON_APPLE,
|
|
5
5
|
ICON_DISCORD,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ICON_SLACK,
|
|
15
15
|
ICON_SPOTIFY,
|
|
16
16
|
ICON_TWITCH
|
|
17
|
-
} from "./icon";
|
|
17
|
+
} from "./icon.js";
|
|
18
18
|
import { jsxDEV } from "hono/jsx/jsx-dev-runtime";
|
|
19
19
|
var PROVIDER_ICONS = {
|
|
20
20
|
apple: ICON_APPLE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftlab/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core implementation for @draftlab/auth",
|
|
6
6
|
"author": "Matheus Pergoli",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@types/bun": "^1.3.6",
|
|
40
41
|
"typescript": "^5.9.3",
|
|
41
42
|
"@draftlab/tsconfig": "0.1.0"
|
|
42
43
|
},
|