auth-vir 2.3.1 → 2.3.3

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.
@@ -1,4 +1,4 @@
1
- import { type AnyObject, type JsonCompatibleObject, type MaybePromise, type PartialWithUndefined, type RequiredAndNotNull } from '@augment-vir/common';
1
+ import { type AnyObject, type JsonCompatibleObject, type MaybePromise, type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type AnyDuration } from 'date-vir';
3
3
  import { type IncomingHttpHeaders, type OutgoingHttpHeaders } from 'node:http';
4
4
  import { type EmptyObject, type RequireExactlyOne, type RequireOneOrNone } from 'type-fest';
@@ -51,7 +51,7 @@ export type BackendAuthClientConfig<DatabaseUser extends AnyObject, UserId exten
51
51
  * called, the same JWT keys are returned (do not call {@link generateNewJwtKeys} each time
52
52
  * this is called). Any time the JWT keys change, all current sessions will terminate.
53
53
  */
54
- getJetKeys: () => MaybePromise<Readonly<RawJwtKeys>>;
54
+ getJwtKeys: () => MaybePromise<Readonly<RawJwtKeys>>;
55
55
  /**
56
56
  * When `isDev` is set, cookies do not require HTTPS (so they can be used with
57
57
  * http://localhost).
@@ -165,7 +165,7 @@ export declare class BackendAuthClient<DatabaseUser extends AnyObject, UserId ex
165
165
  userId: UserId;
166
166
  requestHeaders: IncomingHttpHeaders;
167
167
  isSignUpCookie: boolean;
168
- }): Promise<Pick<RequiredAndNotNull<OutgoingHttpHeaders>, 'set-cookie'> & Record<CsrfHeaderName, string>>;
168
+ }): Promise<OutgoingHttpHeaders>;
169
169
  /** Combines `.getInsecureUser()` and `.getSecureUser()` into one method. */
170
170
  getInsecureOrSecureUser(params: {
171
171
  requestHeaders: IncomingHttpHeaders;
@@ -140,7 +140,7 @@ export class BackendAuthClient {
140
140
  * something else too.
141
141
  */
142
142
  async getJwtParams() {
143
- const rawJwtKeys = await this.config.getJetKeys();
143
+ const rawJwtKeys = await this.config.getJwtKeys();
144
144
  const cacheKey = JSON.stringify(rawJwtKeys);
145
145
  const cachedParsedKeys = this.cachedParsedJwtKeys[cacheKey];
146
146
  const parsedKeys = cachedParsedKeys ?? (await parseJwtKeys(rawJwtKeys));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth-vir",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Auth made easy and secure via JWT cookies, CSRF tokens, and password hashing helpers.",
5
5
  "keywords": [
6
6
  "auth",
@@ -4,7 +4,6 @@ import {
4
4
  type JsonCompatibleObject,
5
5
  type MaybePromise,
6
6
  type PartialWithUndefined,
7
- type RequiredAndNotNull,
8
7
  } from '@augment-vir/common';
9
8
  import {calculateRelativeDate, getNowInUtcTimezone, isDateAfter, type AnyDuration} from 'date-vir';
10
9
  import {type IncomingHttpHeaders, type OutgoingHttpHeaders} from 'node:http';
@@ -72,7 +71,7 @@ export type BackendAuthClientConfig<
72
71
  * called, the same JWT keys are returned (do not call {@link generateNewJwtKeys} each time
73
72
  * this is called). Any time the JWT keys change, all current sessions will terminate.
74
73
  */
75
- getJetKeys: () => MaybePromise<Readonly<RawJwtKeys>>;
74
+ getJwtKeys: () => MaybePromise<Readonly<RawJwtKeys>>;
76
75
  /**
77
76
  * When `isDev` is set, cookies do not require HTTPS (so they can be used with
78
77
  * http://localhost).
@@ -350,7 +349,7 @@ export class BackendAuthClient<
350
349
  * something else too.
351
350
  */
352
351
  public async getJwtParams(): Promise<Readonly<CreateJwtParams>> {
353
- const rawJwtKeys = await this.config.getJetKeys();
352
+ const rawJwtKeys = await this.config.getJwtKeys();
354
353
 
355
354
  const cacheKey = JSON.stringify(rawJwtKeys);
356
355
 
@@ -426,9 +425,7 @@ export class BackendAuthClient<
426
425
  userId: UserId;
427
426
  requestHeaders: IncomingHttpHeaders;
428
427
  isSignUpCookie: boolean;
429
- }): Promise<
430
- Pick<RequiredAndNotNull<OutgoingHttpHeaders>, 'set-cookie'> & Record<CsrfHeaderName, string>
431
- > {
428
+ }): Promise<OutgoingHttpHeaders> {
432
429
  const oppositeCookieName = isSignUpCookie ? AuthCookieName.Auth : AuthCookieName.SignUp;
433
430
  const hasExistingOppositeCookie = requestHeaders.cookie?.includes(`${oppositeCookieName}=`);
434
431