@oneaddress/conformance 3.0.0 → 3.2.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/index.js CHANGED
@@ -3333,6 +3333,24 @@ var D5_BODY_ALL_ALLOWED = [
3333
3333
  ...D5_BODY_DRILL_ONLY
3334
3334
  ];
3335
3335
 
3336
+ // ../protocol/src/retention.ts
3337
+ var MIN_RETENTION_DAYS = 14;
3338
+ var MAX_RETENTION_DAYS = 365;
3339
+ var DEFAULT_RETENTION_DAYS = 90;
3340
+ function resolveRetentionDays(retentionPeriodDays) {
3341
+ if (typeof retentionPeriodDays !== "number" || !Number.isFinite(retentionPeriodDays)) {
3342
+ return DEFAULT_RETENTION_DAYS;
3343
+ }
3344
+ const days = Math.trunc(retentionPeriodDays);
3345
+ if (days < MIN_RETENTION_DAYS || days > MAX_RETENTION_DAYS) return DEFAULT_RETENTION_DAYS;
3346
+ return days;
3347
+ }
3348
+ var DAY_MS = 24 * 60 * 60 * 1e3;
3349
+ function keyShareExpiryIso(dispatchAt, retentionPeriodDays) {
3350
+ const days = resolveRetentionDays(retentionPeriodDays);
3351
+ return new Date(dispatchAt.getTime() + days * DAY_MS).toISOString();
3352
+ }
3353
+
3336
3354
  // src/credentials.ts
3337
3355
  var TEST_WEBHOOK_SECRET = (
3338
3356
  // NOSONAR — intentional test credential, not a real secret
@@ -3357,15 +3375,24 @@ function buildHeaders(partnerId, timestamp, signature, dispatchId, event = "addr
3357
3375
  };
3358
3376
  }
3359
3377
  var DEFAULT_ACCOUNT_REF = "CONF-0001";
3378
+ var DEFAULT_CONFORMANCE_KEY_ID = "conformance-key-1";
3379
+ function asConformanceKey(key) {
3380
+ if (!key) return null;
3381
+ if (typeof key === "string") {
3382
+ return { keyId: DEFAULT_CONFORMANCE_KEY_ID, publicKeyB64: key };
3383
+ }
3384
+ return key;
3385
+ }
3360
3386
  var CONFORMANCE_USER_ID = "conformance:drill";
3361
3387
  function conformanceUpdateId() {
3362
3388
  return import_node_crypto.default.randomInt(9e8, 901e6);
3363
3389
  }
3364
- async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address", identity) {
3365
- const partnerKey = {
3390
+ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address", identity, retentionPeriodDays = DEFAULT_RETENTION_DAYS) {
3391
+ const key = asConformanceKey(publicKeyB64);
3392
+ const partnerKey = key && {
3366
3393
  partner_id: partnerId,
3367
- key_id: "conformance-key-1",
3368
- public_key_b64: publicKeyB64,
3394
+ key_id: key.keyId,
3395
+ public_key_b64: key.publicKeyB64,
3369
3396
  algorithm: "ECDH-P256-AES-GCM-256"
3370
3397
  };
3371
3398
  const nowIso = (/* @__PURE__ */ new Date()).toISOString();
@@ -3395,7 +3422,7 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
3395
3422
  // `verified_name`, which is set before the address block.
3396
3423
  ...identity ?? {}
3397
3424
  };
3398
- const envelope = await encryptSessionForPartner(sessionData, partnerKey);
3425
+ const envelope = partnerKey ? await encryptSessionForPartner(sessionData, partnerKey) : { session_envelope: null, session_key_share: null };
3399
3426
  const loa = {
3400
3427
  consumer_name: "Conformance Test",
3401
3428
  authorisation_date: nowIso,
@@ -3406,7 +3433,7 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
3406
3433
  // placeholder r||s hex (128 chars)
3407
3434
  signature_algorithm: "ECDSA-P256"
3408
3435
  };
