@oneaddress/conformance 3.4.0 → 3.5.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/README.md +10 -0
- package/dist/checks.d.ts +53 -13
- package/dist/checks.js +134 -17
- package/dist/index.js +126 -17
- package/dist/plan.d.ts +2 -0
- package/dist/plan.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,18 @@ Runs a suite of end-to-end checks against a partner's webhook endpoint, covering
|
|
|
11
11
|
- `check-12` and `check-13` (pull API): run only with `--customer-url`.
|
|
12
12
|
- `check-14`: an account reference that cannot match is not acknowledged as matched. Only with `--verifies-account-reference`.
|
|
13
13
|
- `check-15` and `check-16`: key-crossover handling and the `address.test` event.
|
|
14
|
+
- `check-17`: an envelope carrying a field the receiver cannot know is acknowledged. Every run with a key.
|
|
15
|
+
- `check-18`: one envelope per product line (up to five), each carrying that line as `product`, is acknowledged. Only when the run is given product lines (`productLines` in `runChecksDetailed`).
|
|
14
16
|
- The update-kind, contact and LOA checks described below.
|
|
15
17
|
|
|
18
|
+
**Not in this suite: the account check.** The run in the partner portal adds one
|
|
19
|
+
more check, `check-account-verify`, which sends a signed `account.verify` for a
|
|
20
|
+
made-up person and passes only on `match`, `no_match` or `no_account`. Go live
|
|
21
|
+
needs it, and OneAddress sends an update only to a service whose account check
|
|
22
|
+
answered `match`, so a receiver that answers `skipped` is not offered to
|
|
23
|
+
consumers. A green run here does not prove that check: run the checks in the
|
|
24
|
+
portal before you go live.
|
|
25
|
+
|
|
16
26
|
Every fixed dispatch id carries a per-run suffix, so a receiver with a persistent idempotency store decrypts again on a re-run rather than answering `duplicate: true`.
|
|
17
27
|
|
|
18
28
|
### Update kinds: what your receiver's code says it can take
|
package/dist/checks.d.ts
CHANGED
|
@@ -203,6 +203,21 @@ type ConformanceKind = 'address' | 'phone' | 'email';
|
|
|
203
203
|
* would break the runs that prove the scaffolds work.
|
|
204
204
|
*/
|
|
205
205
|
declare const DEFAULT_ACCOUNT_REF = "CONF-0001";
|
|
206
|
+
/** One of the partner's product lines, as check-18 seals it into the envelope. */
|
|
207
|
+
interface ConformanceProductLine {
|
|
208
|
+
id: string;
|
|
209
|
+
code: string;
|
|
210
|
+
name: string;
|
|
211
|
+
}
|
|
212
|
+
/** Check-18 probes at most this many lines, the portal's per-partner cap. */
|
|
213
|
+
declare const MAX_PRODUCT_LINES_PROBED = 5;
|
|
214
|
+
/** Fields `buildBody` sets or adds inside the session envelope. */
|
|
215
|
+
type SealedOverrides = {
|
|
216
|
+
account_number?: string;
|
|
217
|
+
verified_name?: string;
|
|
218
|
+
known_names?: string[];
|
|
219
|
+
product?: ConformanceProductLine;
|
|
220
|
+
} & Record<string, unknown>;
|
|
206
221
|
/**
|
|
207
222
|
* The key_id this suite labels its envelopes with when the caller does not name
|
|
208
223
|
* one. The built-in test key is a single key with no rotation history, so any
|
|
@@ -235,6 +250,12 @@ declare const DEFAULT_CONFORMANCE_KEY_ID = "conformance-key-1";
|
|
|
235
250
|
interface ConformanceKey {
|
|
236
251
|
keyId: string;
|
|
237
252
|
publicKeyB64: string;
|
|
253
|
+
/**
|
|
254
|
+
* The key's registered wrap, as `partner_keys.algorithm` stores it. Absent
|
|
255
|
+
* means ECDH P-256, which is every key the CLI generates. An RSA-OAEP or
|
|
256
|
+
* X-Wing key sealed as ECDH fails at the sender, so the portal passes this.
|
|
257
|
+
*/
|
|
258
|
+
algorithm?: string | null;
|
|
238
259
|
}
|
|
239
260
|
/**
|
|
240
261
|
* Accept either form at every call site, so the CLI's `buildBody(id, b64)` and
|
|
@@ -296,6 +317,21 @@ interface DrillLoaPlan {
|
|
|
296
317
|
* test because a test that rebuilds the body it is meant to check can only ever
|
|
297
318
|
* agree with itself; the guard has to run THIS function.
|
|
298
319
|
*/
|
|
320
|
+
/** The address every address-kind drill seals. Exported for check-16's commitment. */
|
|
321
|
+
declare const CONFORMANCE_ADDRESS: {
|
|
322
|
+
readonly street: "42 Collins Street";
|
|
323
|
+
readonly suburb: "Melbourne";
|
|
324
|
+
readonly state: "VIC";
|
|
325
|
+
readonly postcode: "3000";
|
|
326
|
+
readonly country: "AU";
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Check-16's reading of a receiver's signed answer (3 Nov 2026), against the
|
|
330
|
+
* record the check SEALED: `match`, `mismatch` (present but wrong or
|
|
331
|
+
* malformed), or `absent` (an older receiver). Same canonical function as the
|
|
332
|
+
* relay and every SDK, from @oneaddress/protocol.
|
|
333
|
+
*/
|
|
334
|
+
declare function conformanceCommitmentCheck(answer: unknown, secret: string, verificationId: string, index: number, name: string): 'match' | 'mismatch' | 'absent';
|
|
299
335
|
declare function buildBody(partnerId: string,
|
|
300
336
|
/**
|
|
301
337
|
* The recipient key: a bare SPKI base64 string (the CLI's built-in test key,
|
|
@@ -310,19 +346,16 @@ publicKeyB64: string | ConformanceKey | null, extraFields?: Record<string, unkno
|
|
|
310
346
|
*/
|
|
311
347
|
kind?: ConformanceKind | string,
|
|
312
348
|
/**
|
|
313
|
-
* Override
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* envelope rather than in `extraFields`: `extraFields` lands on the
|
|
317
|
-
* wire, where the receiver cannot act on it and where identity has
|
|
318
|
-
* travelled since the D5 cutover. A no-match has to be a real no-match
|
|
319
|
-
* decryption, or the check proves nothing.
|
|
349
|
+
* Override or add fields INSIDE the session envelope.
|
|
350
|
+
*
|
|
351
|
+
* Check-14 overrides the identity here, and it needs the override to be
|
|
352
|
+
* inside the envelope rather than in `extraFields`: `extraFields` lands on the
|
|
353
|
+
* cleartext wire, where the receiver cannot act on it and where identity has
|
|
354
|
+
* not travelled since the D5 cutover. A no-match has to be a real no-match
|
|
355
|
+
* after decryption, or the check proves nothing. Checks 17 and 18 seal an
|
|
356
|
+
* unknown field and a product line the same way.
|
|
320
357
|
*/
|
|
321
|
-
identity?:
|
|
322
|
-
account_number?: string;
|
|
323
|
-
verified_name?: string;
|
|
324
|
-
known_names?: string[];
|
|
325
|
-
},
|
|
358
|
+
identity?: SealedOverrides,
|
|
326
359
|
/**
|
|
327
360
|
* The retention window to advertise as `key_share_expiry`, in days.
|
|
328
361
|
*
|
|
@@ -458,6 +491,13 @@ interface RunChecksOptions {
|
|
|
458
491
|
* dual-wrapped, which is why it opts the check in.
|
|
459
492
|
*/
|
|
460
493
|
supportsKeyCrossover?: boolean;
|
|
494
|
+
/**
|
|
495
|
+
* The partner's live product lines. Adds check-18, which seals one envelope
|
|
496
|
+
* per line (the first {@link MAX_PRODUCT_LINES_PROBED}) carrying that line as
|
|
497
|
+
* `product` and expects each to be acknowledged. Empty or absent runs no
|
|
498
|
+
* product check, because a partner with no lines is never sent one.
|
|
499
|
+
*/
|
|
500
|
+
productLines?: ConformanceProductLine[];
|
|
461
501
|
/**
|
|
462
502
|
* Signs the drill's consent proof (LOA). See {@link DrillLoaSigner}.
|
|
463
503
|
*
|
|
@@ -565,4 +605,4 @@ declare function runChecks(options: RunChecksOptions): Promise<CheckResult[]>;
|
|
|
565
605
|
*/
|
|
566
606
|
declare function markUnprovenChecks(results: CheckResult[]): CheckResult[];
|
|
567
607
|
|
|
568
|
-
export { type CheckBasis, type CheckResult, type ConformanceKey, type ConformanceRun, DEFAULT_ACCOUNT_REF, DEFAULT_CONFORMANCE_KEY_ID, type DrillLoa, type DrillLoaPlan, type DrillLoaRequest, type DrillLoaSigner, LoaSignerError, type RunChecksOptions, UNSIGNED_LOA_NOTE, annotateUnsignedLoa, asConformanceKey, buildBody, describeFetchError, drillLoa, drillLoaV1Canonical, drillLoaV2Canonical, localDrillLoaSigner, markUnprovenChecks, runChecks, runChecksDetailed, signPullV2 };
|
|
608
|
+
export { CONFORMANCE_ADDRESS, type CheckBasis, type CheckResult, type ConformanceKey, type ConformanceProductLine, type ConformanceRun, DEFAULT_ACCOUNT_REF, DEFAULT_CONFORMANCE_KEY_ID, type DrillLoa, type DrillLoaPlan, type DrillLoaRequest, type DrillLoaSigner, LoaSignerError, MAX_PRODUCT_LINES_PROBED, type RunChecksOptions, type SealedOverrides, UNSIGNED_LOA_NOTE, annotateUnsignedLoa, asConformanceKey, buildBody, conformanceCommitmentCheck, describeFetchError, drillLoa, drillLoaV1Canonical, drillLoaV2Canonical, localDrillLoaSigner, markUnprovenChecks, runChecks, runChecksDetailed, signPullV2 };
|
package/dist/checks.js
CHANGED
|
@@ -32,13 +32,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
32
32
|
// src/checks.ts
|
|
33
33
|
var checks_exports = {};
|
|
34
34
|
__export(checks_exports, {
|
|
35
|
+
CONFORMANCE_ADDRESS: () => CONFORMANCE_ADDRESS,
|
|
35
36
|
DEFAULT_ACCOUNT_REF: () => DEFAULT_ACCOUNT_REF,
|
|
36
37
|
DEFAULT_CONFORMANCE_KEY_ID: () => DEFAULT_CONFORMANCE_KEY_ID,
|
|
37
38
|
LoaSignerError: () => LoaSignerError,
|
|
39
|
+
MAX_PRODUCT_LINES_PROBED: () => MAX_PRODUCT_LINES_PROBED,
|
|
38
40
|
UNSIGNED_LOA_NOTE: () => UNSIGNED_LOA_NOTE,
|
|
39
41
|
annotateUnsignedLoa: () => annotateUnsignedLoa,
|
|
40
42
|
asConformanceKey: () => asConformanceKey,
|
|
41
43
|
buildBody: () => buildBody,
|
|
44
|
+
conformanceCommitmentCheck: () => conformanceCommitmentCheck,
|
|
42
45
|
describeFetchError: () => describeFetchError,
|
|
43
46
|
drillLoa: () => drillLoa,
|
|
44
47
|
drillLoaV1Canonical: () => drillLoaV1Canonical,
|
|
@@ -3947,12 +3950,25 @@ var ENDPOINT_STALE_AFTER_MINUTES = ENDPOINT_PROBE_INTERVAL_MINUTES * 4;
|
|
|
3947
3950
|
var ENDPOINT_UNUSABLE_AFTER_MINUTES = ENDPOINT_PROBE_INTERVAL_MINUTES * 24;
|
|
3948
3951
|
|
|
3949
3952
|
// ../crypto/src/registry-root-pin.ts
|
|
3950
|
-
var
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
})
|
|
3953
|
+
var PRODUCTION_REGISTRY_HOSTS = Object.freeze([
|
|
3954
|
+
"oneaddress.io",
|
|
3955
|
+
"www.oneaddress.io",
|
|
3956
|
+
"app.oneaddress.io"
|
|
3955
3957
|
]);
|
|
3958
|
+
var PRODUCTION_ROOT = Object.freeze({
|
|
3959
|
+
root_key_id: "rk1_251368ec9b0a84ae",
|
|
3960
|
+
spki_sha256: "251368ec9b0a84ae9881533bd1687efb7d439edd927aef47c1bb3bb069b3dc1d"
|
|
3961
|
+
});
|
|
3962
|
+
var REGISTRY_ROOT_PINS = Object.freeze({
|
|
3963
|
+
production: Object.freeze([PRODUCTION_ROOT]),
|
|
3964
|
+
preview: Object.freeze([
|
|
3965
|
+
Object.freeze({
|
|
3966
|
+
root_key_id: "rk1_4690d67464893d48",
|
|
3967
|
+
spki_sha256: "4690d67464893d48ebb335bcd29f3203fbacefbc69afd8a047b639521296bfab"
|
|
3968
|
+
})
|
|
3969
|
+
])
|
|
3970
|
+
});
|
|
3971
|
+
var PINNED_REGISTRY_ROOTS = REGISTRY_ROOT_PINS.production;
|
|
3956
3972
|
|
|
3957
3973
|
// ../crypto/src/vault-pin-hardening.ts
|
|
3958
3974
|
var oprf = ristretto255_oprf.oprf;
|
|
@@ -4225,7 +4241,18 @@ var D5_BODY_CONDITIONAL = {
|
|
|
4225
4241
|
*/
|
|
4226
4242
|
id: "key-crossover copy only",
|
|
4227
4243
|
/** The sibling marker naming the other key_ids this update was sealed to. */
|
|
4228
|
-
crossover_key_ids: "key-crossover copy only"
|
|
4244
|
+
crossover_key_ids: "key-crossover copy only",
|
|
4245
|
+
/**
|
|
4246
|
+
* The day the change takes effect, `YYYY-MM-DD` (31 Oct 2026). Set on every
|
|
4247
|
+
* dispatch made for a SCHEDULED MOVE, which is its move date. A scheduled
|
|
4248
|
+
* move sends each recipient early enough for its own notice period
|
|
4249
|
+
* (`resolveRecipientSendPlan` in `notice-period.ts`), so the update can
|
|
4250
|
+
* arrive days before the customer moves; a recipient that treated it as
|
|
4251
|
+
* immediate could start charging at the new address from the day it arrived.
|
|
4252
|
+
* Absent on an immediate update, which takes effect on receipt. Optional for
|
|
4253
|
+
* receivers: an SDK that does not know the field ignores it.
|
|
4254
|
+
*/
|
|
4255
|
+
effective_date: "scheduled move only"
|
|
4229
4256
|
};
|
|
4230
4257
|
var D5_BODY_DRILL_ONLY = ["conformance"];
|
|
4231
4258
|
var D5_BODY_ADDED_AT_SEND = ["dispatch_id"];
|
|
@@ -4373,6 +4400,36 @@ function isWellFormedDrillLoa(loa, request) {
|
|
|
4373
4400
|
return l.consumer_name === DRILL_LOA_CONSUMER_NAME && l.scope === DRILL_LOA_SCOPE && l.oneaddress_acn === ONEADDRESS_LOA_ACN && l.update_uid === request.updateUid && l.partner_id === request.partnerId && l.envelope_sha256 === request.envelopeSha256 && Array.isArray(aliases) && aliases.length === wantAliases.length && aliases.every((a, i) => a === wantAliases[i]) && l.signature_algorithm === "ECDSA-P256" && typeof l.oneaddress_signature === "string" && /^[0-9a-f]{128}$/.test(l.oneaddress_signature) && typeof l.oneaddress_signature_v2 === "string" && /^[0-9a-f]{128}$/.test(l.oneaddress_signature_v2) && typeof l.authorisation_date === "string" && !Number.isNaN(Date.parse(l.authorisation_date));
|
|
4374
4401
|
}
|
|
4375
4402
|
|
|
4403
|
+
// ../protocol/src/verification-commitment.ts
|
|
4404
|
+
var VERIFICATION_COMMITMENT_VERSION = "oa-verify.v1";
|
|
4405
|
+
var ASCII_WHITESPACE_RUN = /[\t\n\v\f\r ]+/g;
|
|
4406
|
+
function normaliseCommitmentField(value) {
|
|
4407
|
+
if (typeof value !== "string") return "";
|
|
4408
|
+
const collapsed = value.replace(ASCII_WHITESPACE_RUN, " ");
|
|
4409
|
+
const start = collapsed.startsWith(" ") ? 1 : 0;
|
|
4410
|
+
const end = collapsed.length > start && collapsed.endsWith(" ") ? collapsed.length - 1 : collapsed.length;
|
|
4411
|
+
return collapsed.slice(start, end);
|
|
4412
|
+
}
|
|
4413
|
+
function verificationCommitmentString(verificationId, index, record) {
|
|
4414
|
+
if (!Number.isInteger(index) || index <= 0) {
|
|
4415
|
+
throw new RangeError(`verification commitment index must be a positive integer, got ${String(index)}`);
|
|
4416
|
+
}
|
|
4417
|
+
return [
|
|
4418
|
+
VERIFICATION_COMMITMENT_VERSION,
|
|
4419
|
+
normaliseCommitmentField(verificationId),
|
|
4420
|
+
String(index),
|
|
4421
|
+
normaliseCommitmentField(record.name),
|
|
4422
|
+
normaliseCommitmentField(record.street),
|
|
4423
|
+
normaliseCommitmentField(record.suburb),
|
|
4424
|
+
normaliseCommitmentField(record.state),
|
|
4425
|
+
normaliseCommitmentField(record.postcode),
|
|
4426
|
+
normaliseCommitmentField(record.country)
|
|
4427
|
+
].join("\n");
|
|
4428
|
+
}
|
|
4429
|
+
function isWellFormedCommitment(value) {
|
|
4430
|
+
return typeof value === "string" && /^[0-9a-f]{64}$/.test(value);
|
|
4431
|
+
}
|
|
4432
|
+
|
|
4376
4433
|
// src/plan.ts
|
|
4377
4434
|
function plannedCoreCheckIds(opts2) {
|
|
4378
4435
|
const ids = [
|
|
@@ -4391,6 +4448,8 @@ function plannedCoreCheckIds(opts2) {
|
|
|
4391
4448
|
if (opts2.verifiesAccountReference && opts2.hasKey) ids.push("check-14");
|
|
4392
4449
|
if (opts2.supportsKeyCrossover && opts2.hasKey) ids.push("check-15");
|
|
4393
4450
|
ids.push("check-16");
|
|
4451
|
+
if (opts2.hasKey) ids.push("check-17");
|
|
4452
|
+
if (opts2.hasKey && opts2.hasProductLines) ids.push("check-18");
|
|
4394
4453
|
if (opts2.hasCustomerUrl) ids.push("check-12", "check-13");
|
|
4395
4454
|
return ids;
|
|
4396
4455
|
}
|
|
@@ -4457,6 +4516,7 @@ function buildHeaders(partnerId, timestamp, signature, dispatchId, event = "addr
|
|
|
4457
4516
|
};
|
|
4458
4517
|
}
|
|
4459
4518
|
var DEFAULT_ACCOUNT_REF = "CONF-0001";
|
|
4519
|
+
var MAX_PRODUCT_LINES_PROBED = 5;
|
|
4460
4520
|
var DEFAULT_CONFORMANCE_KEY_ID = "conformance-key-1";
|
|
4461
4521
|
function asConformanceKey(key) {
|
|
4462
4522
|
if (!key) return null;
|
|
@@ -4543,13 +4603,26 @@ async function drillLoaFor(request, nowIso, plan) {
|
|
|
4543
4603
|
}
|
|
4544
4604
|
return loa;
|
|
4545
4605
|
}
|
|
4606
|
+
var CONFORMANCE_ADDRESS = {
|
|
4607
|
+
street: "42 Collins Street",
|
|
4608
|
+
suburb: "Melbourne",
|
|
4609
|
+
state: "VIC",
|
|
4610
|
+
postcode: "3000",
|
|
4611
|
+
country: "AU"
|
|
4612
|
+
};
|
|
4613
|
+
function conformanceCommitmentCheck(answer, secret, verificationId, index, name) {
|
|
4614
|
+
if (answer === void 0 || answer === null) return "absent";
|
|
4615
|
+
if (!isWellFormedCommitment(answer)) return "mismatch";
|
|
4616
|
+
const expected = import_node_crypto2.default.createHmac("sha256", secret).update(verificationCommitmentString(verificationId, index, { name, ...CONFORMANCE_ADDRESS }), "utf8").digest("hex");
|
|
4617
|
+
return import_node_crypto2.default.timingSafeEqual(Buffer.from(answer, "hex"), Buffer.from(expected, "hex")) ? "match" : "mismatch";
|
|
4618
|
+
}
|
|
4546
4619
|
async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address", identity, retentionPeriodDays = DEFAULT_RETENTION_DAYS, loaPlan) {
|
|
4547
4620
|
const key = asConformanceKey(publicKeyB64);
|
|
4548
4621
|
const partnerKey = key && {
|
|
4549
4622
|
partner_id: partnerId,
|
|
4550
4623
|
key_id: key.keyId,
|
|
4551
4624
|
public_key_b64: key.publicKeyB64,
|
|
4552
|
-
algorithm: "ECDH-P256-AES-GCM-256"
|
|
4625
|
+
algorithm: key.algorithm ?? "ECDH-P256-AES-GCM-256"
|
|
4553
4626
|
};
|
|
4554
4627
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
4555
4628
|
const updateIdNum = conformanceUpdateId();
|
|
@@ -4562,13 +4635,7 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
|
|
|
4562
4635
|
// signer) and a v2 receiver refuses an envelope whose name differs.
|
|
4563
4636
|
verified_name: DRILL_LOA_CONSUMER_NAME,
|
|
4564
4637
|
...kind === "address" ? {
|
|
4565
|
-
new_address: {
|
|
4566
|
-
street: "42 Collins Street",
|
|
4567
|
-
suburb: "Melbourne",
|
|
4568
|
-
state: "VIC",
|
|
4569
|
-
postcode: "3000",
|
|
4570
|
-
country: "AU"
|
|
4571
|
-
}
|
|
4638
|
+
new_address: { ...CONFORMANCE_ADDRESS }
|
|
4572
4639
|
} : {},
|
|
4573
4640
|
...kind === "phone" ? { new_phone: "+61412345678" } : {},
|
|
4574
4641
|
...kind === "email" ? { new_email: "conformance@example.com" } : {},
|
|
@@ -4733,6 +4800,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
4733
4800
|
let acceptedUpdateTypes = [];
|
|
4734
4801
|
let verifiesAccountReference = false;
|
|
4735
4802
|
let supportsKeyCrossover = false;
|
|
4803
|
+
let productLines = [];
|
|
4736
4804
|
let accountRef = DEFAULT_ACCOUNT_REF;
|
|
4737
4805
|
let recipientKey;
|
|
4738
4806
|
let retentionPeriodDays;
|
|
@@ -4748,6 +4816,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
4748
4816
|
acceptedUpdateTypes = urlOrOptions.acceptedUpdateTypes ?? [];
|
|
4749
4817
|
verifiesAccountReference = urlOrOptions.verifiesAccountReference === true;
|
|
4750
4818
|
supportsKeyCrossover = urlOrOptions.supportsKeyCrossover === true;
|
|
4819
|
+
productLines = (urlOrOptions.productLines ?? []).slice(0, MAX_PRODUCT_LINES_PROBED);
|
|
4751
4820
|
accountRef = urlOrOptions.accountRef?.trim() || DEFAULT_ACCOUNT_REF;
|
|
4752
4821
|
recipientKey = "key" in urlOrOptions ? urlOrOptions.key ?? null : asConformanceKey(publicKeyB64);
|
|
4753
4822
|
retentionPeriodDays = urlOrOptions.retentionPeriodDays;
|
|
@@ -5215,15 +5284,60 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
5215
5284
|
parsed = JSON.parse(ackBody);
|
|
5216
5285
|
} catch {
|
|
5217
5286
|
}
|
|
5287
|
+
const commitment = conformanceCommitmentCheck(
|
|
5288
|
+
parsed.commitment,
|
|
5289
|
+
secret,
|
|
5290
|
+
`conformance-${nonce}`,
|
|
5291
|
+
1,
|
|
5292
|
+
"CONFORMANCE DRILL"
|
|
5293
|
+
);
|
|
5218
5294
|
const acknowledged = !error && status >= 200 && status < 300;
|
|
5219
|
-
const passed = acknowledged && parsed.verification === true;
|
|
5295
|
+
const passed = acknowledged && parsed.verification === true && commitment !== "mismatch";
|
|
5220
5296
|
const missing = typeof parsed.missing_callback === "string" ? parsed.missing_callback : null;
|
|
5221
5297
|
results.push({
|
|
5222
5298
|
id: "check-16",
|
|
5223
5299
|
basis: "acceptance",
|
|
5224
5300
|
label: "Answers a connection-verification record (address.test)",
|
|
5225
5301
|
passed,
|
|
5226
|
-
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}
|
|
5302
|
+
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 && commitment === "mismatch" ? `HTTP ${status}, and the response said it decrypted the record, but its signed answer (\`commitment\`) does not match what was sent. OneAddress refuses that answer when you go live. Check the receiver keys it with the webhook secret that verified the request and builds it from the decrypted name and address, not a formatted copy.` : parsed.verification === true && commitment === "match" ? `HTTP ${status}: verification record decrypted, and its signed answer matches what was sent` : parsed.verification === true ? `HTTP ${status}: verification record decrypted and acknowledged, but with no signed answer (\`commitment\`). Going live will need one: update to the current OneAddress SDK or setup wizard, or, while older receivers are still accepted, ask us to run a connection verification and send back the block it prints.` : `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.`
|
|
5303
|
+
});
|
|
5304
|
+
}
|
|
5305
|
+
if (recipientKey) {
|
|
5306
|
+
const body = await buildBody(partnerId, recipientKey, void 0, "address", {
|
|
5307
|
+
...matchable,
|
|
5308
|
+
x_conformance_unknown: "ignore me"
|
|
5309
|
+
}, retentionPeriodDays, signedLoa);
|
|
5310
|
+
const ts = String(Math.floor(Date.now() / 1e3));
|
|
5311
|
+
const sig = sign(body, ts, secret);
|
|
5312
|
+
const { status, error } = await postTarget(targetUrl, body, buildHeaders(partnerId, ts, sig, `sealed-unknown-${runId}`));
|
|
5313
|
+
const passed = !error && status >= 200 && status < 300;
|
|
5314
|
+
results.push({
|
|
5315
|
+
id: "check-17",
|
|
5316
|
+
basis: "acceptance",
|
|
5317
|
+
label: "Handles an unknown field inside the sealed envelope",
|
|
5318
|
+
passed,
|
|
5319
|
+
detail: error ? `Network error: ${error}` : passed ? `HTTP ${status}: an envelope carrying a field this receiver cannot know was acknowledged` : `HTTP ${status}, expected 2xx. The only difference from check-1 is an extra field inside the decrypted envelope. OneAddress adds optional envelope fields without a version change, so a receiver that refuses unknown fields will start refusing real updates. Ignore fields you do not read.`
|
|
5320
|
+
});
|
|
5321
|
+
}
|
|
5322
|
+
if (recipientKey && productLines.length > 0) {
|
|
5323
|
+
const refused = [];
|
|
5324
|
+
for (const line of productLines) {
|
|
5325
|
+
const body = await buildBody(partnerId, recipientKey, void 0, "address", {
|
|
5326
|
+
...matchable,
|
|
5327
|
+
product: { id: line.id, code: line.code, name: line.name }
|
|
5328
|
+
}, retentionPeriodDays, signedLoa);
|
|
5329
|
+
const ts = String(Math.floor(Date.now() / 1e3));
|
|
5330
|
+
const sig = sign(body, ts, secret);
|
|
5331
|
+
const { status, error } = await postTarget(targetUrl, body, buildHeaders(partnerId, ts, sig, `product-${line.code}-${runId}`));
|
|
5332
|
+
if (error || status < 200 || status >= 300) refused.push(`${line.code} (${error ? `network error: ${error}` : `HTTP ${status}`})`);
|
|
5333
|
+
}
|
|
5334
|
+
const codes = productLines.map((l) => l.code).join(", ");
|
|
5335
|
+
results.push({
|
|
5336
|
+
id: "check-18",
|
|
5337
|
+
basis: "acceptance",
|
|
5338
|
+
label: "Accepts every product line",
|
|
5339
|
+
passed: refused.length === 0,
|
|
5340
|
+
detail: refused.length === 0 ? `Acknowledged an envelope for each product line: ${codes}` : `Not acknowledged: ${refused.join("; ")}. Each envelope matched check-1 apart from its \`product\`, so a receiver that routes on product.code has no route for these codes. Add one, or a default for codes it does not know.`
|
|
5227
5341
|
});
|
|
5228
5342
|
}
|
|
5229
5343
|
if (loaSigner && recipientKey) {
|
|
@@ -5344,7 +5458,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
5344
5458
|
const checks = markUnprovenChecks(loaSigner ? results : annotateUnsignedLoa(results));
|
|
5345
5459
|
return { checks, declaration, informational, loaSigned: loaSigner !== null };
|
|
5346
5460
|
}
|
|
5347
|
-
var LOA_BEARING_ACCEPTANCE = /* @__PURE__ */ new Set(["check-1", "check-6", "check-8", "check-10", "check-16"]);
|
|
5461
|
+
var LOA_BEARING_ACCEPTANCE = /* @__PURE__ */ new Set(["check-1", "check-6", "check-8", "check-10", "check-16", "check-17", "check-18"]);
|
|
5348
5462
|
function annotateUnsignedLoa(results) {
|
|
5349
5463
|
return results.map((r) => {
|
|
5350
5464
|
if (r.passed) return r;
|
|
@@ -5382,13 +5496,16 @@ function markUnprovenChecks(results) {
|
|
|
5382
5496
|
}
|
|
5383
5497
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5384
5498
|
0 && (module.exports = {
|
|
5499
|
+
CONFORMANCE_ADDRESS,
|
|
5385
5500
|
DEFAULT_ACCOUNT_REF,
|
|
5386
5501
|
DEFAULT_CONFORMANCE_KEY_ID,
|
|
5387
5502
|
LoaSignerError,
|
|
5503
|
+
MAX_PRODUCT_LINES_PROBED,
|
|
5388
5504
|
UNSIGNED_LOA_NOTE,
|
|
5389
5505
|
annotateUnsignedLoa,
|
|
5390
5506
|
asConformanceKey,
|
|
5391
5507
|
buildBody,
|
|
5508
|
+
conformanceCommitmentCheck,
|
|
5392
5509
|
describeFetchError,
|
|
5393
5510
|
drillLoa,
|
|
5394
5511
|
drillLoaV1Canonical,
|
package/dist/index.js
CHANGED
|
@@ -3925,12 +3925,25 @@ var ENDPOINT_STALE_AFTER_MINUTES = ENDPOINT_PROBE_INTERVAL_MINUTES * 4;
|
|
|
3925
3925
|
var ENDPOINT_UNUSABLE_AFTER_MINUTES = ENDPOINT_PROBE_INTERVAL_MINUTES * 24;
|
|
3926
3926
|
|
|
3927
3927
|
// ../crypto/src/registry-root-pin.ts
|
|
3928
|
-
var
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
})
|
|
3928
|
+
var PRODUCTION_REGISTRY_HOSTS = Object.freeze([
|
|
3929
|
+
"oneaddress.io",
|
|
3930
|
+
"www.oneaddress.io",
|
|
3931
|
+
"app.oneaddress.io"
|
|
3933
3932
|
]);
|
|
3933
|
+
var PRODUCTION_ROOT = Object.freeze({
|
|
3934
|
+
root_key_id: "rk1_251368ec9b0a84ae",
|
|
3935
|
+
spki_sha256: "251368ec9b0a84ae9881533bd1687efb7d439edd927aef47c1bb3bb069b3dc1d"
|
|
3936
|
+
});
|
|
3937
|
+
var REGISTRY_ROOT_PINS = Object.freeze({
|
|
3938
|
+
production: Object.freeze([PRODUCTION_ROOT]),
|
|
3939
|
+
preview: Object.freeze([
|
|
3940
|
+
Object.freeze({
|
|
3941
|
+
root_key_id: "rk1_4690d67464893d48",
|
|
3942
|
+
spki_sha256: "4690d67464893d48ebb335bcd29f3203fbacefbc69afd8a047b639521296bfab"
|
|
3943
|
+
})
|
|
3944
|
+
])
|
|
3945
|
+
});
|
|
3946
|
+
var PINNED_REGISTRY_ROOTS = REGISTRY_ROOT_PINS.production;
|
|
3934
3947
|
|
|
3935
3948
|
// ../crypto/src/vault-pin-hardening.ts
|
|
3936
3949
|
var oprf = ristretto255_oprf.oprf;
|
|
@@ -4203,7 +4216,18 @@ var D5_BODY_CONDITIONAL = {
|
|
|
4203
4216
|
*/
|
|
4204
4217
|
id: "key-crossover copy only",
|
|
4205
4218
|
/** The sibling marker naming the other key_ids this update was sealed to. */
|
|
4206
|
-
crossover_key_ids: "key-crossover copy only"
|
|
4219
|
+
crossover_key_ids: "key-crossover copy only",
|
|
4220
|
+
/**
|
|
4221
|
+
* The day the change takes effect, `YYYY-MM-DD` (31 Oct 2026). Set on every
|
|
4222
|
+
* dispatch made for a SCHEDULED MOVE, which is its move date. A scheduled
|
|
4223
|
+
* move sends each recipient early enough for its own notice period
|
|
4224
|
+
* (`resolveRecipientSendPlan` in `notice-period.ts`), so the update can
|
|
4225
|
+
* arrive days before the customer moves; a recipient that treated it as
|
|
4226
|
+
* immediate could start charging at the new address from the day it arrived.
|
|
4227
|
+
* Absent on an immediate update, which takes effect on receipt. Optional for
|
|
4228
|
+
* receivers: an SDK that does not know the field ignores it.
|
|
4229
|
+
*/
|
|
4230
|
+
effective_date: "scheduled move only"
|
|
4207
4231
|
};
|
|
4208
4232
|
var D5_BODY_DRILL_ONLY = ["conformance"];
|
|
4209
4233
|
var D5_BODY_ADDED_AT_SEND = ["dispatch_id"];
|
|
@@ -4351,6 +4375,36 @@ function isWellFormedDrillLoa(loa, request) {
|
|
|
4351
4375
|
return l.consumer_name === DRILL_LOA_CONSUMER_NAME && l.scope === DRILL_LOA_SCOPE && l.oneaddress_acn === ONEADDRESS_LOA_ACN && l.update_uid === request.updateUid && l.partner_id === request.partnerId && l.envelope_sha256 === request.envelopeSha256 && Array.isArray(aliases) && aliases.length === wantAliases.length && aliases.every((a, i) => a === wantAliases[i]) && l.signature_algorithm === "ECDSA-P256" && typeof l.oneaddress_signature === "string" && /^[0-9a-f]{128}$/.test(l.oneaddress_signature) && typeof l.oneaddress_signature_v2 === "string" && /^[0-9a-f]{128}$/.test(l.oneaddress_signature_v2) && typeof l.authorisation_date === "string" && !Number.isNaN(Date.parse(l.authorisation_date));
|
|
4352
4376
|
}
|
|
4353
4377
|
|
|
4378
|
+
// ../protocol/src/verification-commitment.ts
|
|
4379
|
+
var VERIFICATION_COMMITMENT_VERSION = "oa-verify.v1";
|
|
4380
|
+
var ASCII_WHITESPACE_RUN = /[\t\n\v\f\r ]+/g;
|
|
4381
|
+
function normaliseCommitmentField(value) {
|
|
4382
|
+
if (typeof value !== "string") return "";
|
|
4383
|
+
const collapsed = value.replace(ASCII_WHITESPACE_RUN, " ");
|
|
4384
|
+
const start = collapsed.startsWith(" ") ? 1 : 0;
|
|
4385
|
+
const end = collapsed.length > start && collapsed.endsWith(" ") ? collapsed.length - 1 : collapsed.length;
|
|
4386
|
+
return collapsed.slice(start, end);
|
|
4387
|
+
}
|
|
4388
|
+
function verificationCommitmentString(verificationId, index, record) {
|
|
4389
|
+
if (!Number.isInteger(index) || index <= 0) {
|
|
4390
|
+
throw new RangeError(`verification commitment index must be a positive integer, got ${String(index)}`);
|
|
4391
|
+
}
|
|
4392
|
+
return [
|
|
4393
|
+
VERIFICATION_COMMITMENT_VERSION,
|
|
4394
|
+
normaliseCommitmentField(verificationId),
|
|
4395
|
+
String(index),
|
|
4396
|
+
normaliseCommitmentField(record.name),
|
|
4397
|
+
normaliseCommitmentField(record.street),
|
|
4398
|
+
normaliseCommitmentField(record.suburb),
|
|
4399
|
+
normaliseCommitmentField(record.state),
|
|
4400
|
+
normaliseCommitmentField(record.postcode),
|
|
4401
|
+
normaliseCommitmentField(record.country)
|
|
4402
|
+
].join("\n");
|
|
4403
|
+
}
|
|
4404
|
+
function isWellFormedCommitment(value) {
|
|
4405
|
+
return typeof value === "string" && /^[0-9a-f]{64}$/.test(value);
|
|
4406
|
+
}
|
|
4407
|
+
|
|
4354
4408
|
// src/loa-forms.ts
|
|
4355
4409
|
var import_node_crypto = __toESM(require("crypto"));
|
|
4356
4410
|
var PLACEHOLDER_SIGNATURE = "00".repeat(64);
|
|
@@ -4379,6 +4433,7 @@ function buildHeaders(partnerId, timestamp, signature, dispatchId, event = "addr
|
|
|
4379
4433
|
};
|
|
4380
4434
|
}
|
|
4381
4435
|
var DEFAULT_ACCOUNT_REF = "CONF-0001";
|
|
4436
|
+
var MAX_PRODUCT_LINES_PROBED = 5;
|
|
4382
4437
|
var DEFAULT_CONFORMANCE_KEY_ID = "conformance-key-1";
|
|
4383
4438
|
function asConformanceKey(key) {
|
|
4384
4439
|
if (!key) return null;
|
|
@@ -4465,13 +4520,26 @@ async function drillLoaFor(request, nowIso, plan) {
|
|
|
4465
4520
|
}
|
|
4466
4521
|
return loa;
|
|
4467
4522
|
}
|
|
4523
|
+
var CONFORMANCE_ADDRESS = {
|
|
4524
|
+
street: "42 Collins Street",
|
|
4525
|
+
suburb: "Melbourne",
|
|
4526
|
+
state: "VIC",
|
|
4527
|
+
postcode: "3000",
|
|
4528
|
+
country: "AU"
|
|
4529
|
+
};
|
|
4530
|
+
function conformanceCommitmentCheck(answer, secret, verificationId, index, name) {
|
|
4531
|
+
if (answer === void 0 || answer === null) return "absent";
|
|
4532
|
+
if (!isWellFormedCommitment(answer)) return "mismatch";
|
|
4533
|
+
const expected = import_node_crypto2.default.createHmac("sha256", secret).update(verificationCommitmentString(verificationId, index, { name, ...CONFORMANCE_ADDRESS }), "utf8").digest("hex");
|
|
4534
|
+
return import_node_crypto2.default.timingSafeEqual(Buffer.from(answer, "hex"), Buffer.from(expected, "hex")) ? "match" : "mismatch";
|
|
4535
|
+
}
|
|
4468
4536
|
async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address", identity, retentionPeriodDays = DEFAULT_RETENTION_DAYS, loaPlan) {
|
|
4469
4537
|
const key = asConformanceKey(publicKeyB64);
|
|
4470
4538
|
const partnerKey = key && {
|
|
4471
4539
|
partner_id: partnerId,
|
|
4472
4540
|
key_id: key.keyId,
|
|
4473
4541
|
public_key_b64: key.publicKeyB64,
|
|
4474
|
-
algorithm: "ECDH-P256-AES-GCM-256"
|
|
4542
|
+
algorithm: key.algorithm ?? "ECDH-P256-AES-GCM-256"
|
|
4475
4543
|
};
|
|
4476
4544
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
4477
4545
|
const updateIdNum = conformanceUpdateId();
|
|
@@ -4484,13 +4552,7 @@ async function buildBody(partnerId, publicKeyB64, extraFields, kind = "address",
|
|
|
4484
4552
|
// signer) and a v2 receiver refuses an envelope whose name differs.
|
|
4485
4553
|
verified_name: DRILL_LOA_CONSUMER_NAME,
|
|
4486
4554
|
...kind === "address" ? {
|
|
4487
|
-
new_address: {
|
|
4488
|
-
street: "42 Collins Street",
|
|
4489
|
-
suburb: "Melbourne",
|
|
4490
|
-
state: "VIC",
|
|
4491
|
-
postcode: "3000",
|
|
4492
|
-
country: "AU"
|
|
4493
|
-
}
|
|
4555
|
+
new_address: { ...CONFORMANCE_ADDRESS }
|
|
4494
4556
|
} : {},
|
|
4495
4557
|
...kind === "phone" ? { new_phone: "+61412345678" } : {},
|
|
4496
4558
|
...kind === "email" ? { new_email: "conformance@example.com" } : {},
|
|
@@ -4655,6 +4717,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
4655
4717
|
let acceptedUpdateTypes = [];
|
|
4656
4718
|
let verifiesAccountReference = false;
|
|
4657
4719
|
let supportsKeyCrossover = false;
|
|
4720
|
+
let productLines = [];
|
|
4658
4721
|
let accountRef = DEFAULT_ACCOUNT_REF;
|
|
4659
4722
|
let recipientKey;
|
|
4660
4723
|
let retentionPeriodDays;
|
|
@@ -4670,6 +4733,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
4670
4733
|
acceptedUpdateTypes = urlOrOptions.acceptedUpdateTypes ?? [];
|
|
4671
4734
|
verifiesAccountReference = urlOrOptions.verifiesAccountReference === true;
|
|
4672
4735
|
supportsKeyCrossover = urlOrOptions.supportsKeyCrossover === true;
|
|
4736
|
+
productLines = (urlOrOptions.productLines ?? []).slice(0, MAX_PRODUCT_LINES_PROBED);
|
|
4673
4737
|
accountRef = urlOrOptions.accountRef?.trim() || DEFAULT_ACCOUNT_REF;
|
|
4674
4738
|
recipientKey = "key" in urlOrOptions ? urlOrOptions.key ?? null : asConformanceKey(publicKeyB64);
|
|
4675
4739
|
retentionPeriodDays = urlOrOptions.retentionPeriodDays;
|
|
@@ -5137,15 +5201,60 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
5137
5201
|
parsed = JSON.parse(ackBody);
|
|
5138
5202
|
} catch {
|
|
5139
5203
|
}
|
|
5204
|
+
const commitment = conformanceCommitmentCheck(
|
|
5205
|
+
parsed.commitment,
|
|
5206
|
+
secret,
|
|
5207
|
+
`conformance-${nonce}`,
|
|
5208
|
+
1,
|
|
5209
|
+
"CONFORMANCE DRILL"
|
|
5210
|
+
);
|
|
5140
5211
|
const acknowledged = !error && status >= 200 && status < 300;
|
|
5141
|
-
const passed = acknowledged && parsed.verification === true;
|
|
5212
|
+
const passed = acknowledged && parsed.verification === true && commitment !== "mismatch";
|
|
5142
5213
|
const missing = typeof parsed.missing_callback === "string" ? parsed.missing_callback : null;
|
|
5143
5214
|
results.push({
|
|
5144
5215
|
id: "check-16",
|
|
5145
5216
|
basis: "acceptance",
|
|
5146
5217
|
label: "Answers a connection-verification record (address.test)",
|
|
5147
5218
|
passed,
|
|
5148
|
-
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}
|
|
5219
|
+
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 && commitment === "mismatch" ? `HTTP ${status}, and the response said it decrypted the record, but its signed answer (\`commitment\`) does not match what was sent. OneAddress refuses that answer when you go live. Check the receiver keys it with the webhook secret that verified the request and builds it from the decrypted name and address, not a formatted copy.` : parsed.verification === true && commitment === "match" ? `HTTP ${status}: verification record decrypted, and its signed answer matches what was sent` : parsed.verification === true ? `HTTP ${status}: verification record decrypted and acknowledged, but with no signed answer (\`commitment\`). Going live will need one: update to the current OneAddress SDK or setup wizard, or, while older receivers are still accepted, ask us to run a connection verification and send back the block it prints.` : `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.`
|
|
5220
|
+
});
|
|
5221
|
+
}
|
|
5222
|
+
if (recipientKey) {
|
|
5223
|
+
const body = await buildBody(partnerId, recipientKey, void 0, "address", {
|
|
5224
|
+
...matchable,
|
|
5225
|
+
x_conformance_unknown: "ignore me"
|
|
5226
|
+
}, retentionPeriodDays, signedLoa);
|
|
5227
|
+
const ts = String(Math.floor(Date.now() / 1e3));
|
|
5228
|
+
const sig = sign(body, ts, secret);
|
|
5229
|
+
const { status, error } = await postTarget(targetUrl, body, buildHeaders(partnerId, ts, sig, `sealed-unknown-${runId}`));
|
|
5230
|
+
const passed = !error && status >= 200 && status < 300;
|
|
5231
|
+
results.push({
|
|
5232
|
+
id: "check-17",
|
|
5233
|
+
basis: "acceptance",
|
|
5234
|
+
label: "Handles an unknown field inside the sealed envelope",
|
|
5235
|
+
passed,
|
|
5236
|
+
detail: error ? `Network error: ${error}` : passed ? `HTTP ${status}: an envelope carrying a field this receiver cannot know was acknowledged` : `HTTP ${status}, expected 2xx. The only difference from check-1 is an extra field inside the decrypted envelope. OneAddress adds optional envelope fields without a version change, so a receiver that refuses unknown fields will start refusing real updates. Ignore fields you do not read.`
|
|
5237
|
+
});
|
|
5238
|
+
}
|
|
5239
|
+
if (recipientKey && productLines.length > 0) {
|
|
5240
|
+
const refused = [];
|
|
5241
|
+
for (const line of productLines) {
|
|
5242
|
+
const body = await buildBody(partnerId, recipientKey, void 0, "address", {
|
|
5243
|
+
...matchable,
|
|
5244
|
+
product: { id: line.id, code: line.code, name: line.name }
|
|
5245
|
+
}, retentionPeriodDays, signedLoa);
|
|
5246
|
+
const ts = String(Math.floor(Date.now() / 1e3));
|
|
5247
|
+
const sig = sign(body, ts, secret);
|
|
5248
|
+
const { status, error } = await postTarget(targetUrl, body, buildHeaders(partnerId, ts, sig, `product-${line.code}-${runId}`));
|
|
5249
|
+
if (error || status < 200 || status >= 300) refused.push(`${line.code} (${error ? `network error: ${error}` : `HTTP ${status}`})`);
|
|
5250
|
+
}
|
|
5251
|
+
const codes = productLines.map((l) => l.code).join(", ");
|
|
5252
|
+
results.push({
|
|
5253
|
+
id: "check-18",
|
|
5254
|
+
basis: "acceptance",
|
|
5255
|
+
label: "Accepts every product line",
|
|
5256
|
+
passed: refused.length === 0,
|
|
5257
|
+
detail: refused.length === 0 ? `Acknowledged an envelope for each product line: ${codes}` : `Not acknowledged: ${refused.join("; ")}. Each envelope matched check-1 apart from its \`product\`, so a receiver that routes on product.code has no route for these codes. Add one, or a default for codes it does not know.`
|
|
5149
5258
|
});
|
|
5150
5259
|
}
|
|
5151
5260
|
if (loaSigner && recipientKey) {
|
|
@@ -5266,7 +5375,7 @@ async function runChecksDetailed(urlOrOptions, secret = TEST_WEBHOOK_SECRET, par
|
|
|
5266
5375
|
const checks = markUnprovenChecks(loaSigner ? results : annotateUnsignedLoa(results));
|
|
5267
5376
|
return { checks, declaration, informational, loaSigned: loaSigner !== null };
|
|
5268
5377
|
}
|
|
5269
|
-
var LOA_BEARING_ACCEPTANCE = /* @__PURE__ */ new Set(["check-1", "check-6", "check-8", "check-10", "check-16"]);
|
|
5378
|
+
var LOA_BEARING_ACCEPTANCE = /* @__PURE__ */ new Set(["check-1", "check-6", "check-8", "check-10", "check-16", "check-17", "check-18"]);
|
|
5270
5379
|
function annotateUnsignedLoa(results) {
|
|
5271
5380
|
return results.map((r) => {
|
|
5272
5381
|
if (r.passed) return r;
|
package/dist/plan.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare function plannedCoreCheckIds(opts: {
|
|
|
47
47
|
supportsKeyCrossover?: boolean;
|
|
48
48
|
/** A customer-app base URL was supplied, adding the pull-API checks. */
|
|
49
49
|
hasCustomerUrl?: boolean;
|
|
50
|
+
/** The partner has at least one live product line. */
|
|
51
|
+
hasProductLines?: boolean;
|
|
50
52
|
}): string[];
|
|
51
53
|
|
|
52
54
|
export { plannedCoreCheckIds };
|
package/dist/plan.js
CHANGED
|
@@ -40,6 +40,8 @@ function plannedCoreCheckIds(opts) {
|
|
|
40
40
|
if (opts.verifiesAccountReference && opts.hasKey) ids.push("check-14");
|
|
41
41
|
if (opts.supportsKeyCrossover && opts.hasKey) ids.push("check-15");
|
|
42
42
|
ids.push("check-16");
|
|
43
|
+
if (opts.hasKey) ids.push("check-17");
|
|
44
|
+
if (opts.hasKey && opts.hasProductLines) ids.push("check-18");
|
|
43
45
|
if (opts.hasCustomerUrl) ids.push("check-12", "check-13");
|
|
44
46
|
return ids;
|
|
45
47
|
}
|