@crvouga/mockingbird-service-oauth 1.3.0 → 1.4.0

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/cli.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-MKBPAVYU.js";
7
- import "./chunk-WHI7Y2UA.js";
6
+ } from "./chunk-D4IAZYMT.js";
7
+ import "./chunk-SYFF4UFD.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -775,6 +775,29 @@ declare class BehaviorState {
775
775
  decisions(): Decisions;
776
776
  }
777
777
 
778
+ /** A caller-supplied RS256 signing key pair. `kid` is published in the JWKS and token headers. */
779
+ type SigningKey = {
780
+ privateJwk: JsonWebKey;
781
+ publicJwk: JsonWebKey;
782
+ kid: string;
783
+ };
784
+ /**
785
+ * Opt-in control over every opaque value the provider mints. With none of these set the provider
786
+ * uses cryptographic randomness, exactly as before.
787
+ */
788
+ type CredentialOptions = {
789
+ /**
790
+ * Derive authorization codes, tokens, transaction ids, session ids, CSP nonces and signing keys
791
+ * from `seed` (default 0) instead of `crypto`, so the same seed and the same requests replay
792
+ * byte-for-byte. Test-only: the values are guessable.
793
+ */
794
+ deterministicCredentials?: boolean;
795
+ /** Replaces `crypto.getRandomValues` for every minted value, and wins over the seeded source. */
796
+ randomBytes?: (length: number) => Uint8Array;
797
+ /** Signing keys used in order: the first is current and each rotation takes the next. */
798
+ signingKeys?: SigningKey[];
799
+ };
800
+
778
801
  type Provider = "google" | "apple" | "oidc" | "microsoft" | "github";