3409
- const loaEnvelope = await encryptEnvelopeForPartner(loa, partnerKey);
3436
+ const loaEnvelope = partnerKey ? await encryptEnvelopeForPartner(loa, partnerKey) : null;
3410
3437
  return JSON.stringify({
3411
3438
  // Body event and `X-OneAddress-Event` must agree — the relay derives both
3412
3439
  // from the same rule, and a receiver may route on either. An address-
@@ -3444,7 +3471,9 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
3444
3471
  // D5 per-partner encrypted address envelope (identity is INSIDE it).
3445
3472
  session_envelope: envelope.session_envelope,
3446
3473
  session_key_share: envelope.session_key_share,
3447
- key_share_expiry: new Date(Date.now() + 90 * 24 * 60 * 60 * 1e3).toISOString(),
3474
+ // Derived from the same resolver the relay uses, so this is the recipient's
3475
+ // horizon rather than a constant. Was hard-coded to 90 days.
3476
+ key_share_expiry: keyShareExpiryIso(/* @__PURE__ */ new Date(), retentionPeriodDays),
3448
3477
  id_verification: {
3449
3478
  method: "identity_document",
3450
3479
  verified_at: nowIso,
@@ -3452,10 +3481,14 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
3452
3481
  platform: "oneaddress/v1"
3453
3482
  },
3454
3483
  // D5 per-partner encrypted signed LOA. No cleartext letter_of_authority.
3455
- loa_encrypted: {
3456
- session_envelope: loaEnvelope.session_envelope,
3457
- session_key_share: loaEnvelope.session_key_share
3458
- },
3484
+ // Omitted entirely with no key: there is nothing to seal it to, and an
3485
+ // unencrypted authorisation is not a thing this protocol has.
3486
+ ...loaEnvelope ? {
3487
+ loa_encrypted: {
3488
+ session_envelope: loaEnvelope.session_envelope,
3489
+ session_key_share: loaEnvelope.session_key_share
3490
+ }
3491
+ } : {},
3459
3492
  // On the wire with a `null` value when no PaymentIntent backed the update,
3460
3493
  // so the KEY is what a receiver sees either way.
3461
3494
  stripe_session_id: null,
@@ -3533,13 +3566,15 @@ async function get(url, headers, timeoutMs = 12e3) {
3533
3566
  clearTimeout(timer);
3534
3567
  }
3535
3568
  }
3536
- async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId = TEST_PARTNER_ID, publicKeyB64 = TEST_PARTNER_PUBLIC_KEY_SPKI_B64) {
3569
+ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId = TEST_PARTNER_ID, publicKeyB64 = TEST_PARTNER_PUBLIC_KEY_SPKI_B64) {
3537
3570
  let targetUrl;
3538
3571
  let customerUrl;
3539
3572
  let acceptedUpdateTypes = [];
3540
3573
  let verifiesAccountReference = false;
3541
3574
  let supportsKeyCrossover = false;
3542
3575
  let accountRef = DEFAULT_ACCOUNT_REF;
3576
+ let recipientKey;
3577
+ let retentionPeriodDays;
3543
3578
  if (typeof urlOrOptions === "object") {
3544
3579
  targetUrl = urlOrOptions.targetUrl;
3545
3580
  secret = urlOrOptions.secret ?? TEST_WEBHOOK_SECRET;
@@ -3550,12 +3585,15 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3550
3585
  verifiesAccountReference = urlOrOptions.verifiesAccountReference === true;
3551
3586
  supportsKeyCrossover = urlOrOptions.supportsKeyCrossover === true;
3552
3587
  accountRef = urlOrOptions.accountRef?.trim() || DEFAULT_ACCOUNT_REF;
3588
+ recipientKey = "key" in urlOrOptions ? urlOrOptions.key ?? null : asConformanceKey(publicKeyB64);
3589
+ retentionPeriodDays = urlOrOptions.retentionPeriodDays;
3553
3590
  } else {
3554
3591
  targetUrl = urlOrOptions;
3592
+ recipientKey = asConformanceKey(publicKeyB64);
3555
3593
  }
3556
3594
  const results = [];
3557
3595
  const matchable = { account_number: accountRef };
3558
- const sharedBody = await buildBody(partnerId, publicKeyB64, void 0, "address", matchable);
3596
+ const sharedBody = await buildBody(partnerId, recipientKey, void 0, "address", matchable, retentionPeriodDays);
3559
3597
  let declaration = readAcceptedUpdateKindsFromAck(null);
3560
3598
  let check1Accepted;
3561
3599
  {
@@ -3570,7 +3608,7 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3570
3608
  basis: "acceptance",
3571
3609
  label: "Accepts correctly signed webhook",
3572
3610
  passed,
3573
- detail: error ? `Network error: ${error}` : `HTTP ${status} \u2014 expected 2xx`
3611
+ detail: error ? `Network error: ${error}` : status === 401 ? "HTTP 401, expected 2xx. Your receiver is running and refused our signature, so the WEBHOOK_SECRET it holds is not the signing secret on this account's Webhook screen. Check it was set up for THIS partner account (its PARTNER_ID should match yours), then restart it. Every check below depends on this one." : `HTTP ${status} \u2014 expected 2xx`
3574
3612
  });
