@oneaddress/partner-sdk 2.2.0 → 2.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/CHANGELOG.md +125 -0
- package/README.md +10 -0
- package/dist/{chunk-PCYKV7RJ.mjs → chunk-4WYW6BM3.mjs} +9 -3
- package/dist/{chunk-LIHXDUUA.mjs → chunk-FDMB4BNC.mjs} +14 -0
- package/dist/edge.js +28 -1
- package/dist/edge.mjs +2 -2
- package/dist/index.d.mts +80 -15
- package/dist/index.d.ts +80 -15
- package/dist/index.js +28 -1
- package/dist/index.mjs +2 -2
- package/dist/{src-ENJJ6YZU.mjs → src-SNMMZ4BT.mjs} +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,131 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.4.0] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **The skip response names the callback it is missing.** A handler built on this
|
|
15
|
+
SDK acknowledges an event whose callback was never wired with HTTP 200 and
|
|
16
|
+
skips it, which is correct. The response now also carries
|
|
17
|
+
`missing_callback: 'onTest'` (or `'onVerify'` / `'onAccountVerify'`) so the
|
|
18
|
+
SENDER can say what to do about it.
|
|
19
|
+
|
|
20
|
+
Why that matters, and it is a real incident rather than tidiness. OneAddress
|
|
21
|
+
sends five `address.test` records before a partner goes live, and the SDK routes
|
|
22
|
+
them to `onTest`, never to `onUpdate`, because the identities inside are
|
|
23
|
+
fabricated and must not reach a real customer record. A handler with no `onTest`
|
|
24
|
+
therefore answers all five with a clean 200 and processes none: delivery looks
|
|
25
|
+
perfect, nothing decrypts, no verification block is printed, and there is
|
|
26
|
+
nothing for the partner to return. The console warning this SDK already emits
|
|
27
|
+
names the callback correctly, but it lands in the receiver's own log, which is
|
|
28
|
+
precisely where nobody is looking when the person watching the verification run
|
|
29
|
+
is at the other end.
|
|
30
|
+
|
|
31
|
+
**Deliberately absent for an event this build has never heard of**, where no
|
|
32
|
+
callback name is the answer and upgrading the SDK is. A field naming one there
|
|
33
|
+
would be a confident wrong answer.
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
- **The blind-index deprecation notes cited the wrong rule and named the wrong
|
|
38
|
+
field.** 2.3.0's `@deprecated` note on `OneAddressVerifyEvent.customer` said
|
|
39
|
+
`customer` is refused because it is in `D5_BODY_NEVER`, and told the reader to
|
|
40
|
+
decrypt `session_envelope` instead. Both halves are wrong for that event, and
|
|
41
|
+
the conclusion is still right, which is why it survived review.
|
|
42
|
+
|
|
43
|
+
`OneAddressVerifyEvent` is `address.verify`, a LEGACY-shaped body: its
|
|
44
|
+
ciphertext is `address_encrypted`, not a `session_envelope`, and the D5 body
|
|
45
|
+
contract governs `address.updated` / `contact.updated` only. That body in fact
|
|
46
|
+
carries three other `D5_BODY_NEVER` keys quite legitimately (`version`,
|
|
47
|
+
`encryption_status`, `address_encrypted`), being one of the two legacy
|
|
48
|
+
composers. `customer` is absent from it because the relay stopped sending a
|
|
49
|
+
cleartext customer block in protocol 2026.2, which is a different and simpler
|
|
50
|
+
reason.
|
|
51
|
+
|
|
52
|
+
The practical correction: on `address.verify` the SDK decrypts
|
|
53
|
+
`address_encrypted` for you before calling `onVerify`, so read the verified
|
|
54
|
+
name, known names and account reference from `event.raw`. A reader following
|
|
55
|
+
the old note would have gone looking for a `session_envelope` that event never
|
|
56
|
+
carries.
|
|
57
|
+
|
|
58
|
+
`OneAddressCustomerMatch`'s own docblock had the same `session_envelope`
|
|
59
|
+
instruction and is now explicit about which field holds the ciphertext on which
|
|
60
|
+
event.
|
|
61
|
+
|
|
62
|
+
Nothing on the wire changed and no signature moved. Found while checking the
|
|
63
|
+
five-dispatch connection-verification path, where the `address.test` sender
|
|
64
|
+
does populate a `customer` block with a fabricated identity on purpose, as
|
|
65
|
+
`OneAddressTestEvent` documents.
|
|
66
|
+
|
|
67
|
+
## [2.3.0] - 2026-10-01
|
|
68
|
+
|
|
69
|
+
Documentation, and nothing in this package's own API. **No exported symbol was
|
|
70
|
+
added, removed or changed**: the built bundle exports the same 40 names as
|
|
71
|
+
published 2.2.0, and every changed line in `dist/index.d.ts` is a comment. A
|
|
72
|
+
minor rather than a patch because the deprecation tags reach a consumer's editor
|
|
73
|
+
and linter through the `.d.ts`, which is a visible change in what the package
|
|
74
|
+
says about itself, and because they are the notice that these names go in the
|
|
75
|
+
next major.
|
|
76
|
+
|
|
77
|
+
**One thing in the bundle is not a comment, and it is not ours to call an API
|
|
78
|
+
change.** Diffing the built tarball against the published 2.2.0 tarball shows
|
|
79
|
+
`blockedPublicKeyReason` and its blocklist newly present in `dist/index.js`,
|
|
80
|
+
`dist/edge.js` and the ESM chunks: 22 added lines, +12 kB unpacked. It arrives
|
|
81
|
+
from `@oneaddress/crypto`, which this package bundles whole, and which gained
|
|
82
|
+
that export after 2.2.0 was cut. **The SDK neither calls it nor re-exports it**
|
|
83
|
+
- it sits inside the bundled crypto module's own namespace, unreachable from
|
|
84
|
+
either entry point - so it changes nothing a consumer can use. Recorded here
|
|
85
|
+
because the diff is the record: a tarball can ship a mechanism the package does
|
|
86
|
+
not implement, and the honest answer to "why is the bundle bigger" is better
|
|
87
|
+
written down than rediscovered.
|
|
88
|
+
|
|
89
|
+
### Deprecated
|
|
90
|
+
|
|
91
|
+
- **Blind-index matching, in four places.** `computeBlindIndex`,
|
|
92
|
+
`normalizeForBlindIndex`, the `BlindIndexField` type, the
|
|
93
|
+
`OneAddressCustomerMatch` interface, and the `customer` / `customer_match`
|
|
94
|
+
fields on `OneAddressVerifyEvent`. Nothing is removed, so an existing import
|
|
95
|
+
still compiles; they go in the next major.
|
|
96
|
+
|
|
97
|
+
The shape they describe is not one OneAddress emits. `customer` and
|
|
98
|
+
`customer_match` are both in the body contract's refused list
|
|
99
|
+
(`D5_BODY_NEVER` in `@oneaddress/protocol`), so a dispatch body carrying
|
|
100
|
+
either fails the shape check before it is sent, and the portal control that
|
|
101
|
+
once enabled blind-index matching no longer exists. Nothing about the
|
|
102
|
+
consumer is knowable before decryption, so there is no cleartext or indexed
|
|
103
|
+
matching block to compare against. **Locate a record by decrypting
|
|
104
|
+
`session_envelope` and matching on the verified name, known names or account
|
|
105
|
+
number in the resulting `SessionData`.**
|
|
106
|
+
|
|
107
|
+
Why this mattered enough to say rather than leave quiet: the previous text
|
|
108
|
+
read as live guidance, down to "exactly one of `customer` / `customer_match`
|
|
109
|
+
is present on any given dispatch". A receiver written to it would branch on a
|
|
110
|
+
block that never arrives and conclude it could not identify the customer.
|
|
111
|
+
|
|
112
|
+
### Documentation
|
|
113
|
+
|
|
114
|
+
- **One confirmation status covers a whole delivery, not one kind of detail.**
|
|
115
|
+
A dispatch can carry an address together with a new phone number or email
|
|
116
|
+
address. None of the four statuses can say one kind applied and another did
|
|
117
|
+
not, and OneAddress cannot detect a partial application from its side, so
|
|
118
|
+
write every kind named in `event.update_types` in the same unit of work. If
|
|
119
|
+
your system cannot, stop accepting that kind under **My Profile** in the
|
|
120
|
+
partner portal rather than applying it best-effort: refusing is honest and
|
|
121
|
+
visible, because we then never send it and the consumer is told. A partial
|
|
122
|
+
application reads to the consumer as a complete one.
|
|
123
|
+
|
|
124
|
+
- **The first confirmation for a dispatch is the one that counts.** All four
|
|
125
|
+
statuses resolve to a terminal record and a later confirm for the same
|
|
126
|
+
`dispatchId` cannot move it, deliberately, so a retry or replay cannot turn a
|
|
127
|
+
recorded success into a failure. The consequence worth stating: two calls
|
|
128
|
+
cannot report two kinds separately. The second is a no-op on what the
|
|
129
|
+
consumer sees, not a correction. `note` is free text and is kept, but nothing
|
|
130
|
+
is driven off it.
|
|
131
|
+
|
|
132
|
+
Covers `OneAddressConfirmStatus`, `onUpdate` in `OneAddressHandlerOptions`,
|
|
133
|
+
`confirmUpdate`, and the README's confirm section.
|
|
134
|
+
|
|
10
135
|
## [2.2.0] - 2026-09-27
|
|
11
136
|
|
|
12
137
|
A minor rather than a patch, and it started life numbered 2.1.1. The change was
|
package/README.md
CHANGED
|
@@ -418,6 +418,16 @@ if (!res.ok) console.error('[oneaddress] confirm failed', res.status, res.error)
|
|
|
418
418
|
|
|
419
419
|
The last two cost different people money. `failed` for a stranger bills a refund against a receiver that behaved correctly; `no_match` during a real outage tells a genuine customer to fix an account number that was never wrong. **If you cannot tell the two apart, send `failed`**, which is the one that is safe to be wrong about.
|
|
420
420
|
|
|
421
|
+
### One status per delivery, not per kind
|
|
422
|
+
|
|
423
|
+
A dispatch can carry an address together with a new phone number or email address, and this status covers all of it. None of the four values can say you applied one kind and not another, so a partial application cannot be reported and cannot be detected from our side.
|
|
424
|
+
|
|
425
|
+
**Write every kind in `event.update_types` in the same unit of work**, so they succeed or fail together. If your system cannot do that for a kind, stop accepting that kind under **My Profile** in the partner portal rather than applying it best-effort. Refusing is honest and visible: we never send it, and the consumer is told. A partial application is neither — it reads to the consumer as a complete one.
|
|
426
|
+
|
|
427
|
+
**The first confirmation for a dispatch is the one that counts.** All four statuses resolve to a terminal record, and a later confirm for the same `dispatchId` cannot move it. That guard is deliberate, so a retry or a replay cannot turn a recorded success into a failure — but it also means two calls cannot report two kinds separately. The second is a no-op on what the consumer sees, not a correction.
|
|
428
|
+
|
|
429
|
+
`note` is free text and is kept, so it can say what did not apply. Nothing is driven off it: the consumer's dashboard reads the status alone.
|
|
430
|
+
|
|
421
431
|
### Which secret
|
|
422
432
|
|
|
423
433
|
If you have minted a **confirm secret** in the Partner Portal, use that one — once it exists it is the only secret `/api/confirm` accepts, so that a leaked webhook secret cannot forge confirmations. If you have not, use your webhook signing secret. The same secret authenticates the request and signs the body.
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
encryptSessionForPartner,
|
|
4
4
|
isFreshTimestamp,
|
|
5
5
|
isSafeWebhookUrl
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FDMB4BNC.mjs";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import crypto from "crypto";
|
|
@@ -501,7 +501,7 @@ async function decryptAddress(payload, privateKeyPem, partnerId) {
|
|
|
501
501
|
return JSON.parse(new TextDecoder().decode(plaintext));
|
|
502
502
|
}
|
|
503
503
|
async function decryptSession(share, envelopeB64, privateKeyPem, partnerId, expectedAlg) {
|
|
504
|
-
const { decryptSession: decryptSessionCrypto } = await import("./src-
|
|
504
|
+
const { decryptSession: decryptSessionCrypto } = await import("./src-SNMMZ4BT.mjs");
|
|
505
505
|
return decryptSessionCrypto(
|
|
506
506
|
share,
|
|
507
507
|
envelopeB64,
|
|
@@ -1408,7 +1408,13 @@ function createOneAddressHandler(options) {
|
|
|
1408
1408
|
// NOSONAR
|
|
1409
1409
|
);
|
|
1410
1410
|
}
|
|
1411
|
-
return new Response(JSON.stringify({
|
|
1411
|
+
return new Response(JSON.stringify({
|
|
1412
|
+
ok: true,
|
|
1413
|
+
skipped: true,
|
|
1414
|
+
event: evt,
|
|
1415
|
+
...unwired ? { missing_callback: unwired } : {},
|
|
1416
|
+
accepted_update_types: acceptedUpdateTypes
|
|
1417
|
+
}), {
|
|
1412
1418
|
status: 200,
|
|
1413
1419
|
headers: { "Content-Type": "application/json" }
|
|
1414
1420
|
});
|
|
@@ -3178,6 +3178,19 @@ function isSafeWebhookUrl(url, opts2 = {}) {
|
|
|
3178
3178
|
return { ok: true };
|
|
3179
3179
|
}
|
|
3180
3180
|
|
|
3181
|
+
// ../crypto/src/blocked-public-keys.ts
|
|
3182
|
+
var BLOCKED_PUBLIC_KEYS_B64 = /* @__PURE__ */ new Set([
|
|
3183
|
+
// @oneaddress/conformance → TEST_PARTNER_PUBLIC_KEY_SPKI_B64.
|
|
3184
|
+
// Its TEST_PARTNER_PRIVATE_KEY_PEM ships in the same file, published on npm.
|
|
3185
|
+
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqFmYg3ct73DoAR3WHO5pUr/bVtaKUlLb9bd+g0KwJGZkgUhGop6JhSzQZw08zuvLbvkJXZnz0BHfsXy4MfeTjg=="
|
|
3186
|
+
]);
|
|
3187
|
+
function normalise(publicKeyB64) {
|
|
3188
|
+
return (publicKeyB64 ?? "").replace(/\s+/g, "");
|
|
3189
|
+
}
|
|
3190
|
+
function blockedPublicKeyReason(publicKeyB64) {
|
|
3191
|
+
return BLOCKED_PUBLIC_KEYS_B64.has(normalise(publicKeyB64)) ? "published_test_key" : null;
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3181
3194
|
// ../crypto/src/endpoint-health.ts
|
|
3182
3195
|
var ENDPOINT_FAILURE_THRESHOLD = 3;
|
|
3183
3196
|
var MISSING_STATUSES = /* @__PURE__ */ new Set([404, 405, 410]);
|
|
@@ -4414,6 +4427,7 @@ export {
|
|
|
4414
4427
|
isFreshTimestamp,
|
|
4415
4428
|
isIpLiteralHost,
|
|
4416
4429
|
isSafeWebhookUrl,
|
|
4430
|
+
blockedPublicKeyReason,
|
|
4417
4431
|
ENDPOINT_FAILURE_THRESHOLD,
|
|
4418
4432
|
classifyEndpointProbe,
|
|
4419
4433
|
countsAsFailure,
|
package/dist/edge.js
CHANGED
|
@@ -3364,6 +3364,25 @@ var init_safe_url = __esm({
|
|
|
3364
3364
|
}
|
|
3365
3365
|
});
|
|
3366
3366
|
|
|
3367
|
+
// ../crypto/src/blocked-public-keys.ts
|
|
3368
|
+
function normalise(publicKeyB64) {
|
|
3369
|
+
return (publicKeyB64 ?? "").replace(/\s+/g, "");
|
|
3370
|
+
}
|
|
3371
|
+
function blockedPublicKeyReason(publicKeyB64) {
|
|
3372
|
+
return BLOCKED_PUBLIC_KEYS_B64.has(normalise(publicKeyB64)) ? "published_test_key" : null;
|
|
3373
|
+
}
|
|
3374
|
+
var BLOCKED_PUBLIC_KEYS_B64;
|
|
3375
|
+
var init_blocked_public_keys = __esm({
|
|
3376
|
+
"../crypto/src/blocked-public-keys.ts"() {
|
|
3377
|
+
"use strict";
|
|
3378
|
+
BLOCKED_PUBLIC_KEYS_B64 = /* @__PURE__ */ new Set([
|
|
3379
|
+
// @oneaddress/conformance → TEST_PARTNER_PUBLIC_KEY_SPKI_B64.
|
|
3380
|
+
// Its TEST_PARTNER_PRIVATE_KEY_PEM ships in the same file, published on npm.
|
|
3381
|
+
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqFmYg3ct73DoAR3WHO5pUr/bVtaKUlLb9bd+g0KwJGZkgUhGop6JhSzQZw08zuvLbvkJXZnz0BHfsXy4MfeTjg=="
|
|
3382
|
+
]);
|
|
3383
|
+
}
|
|
3384
|
+
});
|
|
3385
|
+
|
|
3367
3386
|
// ../crypto/src/endpoint-health.ts
|
|
3368
3387
|
function classifyEndpointProbe(input) {
|
|
3369
3388
|
const status = typeof input.httpStatus === "number" && Number.isFinite(input.httpStatus) ? input.httpStatus : null;
|
|
@@ -3991,6 +4010,7 @@ __export(src_exports, {
|
|
|
3991
4010
|
REGISTRY_HEAD_V1: () => REGISTRY_HEAD_V1,
|
|
3992
4011
|
REGISTRY_HEAD_V2: () => REGISTRY_HEAD_V2,
|
|
3993
4012
|
SENDER_HELD_KEY_ALGORITHM: () => SENDER_HELD_KEY_ALGORITHM,
|
|
4013
|
+
blockedPublicKeyReason: () => blockedPublicKeyReason,
|
|
3994
4014
|
buildPartnerKeyAttestation: () => buildPartnerKeyAttestation,
|
|
3995
4015
|
buildRegistryHeadStatement: () => buildRegistryHeadStatement,
|
|
3996
4016
|
classifyEndpointProbe: () => classifyEndpointProbe,
|
|
@@ -4653,6 +4673,7 @@ var init_src = __esm({
|
|
|
4653
4673
|
init_hybrid();
|
|
4654
4674
|
init_replay_window();
|
|
4655
4675
|
init_safe_url();
|
|
4676
|
+
init_blocked_public_keys();
|
|
4656
4677
|
init_endpoint_health();
|
|
4657
4678
|
init_partner_key_attestation();
|
|
4658
4679
|
init_registry_head();
|
|
@@ -5783,7 +5804,13 @@ function createOneAddressHandler(options) {
|
|
|
5783
5804
|
// NOSONAR
|
|
5784
5805
|
);
|
|
5785
5806
|
}
|
|
5786
|
-
return new Response(JSON.stringify({
|
|
5807
|
+
return new Response(JSON.stringify({
|
|
5808
|
+
ok: true,
|
|
5809
|
+
skipped: true,
|
|
5810
|
+
event: evt,
|
|
5811
|
+
...unwired ? { missing_callback: unwired } : {},
|
|
5812
|
+
accepted_update_types: acceptedUpdateTypes
|
|
5813
|
+
}), {
|
|
5787
5814
|
status: 200,
|
|
5788
5815
|
headers: { "Content-Type": "application/json" }
|
|
5789
5816
|
});
|
package/dist/edge.mjs
CHANGED
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
verifyLOA,
|
|
21
21
|
verifySignature,
|
|
22
22
|
verifyWithGrace
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4WYW6BM3.mjs";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
26
26
|
computeBlindIndex,
|
|
27
27
|
isFreshTimestamp,
|
|
28
28
|
normalizeForBlindIndex
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FDMB4BNC.mjs";
|
|
30
30
|
export {
|
|
31
31
|
CURRENT_VERSION,
|
|
32
32
|
DEFAULT_REPLAY_WINDOW_SECS,
|
package/dist/index.d.mts
CHANGED
|
@@ -393,6 +393,26 @@ declare function createOutboxConsumer(opts: OutboxConsumerOptions): OutboxConsum
|
|
|
393
393
|
* number that was never wrong. **When you cannot tell the two apart, send
|
|
394
394
|
* `failed`** - it is the one that is safe to be wrong about, because the
|
|
395
395
|
* retry either clears it or the refund makes the consumer whole.
|
|
396
|
+
*
|
|
397
|
+
* ## ONE STATUS PER DELIVERY, NOT PER KIND
|
|
398
|
+
*
|
|
399
|
+
* A dispatch can carry an address together with a new phone number or email
|
|
400
|
+
* address (see `update_types` on {@link OneAddressUpdateEvent}), and this
|
|
401
|
+
* status covers the whole delivery. None of the four values can say you
|
|
402
|
+
* applied one kind and not another, so there is no way to report a partial
|
|
403
|
+
* application and no way for OneAddress to detect one.
|
|
404
|
+
*
|
|
405
|
+
* Write every kind named in `update_types` in the SAME unit of work, so they
|
|
406
|
+
* succeed or fail together. If your system cannot do that for a kind, stop
|
|
407
|
+
* accepting that kind (My Profile in the partner portal) rather than applying
|
|
408
|
+
* it on a best-effort basis. Refusing it is honest and visible: OneAddress
|
|
409
|
+
* never sends it and tells the consumer so. A partial application is neither -
|
|
410
|
+
* it reads to the consumer as a complete one, and neither side can tell the
|
|
411
|
+
* two apart.
|
|
412
|
+
*
|
|
413
|
+
* If you need to record that something did not apply, `note` on
|
|
414
|
+
* {@link confirmUpdate} is free text and is kept, but nothing is driven off
|
|
415
|
+
* it: the consumer's dashboard reads the status alone.
|
|
396
416
|
*/
|
|
397
417
|
type OneAddressConfirmStatus = 'confirmed' | 'already_current' | 'failed' | 'no_match';
|
|
398
418
|
interface OneAddressAddress {
|
|
@@ -417,16 +437,25 @@ interface OneAddressCustomer {
|
|
|
417
437
|
known_names: string[];
|
|
418
438
|
}
|
|
419
439
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
440
|
+
* @deprecated NO DISPATCH CARRIES THIS BLOCK.
|
|
441
|
+
*
|
|
442
|
+
* It described a matching shape where each value was
|
|
443
|
+
* `base64url( HMAC-SHA256(yourBlindIndexSecret, normalize(field)) )`, so a
|
|
444
|
+
* receiver could locate a record WITHOUT decrypting the envelope. That shape
|
|
445
|
+
* is gone: no dispatch carries the block, the D5 body contract
|
|
446
|
+
* (`D5_BODY_NEVER`) refuses it outright on an `address.updated` /
|
|
447
|
+
* `contact.updated` body, and the portal control that enabled it has been
|
|
448
|
+
* removed.
|
|
449
|
+
*
|
|
450
|
+
* Nothing about the consumer is knowable before decryption, so match on the
|
|
451
|
+
* decrypted payload. Which field holds the ciphertext depends on the event: a
|
|
452
|
+
* D5 dispatch carries `session_envelope`, whose `SessionData` gives the
|
|
453
|
+
* verified name, known names and account number; the legacy-shaped
|
|
454
|
+
* `address.verify` carries `address_encrypted` instead, which this SDK decrypts
|
|
455
|
+
* for you (see {@link OneAddressVerifyEvent.raw}).
|
|
456
|
+
*
|
|
457
|
+
* The type is retained so an existing import compiles; it will go in the next
|
|
458
|
+
* major.
|
|
430
459
|
*/
|
|
431
460
|
interface OneAddressCustomerMatch {
|
|
432
461
|
/** Blind index of the consumer's email, when present. */
|
|
@@ -573,12 +602,25 @@ interface OneAddressVerifyEvent {
|
|
|
573
602
|
dispatchId: string;
|
|
574
603
|
batch_id: number;
|
|
575
604
|
user_id: string;
|
|
576
|
-
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
605
|
+
/** @deprecated NOT SENT. The relay stopped putting a cleartext customer block
|
|
606
|
+
* on `address.verify` in protocol 2026.2. The consumer's name, known names
|
|
607
|
+
* and account reference travel encrypted inside `address_encrypted`, which
|
|
608
|
+
* this SDK decrypts for you before calling `onVerify`, so read them from
|
|
609
|
+
* {@link OneAddressVerifyEvent.raw} (the decrypted payload) rather than from
|
|
610
|
+
* here.
|
|
611
|
+
*
|
|
612
|
+
* Note that `address.verify` is a LEGACY-shaped body: the ciphertext is
|
|
613
|
+
* `address_encrypted`, not a `session_envelope`, and the D5 body contract
|
|
614
|
+
* (`D5_BODY_NEVER`) does not govern it. An earlier version of this comment
|
|
615
|
+
* cited that contract and named the wrong field.
|
|
616
|
+
*
|
|
617
|
+
* Kept optional so an existing narrowing check still compiles; it will never
|
|
618
|
+
* be populated. */
|
|
579
619
|
customer?: OneAddressCustomer;
|
|
580
|
-
/**
|
|
581
|
-
*
|
|
620
|
+
/** @deprecated NOT SENT, and no dispatch of any kind carries this block any
|
|
621
|
+
* more. See {@link OneAddressCustomerMatch}. Neither this nor `customer` is
|
|
622
|
+
* present, so the earlier "exactly one of" described a shape that no longer
|
|
623
|
+
* exists; match on the decrypted payload instead. */
|
|
582
624
|
customer_match?: OneAddressCustomerMatch;
|
|
583
625
|
address: OneAddressAddress;
|
|
584
626
|
/** The Letter of Authority. On D5 dispatches this is the structured
|
|
@@ -834,6 +876,12 @@ interface OneAddressHandlerOptions {
|
|
|
834
876
|
* The status is a union rather than a bare `string`: `/api/confirm` rejects
|
|
835
877
|
* anything outside the four with a 400, and a typo used to surface as an
|
|
836
878
|
* unexplained rejection at runtime instead of a compile error.
|
|
879
|
+
*
|
|
880
|
+
* ONE STATUS COVERS THE WHOLE DELIVERY. If `event.update_types` names more
|
|
881
|
+
* than one kind, this single value speaks for all of them: there is no way
|
|
882
|
+
* to say the address went in and the phone number did not. Write every kind
|
|
883
|
+
* it names in one unit of work, or stop accepting that kind. See
|
|
884
|
+
* {@link OneAddressConfirmStatus}.
|
|
837
885
|
*/
|
|
838
886
|
onUpdate: (event: OneAddressUpdateEvent) => Promise<{
|
|
839
887
|
status?: OneAddressConfirmStatus;
|
|
@@ -1472,6 +1520,23 @@ interface ConfirmUpdateResult {
|
|
|
1472
1520
|
* something your code can see and log; an exception in a fire-and-forget
|
|
1473
1521
|
* `.catch()` is how a dropped confirmation stays invisible.
|
|
1474
1522
|
*
|
|
1523
|
+
* ## One call per dispatch, and one status for everything in it
|
|
1524
|
+
*
|
|
1525
|
+
* `dispatchId` identifies a DELIVERY, not a kind of detail. A delivery that
|
|
1526
|
+
* carried an address and a new phone number is confirmed once, with one
|
|
1527
|
+
* status covering both.
|
|
1528
|
+
*
|
|
1529
|
+
* **The FIRST confirmation for a dispatch is the one that counts.** Every one
|
|
1530
|
+
* of the four statuses resolves to a terminal record, and a later confirm for
|
|
1531
|
+
* the same `dispatchId` cannot move it - that guard is deliberate, so a retry
|
|
1532
|
+
* or a replay cannot turn a recorded success into a failure. It also means you
|
|
1533
|
+
* cannot send two calls to report two kinds separately: the second is a no-op
|
|
1534
|
+
* on what the consumer is shown, not a correction.
|
|
1535
|
+
*
|
|
1536
|
+
* So make one call, with a status that is true of the whole delivery. See
|
|
1537
|
+
* {@link OneAddressConfirmStatus} for what to do when your system cannot
|
|
1538
|
+
* apply every kind atomically.
|
|
1539
|
+
*
|
|
1475
1540
|
* @example
|
|
1476
1541
|
* const res = await confirmUpdate({
|
|
1477
1542
|
* partnerId: process.env.OA_PARTNER_ID!,
|
package/dist/index.d.ts
CHANGED
|
@@ -393,6 +393,26 @@ declare function createOutboxConsumer(opts: OutboxConsumerOptions): OutboxConsum
|
|
|
393
393
|
* number that was never wrong. **When you cannot tell the two apart, send
|
|
394
394
|
* `failed`** - it is the one that is safe to be wrong about, because the
|
|
395
395
|
* retry either clears it or the refund makes the consumer whole.
|
|
396
|
+
*
|
|
397
|
+
* ## ONE STATUS PER DELIVERY, NOT PER KIND
|
|
398
|
+
*
|
|
399
|
+
* A dispatch can carry an address together with a new phone number or email
|
|
400
|
+
* address (see `update_types` on {@link OneAddressUpdateEvent}), and this
|
|
401
|
+
* status covers the whole delivery. None of the four values can say you
|
|
402
|
+
* applied one kind and not another, so there is no way to report a partial
|
|
403
|
+
* application and no way for OneAddress to detect one.
|
|
404
|
+
*
|
|
405
|
+
* Write every kind named in `update_types` in the SAME unit of work, so they
|
|
406
|
+
* succeed or fail together. If your system cannot do that for a kind, stop
|
|
407
|
+
* accepting that kind (My Profile in the partner portal) rather than applying
|
|
408
|
+
* it on a best-effort basis. Refusing it is honest and visible: OneAddress
|
|
409
|
+
* never sends it and tells the consumer so. A partial application is neither -
|
|
410
|
+
* it reads to the consumer as a complete one, and neither side can tell the
|
|
411
|
+
* two apart.
|
|
412
|
+
*
|
|
413
|
+
* If you need to record that something did not apply, `note` on
|
|
414
|
+
* {@link confirmUpdate} is free text and is kept, but nothing is driven off
|
|
415
|
+
* it: the consumer's dashboard reads the status alone.
|
|
396
416
|
*/
|
|
397
417
|
type OneAddressConfirmStatus = 'confirmed' | 'already_current' | 'failed' | 'no_match';
|
|
398
418
|
interface OneAddressAddress {
|
|
@@ -417,16 +437,25 @@ interface OneAddressCustomer {
|
|
|
417
437
|
known_names: string[];
|
|
418
438
|
}
|
|
419
439
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
440
|
+
* @deprecated NO DISPATCH CARRIES THIS BLOCK.
|
|
441
|
+
*
|
|
442
|
+
* It described a matching shape where each value was
|
|
443
|
+
* `base64url( HMAC-SHA256(yourBlindIndexSecret, normalize(field)) )`, so a
|
|
444
|
+
* receiver could locate a record WITHOUT decrypting the envelope. That shape
|
|
445
|
+
* is gone: no dispatch carries the block, the D5 body contract
|
|
446
|
+
* (`D5_BODY_NEVER`) refuses it outright on an `address.updated` /
|
|
447
|
+
* `contact.updated` body, and the portal control that enabled it has been
|
|
448
|
+
* removed.
|
|
449
|
+
*
|
|
450
|
+
* Nothing about the consumer is knowable before decryption, so match on the
|
|
451
|
+
* decrypted payload. Which field holds the ciphertext depends on the event: a
|
|
452
|
+
* D5 dispatch carries `session_envelope`, whose `SessionData` gives the
|
|
453
|
+
* verified name, known names and account number; the legacy-shaped
|
|
454
|
+
* `address.verify` carries `address_encrypted` instead, which this SDK decrypts
|
|
455
|
+
* for you (see {@link OneAddressVerifyEvent.raw}).
|
|
456
|
+
*
|
|
457
|
+
* The type is retained so an existing import compiles; it will go in the next
|
|
458
|
+
* major.
|
|
430
459
|
*/
|
|
431
460
|
interface OneAddressCustomerMatch {
|
|
432
461
|
/** Blind index of the consumer's email, when present. */
|
|
@@ -573,12 +602,25 @@ interface OneAddressVerifyEvent {
|
|
|
573
602
|
dispatchId: string;
|
|
574
603
|
batch_id: number;
|
|
575
604
|
user_id: string;
|
|
576
|
-
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
605
|
+
/** @deprecated NOT SENT. The relay stopped putting a cleartext customer block
|
|
606
|
+
* on `address.verify` in protocol 2026.2. The consumer's name, known names
|
|
607
|
+
* and account reference travel encrypted inside `address_encrypted`, which
|
|
608
|
+
* this SDK decrypts for you before calling `onVerify`, so read them from
|
|
609
|
+
* {@link OneAddressVerifyEvent.raw} (the decrypted payload) rather than from
|
|
610
|
+
* here.
|
|
611
|
+
*
|
|
612
|
+
* Note that `address.verify` is a LEGACY-shaped body: the ciphertext is
|
|
613
|
+
* `address_encrypted`, not a `session_envelope`, and the D5 body contract
|
|
614
|
+
* (`D5_BODY_NEVER`) does not govern it. An earlier version of this comment
|
|
615
|
+
* cited that contract and named the wrong field.
|
|
616
|
+
*
|
|
617
|
+
* Kept optional so an existing narrowing check still compiles; it will never
|
|
618
|
+
* be populated. */
|
|
579
619
|
customer?: OneAddressCustomer;
|
|
580
|
-
/**
|
|
581
|
-
*
|
|
620
|
+
/** @deprecated NOT SENT, and no dispatch of any kind carries this block any
|
|
621
|
+
* more. See {@link OneAddressCustomerMatch}. Neither this nor `customer` is
|
|
622
|
+
* present, so the earlier "exactly one of" described a shape that no longer
|
|
623
|
+
* exists; match on the decrypted payload instead. */
|
|
582
624
|
customer_match?: OneAddressCustomerMatch;
|
|
583
625
|
address: OneAddressAddress;
|
|
584
626
|
/** The Letter of Authority. On D5 dispatches this is the structured
|
|
@@ -834,6 +876,12 @@ interface OneAddressHandlerOptions {
|
|
|
834
876
|
* The status is a union rather than a bare `string`: `/api/confirm` rejects
|
|
835
877
|
* anything outside the four with a 400, and a typo used to surface as an
|
|
836
878
|
* unexplained rejection at runtime instead of a compile error.
|
|
879
|
+
*
|
|
880
|
+
* ONE STATUS COVERS THE WHOLE DELIVERY. If `event.update_types` names more
|
|
881
|
+
* than one kind, this single value speaks for all of them: there is no way
|
|
882
|
+
* to say the address went in and the phone number did not. Write every kind
|
|
883
|
+
* it names in one unit of work, or stop accepting that kind. See
|
|
884
|
+
* {@link OneAddressConfirmStatus}.
|
|
837
885
|
*/
|
|
838
886
|
onUpdate: (event: OneAddressUpdateEvent) => Promise<{
|
|
839
887
|
status?: OneAddressConfirmStatus;
|
|
@@ -1472,6 +1520,23 @@ interface ConfirmUpdateResult {
|
|
|
1472
1520
|
* something your code can see and log; an exception in a fire-and-forget
|
|
1473
1521
|
* `.catch()` is how a dropped confirmation stays invisible.
|
|
1474
1522
|
*
|
|
1523
|
+
* ## One call per dispatch, and one status for everything in it
|
|
1524
|
+
*
|
|
1525
|
+
* `dispatchId` identifies a DELIVERY, not a kind of detail. A delivery that
|
|
1526
|
+
* carried an address and a new phone number is confirmed once, with one
|
|
1527
|
+
* status covering both.
|
|
1528
|
+
*
|
|
1529
|
+
* **The FIRST confirmation for a dispatch is the one that counts.** Every one
|
|
1530
|
+
* of the four statuses resolves to a terminal record, and a later confirm for
|
|
1531
|
+
* the same `dispatchId` cannot move it - that guard is deliberate, so a retry
|
|
1532
|
+
* or a replay cannot turn a recorded success into a failure. It also means you
|
|
1533
|
+
* cannot send two calls to report two kinds separately: the second is a no-op
|
|
1534
|
+
* on what the consumer is shown, not a correction.
|
|
1535
|
+
*
|
|
1536
|
+
* So make one call, with a status that is true of the whole delivery. See
|
|
1537
|
+
* {@link OneAddressConfirmStatus} for what to do when your system cannot
|
|
1538
|
+
* apply every kind atomically.
|
|
1539
|
+
*
|
|
1475
1540
|
* @example
|
|
1476
1541
|
* const res = await confirmUpdate({
|
|
1477
1542
|
* partnerId: process.env.OA_PARTNER_ID!,
|
package/dist/index.js
CHANGED
|
@@ -3364,6 +3364,25 @@ var init_safe_url = __esm({
|
|
|
3364
3364
|
}
|
|
3365
3365
|
});
|
|
3366
3366
|
|
|
3367
|
+
// ../crypto/src/blocked-public-keys.ts
|
|
3368
|
+
function normalise(publicKeyB64) {
|
|
3369
|
+
return (publicKeyB64 ?? "").replace(/\s+/g, "");
|
|
3370
|
+
}
|
|
3371
|
+
function blockedPublicKeyReason(publicKeyB64) {
|
|
3372
|
+
return BLOCKED_PUBLIC_KEYS_B64.has(normalise(publicKeyB64)) ? "published_test_key" : null;
|
|
3373
|
+
}
|
|
3374
|
+
var BLOCKED_PUBLIC_KEYS_B64;
|
|
3375
|
+
var init_blocked_public_keys = __esm({
|
|
3376
|
+
"../crypto/src/blocked-public-keys.ts"() {
|
|
3377
|
+
"use strict";
|
|
3378
|
+
BLOCKED_PUBLIC_KEYS_B64 = /* @__PURE__ */ new Set([
|
|
3379
|
+
// @oneaddress/conformance → TEST_PARTNER_PUBLIC_KEY_SPKI_B64.
|
|
3380
|
+
// Its TEST_PARTNER_PRIVATE_KEY_PEM ships in the same file, published on npm.
|
|
3381
|
+
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqFmYg3ct73DoAR3WHO5pUr/bVtaKUlLb9bd+g0KwJGZkgUhGop6JhSzQZw08zuvLbvkJXZnz0BHfsXy4MfeTjg=="
|
|
3382
|
+
]);
|
|
3383
|
+
}
|
|
3384
|
+
});
|
|
3385
|
+
|
|
3367
3386
|
// ../crypto/src/endpoint-health.ts
|
|
3368
3387
|
function classifyEndpointProbe(input) {
|
|
3369
3388
|
const status = typeof input.httpStatus === "number" && Number.isFinite(input.httpStatus) ? input.httpStatus : null;
|
|
@@ -3991,6 +4010,7 @@ __export(src_exports, {
|
|
|
3991
4010
|
REGISTRY_HEAD_V1: () => REGISTRY_HEAD_V1,
|
|
3992
4011
|
REGISTRY_HEAD_V2: () => REGISTRY_HEAD_V2,
|
|
3993
4012
|
SENDER_HELD_KEY_ALGORITHM: () => SENDER_HELD_KEY_ALGORITHM,
|
|
4013
|
+
blockedPublicKeyReason: () => blockedPublicKeyReason,
|
|
3994
4014
|
buildPartnerKeyAttestation: () => buildPartnerKeyAttestation,
|
|
3995
4015
|
buildRegistryHeadStatement: () => buildRegistryHeadStatement,
|
|
3996
4016
|
classifyEndpointProbe: () => classifyEndpointProbe,
|
|
@@ -4653,6 +4673,7 @@ var init_src = __esm({
|
|
|
4653
4673
|
init_hybrid();
|
|
4654
4674
|
init_replay_window();
|
|
4655
4675
|
init_safe_url();
|
|
4676
|
+
init_blocked_public_keys();
|
|
4656
4677
|
init_endpoint_health();
|
|
4657
4678
|
init_partner_key_attestation();
|
|
4658
4679
|
init_registry_head();
|
|
@@ -6145,7 +6166,13 @@ function createOneAddressHandler(options) {
|
|
|
6145
6166
|
// NOSONAR
|
|
6146
6167
|
);
|
|
6147
6168
|
}
|
|
6148
|
-
return new Response(JSON.stringify({
|
|
6169
|
+
return new Response(JSON.stringify({
|
|
6170
|
+
ok: true,
|
|
6171
|
+
skipped: true,
|
|
6172
|
+
event: evt,
|
|
6173
|
+
...unwired ? { missing_callback: unwired } : {},
|
|
6174
|
+
accepted_update_types: acceptedUpdateTypes
|
|
6175
|
+
}), {
|
|
6149
6176
|
status: 200,
|
|
6150
6177
|
headers: { "Content-Type": "application/json" }
|
|
6151
6178
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
verifyLOA,
|
|
32
32
|
verifySignature,
|
|
33
33
|
verifyWithGrace
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4WYW6BM3.mjs";
|
|
35
35
|
import {
|
|
36
36
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
37
37
|
computeBlindIndex,
|
|
38
38
|
isFreshTimestamp,
|
|
39
39
|
normalizeForBlindIndex
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-FDMB4BNC.mjs";
|
|
41
41
|
export {
|
|
42
42
|
CURRENT_VERSION,
|
|
43
43
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
REGISTRY_HEAD_V1,
|
|
9
9
|
REGISTRY_HEAD_V2,
|
|
10
10
|
SENDER_HELD_KEY_ALGORITHM,
|
|
11
|
+
blockedPublicKeyReason,
|
|
11
12
|
buildPartnerKeyAttestation,
|
|
12
13
|
buildRegistryHeadStatement,
|
|
13
14
|
classifyEndpointProbe,
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
verifyPartnerKeyAttestationWithRoots,
|
|
48
49
|
verifyRegistryHead,
|
|
49
50
|
verifyWebhookSignature
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-FDMB4BNC.mjs";
|
|
51
52
|
export {
|
|
52
53
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
53
54
|
ENDPOINT_FAILURE_THRESHOLD,
|
|
@@ -58,6 +59,7 @@ export {
|
|
|
58
59
|
REGISTRY_HEAD_V1,
|
|
59
60
|
REGISTRY_HEAD_V2,
|
|
60
61
|
SENDER_HELD_KEY_ALGORITHM,
|
|
62
|
+
blockedPublicKeyReason,
|
|
61
63
|
buildPartnerKeyAttestation,
|
|
62
64
|
buildRegistryHeadStatement,
|
|
63
65
|
classifyEndpointProbe,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneaddress/partner-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Official OneAddress partner integration SDK — webhook verification, address decryption (legacy + D5 session-envelope), LOA validation",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|