@baliola/auth-sdk 0.4.0 → 0.4.1
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 +38 -21
- package/README.md +14 -4
- package/dist/{authError-DbEZJnC4.js → authError-CYUAl2Jt.js} +1 -0
- package/dist/{authError-C5g5jP5l.d.ts → authError-DgPEjTfW.d.ts} +1 -0
- package/dist/client/index.js +1 -1
- package/dist/{client-CX3XFmOA.js → client-DU_DerYi.js} +17 -27
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +38 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@baliola/auth-sdk` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.4.1
|
|
6
|
+
|
|
7
|
+
- chore(sdk): internal cleanup, no public API change. Removed dead code (the
|
|
8
|
+
unused `bearer-only-passthrough` auth-header mode, the throw-only
|
|
9
|
+
`refreshResponseShape` type helper, and the redundant `stripUndefined` body
|
|
10
|
+
helper, since the transport already drops `undefined` keys via
|
|
11
|
+
`JSON.stringify`), narrowed the internal request method union to the verbs
|
|
12
|
+
actually used (GET / POST), and deduplicated internal wire types against the
|
|
13
|
+
public `RegisterResult` / `ResendCodeResult`.
|
|
14
|
+
- chore(packaging): `viem` is now declared an **optional** peer dependency
|
|
15
|
+
(`peerDependenciesMeta`). It is only needed by the `./wallet` subpath, so
|
|
16
|
+
consumers who never import a wallet no longer have it auto-installed by npm 7+
|
|
17
|
+
and no longer see a missing-peer warning. Wallet users must install `viem`
|
|
18
|
+
themselves, which the wallet setup already required.
|
|
19
|
+
- Repo: this package moved out of the `baliola-auth` backend monorepo into its
|
|
20
|
+
own repository at `baliola/baliola-auth-sdk`. Package name, npm scope, and
|
|
21
|
+
every import path are unchanged.
|
|
22
|
+
|
|
5
23
|
## 0.4.0
|
|
6
24
|
|
|
7
25
|
- feat(sdk): add `auth.getProfile()` → `GET /profile`. Returns `{ account, profile }` where `account` carries the **live** account status (read from the database, not the token) and `profile` is the account's profile record (`displayName`, `avatarUrl`, `primaryEmail`, `primaryPhone`) or `null` when none exists yet. New exported types: `Profile`, `ProfileResult`.
|
|
@@ -9,17 +27,17 @@ All notable changes to `@baliola/auth-sdk` are documented here.
|
|
|
9
27
|
|
|
10
28
|
## 0.3.0
|
|
11
29
|
|
|
12
|
-
- feat(sdk): add the custodial wallet namespace
|
|
13
|
-
- feat(sdk): add `createRemoteSigner` under the `./wallet` subpath
|
|
30
|
+
- feat(sdk): add the custodial wallet namespace: `auth.wallet.getAddress()` (`GET /auth/wallet`, provisioned on first read) and `auth.wallet.signHash(hash)` (`POST /auth/wallet/sign`).
|
|
31
|
+
- feat(sdk): add `createRemoteSigner` under the `./wallet` subpath, a viem-compatible account whose `signMessage({ raw })` delegates to `POST /auth/wallet/sign`, so the custodial private key never leaves baliola-auth.
|
|
14
32
|
|
|
15
33
|
## 0.2.0
|
|
16
34
|
|
|
17
35
|
Distribution change and clean-ups; no method-level API changes.
|
|
18
36
|
|
|
19
|
-
- chore(release): publish to **public npm** (`https://registry.npmjs.org`) instead of GitHub Packages. Installing no longer requires a Personal Access Token, an `.npmrc` registry override, or SSO authorization
|
|
37
|
+
- chore(release): publish to **public npm** (`https://registry.npmjs.org`) instead of GitHub Packages. Installing no longer requires a Personal Access Token, an `.npmrc` registry override, or SSO authorization. Plain `bun add @baliola/auth-sdk` works in every environment.
|
|
20
38
|
- docs: rewrite `README.md`, `docs/install.md`, `docs/ciSetup.md`, and `docs/troubleshooting.md` to reflect public-npm install. CI snippets no longer need build secrets.
|
|
21
39
|
- Consumers previously installing from GitHub Packages should remove any `@baliola:registry=https://npm.pkg.github.com` entries from `~/.npmrc` and project-local `.npmrc` files before upgrading.
|
|
22
|
-
- fix(types): realign `AccessTokenPayload` with the server's current JWT shape. The flat `projectId?: string | null` / `projectName?: string | null` pair is replaced by `projects: AccessTokenPayloadProject[]` (each entry carries `{ id, name, clientId }`). Type-only change
|
|
40
|
+
- fix(types): realign `AccessTokenPayload` with the server's current JWT shape. The flat `projectId?: string | null` / `projectName?: string | null` pair is replaced by `projects: AccessTokenPayloadProject[]` (each entry carries `{ id, name, clientId }`). Type-only change, affecting consumers that decode the JWT manually and reference this type. A scoped login (`clientId` supplied) yields a single-entry array; a central login yields every project the account has active roles in.
|
|
23
41
|
- chore!: remove the `./internal` subpath export and the `internal/` source folder (`createValidateCache`, `newIdempotencyKey`, `consumeHeaders`). Those helpers targeted the retired `/internal/api-keys/*` endpoints and the static "internal token" concept. Service-to-service callers now authenticate with an admin-tier API key (`baliola_admin_…`) against `/admin/api-keys/*`; cache + idempotency helpers for that surface will ship in a dedicated admin SDK.
|
|
24
42
|
|
|
25
43
|
## 0.1.0
|
|
@@ -28,7 +46,7 @@ Breaking redesign of the auth API and SDK surface to eliminate dev confusion bet
|
|
|
28
46
|
|
|
29
47
|
### Breaking changes
|
|
30
48
|
|
|
31
|
-
- feat(sdk)!: replace the flat method surface with namespaced flows
|
|
49
|
+
- feat(sdk)!: replace the flat method surface with namespaced flows: `auth.emailOtp.*`, `auth.emailPassword.*`, `auth.google.*`. The namespaces match the DB provider names (`email_otp`, `email_password`).
|
|
32
50
|
- feat(sdk)!: rename verb-overloaded methods so each one's purpose is unambiguous at the call site:
|
|
33
51
|
- `auth.requestEmailOtp` → `auth.emailOtp.sendLoginCode`
|
|
34
52
|
- `auth.verifyEmailOtp` → `auth.emailOtp.verifyLoginCode`
|
|
@@ -39,14 +57,14 @@ Breaking redesign of the auth API and SDK surface to eliminate dev confusion bet
|
|
|
39
57
|
- `auth.changePassword` → `auth.emailPassword.changePassword`
|
|
40
58
|
- `auth.loginWithGoogle` → `auth.google.login`
|
|
41
59
|
- feat(sdk)!: verify-code methods take `{ email, code }` instead of `{ email, otp }`.
|
|
42
|
-
- feat(sdk)!: `auth.emailPassword.register` no longer branches on `'otp_sent' | 'linked'
|
|
43
|
-
- feat(sdk)!: send/resend/register success responses replace `expiresInMinutes` with a structured `OtpInfo` payload
|
|
60
|
+
- feat(sdk)!: `auth.emailPassword.register` no longer branches on `'otp_sent' | 'linked'`. It always sends a verification OTP and returns `{ otp: OtpInfo }`. The single-step "linked" path is removed.
|
|
61
|
+
- feat(sdk)!: send/resend/register success responses replace `expiresInMinutes` with a structured `OtpInfo` payload: `expiresInSeconds`, `expiresAt`, `canResendInSeconds`, `resendsRemaining`.
|
|
44
62
|
- feat(sdk)!: backend endpoint paths renamed to match the namespaces: `POST /auth/email-otp/send-login-code`, `/auth/email-otp/verify-login-code`, `/auth/email-otp/resend-login-code`, `/auth/email-password/register`, `/auth/email-password/verify-registration-code`, `/auth/email-password/resend-registration-code`, etc.
|
|
45
63
|
|
|
46
64
|
### New features
|
|
47
65
|
|
|
48
|
-
- feat(sdk): add typed error subclasses under `AuthError
|
|
49
|
-
- feat(sdk): add dedicated resend methods
|
|
66
|
+
- feat(sdk): add typed error subclasses under `AuthError`: `OtpInvalidError` (with `attemptsRemaining`, `canResendInSeconds`), `OtpExpiredError`, `MaxAttemptsError` (with `retryAfterSeconds`), `NoPendingOtpError`, `ResendCooldownError` (with `canResendInSeconds`), `MaxResendsError`, `InvalidCredentialsError`, `NoPasswordSetError`, `AccountSuspendedError`, `EmailAlreadyHasPasswordError`, `CaptchaFailedError`, `RateLimitedError` (with `retryAfterSeconds`, `retryAfterHuman`), `InvalidPasswordError` (with `reason`), `InvalidEmailError`. Branch on `instanceof` for TS narrowing, or `err.code` for stable string matching. Backend responses now carry the structured context fields via `error.details` so the SDK lifts them into the typed properties.
|
|
67
|
+
- feat(sdk): add dedicated resend methods: `auth.emailOtp.resendLoginCode` and `auth.emailPassword.resendRegistrationCode`. Each enforces its own resend cooldown (`OTP_RESEND_COOLDOWN_SECONDS`, default 60s) and per-OTP cap (`OTP_MAX_RESENDS`, default 3) on top of the per-OTP attempts limit.
|
|
50
68
|
- feat(sdk): add `captchaToken` option on every public unauthenticated entrypoint (`sendLoginCode`, `resendLoginCode`, `register`, `resendRegistrationCode`, `login`). Backend verifies via Cloudflare Turnstile when `TURNSTILE_SECRET_KEY` is set; dev bypass when unset; server-to-server clients can be allowlisted via `CAPTCHA_BYPASS_CLIENT_IDS`.
|
|
51
69
|
- feat(sdk): `auth.emailOtp.sendLoginCode` response includes `flow: 'login' | 'signup'` and `methods: ('password' | 'passwordless')[]` so the UI can adapt to the account state without an extra round-trip.
|
|
52
70
|
|
|
@@ -57,30 +75,29 @@ Breaking redesign of the auth API and SDK surface to eliminate dev confusion bet
|
|
|
57
75
|
|
|
58
76
|
## 0.0.5
|
|
59
77
|
|
|
60
|
-
- feat(sdk): add cross-tab session sync via `BroadcastChannel
|
|
78
|
+
- feat(sdk): add cross-tab session sync via `BroadcastChannel`. When one tab logs in, logs out, or refreshes the access token, every other tab on the same origin updates its in-memory mirror in real time.
|
|
61
79
|
- feat(sdk): add `auth.fetch({ requireAuth: true })` per-call option that throws `AuthError(401)` before sending when no session is loaded.
|
|
62
80
|
- feat(sdk): add `auth.fetch({ disableRefresh: true })` per-call option that skips both proactive and reactive refresh, letting a 401 propagate to the caller.
|
|
63
81
|
|
|
64
82
|
## 0.0.4
|
|
65
83
|
|
|
66
|
-
- feat(sdk): add `changePassword({ currentPassword, newPassword })` paired with `POST /auth/email-password/change-password` server route
|
|
84
|
+
- feat(sdk): add `changePassword({ currentPassword, newPassword })` paired with `POST /auth/email-password/change-password` server route. It verifies the current password, rotates the bcrypt hash, revokes every other session for the account (caller stays signed in), and sends a confirmation email out-of-band.
|
|
67
85
|
- chore(auth): relax password policy to require only 8+ characters and at least one uppercase letter (number and special-character requirements dropped).
|
|
68
86
|
|
|
69
87
|
## 0.0.3
|
|
70
88
|
|
|
71
|
-
-
|
|
72
|
-
- feat(sdk): expose `Project.allowedOrigins` on `AuthSession`
|
|
89
|
+
- feat(sdk): expose `Project.allowedOrigins` on `AuthSession`, so a consumer can read the origins a project accepts without a second call.
|
|
73
90
|
|
|
74
91
|
## 0.0.2
|
|
75
92
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
- docs(sdk): add README
|
|
81
|
-
- test(sdk): add unit tests for client, transport, and store
|
|
82
|
-
- feat(sdk): implement auth client with auto-refresh, session mirror, and consumer fetch helper
|
|
93
|
+
The first usable release. 0.0.1 published the package shell; this one puts a working client inside it.
|
|
94
|
+
|
|
95
|
+
- feat(sdk): implement the auth client, with proactive and reactive access-token refresh, the in-memory session mirror, and the `auth.fetch` helper that attaches the access token for consumers.
|
|
96
|
+
- refactor(sdk): drop pre-release version labels from public JSDoc, so published docs no longer advertise a version that moves every release.
|
|
97
|
+
- docs(sdk): add the README API reference plus the install, troubleshooting, and CI setup guides, and move the roadmap out to `ROADMAP.md`.
|
|
83
98
|
|
|
84
99
|
## 0.0.1
|
|
85
100
|
|
|
86
|
-
- feat(sdk): scaffold `@baliola/auth-sdk` package config
|
|
101
|
+
- feat(sdk): scaffold the `@baliola/auth-sdk` package config. Package shell and build only, no client implementation yet.
|
|
102
|
+
|
|
103
|
+
These 0.0.x releases went to GitHub Packages, not public npm. 0.2.0 moved distribution to public npm, and nothing below 0.2.0 is installable from the public registry.
|
package/README.md
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Client SDK for the Baliola Auth service. Two clearly separated email flows (passwordless OTP, password + verification OTP) plus Google login, with typed methods, typed errors, auto-refresh, and cross-tab sync.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Guides:
|
|
6
|
+
|
|
7
|
+
- [docs/concepts.md](./docs/concepts.md): flows, session mirror, refresh, cross-tab sync, errors.
|
|
8
|
+
- [docs/install.md](./docs/install.md): install and first call.
|
|
9
|
+
- [docs/ciSetup.md](./docs/ciSetup.md): installing this SDK in your own pipeline.
|
|
10
|
+
- [docs/troubleshooting.md](./docs/troubleshooting.md): install and build symptoms.
|
|
6
11
|
|
|
7
12
|
## Install
|
|
8
13
|
|
|
@@ -18,11 +23,14 @@ Published to public npm under the `@baliola` scope — no registry config or aut
|
|
|
18
23
|
|
|
19
24
|
## Quick start
|
|
20
25
|
|
|
26
|
+
`AUTH_URL` below is the base URL of the Baliola Auth deployment you are targeting. It differs per
|
|
27
|
+
environment. Baliola developers: the per-environment values are in the internal integration docs.
|
|
28
|
+
|
|
21
29
|
```ts
|
|
22
30
|
import { createAuthClient, localStorageStore, OtpInvalidError } from '@baliola/auth-sdk';
|
|
23
31
|
|
|
24
32
|
const auth = createAuthClient({
|
|
25
|
-
baseUrl:
|
|
33
|
+
baseUrl: AUTH_URL,
|
|
26
34
|
clientId: 'your-project-client-id', // omit for a central multi-project login
|
|
27
35
|
store: localStorageStore(), // omit for in-memory (server-side / tests)
|
|
28
36
|
});
|
|
@@ -234,7 +242,7 @@ Cross-tab sync (login / logout / refresh) is automatic via `BroadcastChannel`, r
|
|
|
234
242
|
|
|
235
243
|
```ts
|
|
236
244
|
createAuthClient({
|
|
237
|
-
baseUrl:
|
|
245
|
+
baseUrl: AUTH_URL, // required, no trailing slash
|
|
238
246
|
clientId: 'your-project-client-id', // optional; scopes the session to one project. Omit for a central login that carries every project the account has active roles in.
|
|
239
247
|
store: memoryStore(), // default; or localStorageStore() / custom
|
|
240
248
|
fetch: globalThis.fetch, // override for tests / interceptors
|
|
@@ -263,6 +271,8 @@ if (session) {
|
|
|
263
271
|
}
|
|
264
272
|
```
|
|
265
273
|
|
|
274
|
+
`decodeJwt` reads claims without checking the signature, which is fine on the client where the token came from your own session. A service that trusts the token for authorization must verify it: the tokens are EdDSA (Ed25519), issuer `baliola-auth`, and the public keys are served at `GET /.well-known/jwks.json` on the same `baseUrl`.
|
|
275
|
+
|
|
266
276
|
## Sample response shapes
|
|
267
277
|
|
|
268
278
|
**`auth.emailOtp.sendLoginCode` success:**
|
|
@@ -297,7 +307,7 @@ if (session) {
|
|
|
297
307
|
|
|
298
308
|
```json
|
|
299
309
|
{
|
|
300
|
-
"accessToken": "
|
|
310
|
+
"accessToken": "eyJhbGciOiJFZERTQSIs...",
|
|
301
311
|
"refreshToken": "session-uuid",
|
|
302
312
|
"expiresIn": 3600,
|
|
303
313
|
"account": { "id": "...", "email": "user@example.com", "status": "active" },
|
|
@@ -32,6 +32,7 @@ var AuthError = class extends Error {
|
|
|
32
32
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
/** Concrete subclasses with structured fields lifted from `details` */
|
|
35
36
|
var OtpInvalidError = class extends AuthError {
|
|
36
37
|
attemptsRemaining;
|
|
37
38
|
canResendInSeconds;
|
|
@@ -30,6 +30,7 @@ declare class AuthError extends Error {
|
|
|
30
30
|
readonly cause?: unknown;
|
|
31
31
|
constructor(init: AuthErrorInit);
|
|
32
32
|
}
|
|
33
|
+
/** Concrete subclasses with structured fields lifted from `details` */
|
|
33
34
|
declare class OtpInvalidError extends AuthError {
|
|
34
35
|
readonly attemptsRemaining: number;
|
|
35
36
|
readonly canResendInSeconds: number;
|
package/dist/client/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createAuthClient } from "../client-
|
|
1
|
+
import { t as createAuthClient } from "../client-DU_DerYi.js";
|
|
2
2
|
export { createAuthClient };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as authErrorFromResponse, g as authErrorFromFetchFailure, n as AuthError } from "./authError-
|
|
1
|
+
import { _ as authErrorFromResponse, g as authErrorFromFetchFailure, n as AuthError } from "./authError-CYUAl2Jt.js";
|
|
2
2
|
import { n as memoryStore } from "./sessionStore-DD6lON9W.js";
|
|
3
3
|
//#region src/client/methods.ts
|
|
4
4
|
function toAuthSession(data) {
|
|
@@ -23,21 +23,17 @@ function createMethods(ctx) {
|
|
|
23
23
|
clientId: ctx.clientId
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
const stripUndefined = (body) => {
|
|
27
|
-
const out = {};
|
|
28
|
-
for (const [k, v] of Object.entries(body)) if (v !== void 0) out[k] = v;
|
|
29
|
-
return out;
|
|
30
|
-
};
|
|
31
26
|
return {
|
|
27
|
+
/** emailOtp.* (passwordless) */
|
|
32
28
|
async sendLoginCode(input) {
|
|
33
29
|
return ctx.transport.request({
|
|
34
30
|
path: "/auth/email-otp/send-login-code",
|
|
35
31
|
method: "POST",
|
|
36
32
|
authMode: "none",
|
|
37
|
-
body:
|
|
33
|
+
body: withClientId({
|
|
38
34
|
email: input.email,
|
|
39
35
|
captchaToken: input.captchaToken
|
|
40
|
-
})
|
|
36
|
+
})
|
|
41
37
|
});
|
|
42
38
|
},
|
|
43
39
|
async verifyLoginCode(input) {
|
|
@@ -56,22 +52,23 @@ function createMethods(ctx) {
|
|
|
56
52
|
path: "/auth/email-otp/resend-login-code",
|
|
57
53
|
method: "POST",
|
|
58
54
|
authMode: "none",
|
|
59
|
-
body:
|
|
55
|
+
body: withClientId({
|
|
60
56
|
email: input.email,
|
|
61
57
|
captchaToken: input.captchaToken
|
|
62
|
-
})
|
|
58
|
+
})
|
|
63
59
|
});
|
|
64
60
|
},
|
|
61
|
+
/** emailPassword.* (password flow) */
|
|
65
62
|
async register(input) {
|
|
66
63
|
return ctx.transport.request({
|
|
67
64
|
path: "/auth/email-password/register",
|
|
68
65
|
method: "POST",
|
|
69
66
|
authMode: "none",
|
|
70
|
-
body:
|
|
67
|
+
body: withClientId({
|
|
71
68
|
email: input.email,
|
|
72
69
|
password: input.password,
|
|
73
70
|
captchaToken: input.captchaToken
|
|
74
|
-
})
|
|
71
|
+
})
|
|
75
72
|
});
|
|
76
73
|
},
|
|
77
74
|
async verifyRegistrationCode(input) {
|
|
@@ -90,10 +87,10 @@ function createMethods(ctx) {
|
|
|
90
87
|
path: "/auth/email-password/resend-registration-code",
|
|
91
88
|
method: "POST",
|
|
92
89
|
authMode: "none",
|
|
93
|
-
body:
|
|
90
|
+
body: withClientId({
|
|
94
91
|
email: input.email,
|
|
95
92
|
captchaToken: input.captchaToken
|
|
96
|
-
})
|
|
93
|
+
})
|
|
97
94
|
});
|
|
98
95
|
},
|
|
99
96
|
async loginWithPassword(input) {
|
|
@@ -101,11 +98,11 @@ function createMethods(ctx) {
|
|
|
101
98
|
path: "/auth/email-password/login",
|
|
102
99
|
method: "POST",
|
|
103
100
|
authMode: "none",
|
|
104
|
-
body:
|
|
101
|
+
body: withClientId({
|
|
105
102
|
email: input.email,
|
|
106
103
|
password: input.password,
|
|
107
104
|
captchaToken: input.captchaToken
|
|
108
|
-
})
|
|
105
|
+
})
|
|
109
106
|
}));
|
|
110
107
|
},
|
|
111
108
|
async setPassword(input) {
|
|
@@ -127,6 +124,7 @@ function createMethods(ctx) {
|
|
|
127
124
|
}
|
|
128
125
|
});
|
|
129
126
|
},
|
|
127
|
+
/** google.* */
|
|
130
128
|
async loginWithGoogle(input) {
|
|
131
129
|
return toAuthSession(await ctx.transport.request({
|
|
132
130
|
path: "/auth/google/login",
|
|
@@ -135,6 +133,7 @@ function createMethods(ctx) {
|
|
|
135
133
|
body: withClientId({ idToken: input.idToken })
|
|
136
134
|
}));
|
|
137
135
|
},
|
|
136
|
+
/** wallet.* */
|
|
138
137
|
async getWalletAddress() {
|
|
139
138
|
return ctx.transport.request({
|
|
140
139
|
path: "/auth/wallet",
|
|
@@ -150,6 +149,7 @@ function createMethods(ctx) {
|
|
|
150
149
|
body: { hash }
|
|
151
150
|
});
|
|
152
151
|
},
|
|
152
|
+
/** profile */
|
|
153
153
|
async getProfile() {
|
|
154
154
|
return ctx.transport.request({
|
|
155
155
|
path: "/profile",
|
|
@@ -157,20 +157,13 @@ function createMethods(ctx) {
|
|
|
157
157
|
authMode: "bearer+session"
|
|
158
158
|
});
|
|
159
159
|
},
|
|
160
|
+
/** session lifecycle */
|
|
160
161
|
async logoutRequest() {
|
|
161
162
|
await ctx.transport.request({
|
|
162
163
|
path: "/auth/logout",
|
|
163
164
|
method: "POST",
|
|
164
165
|
authMode: "bearer+session"
|
|
165
166
|
});
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* Type-only helper: declares the refresh response shape so consumers
|
|
169
|
-
* pulling the inferred Methods type don't break. Refresh itself is
|
|
170
|
-
* handled by transport.refreshSession() to keep stampede protection.
|
|
171
|
-
*/
|
|
172
|
-
refreshResponseShape() {
|
|
173
|
-
throw new Error("refreshResponseShape is a type-only helper");
|
|
174
167
|
}
|
|
175
168
|
};
|
|
176
169
|
}
|
|
@@ -202,9 +195,6 @@ function createTransport(options) {
|
|
|
202
195
|
case "session-only":
|
|
203
196
|
headers.set("X-Session-ID", session.refreshToken);
|
|
204
197
|
break;
|
|
205
|
-
case "bearer-only-passthrough":
|
|
206
|
-
headers.set("Authorization", `Bearer ${session.accessToken}`);
|
|
207
|
-
break;
|
|
208
198
|
case "none": break;
|
|
209
199
|
}
|
|
210
200
|
return headers;
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as authErrorFromFetchFailure, a as EmailAlreadyHasPasswordError, c as InvalidPasswordError, d as NoPasswordSetError, f as NoPendingOtpError, g as ResendCooldownError, h as RateLimitedError, i as CaptchaFailedError, l as MaxAttemptsError, m as OtpInvalidError, n as AuthError, o as InvalidCredentialsError, p as OtpExpiredError, r as AuthErrorInit, s as InvalidEmailError, t as AccountSuspendedError, u as MaxResendsError, v as authErrorFromResponse } from "../authError-
|
|
1
|
+
import { _ as authErrorFromFetchFailure, a as EmailAlreadyHasPasswordError, c as InvalidPasswordError, d as NoPasswordSetError, f as NoPendingOtpError, g as ResendCooldownError, h as RateLimitedError, i as CaptchaFailedError, l as MaxAttemptsError, m as OtpInvalidError, n as AuthError, o as InvalidCredentialsError, p as OtpExpiredError, r as AuthErrorInit, s as InvalidEmailError, t as AccountSuspendedError, u as MaxResendsError, v as authErrorFromResponse } from "../authError-DgPEjTfW.js";
|
|
2
2
|
export { AccountSuspendedError, AuthError, type AuthErrorInit, CaptchaFailedError, EmailAlreadyHasPasswordError, InvalidCredentialsError, InvalidEmailError, InvalidPasswordError, MaxAttemptsError, MaxResendsError, NoPasswordSetError, NoPendingOtpError, OtpExpiredError, OtpInvalidError, RateLimitedError, ResendCooldownError, authErrorFromFetchFailure, authErrorFromResponse };
|
package/dist/errors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as authErrorFromResponse, a as InvalidCredentialsError, c as MaxAttemptsError, d as NoPendingOtpError, f as OtpExpiredError, g as authErrorFromFetchFailure, h as ResendCooldownError, i as EmailAlreadyHasPasswordError, l as MaxResendsError, m as RateLimitedError, n as AuthError, o as InvalidEmailError, p as OtpInvalidError, r as CaptchaFailedError, s as InvalidPasswordError, t as AccountSuspendedError, u as NoPasswordSetError } from "../authError-
|
|
1
|
+
import { _ as authErrorFromResponse, a as InvalidCredentialsError, c as MaxAttemptsError, d as NoPendingOtpError, f as OtpExpiredError, g as authErrorFromFetchFailure, h as ResendCooldownError, i as EmailAlreadyHasPasswordError, l as MaxResendsError, m as RateLimitedError, n as AuthError, o as InvalidEmailError, p as OtpInvalidError, r as CaptchaFailedError, s as InvalidPasswordError, t as AccountSuspendedError, u as NoPasswordSetError } from "../authError-CYUAl2Jt.js";
|
|
2
2
|
export { AccountSuspendedError, AuthError, CaptchaFailedError, EmailAlreadyHasPasswordError, InvalidCredentialsError, InvalidEmailError, InvalidPasswordError, MaxAttemptsError, MaxResendsError, NoPasswordSetError, NoPendingOtpError, OtpExpiredError, OtpInvalidError, RateLimitedError, ResendCooldownError, authErrorFromFetchFailure, authErrorFromResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { a as OtpInfo, c as ResendCodeResult, i as ErrorSource, l as SendLoginCo
|
|
|
2
2
|
import { a as GoogleNamespace, c as WalletNamespace, d as ProfileResult, f as AuthFetchInit, i as EmailPasswordNamespace, l as createAuthClient, n as CreateAuthClientOptions, o as ProactiveRefreshConfig, r as EmailOtpNamespace, s as SubscribeOptions, t as AuthClient, u as Profile } from "./index-B2RuGLX_.js";
|
|
3
3
|
import { i as memoryStore, n as SessionStore, r as localStorageStore, t as LocalStorageStoreOptions } from "./sessionStore-BDdEpbL8.js";
|
|
4
4
|
import { a as RegisterInput, c as SendLoginCodeInput, d as VerifyRegistrationCodeInput, i as LoginWithPasswordInput, l as SetPasswordInput, n as ChangePasswordInput, o as ResendLoginCodeInput, r as LoginWithGoogleInput, s as ResendRegistrationCodeInput, t as CaptchaArgs, u as VerifyLoginCodeInput } from "./requests-eTORIjY5.js";
|
|
5
|
-
import { _ as authErrorFromFetchFailure, a as EmailAlreadyHasPasswordError, c as InvalidPasswordError, d as NoPasswordSetError, f as NoPendingOtpError, g as ResendCooldownError, h as RateLimitedError, i as CaptchaFailedError, l as MaxAttemptsError, m as OtpInvalidError, n as AuthError, o as InvalidCredentialsError, p as OtpExpiredError, r as AuthErrorInit, s as InvalidEmailError, t as AccountSuspendedError, u as MaxResendsError, v as authErrorFromResponse } from "./authError-
|
|
5
|
+
import { _ as authErrorFromFetchFailure, a as EmailAlreadyHasPasswordError, c as InvalidPasswordError, d as NoPasswordSetError, f as NoPendingOtpError, g as ResendCooldownError, h as RateLimitedError, i as CaptchaFailedError, l as MaxAttemptsError, m as OtpInvalidError, n as AuthError, o as InvalidCredentialsError, p as OtpExpiredError, r as AuthErrorInit, s as InvalidEmailError, t as AccountSuspendedError, u as MaxResendsError, v as authErrorFromResponse } from "./authError-DgPEjTfW.js";
|
|
6
6
|
import { n as AccessTokenPayloadProject, t as AccessTokenPayload } from "./tokens-BXrPLi5B.js";
|
|
7
7
|
|
|
8
8
|
//#region src/types/wallet.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createAuthClient } from "./client-
|
|
2
|
-
import { _ as authErrorFromResponse, a as InvalidCredentialsError, c as MaxAttemptsError, d as NoPendingOtpError, f as OtpExpiredError, g as authErrorFromFetchFailure, h as ResendCooldownError, i as EmailAlreadyHasPasswordError, l as MaxResendsError, m as RateLimitedError, n as AuthError, o as InvalidEmailError, p as OtpInvalidError, r as CaptchaFailedError, s as InvalidPasswordError, t as AccountSuspendedError, u as NoPasswordSetError } from "./authError-
|
|
1
|
+
import { t as createAuthClient } from "./client-DU_DerYi.js";
|
|
2
|
+
import { _ as authErrorFromResponse, a as InvalidCredentialsError, c as MaxAttemptsError, d as NoPendingOtpError, f as OtpExpiredError, g as authErrorFromFetchFailure, h as ResendCooldownError, i as EmailAlreadyHasPasswordError, l as MaxResendsError, m as RateLimitedError, n as AuthError, o as InvalidEmailError, p as OtpInvalidError, r as CaptchaFailedError, s as InvalidPasswordError, t as AccountSuspendedError, u as NoPasswordSetError } from "./authError-CYUAl2Jt.js";
|
|
3
3
|
import { n as memoryStore, t as localStorageStore } from "./sessionStore-DD6lON9W.js";
|
|
4
4
|
export { AccountSuspendedError, AuthError, CaptchaFailedError, EmailAlreadyHasPasswordError, InvalidCredentialsError, InvalidEmailError, InvalidPasswordError, MaxAttemptsError, MaxResendsError, NoPasswordSetError, NoPendingOtpError, OtpExpiredError, OtpInvalidError, RateLimitedError, ResendCooldownError, authErrorFromFetchFailure, authErrorFromResponse, createAuthClient, localStorageStore, memoryStore };
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baliola/auth-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Client SDK for Baliola Auth",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"auth",
|
|
7
|
+
"authentication",
|
|
8
|
+
"passwordless",
|
|
9
|
+
"otp",
|
|
10
|
+
"email-otp",
|
|
11
|
+
"jwt",
|
|
12
|
+
"session",
|
|
13
|
+
"sdk",
|
|
14
|
+
"typescript",
|
|
15
|
+
"esm",
|
|
16
|
+
"baliola"
|
|
17
|
+
],
|
|
5
18
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
19
|
"author": "Baliola Development Team",
|
|
7
20
|
"type": "module",
|
|
@@ -41,26 +54,47 @@
|
|
|
41
54
|
"README.md",
|
|
42
55
|
"CHANGELOG.md"
|
|
43
56
|
],
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=20.3.0"
|
|
59
|
+
},
|
|
44
60
|
"publishConfig": {
|
|
45
61
|
"registry": "https://registry.npmjs.org",
|
|
46
62
|
"access": "public"
|
|
47
63
|
},
|
|
48
64
|
"repository": {
|
|
49
65
|
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/baliola/baliola-auth.git"
|
|
51
|
-
|
|
66
|
+
"url": "git+https://github.com/baliola/baliola-auth-sdk.git"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/baliola/baliola-auth-sdk#readme",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/baliola/baliola-auth-sdk/issues"
|
|
52
71
|
},
|
|
53
72
|
"scripts": {
|
|
54
73
|
"build": "tsdown",
|
|
55
74
|
"typecheck": "bash scripts/typecheck.sh",
|
|
56
75
|
"test": "bun test test/unit",
|
|
76
|
+
"lint": "eslint",
|
|
77
|
+
"lint:fix": "eslint --fix",
|
|
78
|
+
"format": "prettier --write \"{src,test}/**/*.ts\" \"*.ts\"",
|
|
79
|
+
"format:check": "prettier --check \"{src,test}/**/*.ts\" \"*.ts\"",
|
|
57
80
|
"prepublishOnly": "bun run build"
|
|
58
81
|
},
|
|
59
82
|
"peerDependencies": { "viem": "^2.47.6" },
|
|
83
|
+
"peerDependenciesMeta": { "viem": { "optional": true } },
|
|
60
84
|
"devDependencies": {
|
|
61
|
-
"@
|
|
85
|
+
"@eslint/js": "^10.0.1",
|
|
86
|
+
"@types/bun": "^1.4.0",
|
|
87
|
+
"eslint": "^10.7.0",
|
|
88
|
+
"eslint-config-prettier": "^10.1.8",
|
|
89
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
90
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
91
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
92
|
+
"globals": "^17.7.0",
|
|
93
|
+
"jiti": "^2.7.0",
|
|
94
|
+
"prettier": "3.8.1",
|
|
62
95
|
"tsdown": "^0.21.10",
|
|
63
96
|
"typescript": "^5.7.0",
|
|
97
|
+
"typescript-eslint": "^8.64.0",
|
|
64
98
|
"viem": "^2.47.6"
|
|
65
99
|
}
|
|
66
100
|
}
|