@venturekit/auth 0.0.50 → 0.0.51
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 +8 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/migrations/vk_auth_006_verification_code_issuance.sql +29 -0
- package/dist/server/api-keys.d.ts +10 -5
- package/dist/server/api-keys.d.ts.map +1 -1
- package/dist/server/api-keys.js +24 -8
- package/dist/server/api-keys.js.map +1 -1
- package/dist/server/config.d.ts +6 -0
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +2 -0
- package/dist/server/config.js.map +1 -1
- package/dist/server/cookies.d.ts +9 -5
- package/dist/server/cookies.d.ts.map +1 -1
- package/dist/server/cookies.js +19 -6
- package/dist/server/cookies.js.map +1 -1
- package/dist/server/errors.d.ts +18 -2
- package/dist/server/errors.d.ts.map +1 -1
- package/dist/server/errors.js +46 -3
- package/dist/server/errors.js.map +1 -1
- package/dist/server/federated/account-linking.d.ts +90 -0
- package/dist/server/federated/account-linking.d.ts.map +1 -0
- package/dist/server/federated/account-linking.js +78 -0
- package/dist/server/federated/account-linking.js.map +1 -0
- package/dist/server/federated/authorization.d.ts +81 -0
- package/dist/server/federated/authorization.d.ts.map +1 -0
- package/dist/server/federated/authorization.js +229 -0
- package/dist/server/federated/authorization.js.map +1 -0
- package/dist/server/federated/credentials.d.ts +22 -0
- package/dist/server/federated/credentials.d.ts.map +1 -0
- package/dist/server/federated/credentials.js +81 -0
- package/dist/server/federated/credentials.js.map +1 -0
- package/dist/server/federated/oauth-transaction.d.ts +54 -0
- package/dist/server/federated/oauth-transaction.d.ts.map +1 -0
- package/dist/server/federated/oauth-transaction.js +92 -0
- package/dist/server/federated/oauth-transaction.js.map +1 -0
- package/dist/server/federated/providers.d.ts +34 -0
- package/dist/server/federated/providers.d.ts.map +1 -0
- package/dist/server/federated/providers.js +65 -0
- package/dist/server/federated/providers.js.map +1 -0
- package/dist/server/federated/sign-in.d.ts +81 -0
- package/dist/server/federated/sign-in.d.ts.map +1 -0
- package/dist/server/federated/sign-in.js +180 -0
- package/dist/server/federated/sign-in.js.map +1 -0
- package/dist/server/federated/types.d.ts +36 -0
- package/dist/server/federated/types.d.ts.map +1 -0
- package/dist/server/federated/types.js +5 -0
- package/dist/server/federated/types.js.map +1 -0
- package/dist/server/federated-routes.d.ts +15 -7
- package/dist/server/federated-routes.d.ts.map +1 -1
- package/dist/server/federated-routes.js +27 -16
- package/dist/server/federated-routes.js.map +1 -1
- package/dist/server/federated.d.ts +25 -196
- package/dist/server/federated.d.ts.map +1 -1
- package/dist/server/federated.js +19 -521
- package/dist/server/federated.js.map +1 -1
- package/dist/server/forgot-password.d.ts +4 -3
- package/dist/server/forgot-password.d.ts.map +1 -1
- package/dist/server/forgot-password.js +3 -5
- package/dist/server/forgot-password.js.map +1 -1
- package/dist/server/handoff-routes.d.ts +16 -5
- package/dist/server/handoff-routes.d.ts.map +1 -1
- package/dist/server/handoff-routes.js +23 -11
- package/dist/server/handoff-routes.js.map +1 -1
- package/dist/server/impersonation.d.ts +6 -3
- package/dist/server/impersonation.d.ts.map +1 -1
- package/dist/server/impersonation.js +11 -5
- package/dist/server/impersonation.js.map +1 -1
- package/dist/server/index.d.ts +5 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/invitations.d.ts +6 -2
- package/dist/server/invitations.d.ts.map +1 -1
- package/dist/server/invitations.js +6 -3
- package/dist/server/invitations.js.map +1 -1
- package/dist/server/local-cognito.d.ts +19 -0
- package/dist/server/local-cognito.d.ts.map +1 -0
- package/dist/server/local-cognito.js +19 -0
- package/dist/server/local-cognito.js.map +1 -0
- package/dist/server/refresh.d.ts +23 -12
- package/dist/server/refresh.d.ts.map +1 -1
- package/dist/server/refresh.js +35 -19
- package/dist/server/refresh.js.map +1 -1
- package/dist/server/resource-scope.d.ts +19 -0
- package/dist/server/resource-scope.d.ts.map +1 -0
- package/dist/server/resource-scope.js +2 -0
- package/dist/server/resource-scope.js.map +1 -0
- package/dist/server/route-rate-limit.d.ts +50 -0
- package/dist/server/route-rate-limit.d.ts.map +1 -0
- package/dist/server/route-rate-limit.js +39 -0
- package/dist/server/route-rate-limit.js.map +1 -0
- package/dist/server/session-routes.d.ts +9 -2
- package/dist/server/session-routes.d.ts.map +1 -1
- package/dist/server/session-routes.js +6 -4
- package/dist/server/session-routes.js.map +1 -1
- package/dist/server/sign-up.d.ts +32 -17
- package/dist/server/sign-up.d.ts.map +1 -1
- package/dist/server/sign-up.js +30 -12
- package/dist/server/sign-up.js.map +1 -1
- package/dist/server/store/postgres.d.ts.map +1 -1
- package/dist/server/store/postgres.js +43 -27
- package/dist/server/store/postgres.js.map +1 -1
- package/dist/server/verification.d.ts +76 -33
- package/dist/server/verification.d.ts.map +1 -1
- package/dist/server/verification.js +68 -67
- package/dist/server/verification.js.map +1 -1
- package/dist/server/verify.d.ts.map +1 -1
- package/dist/server/verify.js +8 -3
- package/dist/server/verify.js.map +1 -1
- package/dist/session/index.d.ts +11 -13
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +13 -14
- package/dist/session/index.js.map +1 -1
- package/package.json +6 -6
- package/src/migrations/vk_auth_006_verification_code_issuance.sql +29 -0
|
@@ -13,6 +13,24 @@
|
|
|
13
13
|
* stored value is a SHA-256 hash of the code, never the code itself —
|
|
14
14
|
* if the table leaks the codes are still useless.
|
|
15
15
|
*
|
|
16
|
+
* # Brute-force and pumping limits
|
|
17
|
+
*
|
|
18
|
+
* A 6-digit code has a million values, so the guess budget is the
|
|
19
|
+
* security. Two limits, both enforced here over the store:
|
|
20
|
+
*
|
|
21
|
+
* - **Attempts per code** (`maxAttempts`, default 5). Every guess
|
|
22
|
+
* spends one attempt ATOMICALLY ({@link VerificationCodeStore.claimAttempt})
|
|
23
|
+
* before the comparison, so parallel guesses cannot exceed the budget.
|
|
24
|
+
* An exhausted code stays on record (refusing every guess) until it
|
|
25
|
+
* expires or a new code is issued.
|
|
26
|
+
* - **Codes per window** (`maxCodesPerWindow`, default 5 per
|
|
27
|
+
* `windowSeconds` = 1 hour) for each `(channel, identifier)`. A new
|
|
28
|
+
* code buys a fresh attempt budget, so without this cap "request,
|
|
29
|
+
* guess five times, request again" is an unbounded guessing loop —
|
|
30
|
+
* and an unbounded stream of e-mails / SMS to someone else's address.
|
|
31
|
+
* Over the cap, {@link requestVerificationCode} throws
|
|
32
|
+
* `verification_rate_limited` (429).
|
|
33
|
+
*
|
|
16
34
|
* Usage sketch (route handler):
|
|
17
35
|
*
|
|
18
36
|
* ```ts
|
|
@@ -28,48 +46,61 @@
|
|
|
28
46
|
* await verifyVerificationCode({
|
|
29
47
|
* channel: 'email', identifier: email, code: req.body.code, store,
|
|
30
48
|
* });
|
|
31
|
-
*
|
|
49
|
+
* // The code just proved the address — say so explicitly.
|
|
50
|
+
* await signUpUser({ email, password, autoConfirm: true });
|
|
32
51
|
* ```
|
|
33
52
|
*/
|
|
34
53
|
/** A delivery channel — `email`, `sms`, `whatsapp`, or anything else. */
|
|
35
54
|
export type VerificationChannel = string;
|
|
55
|
+
/** A store slot: one outstanding code per `(channel, identifier)`. */
|
|
56
|
+
export interface VerificationCodeKey {
|
|
57
|
+
channel: VerificationChannel;
|
|
58
|
+
identifier: string;
|
|
59
|
+
}
|
|
36
60
|
/**
|
|
37
|
-
* Pluggable storage for outstanding codes.
|
|
38
|
-
* idempotent on `put` (overwrite previous code for the same key) and
|
|
39
|
-
* return `undefined` for unknown / expired keys on `get`.
|
|
61
|
+
* Pluggable storage for outstanding codes.
|
|
40
62
|
*
|
|
41
63
|
* Keys are tuples of `(channel, identifier)`; e.g.
|
|
42
64
|
* `('email', 'foo@example.com')` and `('whatsapp', '+212600000000')`
|
|
43
65
|
* occupy distinct slots so a user with both can verify each one.
|
|
66
|
+
*
|
|
67
|
+
* The store keeps data; the limits live in {@link requestVerificationCode}
|
|
68
|
+
* / {@link verifyVerificationCode}. The one thing a store MUST do
|
|
69
|
+
* atomically is {@link claimAttempt}.
|
|
44
70
|
*/
|
|
45
71
|
export interface VerificationCodeStore {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Store a newly issued code, replacing any outstanding one for the key.
|
|
74
|
+
* `attempts` starts at 0; `issuedCount` / `windowEndsAt` are persisted
|
|
75
|
+
* as given (the helper computes them).
|
|
76
|
+
*/
|
|
77
|
+
put(input: VerificationCodeKey & {
|
|
49
78
|
/** SHA-256 hex digest of the plaintext code. */
|
|
50
79
|
codeHash: string;
|
|
51
80
|
/** Wall-clock expiry, ms epoch. */
|
|
52
81
|
expiresAt: number;
|
|
53
|
-
/**
|
|
82
|
+
/** Guesses allowed on this code. */
|
|
54
83
|
maxAttempts: number;
|
|
84
|
+
/** Codes issued for this key in the current window, this one included. */
|
|
85
|
+
issuedCount: number;
|
|
86
|
+
/** End of the current issuance window, ms epoch. */
|
|
87
|
+
windowEndsAt: number;
|
|
55
88
|
}): Promise<void>;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
identifier: string;
|
|
59
|
-
}): Promise<VerificationCodeRecord | undefined>;
|
|
89
|
+
/** The record for a key, INCLUDING an expired or exhausted one; `undefined` when absent. */
|
|
90
|
+
get(input: VerificationCodeKey): Promise<VerificationCodeRecord | undefined>;
|
|
60
91
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
92
|
+
* Spend one guess, atomically: when the key has a code that is not
|
|
93
|
+
* expired at `now` (ms epoch) and has `attempts < maxAttempts`,
|
|
94
|
+
* increment `attempts` and return the record as it was BEFORE the
|
|
95
|
+
* increment; otherwise change nothing and return `undefined`.
|
|
96
|
+
*
|
|
97
|
+
* Must be a single atomic step (e.g. one conditional `UPDATE …
|
|
98
|
+
* RETURNING`): read-then-write lets parallel guesses all pass the check.
|
|
64
99
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
delete(input: {
|
|
70
|
-
channel: VerificationChannel;
|
|
71
|
-
identifier: string;
|
|
72
|
-
}): Promise<void>;
|
|
100
|
+
claimAttempt(input: VerificationCodeKey & {
|
|
101
|
+
now: number;
|
|
102
|
+
}): Promise<VerificationCodeRecord | undefined>;
|
|
103
|
+
delete(input: VerificationCodeKey): Promise<void>;
|
|
73
104
|
}
|
|
74
105
|
export interface VerificationCodeRecord {
|
|
75
106
|
channel: VerificationChannel;
|
|
@@ -78,6 +109,10 @@ export interface VerificationCodeRecord {
|
|
|
78
109
|
expiresAt: number;
|
|
79
110
|
attempts: number;
|
|
80
111
|
maxAttempts: number;
|
|
112
|
+
/** Codes issued for this key in the current window, this one included. */
|
|
113
|
+
issuedCount: number;
|
|
114
|
+
/** End of the current issuance window, ms epoch. */
|
|
115
|
+
windowEndsAt: number;
|
|
81
116
|
}
|
|
82
117
|
/**
|
|
83
118
|
* Generate a random numeric code of `length` digits (default 6).
|
|
@@ -102,8 +137,12 @@ export interface RequestVerificationCodeInput {
|
|
|
102
137
|
length?: number;
|
|
103
138
|
/** TTL in seconds. Default 600 (10 minutes). */
|
|
104
139
|
ttlSeconds?: number;
|
|
105
|
-
/**
|
|
140
|
+
/** Guesses allowed on the code. Default 5. */
|
|
106
141
|
maxAttempts?: number;
|
|
142
|
+
/** Codes that may be issued for this key per window. Default 5. */
|
|
143
|
+
maxCodesPerWindow?: number;
|
|
144
|
+
/** Issuance window, in seconds. Default 3600 (1 hour). */
|
|
145
|
+
windowSeconds?: number;
|
|
107
146
|
}
|
|
108
147
|
export interface RequestVerificationCodeResult {
|
|
109
148
|
/** The plaintext code — caller is responsible for delivery. */
|
|
@@ -112,9 +151,11 @@ export interface RequestVerificationCodeResult {
|
|
|
112
151
|
expiresAt: number;
|
|
113
152
|
}
|
|
114
153
|
/**
|
|
115
|
-
* Mint a fresh code and store its hash.
|
|
116
|
-
*
|
|
117
|
-
*
|
|
154
|
+
* Mint a fresh code and store its hash. Replaces any previous code for
|
|
155
|
+
* the same `(channel, identifier)` so a user who didn't receive the
|
|
156
|
+
* first email can hit "resend" — up to `maxCodesPerWindow` times per
|
|
157
|
+
* window, after which it throws `verification_rate_limited` (429, with
|
|
158
|
+
* `retryAfterSeconds` in the message's sense: when the window ends).
|
|
118
159
|
*
|
|
119
160
|
* Returns the plaintext code so the caller can deliver it via
|
|
120
161
|
* email / WhatsApp / SMS. The plaintext never re-enters this module.
|
|
@@ -128,14 +169,16 @@ export interface VerifyVerificationCodeInput {
|
|
|
128
169
|
store: VerificationCodeStore;
|
|
129
170
|
}
|
|
130
171
|
/**
|
|
131
|
-
* Verify a submitted code.
|
|
132
|
-
*
|
|
133
|
-
* `maxAttempts`
|
|
134
|
-
*
|
|
172
|
+
* Verify a submitted code. One guess is spent atomically BEFORE the
|
|
173
|
+
* comparison, so no number of parallel requests gets more than
|
|
174
|
+
* `maxAttempts` guesses at one code. On success the record is deleted
|
|
175
|
+
* (codes are single-use). An exhausted or expired code is left on record
|
|
176
|
+
* — it refuses every guess, and it keeps the issuance window's count, so
|
|
177
|
+
* running out of guesses cannot be used to reset the code budget.
|
|
135
178
|
*
|
|
136
179
|
* Throws {@link AuthError} (`verification_failed`, HTTP 401) on any
|
|
137
|
-
* failure path
|
|
138
|
-
*
|
|
180
|
+
* failure path — no code, expired, exhausted, wrong — so route handlers
|
|
181
|
+
* surface a single error without leaking which path was taken.
|
|
139
182
|
*/
|
|
140
183
|
export declare function verifyVerificationCode(input: VerifyVerificationCodeInput): Promise<void>;
|
|
141
184
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/server/verification.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/server/verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AgB,wBAAwB,CAAC,MAAM,SAAI,GAAG,MAAM,CAW3D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAMD,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC5C,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,6BAA6B,CAAC,CA+BxC;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,IAAI,CAAC,CAYf;AAMD;;;;;GAKG;AACH,wBAAgB,mCAAmC,IAAI,qBAAqB,CAuB3E"}
|
|
@@ -13,6 +13,24 @@
|
|
|
13
13
|
* stored value is a SHA-256 hash of the code, never the code itself —
|
|
14
14
|
* if the table leaks the codes are still useless.
|
|
15
15
|
*
|
|
16
|
+
* # Brute-force and pumping limits
|
|
17
|
+
*
|
|
18
|
+
* A 6-digit code has a million values, so the guess budget is the
|
|
19
|
+
* security. Two limits, both enforced here over the store:
|
|
20
|
+
*
|
|
21
|
+
* - **Attempts per code** (`maxAttempts`, default 5). Every guess
|
|
22
|
+
* spends one attempt ATOMICALLY ({@link VerificationCodeStore.claimAttempt})
|
|
23
|
+
* before the comparison, so parallel guesses cannot exceed the budget.
|
|
24
|
+
* An exhausted code stays on record (refusing every guess) until it
|
|
25
|
+
* expires or a new code is issued.
|
|
26
|
+
* - **Codes per window** (`maxCodesPerWindow`, default 5 per
|
|
27
|
+
* `windowSeconds` = 1 hour) for each `(channel, identifier)`. A new
|
|
28
|
+
* code buys a fresh attempt budget, so without this cap "request,
|
|
29
|
+
* guess five times, request again" is an unbounded guessing loop —
|
|
30
|
+
* and an unbounded stream of e-mails / SMS to someone else's address.
|
|
31
|
+
* Over the cap, {@link requestVerificationCode} throws
|
|
32
|
+
* `verification_rate_limited` (429).
|
|
33
|
+
*
|
|
16
34
|
* Usage sketch (route handler):
|
|
17
35
|
*
|
|
18
36
|
* ```ts
|
|
@@ -28,7 +46,8 @@
|
|
|
28
46
|
* await verifyVerificationCode({
|
|
29
47
|
* channel: 'email', identifier: email, code: req.body.code, store,
|
|
30
48
|
* });
|
|
31
|
-
*
|
|
49
|
+
* // The code just proved the address — say so explicitly.
|
|
50
|
+
* await signUpUser({ email, password, autoConfirm: true });
|
|
32
51
|
* ```
|
|
33
52
|
*/
|
|
34
53
|
import { createHash, randomInt, timingSafeEqual } from 'node:crypto';
|
|
@@ -62,9 +81,11 @@ export function hashVerificationCode(code) {
|
|
|
62
81
|
return createHash('sha256').update(code).digest('hex');
|
|
63
82
|
}
|
|
64
83
|
/**
|
|
65
|
-
* Mint a fresh code and store its hash.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
84
|
+
* Mint a fresh code and store its hash. Replaces any previous code for
|
|
85
|
+
* the same `(channel, identifier)` so a user who didn't receive the
|
|
86
|
+
* first email can hit "resend" — up to `maxCodesPerWindow` times per
|
|
87
|
+
* window, after which it throws `verification_rate_limited` (429, with
|
|
88
|
+
* `retryAfterSeconds` in the message's sense: when the window ends).
|
|
68
89
|
*
|
|
69
90
|
* Returns the plaintext code so the caller can deliver it via
|
|
70
91
|
* email / WhatsApp / SMS. The plaintext never re-enters this module.
|
|
@@ -73,68 +94,52 @@ export async function requestVerificationCode(input) {
|
|
|
73
94
|
const length = input.length ?? 6;
|
|
74
95
|
const ttlSeconds = input.ttlSeconds ?? 600;
|
|
75
96
|
const maxAttempts = input.maxAttempts ?? 5;
|
|
97
|
+
const maxCodesPerWindow = input.maxCodesPerWindow ?? 5;
|
|
98
|
+
const windowMs = (input.windowSeconds ?? 3600) * 1000;
|
|
99
|
+
const key = { channel: input.channel, identifier: input.identifier };
|
|
100
|
+
const now = Date.now();
|
|
101
|
+
const previous = await input.store.get(key);
|
|
102
|
+
const inWindow = previous !== undefined && previous.windowEndsAt > now;
|
|
103
|
+
if (inWindow && previous.issuedCount >= maxCodesPerWindow) {
|
|
104
|
+
const retryAfterSeconds = Math.ceil((previous.windowEndsAt - now) / 1000);
|
|
105
|
+
throw new AuthError('verification_rate_limited', `Too many codes were requested for this address — try again in ${retryAfterSeconds} seconds`, 429);
|
|
106
|
+
}
|
|
76
107
|
const code = generateVerificationCode(length);
|
|
77
|
-
const
|
|
78
|
-
const expiresAt = Date.now() + ttlSeconds * 1000;
|
|
108
|
+
const expiresAt = now + ttlSeconds * 1000;
|
|
79
109
|
await input.store.put({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
codeHash,
|
|
110
|
+
...key,
|
|
111
|
+
codeHash: hashVerificationCode(code),
|
|
83
112
|
expiresAt,
|
|
84
113
|
maxAttempts,
|
|
114
|
+
issuedCount: inWindow ? previous.issuedCount + 1 : 1,
|
|
115
|
+
windowEndsAt: inWindow ? previous.windowEndsAt : now + windowMs,
|
|
85
116
|
});
|
|
86
117
|
return { code, expiresAt };
|
|
87
118
|
}
|
|
88
119
|
/**
|
|
89
|
-
* Verify a submitted code.
|
|
90
|
-
*
|
|
91
|
-
* `maxAttempts`
|
|
92
|
-
*
|
|
120
|
+
* Verify a submitted code. One guess is spent atomically BEFORE the
|
|
121
|
+
* comparison, so no number of parallel requests gets more than
|
|
122
|
+
* `maxAttempts` guesses at one code. On success the record is deleted
|
|
123
|
+
* (codes are single-use). An exhausted or expired code is left on record
|
|
124
|
+
* — it refuses every guess, and it keeps the issuance window's count, so
|
|
125
|
+
* running out of guesses cannot be used to reset the code budget.
|
|
93
126
|
*
|
|
94
127
|
* Throws {@link AuthError} (`verification_failed`, HTTP 401) on any
|
|
95
|
-
* failure path
|
|
96
|
-
*
|
|
128
|
+
* failure path — no code, expired, exhausted, wrong — so route handlers
|
|
129
|
+
* surface a single error without leaking which path was taken.
|
|
97
130
|
*/
|
|
98
131
|
export async function verifyVerificationCode(input) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
132
|
+
const key = { channel: input.channel, identifier: input.identifier };
|
|
133
|
+
const record = await input.store.claimAttempt({ ...key, now: Date.now() });
|
|
134
|
+
if (record) {
|
|
135
|
+
const a = Buffer.from(hashVerificationCode(input.code), 'hex');
|
|
136
|
+
const b = Buffer.from(record.codeHash, 'hex');
|
|
137
|
+
if (a.length === b.length && timingSafeEqual(a, b)) {
|
|
138
|
+
await input.store.delete(key);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
105
141
|
}
|
|
106
|
-
|
|
107
|
-
await input.store.delete({
|
|
108
|
-
channel: input.channel,
|
|
109
|
-
identifier: input.identifier,
|
|
110
|
-
});
|
|
111
|
-
throw new AuthError('verification_failed', 'Verification code expired — request a new one', 401);
|
|
112
|
-
}
|
|
113
|
-
const submittedHash = hashVerificationCode(input.code);
|
|
114
|
-
const a = Buffer.from(submittedHash, 'hex');
|
|
115
|
-
const b = Buffer.from(record.codeHash, 'hex');
|
|
116
|
-
const matches = a.length === b.length && timingSafeEqual(a, b);
|
|
117
|
-
if (matches) {
|
|
118
|
-
await input.store.delete({
|
|
119
|
-
channel: input.channel,
|
|
120
|
-
identifier: input.identifier,
|
|
121
|
-
});
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
// Wrong code — bump the counter; if we've hit the limit, wipe the
|
|
125
|
-
// record so the user has to request a new one (this is the
|
|
126
|
-
// brute-force defense, since 6-digit codes only have 1M states).
|
|
127
|
-
const attempts = await input.store.incrementAttempts({
|
|
128
|
-
channel: input.channel,
|
|
129
|
-
identifier: input.identifier,
|
|
130
|
-
});
|
|
131
|
-
if (attempts >= record.maxAttempts) {
|
|
132
|
-
await input.store.delete({
|
|
133
|
-
channel: input.channel,
|
|
134
|
-
identifier: input.identifier,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
throw new AuthError('verification_failed', 'Invalid verification code', 401);
|
|
142
|
+
throw new AuthError('verification_failed', 'Invalid or expired verification code — request a new one', 401);
|
|
138
143
|
}
|
|
139
144
|
// ────────────────────────────────────────────────────────────────────
|
|
140
145
|
// In-memory store — for tests / local dev only
|
|
@@ -149,25 +154,21 @@ export function createInMemoryVerificationCodeStore() {
|
|
|
149
154
|
const map = new Map();
|
|
150
155
|
const key = (c, i) => `${c}\u0000${i}`;
|
|
151
156
|
return {
|
|
152
|
-
async put({ channel, identifier,
|
|
153
|
-
map.set(key(channel, identifier), {
|
|
154
|
-
channel,
|
|
155
|
-
identifier,
|
|
156
|
-
codeHash,
|
|
157
|
-
expiresAt,
|
|
158
|
-
attempts: 0,
|
|
159
|
-
maxAttempts,
|
|
160
|
-
});
|
|
157
|
+
async put({ channel, identifier, ...rest }) {
|
|
158
|
+
map.set(key(channel, identifier), { channel, identifier, attempts: 0, ...rest });
|
|
161
159
|
},
|
|
162
160
|
async get({ channel, identifier }) {
|
|
163
|
-
|
|
161
|
+
const rec = map.get(key(channel, identifier));
|
|
162
|
+
return rec ? { ...rec } : undefined;
|
|
164
163
|
},
|
|
165
|
-
|
|
164
|
+
// Synchronous between the read and the write, so atomic in one process.
|
|
165
|
+
async claimAttempt({ channel, identifier, now }) {
|
|
166
166
|
const rec = map.get(key(channel, identifier));
|
|
167
|
-
if (!rec)
|
|
168
|
-
return
|
|
167
|
+
if (!rec || rec.expiresAt <= now || rec.attempts >= rec.maxAttempts)
|
|
168
|
+
return undefined;
|
|
169
|
+
const before = { ...rec };
|
|
169
170
|
rec.attempts += 1;
|
|
170
|
-
return
|
|
171
|
+
return before;
|
|
171
172
|
},
|
|
172
173
|
async delete({ channel, identifier }) {
|
|
173
174
|
map.delete(key(channel, identifier));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.js","sourceRoot":"","sources":["../../src/server/verification.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verification.js","sourceRoot":"","sources":["../../src/server/verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsExC,uEAAuE;AACvE,aAAa;AACb,uEAAuE;AAEvE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAM,GAAG,CAAC;IACjD,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,8BAA8B,MAAM,mCAAmC,CACxE,CAAC;IACJ,CAAC;IACD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAClC,CA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,OAAO,SAAS,CAAC;YACtF,MAAM,MAAM,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;YAC1B,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;YAClB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE;YAClC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/server/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/server/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAI3D,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgCD;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,YAAW,WAAW;IACtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;gBAEhC,aAAa,GAAE,WAAqC;IAIhE,KAAK,GACH,KAAK,MAAM,EACX,iBAAiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,OAAO,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CA0Bd;CACH;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAEzC;AAED,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,CAAC,CAgExB;AAED,iEAAiE;AACjE,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}
|
package/dist/server/verify.js
CHANGED
|
@@ -25,6 +25,7 @@ import { CognitoJwtVerifier, JwtRsaVerifier } from 'aws-jwt-verify';
|
|
|
25
25
|
import { validateCognitoJwtFields } from 'aws-jwt-verify/cognito-verifier';
|
|
26
26
|
import { SimpleJsonFetcher } from 'aws-jwt-verify/https';
|
|
27
27
|
import { SimpleJwksCache } from 'aws-jwt-verify/jwk';
|
|
28
|
+
import { isLocalCognito } from './local-cognito.js';
|
|
28
29
|
const verifierCache = new Map();
|
|
29
30
|
function cacheKey(opts) {
|
|
30
31
|
const tokenUse = opts.tokenUse ?? 'access';
|
|
@@ -106,16 +107,20 @@ export async function verifyAndDecode(token, options) {
|
|
|
106
107
|
* are both "refused", and only the reason tells them apart.
|
|
107
108
|
*/
|
|
108
109
|
export async function verifyAndExplain(token, options) {
|
|
109
|
-
|
|
110
|
+
// The cognito-local issuer + plain-HTTP JWKS only under `vk dev`: a
|
|
111
|
+
// deployed function configured with a custom endpoint (FIPS, VPC) still
|
|
112
|
+
// verifies against the real Cognito issuer.
|
|
113
|
+
const local = isLocalCognito(options);
|
|
114
|
+
const expectedIssuer = local
|
|
110
115
|
? `${trimTrailingSlash(options.endpoint)}/${options.userPoolId}`
|
|
111
116
|
: `https://cognito-idp.${options.userPoolId.split('_')[0]}.amazonaws.com/${options.userPoolId}`;
|
|
112
|
-
const key = cacheKey(options);
|
|
117
|
+
const key = cacheKey({ ...options, endpoint: local ? options.endpoint : undefined });
|
|
113
118
|
const cached = verifierCache.get(key);
|
|
114
119
|
let verifier;
|
|
115
120
|
if (cached) {
|
|
116
121
|
verifier = cached;
|
|
117
122
|
}
|
|
118
|
-
else if (
|
|
123
|
+
else if (local) {
|
|
119
124
|
// Dev path: cognito-local. Use the generic OIDC verifier with the
|
|
120
125
|
// local issuer + JWKS URL, and reapply Cognito-specific checks
|
|
121
126
|
// (`token_use`, `client_id` / `aud`) via `customJwtCheck`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/server/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/server/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpE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AC,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC;IACpG,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,6BAA6B;IAC3C,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/session/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Utilities for managing user sessions and tokens.
|
|
5
5
|
*/
|
|
6
6
|
import type { User } from '../types/index.js';
|
|
7
|
+
import { type VerifyOptions } from '../server/verify.js';
|
|
7
8
|
/**
|
|
8
9
|
* Decode JWT token payload WITHOUT verifying the signature.
|
|
9
10
|
*
|
|
@@ -19,23 +20,20 @@ import type { User } from '../types/index.js';
|
|
|
19
20
|
* - Extracting the TTL for local caches.
|
|
20
21
|
*/
|
|
21
22
|
export declare function decodeTokenUnsafe(token: string): Record<string, unknown> | null;
|
|
22
|
-
/**
|
|
23
|
-
* Deprecated alias for {@link decodeTokenUnsafe}. Kept for backward
|
|
24
|
-
* compatibility; prefer the explicit `Unsafe` suffix so reviewers can spot
|
|
25
|
-
* authentication bypasses at a glance.
|
|
26
|
-
*
|
|
27
|
-
* @deprecated Use `decodeTokenUnsafe` or `verifyAndDecode`.
|
|
28
|
-
*/
|
|
29
|
-
export declare const decodeToken: typeof decodeTokenUnsafe;
|
|
30
23
|
export { verifyAndDecode } from '../server/verify.js';
|
|
31
24
|
export type { VerifyOptions } from '../server/verify.js';
|
|
32
25
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
26
|
+
* Verify an ID token, then map its claims to a {@link User}. `null` when
|
|
27
|
+
* the token is refused. The one way to get a `User` — with its roles —
|
|
28
|
+
* from a raw token: the unverified path (the former `extractUserFromToken`)
|
|
29
|
+
* handed out roles anyone could write into a forged token.
|
|
30
|
+
*/
|
|
31
|
+
export declare function verifyUserFromToken(idToken: string, options: VerifyOptions): Promise<User | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Map ALREADY-VERIFIED ID-token claims (from {@link verifyAndDecode}, an
|
|
34
|
+
* API Gateway authorizer, …) to a {@link User}. Pure; `null` for `null`.
|
|
37
35
|
*/
|
|
38
|
-
export declare function
|
|
36
|
+
export declare function userFromClaims(claims: Record<string, unknown> | null): User | null;
|
|
39
37
|
/**
|
|
40
38
|
* Check if a token is expired (based on its `exp` claim, without signature verification).
|
|
41
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAW/E;AAKD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAEvG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAuBlF;AAuDD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAKzD"}
|
package/dist/session/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Utilities for managing user sessions and tokens.
|
|
5
5
|
*/
|
|
6
|
+
import { verifyAndDecode } from '../server/verify.js';
|
|
6
7
|
/**
|
|
7
8
|
* Decode JWT token payload WITHOUT verifying the signature.
|
|
8
9
|
*
|
|
@@ -30,26 +31,24 @@ export function decodeTokenUnsafe(token) {
|
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Deprecated alias for {@link decodeTokenUnsafe}. Kept for backward
|
|
35
|
-
* compatibility; prefer the explicit `Unsafe` suffix so reviewers can spot
|
|
36
|
-
* authentication bypasses at a glance.
|
|
37
|
-
*
|
|
38
|
-
* @deprecated Use `decodeTokenUnsafe` or `verifyAndDecode`.
|
|
39
|
-
*/
|
|
40
|
-
export const decodeToken = decodeTokenUnsafe;
|
|
41
34
|
// `verifyAndDecode` now lives in `../server/verify.ts` and is re-exported
|
|
42
35
|
// from the package root for backward compatibility. Server-side consumers
|
|
43
36
|
// should import from `@venturekit/auth/server` instead.
|
|
44
37
|
export { verifyAndDecode } from '../server/verify.js';
|
|
45
38
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
39
|
+
* Verify an ID token, then map its claims to a {@link User}. `null` when
|
|
40
|
+
* the token is refused. The one way to get a `User` — with its roles —
|
|
41
|
+
* from a raw token: the unverified path (the former `extractUserFromToken`)
|
|
42
|
+
* handed out roles anyone could write into a forged token.
|
|
43
|
+
*/
|
|
44
|
+
export async function verifyUserFromToken(idToken, options) {
|
|
45
|
+
return userFromClaims(await verifyAndDecode(idToken, { ...options, tokenUse: 'id' }));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Map ALREADY-VERIFIED ID-token claims (from {@link verifyAndDecode}, an
|
|
49
|
+
* API Gateway authorizer, …) to a {@link User}. Pure; `null` for `null`.
|
|
50
50
|
*/
|
|
51
|
-
export function
|
|
52
|
-
const claims = decodeTokenUnsafe(idToken);
|
|
51
|
+
export function userFromClaims(claims) {
|
|
53
52
|
if (!claims)
|
|
54
53
|
return null;
|
|
55
54
|
// Determine identifier type and value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAsB,MAAM,qBAAqB,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEpC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,0EAA0E;AAC1E,wDAAwD;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAsB;IAC/E,OAAO,cAAc,CAAC,MAAM,eAAe,CAAC,OAAO,EAAE,EAAE,GAAG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C,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAExC,MAAM,MAAM,GAAI,MAAM,CAAC,GAAc,GAAG,IAAI,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,IAAI,IAAI,CAAE,MAAM,CAAC,GAAc,GAAG,IAAI,CAAC,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturekit/auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.51",
|
|
4
4
|
"description": "Authentication and authorization for VentureKit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@venturekit/core": "0.0.
|
|
44
|
+
"@venturekit/core": "0.0.51",
|
|
45
45
|
"@aws-sdk/client-cognito-identity-provider": "^3.1126.0",
|
|
46
46
|
"@aws-sdk/client-secrets-manager": "^3.1126.0",
|
|
47
47
|
"aws-jwt-verify": "^4.0.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@venturekit/data": "0.0.
|
|
51
|
-
"@venturekit/runtime": "0.0.
|
|
50
|
+
"@venturekit/data": "0.0.51",
|
|
51
|
+
"@venturekit/runtime": "0.0.51"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"@venturekit/data": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@venturekit/data": "0.0.
|
|
63
|
-
"@venturekit/runtime": "0.0.
|
|
62
|
+
"@venturekit/data": "0.0.51",
|
|
63
|
+
"@venturekit/runtime": "0.0.51",
|
|
64
64
|
"@types/aws-lambda": "^8.10.163",
|
|
65
65
|
"@types/node": "^26.5.1",
|
|
66
66
|
"typescript": "^5.3.0"
|