auth-vir 0.0.1 → 0.0.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.
package/README.md CHANGED
@@ -65,7 +65,7 @@ Use this on your host / server / backend to authenticate client / frontend reque
65
65
  5. In your application code, load the string keys from step 1 into [`parseJwtKeys`](https://electrovir.github.io/auth-vir/functions/parseUserJwt.html): `await parseJwtKeys(stringKeys)`.
66
66
  6. Use the output of [`parseJwtKeys`](https://electrovir.github.io/auth-vir/functions/parseUserJwt.html) in all auth functionality:
67
67
  - [`generateSuccessfulLoginHeaders`](https://electrovir.github.io/auth-vir/functions/generateSuccessfulLoginHeaders.html): after a user successfully logs in, run this function and attach the output headers to the `Response` object.
68
- - [`extractUserIdFromRequestHeaders`](https://electrovir.github.io/auth-vir/functions/extractUserIdFromRequestHeaders.html): to verify an authenticated user `Request` object (make sure to properly attach all auth in the client by following the below [Client side](#client-side) guide).
68
+ - [`extractUserIdFromRequestHeaders`](https://electrovir.github.io/auth-vir/functions/extractUserIdFromRequestHeaders.html): to verify an authenticated user `Request` object (make sure to properly attach all auth in the client by following the below [Client / frontend side](#client--frontend-side) guide).
69
69
 
70
70
  Here's a full example of how to use all host / server / backend side auth functionality:
71
71
 
@@ -236,7 +236,7 @@ Use this on your client / frontend for storing and sending session authorization
236
236
  1. Send a login fetch request to your host / server / backend with `{credentials: 'include'}` set on the request.
237
237
  2. Pass the `Response` from step 1 into [`handleAuthResponse`](https://electrovir.github.io/auth-vir/functions/handleAuthResponse.html).
238
238
  3. In all subsequent fetch requests to the host / server / backend, set `{credentials: 'include'}` and include `{headers: {[csrfTokenHeaderName]: getCurrentCsrfToken()}}`.
239
- 4. Upon user logout, call [`wipeCurrentCsrfToken()]`(https://electrovir.github.io/auth-vir/functions/wipeCurrentCsrfToken.html)
239
+ 4. Upon user logout, call [`wipeCurrentCsrfToken()`](https://electrovir.github.io/auth-vir/functions/wipeCurrentCsrfToken.html)
240
240
 
241
241
  Here's a full example of how to use all the client / frontend side auth functionality:
242
242
 
package/dist/auth.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { CookieParams } from './cookie.js';
2
- import { ParseJwtParams } from './jwt.js';
1
+ import { type CookieParams } from './cookie.js';
2
+ import { type ParseJwtParams } from './jwt.js';
3
3
  /**
4
4
  * All possible headers container types supported by {@link extractUserIdFromRequestHeaders}.
5
5
  *
package/dist/cookie.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type AnyDuration } from 'date-vir';
3
- import { CreateJwtParams, type ParseJwtParams } from './jwt.js';
4
- import { UserJwtData } from './user-jwt.js';
3
+ import { type CreateJwtParams, type ParseJwtParams } from './jwt.js';
4
+ import { type UserJwtData } from './user-jwt.js';
5
5
  /**
6
6
  * Parameters for {@link generateCookie}.
7
7
  *
package/dist/jwt.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { AnyObject, PartialWithUndefined } from '@augment-vir/common';
1
+ import { type AnyObject, type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type AnyDuration, type DateLike } from 'date-vir';
3
- import { JwtKeys } from './jwt-keys.js';
3
+ import { type JwtKeys } from './jwt-keys.js';
4
4
  /**
5
5
  * Params for {@link createJwt}.
6
6
  *
@@ -1,4 +1,4 @@
1
- import { CreateJwtParams, ParseJwtParams } from './jwt.js';
1
+ import { type CreateJwtParams, type ParseJwtParams } from './jwt.js';
2
2
  /**
3
3
  * Shape definition and source of truth for {@link UserJwtData}.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth-vir",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Auth made easy and secure via JWT cookies, CSRF tokens, and password hashing helpers.",
5
5
  "keywords": [
6
6
  "auth",
@@ -28,7 +28,7 @@
28
28
  "main": "dist/index.js",
29
29
  "module": "dist/index.js",
30
30
  "types": "dist/index.d.ts",
31
- "bin": "",
31
+ "bin": "bin.js",
32
32
  "scripts": {
33
33
  "build": "virmator frontend build",
34
34
  "compile": "virmator compile",
@@ -40,16 +40,16 @@
40
40
  "test:update": "npm test update"
41
41
  },
42
42
  "dependencies": {
43
- "@augment-vir/assert": "^31.11.0",
44
- "@augment-vir/common": "^31.11.0",
43
+ "@augment-vir/assert": "^31.17.1",
44
+ "@augment-vir/common": "^31.17.1",
45
45
  "date-vir": "^7.3.1",
46
46
  "hash-wasm": "^4.12.0",
47
- "jose": "^6.0.10",
47
+ "jose": "^6.0.11",
48
48
  "object-shape-tester": "^5.1.5",
49
49
  "url-vir": "^2.1.3"
50
50
  },
51
51
  "devDependencies": {
52
- "@augment-vir/test": "^31.11.0",
52
+ "@augment-vir/test": "^31.17.1",
53
53
  "@web/dev-server-esbuild": "^1.0.4",
54
54
  "@web/test-runner": "^0.20.1",
55
55
  "@web/test-runner-commands": "^0.9.0",
@@ -57,7 +57,7 @@
57
57
  "@web/test-runner-visual-regression": "^0.10.0",
58
58
  "istanbul-smart-text-reporter": "^1.1.5",
59
59
  "markdown-code-example-inserter": "^3.0.3",
60
- "typedoc": "^0.28.2"
60
+ "typedoc": "^0.28.4"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=22"
package/src/auth.ts CHANGED
@@ -1,6 +1,6 @@
1
- import {CookieParams, extractCookieJwt, generateCookie} from './cookie.js';
1
+ import {type CookieParams, extractCookieJwt, generateCookie} from './cookie.js';
2
2
  import {csrfTokenHeaderName, generateCsrfToken} from './csrf-token.js';
3
- import {ParseJwtParams} from './jwt.js';
3
+ import {type ParseJwtParams} from './jwt.js';
4
4
 
5
5
  /**
6
6
  * All possible headers container types supported by {@link extractUserIdFromRequestHeaders}.
package/src/cookie.ts CHANGED
@@ -2,8 +2,8 @@ import {check} from '@augment-vir/assert';
2
2
  import {safeMatch, type PartialWithUndefined} from '@augment-vir/common';
3
3
  import {convertDuration, type AnyDuration} from 'date-vir';
4
4
  import {parseUrl} from 'url-vir';
5
- import {CreateJwtParams, type ParseJwtParams} from './jwt.js';
6
- import {createUserJwt, parseUserJwt, UserJwtData} from './user-jwt.js';
5
+ import {type CreateJwtParams, type ParseJwtParams} from './jwt.js';
6
+ import {createUserJwt, parseUserJwt, type UserJwtData} from './user-jwt.js';
7
7
 
8
8
  /**
9
9
  * Parameters for {@link generateCookie}.
package/src/jwt.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {check} from '@augment-vir/assert';
2
- import type {AnyObject, PartialWithUndefined} from '@augment-vir/common';
2
+ import {type AnyObject, type PartialWithUndefined} from '@augment-vir/common';
3
3
  import {
4
4
  calculateRelativeDate,
5
5
  createFullDateInUserTimezone,
@@ -9,7 +9,7 @@ import {
9
9
  type DateLike,
10
10
  } from 'date-vir';
11
11
  import {EncryptJWT, jwtDecrypt, jwtVerify, SignJWT} from 'jose';
12
- import {JwtKeys} from './jwt-keys.js';
12
+ import {type JwtKeys} from './jwt-keys.js';
13
13
 
14
14
  const encryptionProtectedHeader = {alg: 'dir', enc: 'A256GCM'};
15
15
  const signingProtectedHeader = {alg: 'HS512'};
package/src/user-jwt.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {defineShape, isValidShape} from 'object-shape-tester';
2
2
  import {type generateCsrfToken} from './csrf-token.js';
3
- import {createJwt, CreateJwtParams, parseJwt, ParseJwtParams} from './jwt.js';
3
+ import {createJwt, type CreateJwtParams, parseJwt, type ParseJwtParams} from './jwt.js';
4
4
 
5
5
  /**
6
6
  * Shape definition and source of truth for {@link UserJwtData}.