@drawbridge/drawbridge-utils 0.0.141 → 0.0.142
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/env.d.cts +2 -2
- package/dist/env.d.ts +2 -2
- package/dist/oauth/index.cjs +1 -1
- package/dist/oauth/index.d.cts +2 -2
- package/dist/oauth/index.d.ts +2 -2
- package/dist/oauth/index.js +1 -1
- package/dist/oauth/server.cjs +1 -1
- package/dist/oauth/server.js +1 -1
- package/package.json +1 -1
package/dist/env.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Boot-time required-environment-variable validation. A service calls
|
|
2
2
|
// assertEnv(required) as the first thing in index.js so a missing must-have
|
|
3
3
|
// config fails loudly at startup instead of silently degrading at first use
|
|
4
|
-
// (e.g. a missing
|
|
4
|
+
// (e.g. a missing HMAC_OAUTH_TOKEN_KEY surfacing only as failed socket auth).
|
|
5
5
|
//
|
|
6
6
|
// const { assertEnv } = require( '@drawbridge/drawbridge-utils/env' );
|
|
7
|
-
// assertEnv([ 'MONGODB_URI', 'REDIS_URL', '
|
|
7
|
+
// assertEnv([ 'MONGODB_URI', 'REDIS_URL', 'HMAC_OAUTH_TOKEN_KEY' ]);
|
|
8
8
|
//
|
|
9
9
|
// Reports EVERY missing var in one message (not just the first) and exits the
|
|
10
10
|
// process with code 1. A var counts as missing when unset, null, or an
|
package/dist/env.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Boot-time required-environment-variable validation. A service calls
|
|
2
2
|
// assertEnv(required) as the first thing in index.js so a missing must-have
|
|
3
3
|
// config fails loudly at startup instead of silently degrading at first use
|
|
4
|
-
// (e.g. a missing
|
|
4
|
+
// (e.g. a missing HMAC_OAUTH_TOKEN_KEY surfacing only as failed socket auth).
|
|
5
5
|
//
|
|
6
6
|
// const { assertEnv } = require( '@drawbridge/drawbridge-utils/env' );
|
|
7
|
-
// assertEnv([ 'MONGODB_URI', 'REDIS_URL', '
|
|
7
|
+
// assertEnv([ 'MONGODB_URI', 'REDIS_URL', 'HMAC_OAUTH_TOKEN_KEY' ]);
|
|
8
8
|
//
|
|
9
9
|
// Reports EVERY missing var in one message (not just the first) and exits the
|
|
10
10
|
// process with code 1. A var counts as missing when unset, null, or an
|
package/dist/oauth/index.cjs
CHANGED
|
@@ -217,7 +217,7 @@ var toOption = (scope) => ({
|
|
|
217
217
|
});
|
|
218
218
|
var developerOptions = developer.map(toOption);
|
|
219
219
|
var scopeOptions = scopes.map(toOption);
|
|
220
|
-
var hashToken = (raw) => hash(raw, process.env.
|
|
220
|
+
var hashToken = (raw) => hash(raw, process.env.HMAC_OAUTH_TOKEN_KEY);
|
|
221
221
|
var generateToken = () => generate(32, "base64url");
|
|
222
222
|
var REFRESH_LEAD_SECONDS = 60;
|
|
223
223
|
var createOAuthClient = ({
|
package/dist/oauth/index.d.cts
CHANGED
|
@@ -255,10 +255,10 @@ const scopeOptions = scopes.map( toOption );
|
|
|
255
255
|
// fix the OAuth-specific conventions (32 bytes base64url, env-keyed HMAC)
|
|
256
256
|
// ─────────────────────────────────────────────────────────────────────────
|
|
257
257
|
|
|
258
|
-
// Hash an OAuth token with the deployment's HMAC key (
|
|
258
|
+
// Hash an OAuth token with the deployment's HMAC key (HMAC_OAUTH_TOKEN_KEY).
|
|
259
259
|
// Falls back to plain SHA256 if the env var is unset — fine for local dev,
|
|
260
260
|
// not for production (DB compromise would then allow token forgery).
|
|
261
|
-
const hashToken = ( raw ) => hash( raw, process.env.
|
|
261
|
+
const hashToken = ( raw ) => hash( raw, process.env.HMAC_OAUTH_TOKEN_KEY );
|
|
262
262
|
|
|
263
263
|
// 32 cryptographically random bytes encoded as a 43-char base64url string —
|
|
264
264
|
// the shape used for access tokens, refresh tokens, PATs, and authorization
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -255,10 +255,10 @@ const scopeOptions = scopes.map( toOption );
|
|
|
255
255
|
// fix the OAuth-specific conventions (32 bytes base64url, env-keyed HMAC)
|
|
256
256
|
// ─────────────────────────────────────────────────────────────────────────
|
|
257
257
|
|
|
258
|
-
// Hash an OAuth token with the deployment's HMAC key (
|
|
258
|
+
// Hash an OAuth token with the deployment's HMAC key (HMAC_OAUTH_TOKEN_KEY).
|
|
259
259
|
// Falls back to plain SHA256 if the env var is unset — fine for local dev,
|
|
260
260
|
// not for production (DB compromise would then allow token forgery).
|
|
261
|
-
const hashToken = ( raw ) => hash( raw, process.env.
|
|
261
|
+
const hashToken = ( raw ) => hash( raw, process.env.HMAC_OAUTH_TOKEN_KEY );
|
|
262
262
|
|
|
263
263
|
// 32 cryptographically random bytes encoded as a 43-char base64url string —
|
|
264
264
|
// the shape used for access tokens, refresh tokens, PATs, and authorization
|
package/dist/oauth/index.js
CHANGED
|
@@ -162,7 +162,7 @@ var toOption = (scope) => ({
|
|
|
162
162
|
});
|
|
163
163
|
var developerOptions = developer.map(toOption);
|
|
164
164
|
var scopeOptions = scopes.map(toOption);
|
|
165
|
-
var hashToken = (raw) => hash(raw, process.env.
|
|
165
|
+
var hashToken = (raw) => hash(raw, process.env.HMAC_OAUTH_TOKEN_KEY);
|
|
166
166
|
var generateToken = () => generate(32, "base64url");
|
|
167
167
|
var REFRESH_LEAD_SECONDS = 60;
|
|
168
168
|
var createOAuthClient = ({
|
package/dist/oauth/server.cjs
CHANGED
|
@@ -143,7 +143,7 @@ var toOption = (scope) => ({
|
|
|
143
143
|
});
|
|
144
144
|
var developerOptions = developer.map(toOption);
|
|
145
145
|
var scopeOptions = scopes.map(toOption);
|
|
146
|
-
var hashToken = (raw) => hash(raw, process.env.
|
|
146
|
+
var hashToken = (raw) => hash(raw, process.env.HMAC_OAUTH_TOKEN_KEY);
|
|
147
147
|
var generateToken = () => generate(32, "base64url");
|
|
148
148
|
|
|
149
149
|
// lib/oauth/server.js
|
package/dist/oauth/server.js
CHANGED
|
@@ -107,7 +107,7 @@ var toOption = (scope) => ({
|
|
|
107
107
|
});
|
|
108
108
|
var developerOptions = developer.map(toOption);
|
|
109
109
|
var scopeOptions = scopes.map(toOption);
|
|
110
|
-
var hashToken = (raw) => hash(raw, process.env.
|
|
110
|
+
var hashToken = (raw) => hash(raw, process.env.HMAC_OAUTH_TOKEN_KEY);
|
|
111
111
|
var generateToken = () => generate(32, "base64url");
|
|
112
112
|
|
|
113
113
|
// lib/oauth/server.js
|
package/package.json
CHANGED