3575
3613
  }
3576
3614
  {
@@ -3629,10 +3667,11 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3629
3667
  {
3630
3668
  const futureBody = await buildBody(
3631
3669
  partnerId,
3632
- publicKeyB64,
3670
+ recipientKey,
3633
3671
  { future_field: "ignored", future_object: { x: 1 } },
3634
3672
  "address",
3635
- matchable
3673
+ matchable,
3674
+ retentionPeriodDays
3636
3675
  );
3637
3676
  const ts = String(Math.floor(Date.now() / 1e3));
3638
3677
  const sig = sign(futureBody, ts, secret);
@@ -3735,10 +3774,22 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3735
3774
  detail: error ? `Network error: ${error}` : `HTTP ${status} \u2014 expected 2xx (timestamp is within the \xB1300s window)`
3736
3775
  });
3737
3776
  }
3738
- {
3777
+ if (recipientKey) {
3739
3778
  const throwaway = import_node_crypto.default.generateKeyPairSync("ec", { namedCurve: "prime256v1" });
3740
3779
  const foreignKey = throwaway.publicKey.export({ type: "spki", format: "der" }).toString("base64");
3741
- const foreignBody = await buildBody(partnerId, foreignKey);
3780
+ const foreignBody = await buildBody(
3781
+ partnerId,
3782
+ // The partner's OWN key_id over a key they do not hold: a receiver that
3783
+ // selects its private half by key_id must get as far as selecting one and
3784
+ // then fail to decrypt. Labelling it `conformance-key-1` instead would be
3785
+ // refused one step earlier, as an unknown key, which is a different
3786
+ // property from the one this check is named for.
3787
+ { keyId: recipientKey?.keyId ?? DEFAULT_CONFORMANCE_KEY_ID, publicKeyB64: foreignKey },
3788
+ void 0,
3789
+ "address",
3790
+ void 0,
3791
+ retentionPeriodDays
3792
+ );
3742
3793
  const ts = String(Math.floor(Date.now() / 1e3));
3743
3794
  const sig = sign(foreignBody, ts, secret);
3744
3795
  const res = await fetch(targetUrl, {
@@ -3766,13 +3817,13 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3766
3817
  detail: !reachable ? "Network error: no response" : passed ? `HTTP ${status}${bodyFailure ? " with ok:false" : ""} \u2014 correctly reported as a failed delivery. This probe is now held by your receiver, which is how the check was passed: it is one undecryptable dispatch, not a fault in your setup. Clear it with [d] on the dashboard.` : `HTTP ${status} without ok:false \u2014 a payload this receiver CANNOT decrypt was reported as delivered. OneAddress will mark it delivered and never retry it. Return a 4xx/5xx, or 200 with { ok: false }, when decryption fails.`
3767
3818
  });
3768
3819
  }
3769
- if (verifiesAccountReference) {
3820
+ if (verifiesAccountReference && recipientKey) {
3770
3821
  const nonce = import_node_crypto.default.randomUUID();
3771
- const body = await buildBody(partnerId, publicKeyB64, void 0, "address", {
3822
+ const body = await buildBody(partnerId, recipientKey, void 0, "address", {
3772
3823
  account_number: `CONF-NOSUCH-${nonce}`,
3773
3824
  verified_name: `Nomatch ${nonce.slice(0, 8)}`,
3774
3825
  known_names: [`Nomatch ${nonce.slice(0, 8)}`]
3775
- });
3826
+ }, retentionPeriodDays);
3776
3827
  const ts = String(Math.floor(Date.now() / 1e3));
3777
3828
  const sig = sign(body, ts, secret);
3778
3829
  const res = await fetch(targetUrl, {
@@ -3813,7 +3864,7 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3813
3864
  const contactKinds = plan.accept;
3814
3865
  for (const kind of contactKinds) {
3815
3866
  const article = kind === "email" ? "an" : "a";
3816
- const body = await buildBody(partnerId, publicKeyB64, void 0, kind, matchable);
3867
+ const body = await buildBody(partnerId, recipientKey, void 0, kind, matchable, retentionPeriodDays);
3817
3868
  const ts = String(Math.floor(Date.now() / 1e3));
3818
3869
  const sig = sign(body, ts, secret);
3819
3870
  const res = await fetch(targetUrl, {
@@ -3866,7 +3917,7 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3866
3917
  });
3867
3918
  if (plan.refuse !== null) {
3868
3919
  const probe = plan.refuse;
3869
- const body = await buildBody(partnerId, publicKeyB64, void 0, probe, matchable);
3920
+ const body = await buildBody(partnerId, recipientKey, void 0, probe, matchable, retentionPeriodDays);
3870
3921
  const ts = String(Math.floor(Date.now() / 1e3));
3871
3922
  const sig = sign(body, ts, secret);
3872
3923
  const res = await fetch(targetUrl, {
@@ -3892,12 +3943,19 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3892
3943
  detail: res === null ? "Network error: no response" : passed ? `HTTP ${status}, a dispatch carrying an undeclared kind was refused, so nothing it did not promise to handle can be acknowledged and dropped.` : `HTTP ${status}, this receiver ACKNOWLEDGED a dispatch carrying a kind (${probe}) it never declared. That is the silent-loss shape: the consumer is told the update was delivered and the value went nowhere. Refuse it with a 4xx (the SDK answers 422 update_type_not_accepted) so OneAddress retries once you have widened acceptedUpdateTypes.`
3893
3944
  });
3894
3945
  }
3895
- if (supportsKeyCrossover) {
3946
+ if (supportsKeyCrossover && recipientKey) {
3947
+ const stagedKeyId = "conformance-crossover-staged";
3896
3948
  const throwaway = import_node_crypto.default.generateKeyPairSync("ec", { namedCurve: "prime256v1" });
3897
3949
  const foreignKey = throwaway.publicKey.export({ type: "spki", format: "der" }).toString("base64");
3898
- const base = JSON.parse(await buildBody(partnerId, foreignKey));
3899
- const heldKeyId = "conformance-key-1";
3900
- const stagedKeyId = "conformance-crossover-staged";
3950
+ const base = JSON.parse(await buildBody(
3951
+ partnerId,
3952
+ { keyId: stagedKeyId, publicKeyB64: foreignKey },
3953
+ void 0,
3954
+ "address",
3955
+ void 0,
3956
+ retentionPeriodDays
3957
+ ));
3958
+ const heldKeyId = recipientKey?.keyId ?? DEFAULT_CONFORMANCE_KEY_ID;
3901
3959
  base.session_key_share.key_id = stagedKeyId;
3902
3960
  base.crossover_key_ids = [stagedKeyId, heldKeyId];
3903
3961
  const body = JSON.stringify(base);
@@ -3926,6 +3984,62 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3926
3984
  detail: !reachable ? "Network error: no response" : passed ? `HTTP ${status} with crossover:true \u2014 a copy sealed to a rotation sibling key was correctly skip-acked; the copy sealed to a held key carries the update` : `HTTP ${status} \u2014 a copy naming one of this receiver's keys as a crossover sibling was not skip-acked. During a key rotation a copy sealed to your OTHER key must be skipped (a decryptable sibling copy is coming), signalled with { ok: true, skipped: true, crossover: true }. A 500 here drops one copy of a live update; a bare 200 ok:true without crossover:true is check-11's silent-loss shape. Configure your handler's key_id (or key store) so it recognises the marker, or clear "supports key crossover" until you have.`
3927
3985
  });
3928
3986
  }
3987
+ {
3988
+ const nonce = import_node_crypto.default.randomUUID();
3989
+ const body = await buildBody(partnerId, recipientKey, {
3990
+ // `event` IS LOAD-BEARING HERE and setting only the header is the bug this
3991
+ // check shipped with for one run. `buildBody` defaults the body event to
3992
+ // `address.updated`, and both the SDK and the drop-in receiver route on the
3993
+ // BODY, not on `X-OneAddress-Event`. With the header alone our own
3994
+ // reference receiver treated the record as an ordinary update, answered
3995
+ // `{ ok: true }`, and failed its own conformance self-test — which is
3996
+ // precisely the signal this check is supposed to produce for a receiver
3997
+ // that never handled test records. Caught by
3998
+ // `packages/receiver/src/conformance-self.test.ts`.
3999
+ //
4000
+ // `extraFields` is spread last, so this wins, and the two now agree as the
4001
+ // builder's own comment requires.
4002
+ event: "address.test",
4003
+ verification_id: `conformance-${nonce}`,
4004
+ index: 1,
4005
+ total: 1
4006
+ }, "address", {
4007
+ // `...matchable` FIRST, and it is not optional: it carries the account
4008
+ // reference the operator supplied, and `account-ref.test.ts` fails any
4009
+ // probe meant to MATCH that falls back to DEFAULT_ACCOUNT_REF. It caught
4010
+ // exactly that here. A verification record IS meant to match: the whole
4011
+ // point is that the receiver decrypts it and finds something it can place.
4012
+ ...matchable,
4013
+ // Deliberately self-describing. The drop-in receiver PRINTS a verification
4014
+ // line for this record, so it lands in the partner's own stdout beside the
4015
+ // real ones. A name that says what it is stops a drill line being pasted
4016
+ // into a real submission, where it would parse and then mismatch.
4017
+ verified_name: "CONFORMANCE DRILL",
4018
+ known_names: ["CONFORMANCE DRILL"]
4019
+ });
4020
+ const ts = String(Math.floor(Date.now() / 1e3));
4021
+ const sig = sign(body, ts, secret);
4022
+ const { status, error, body: ackBody } = await post(
4023
+ targetUrl,
4024
+ body,
4025
+ buildHeaders(partnerId, ts, sig, `conformance-${nonce}-1`, "address.test")
4026
+ );
4027
+ let parsed = {};
4028
+ try {
4029
+ parsed = JSON.parse(ackBody);
4030
+ } catch {
4031
+ }
4032
+ const acknowledged = !error && status >= 200 && status < 300;
4033
+ const passed = acknowledged && parsed.verification === true;
4034
+ const missing = typeof parsed.missing_callback === "string" ? parsed.missing_callback : null;
4035
+ results.push({
4036
+ id: "check-16",
4037
+ basis: "acceptance",
4038
+ label: "Answers a connection-verification record (address.test)",
4039
+ passed,
4040
+ detail: error ? `Network error: ${error}` : !acknowledged ? `HTTP ${status} \u2014 expected 2xx. A test record is a real signed, encrypted dispatch; refusing it will fail connection verification.` : missing ? `HTTP ${status}, and your receiver reported no \`${missing}\` callback, so the record was acknowledged and SKIPPED. OneAddress sends five of these before go-live and counts how many you decrypt; with no \`${missing}\` you will score zero while every delivery looks clean. Add \`${missing}\` to createOneAddressHandler.` : parsed.verification === true ? `HTTP ${status} \u2014 verification record decrypted and acknowledged` : `HTTP ${status}, but the response did not carry { verification: true }. OneAddress counts that field as proof you decrypted the record, so without it a working receiver still reads as "decrypted 0 of 5" on the real run. Echo it from your test-record handler.`
4041
+ });
4042
+ }
3929
4043
  if (customerUrl) {
3930
4044
  const pullBase = customerUrl.replace(/\/$/, "");
3931
4045
  {
@@ -3983,7 +4097,16 @@ async function runChecks(urlOrOptions, secret = TEST_WEBHOOK_SECRET, partnerId =
3983
4097
  });
3984
4098
  }
3985
4099
  }
3986
- return markUnprovenChecks(results);
4100
+ return { checks: markUnprovenChecks(results), declaration };
4101
+ }
4102
+ async function runChecks(urlOrOptions, secret, partnerId, publicKeyB64) {
4103
+ const run = typeof urlOrOptions === "string" ? await runChecksDetailed(
4104
+ urlOrOptions,
4105
+ secret ?? TEST_WEBHOOK_SECRET,
4106
+ partnerId ?? TEST_PARTNER_ID,
4107
+ publicKeyB64 ?? TEST_PARTNER_PUBLIC_KEY_SPKI_B64
4108
+ ) : await runChecksDetailed(urlOrOptions);
4109
+ return run.checks;
3987
4110
  }
3988
4111
  function markUnprovenChecks(results) {
3989
4112
  const anythingAccepted = results.some((r) => r.basis === "acceptance" && r.passed);
@@ -4187,7 +4310,9 @@ Options:
4187
4310
  Supply ALL THREE or none: a partial set is refused, because it passes every
4188
4311
  signature check while the payload stays sealed to the built-in test key, so
4189
4312
  the failures land on the acceptance checks and read as a fault in your code.
4190
- --customer-url <url> Customer app URL for pull API checks (adds checks 9 + 10)
4313
+ --customer-url <url> Customer app URL for pull API checks (adds checks 12 + 13;
4314
+ this line said "9 + 10" for months, which are the
4315
+ malformed-JSON and replay-edge checks and run always)
4191
4316
  --account-ref <ref> The account reference the dispatches carry (default: CONF-0001,
4192
4317
  which every scaffold seeds). Only matters if your receiver
4193
4318
  matches dispatches to your own customer records: it holds no
package/dist/plan.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * How big a conformance run will be, BEFORE it runs.
3
+ *
4
+ * ── WHY THIS IS ITS OWN MODULE WITH NO IMPORTS ─────────────────────────────
5
+ *
6
+ * The only caller that needs it is the partner portal's Testing card, which is
7
+ * a `'use client'` React component. `checks.ts` reaches `node:crypto` and
8
+ * `@oneaddress/crypto` on the first line, so importing the planner from there
9
+ * drags a key-agreement implementation into the browser bundle to answer a
10
+ * question about arithmetic. This file imports NOTHING, deliberately, and must
11
+ * stay that way: the next person to need a constant from `checks.ts` here
12
+ * should copy the constant, not add the import.
13
+ *
14
+ * `checks.ts` re-exports it so server-side callers keep one import.
15
+ */
16
+ /**
17
+ * Which NON-kind checks a given option set will produce, in run order.
18
+ *
19
+ * ── WHY THIS EXISTS AND WHY IT IS GUARDED BY EXECUTION ─────────────────────
20
+ *
21
+ * The partner portal's Testing card has to say how many checks it is about to
22
+ * run, before it runs them. It did that with `const BASE_CHECK_COUNT = 8` and
23
+ * two conditionals typed into the component, under a comment warning that the
24
+ * number "is the kind that gets reintroduced by the next optional check unless
25
+ * the number is derived rather than typed". It then stayed 8 while the suite
26
+ * the card now calls has eleven unconditional checks, so the card promised ten
27
+ * and ran fifteen.
28
+ *
29
+ * A PLANNER IS A SECOND ENCODING OF THE SUITE AND WOULD DRIFT TOO, so it is not
30
+ * trusted: `src/__tests__/planner-matches-run.test.ts` EXECUTES the suite
31
+ * against a stub receiver and asserts this function's output equals the
32
+ * non-kind ids the run actually produced, for every combination of the gates.
33
+ * A check added without a line here fails that test rather than quietly
34
+ * mis-sizing the card.
35
+ *
36
+ * KIND CHECKS ARE DELIBERATELY NOT COUNTED. How many there are depends on what
37
+ * the RECEIVER declares on its first acknowledgement, which is not known until
38
+ * check-1 has run. The card says "plus the update-kind checks your receiver's
39
+ * own declaration drives" instead of guessing, which is the honest form.
40
+ */
41
+ declare function plannedCoreCheckIds(opts: {
42
+ /** The partner has a registered encryption key. */
43
+ hasKey?: boolean;
44
+ /** `partners.verifies_account_reference` resolved to true. */
45
+ verifiesAccountReference?: boolean;
46
+ /** The receiver declared it handles key-crossover siblings. */
47
+ supportsKeyCrossover?: boolean;
48
+ /** A customer-app base URL was supplied, adding the pull-API checks. */
49
+ hasCustomerUrl?: boolean;
50
+ }): string[];
51
+
52
+ export { plannedCoreCheckIds };
package/dist/plan.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/plan.ts
21
+ var plan_exports = {};
22
+ __export(plan_exports, {
23
+ plannedCoreCheckIds: () => plannedCoreCheckIds
24
+ });
25
+ module.exports = __toCommonJS(plan_exports);
26
+ function plannedCoreCheckIds(opts) {
27
+ const ids = [
28
+ "check-1",
29
+ "check-2",
30
+ "check-3",
31
+ "check-4",
32
+ "check-5",
33
+ "check-6",
34
+ "check-7",
35
+ "check-8",
36
+ "check-9",
37
+ "check-10"
38
+ ];
39
+ if (opts.hasKey) ids.push("check-11");
40
+ if (opts.verifiesAccountReference && opts.hasKey) ids.push("check-14");
41
+ if (opts.supportsKeyCrossover && opts.hasKey) ids.push("check-15");
42
+ ids.push("check-16");
43
+ if (opts.hasCustomerUrl) ids.push("check-12", "check-13");
44
+ return ids;
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ plannedCoreCheckIds
49
+ });
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@oneaddress/conformance",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Conformance test tool for OneAddress partner integrations",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
7
7
  "oneaddress-conformance": "./dist/index.js"
8
8
  },
9
- "files": ["LICENSE", "dist", "README.md"],
9
+ "files": [
10
+ "LICENSE",
11
+ "dist",
12
+ "README.md"
13
+ ],
10
14
  "scripts": {
11
- "build": "tsup",
12
- "prepare": "tsup",
15
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
16
+ "prepare": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
13
17
  "type-check": "tsc --noEmit"
14
18
  },
15
19
  "publishConfig": {