779
802
  type Account = {
780
803
  id: string;
@@ -1053,7 +1076,7 @@ type OAuthMultiRuntime = {
1053
1076
  /** Compose independent provider runtimes behind exact path mounts on one listener. */
1054
1077
  declare function createMultiRuntime(options: OAuthMultiRuntimeOptions): OAuthMultiRuntime;
1055
1078
 
1056
- type OAuthAPIOptions = APIOptions & {
1079
+ type OAuthAPIOptions = APIOptions & CredentialOptions & {
1057
1080
  /** Browser Fetch forbids Cookie/Set-Cookie; local transports may explicitly remap them. */
1058
1081
  cookieHeaders?: {
1059
1082
  request: string;
@@ -1068,7 +1091,7 @@ type OAuthAPIOptions = APIOptions & {
1068
1091
  accounts?: Account[];
1069
1092
  clients?: Client[];
1070
1093
  behavior?: BehaviorInput;
1071
- /** Replays behavior choices, never credentials. */
1094
+ /** Replays behavior choices; also credentials when `deterministicCredentials` is set. */
1072
1095
  seed?: number | string;
1073
1096
  /** CSP nonce source for form-post responses. Defaults to `crypto.randomUUID`. */
1074
1097
  nonce?: () => string;
@@ -1088,9 +1111,10 @@ declare class OAuthAPI {
1088
1111
  private readonly sessions;
1089
1112
  private readonly consents;
1090
1113
  private signer;
1114
+ private readonly credentials;
1091
1115
  private previousSigners;
1092
1116
  /** Never published: signs ID tokens for `tokens.idTokenSigningKey: "unpublished"`. */
1093
- private unpublishedSigner?;
1117
+ private unpublishedSigner;
1094
1118
  readonly behavior: BehaviorState;
1095
1119
  private readonly identities;
1096
1120
  private readonly appleDisclosures;
@@ -1160,4 +1184,4 @@ declare class OAuthAPI {
1160
1184
  }
1161
1185
 
1162
1186
  export { OAUTH_PRESETS, OAUTH_SCENARIOS, OAuthAPI, createMultiRuntime, createRuntime, document, operationIds, supportedOperationIds };
1163
- export type { Account, AppleNotificationType, BehaviorEvent, BehaviorInput, Client, EdgeCase, GrantView, NotificationDelivery, OAuthAPIOptions, OAuthBehavior, OAuthMount, OAuthMultiRuntime, OAuthMultiRuntimeOptions, OAuthRuntime, OAuthRuntimeOptions, OAuthScenario, Provider };
1187
+ export type { Account, AppleNotificationType, BehaviorEvent, BehaviorInput, Client, CredentialOptions, EdgeCase, GrantView, NotificationDelivery, OAuthAPIOptions, OAuthBehavior, OAuthMount, OAuthMultiRuntime, OAuthMultiRuntimeOptions, OAuthRuntime, OAuthRuntimeOptions, OAuthScenario, Provider, SigningKey };
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  document,
8
8
  operationIds,
9
9
  supportedOperationIds
10
- } from "./chunk-WHI7Y2UA.js";
10
+ } from "./chunk-SYFF4UFD.js";
11
11
  export {
12
12
  OAUTH_PRESETS,
13
13
  OAUTH_SCENARIOS,
package/dist/server.d.ts CHANGED
@@ -1314,6 +1314,29 @@ declare class BehaviorState {
1314
1314
  decisions(): Decisions;
1315
1315
  }
1316
1316
 
1317
+ /** A caller-supplied RS256 signing key pair. `kid` is published in the JWKS and token headers. */
1318
+ type SigningKey = {
1319
+ privateJwk: JsonWebKey;
1320
+ publicJwk: JsonWebKey;
1321
+ kid: string;
1322
+ };
1323
+ /**
1324
+ * Opt-in control over every opaque value the provider mints. With none of these set the provider
1325
+ * uses cryptographic randomness, exactly as before.
1326
+ */
1327
+ type CredentialOptions = {
1328
+ /**
1329
+ * Derive authorization codes, tokens, transaction ids, session ids, CSP nonces and signing keys
1330
+ * from `seed` (default 0) instead of `crypto`, so the same seed and the same requests replay
1331
+ * byte-for-byte. Test-only: the values are guessable.
1332
+ */
1333
+ deterministicCredentials?: boolean;
1334
+ /** Replaces `crypto.getRandomValues` for every minted value, and wins over the seeded source. */
1335
+ randomBytes?: (length: number) => Uint8Array;
1336
+ /** Signing keys used in order: the first is current and each rotation takes the next. */
1337
+ signingKeys?: SigningKey[];
1338
+ };
1339
+
1317
1340
  type Provider = "google" | "apple" | "oidc" | "microsoft" | "github";
1318
1341
  type Account = {
1319
1342
  id: string;
@@ -1389,7 +1412,7 @@ type GrantView = {
1389
1412
  userDisclosed: boolean;
1390
1413
  };
1391
1414
 
1392
- type OAuthAPIOptions = APIOptions & {
1415
+ type OAuthAPIOptions = APIOptions & CredentialOptions & {
1393
1416
  /** Browser Fetch forbids Cookie/Set-Cookie; local transports may explicitly remap them. */
1394
1417
  cookieHeaders?: {
1395
1418
  request: string;
@@ -1404,7 +1427,7 @@ type OAuthAPIOptions = APIOptions & {
1404
1427
  accounts?: Account[];
1405
1428
  clients?: Client[];
1406
1429
  behavior?: BehaviorInput;
1407
- /** Replays behavior choices, never credentials. */
1430
+ /** Replays behavior choices; also credentials when `deterministicCredentials` is set. */
1408
1431
  seed?: number | string;
1409
1432
  /** CSP nonce source for form-post responses. Defaults to `crypto.randomUUID`. */
1410
1433
  nonce?: () => string;
@@ -1424,9 +1447,10 @@ declare class OAuthAPI {
1424
1447
  private readonly sessions;
1425
1448
  private readonly consents;
1426
1449
  private signer;
1450
+ private readonly credentials;
1427
1451
  private previousSigners;
1428
1452
  /** Never published: signs ID tokens for `tokens.idTokenSigningKey: "unpublished"`. */
1429
- private unpublishedSigner?;
1453
+ private unpublishedSigner;
1430
1454
  readonly behavior: BehaviorState;
1431
1455
  private readonly identities;
1432
1456
  private readonly appleDisclosures;
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createMultiServer,
4
4
  createServer,
5
5
  serveTarget
6
- } from "./chunk-MKBPAVYU.js";
7
- import "./chunk-WHI7Y2UA.js";
6
+ } from "./chunk-D4IAZYMT.js";
7
+ import "./chunk-SYFF4UFD.js";
8
8
  export {
9
9
  DEFAULT_PORT,
10
10
  createMultiServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-oauth",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Portable social-login mock with Google, Apple, Microsoft, GitHub and generic OIDC profiles, private relay identities, reproducible edge cases, signed tokens and an accessible UI.",
5
5
  "license": "MIT",
6
6
  "type": "module",