@oneaddress/partner-sdk 2.2.0 → 2.3.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 +68 -0
- package/README.md +10 -0
- package/dist/{chunk-LIHXDUUA.mjs → chunk-FDMB4BNC.mjs} +14 -0
- package/dist/{chunk-PCYKV7RJ.mjs → chunk-VGE5OE4D.mjs} +2 -2
- package/dist/edge.js +21 -0
- package/dist/edge.mjs +2 -2
- package/dist/index.d.mts +67 -15
- package/dist/index.d.ts +67 -15
- package/dist/index.js +21 -0
- 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,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.3.0] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
Documentation, and nothing in this package's own API. **No exported symbol was
|
|
13
|
+
added, removed or changed**: the built bundle exports the same 40 names as
|
|
14
|
+
published 2.2.0, and every changed line in `dist/index.d.ts` is a comment. A
|
|
15
|
+
minor rather than a patch because the deprecation tags reach a consumer's editor
|
|
16
|
+
and linter through the `.d.ts`, which is a visible change in what the package
|
|
17
|
+
says about itself, and because they are the notice that these names go in the
|
|
18
|
+
next major.
|
|
19
|
+
|
|
20
|
+
**One thing in the bundle is not a comment, and it is not ours to call an API
|
|
21
|
+
change.** Diffing the built tarball against the published 2.2.0 tarball shows
|
|
22
|
+
`blockedPublicKeyReason` and its blocklist newly present in `dist/index.js`,
|
|
23
|
+
`dist/edge.js` and the ESM chunks: 22 added lines, +12 kB unpacked. It arrives
|
|
24
|
+
from `@oneaddress/crypto`, which this package bundles whole, and which gained
|
|
25
|
+
that export after 2.2.0 was cut. **The SDK neither calls it nor re-exports it**
|
|
26
|
+
- it sits inside the bundled crypto module's own namespace, unreachable from
|
|
27
|
+
either entry point - so it changes nothing a consumer can use. Recorded here
|
|
28
|
+
because the diff is the record: a tarball can ship a mechanism the package does
|
|
29
|
+
not implement, and the honest answer to "why is the bundle bigger" is better
|
|
30
|
+
written down than rediscovered.
|
|
31
|
+
|
|
32
|
+
### Deprecated
|
|
33
|
+
|
|
34
|
+
- **Blind-index matching, in four places.** `computeBlindIndex`,
|
|
35
|
+
`normalizeForBlindIndex`, the `BlindIndexField` type, the
|
|
36
|
+
`OneAddressCustomerMatch` interface, and the `customer` / `customer_match`
|
|
37
|
+
fields on `OneAddressVerifyEvent`. Nothing is removed, so an existing import
|
|
38
|
+
still compiles; they go in the next major.
|
|
39
|
+
|
|
40
|
+
The shape they describe is not one OneAddress emits. `customer` and
|
|
41
|
+
`customer_match` are both in the body contract's refused list
|
|
42
|
+
(`D5_BODY_NEVER` in `@oneaddress/protocol`), so a dispatch body carrying
|
|
43
|
+
either fails the shape check before it is sent, and the portal control that
|
|
44
|
+
once enabled blind-index matching no longer exists. Nothing about the
|
|
45
|
+
consumer is knowable before decryption, so there is no cleartext or indexed
|
|
46
|
+
matching block to compare against. **Locate a record by decrypting
|
|
47
|
+
`session_envelope` and matching on the verified name, known names or account
|
|
48
|
+
number in the resulting `SessionData`.**
|
|
49
|
+
|
|
50
|
+
Why this mattered enough to say rather than leave quiet: the previous text
|
|
51
|
+
read as live guidance, down to "exactly one of `customer` / `customer_match`
|
|
52
|
+
is present on any given dispatch". A receiver written to it would branch on a
|
|
53
|
+
block that never arrives and conclude it could not identify the customer.
|
|
54
|
+
|
|
55
|
+
### Documentation
|
|
56
|
+
|
|
57
|
+
- **One confirmation status covers a whole delivery, not one kind of detail.**
|
|
58
|
+
A dispatch can carry an address together with a new phone number or email
|
|
59
|
+
address. None of the four statuses can say one kind applied and another did
|
|
60
|
+
not, and OneAddress cannot detect a partial application from its side, so
|
|
61
|
+
write every kind named in `event.update_types` in the same unit of work. If
|
|
62
|
+
your system cannot, stop accepting that kind under **My Profile** in the
|
|
63
|
+
partner portal rather than applying it best-effort: refusing is honest and
|
|
64
|
+
visible, because we then never send it and the consumer is told. A partial
|
|
65
|
+
application reads to the consumer as a complete one.
|
|
66
|
+
|
|
67
|
+
- **The first confirmation for a dispatch is the one that counts.** All four
|
|
68
|
+
statuses resolve to a terminal record and a later confirm for the same
|
|
69
|
+
`dispatchId` cannot move it, deliberately, so a retry or replay cannot turn a
|
|
70
|
+
recorded success into a failure. The consequence worth stating: two calls
|
|
71
|
+
cannot report two kinds separately. The second is a no-op on what the
|
|
72
|
+
consumer sees, not a correction. `note` is free text and is kept, but nothing
|
|
73
|
+
is driven off it.
|
|
74
|
+
|
|
75
|
+
Covers `OneAddressConfirmStatus`, `onUpdate` in `OneAddressHandlerOptions`,
|
|
76
|
+
`confirmUpdate`, and the README's confirm section.
|
|
77
|
+
|
|
10
78
|
## [2.2.0] - 2026-09-27
|
|
11
79
|
|
|
12
80
|
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.
|
|
@@ -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,
|
|
@@ -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,
|
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();
|
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-VGE5OE4D.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,20 @@ 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: `customer_match` is refused by the body contract, and the portal
|
|
446
|
+
* control that enabled it has been removed.
|
|
447
|
+
*
|
|
448
|
+
* Nothing about the consumer is knowable before decryption. Decrypt
|
|
449
|
+
* `session_envelope` and match on the verified name, known names or account
|
|
450
|
+
* number in the resulting `SessionData`.
|
|
451
|
+
*
|
|
452
|
+
* The type is retained so an existing import compiles; it will go in the next
|
|
453
|
+
* major.
|
|
430
454
|
*/
|
|
431
455
|
interface OneAddressCustomerMatch {
|
|
432
456
|
/** Blind index of the consumer's email, when present. */
|
|
@@ -573,12 +597,17 @@ interface OneAddressVerifyEvent {
|
|
|
573
597
|
dispatchId: string;
|
|
574
598
|
batch_id: number;
|
|
575
599
|
user_id: string;
|
|
576
|
-
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
600
|
+
/** @deprecated NOT SENT. `customer` is in the body contract's refused list
|
|
601
|
+
* (`D5_BODY_NEVER`), so a body carrying one fails the shape check. Nothing
|
|
602
|
+
* about the consumer travels outside the encrypted envelope, so there is no
|
|
603
|
+
* cleartext matching block to read: decrypt
|
|
604
|
+
* `session_envelope` and match on the verified name, known names or account
|
|
605
|
+
* number it carries. Kept optional so an existing narrowing check still
|
|
606
|
+
* compiles; it will never be populated. */
|
|
579
607
|
customer?: OneAddressCustomer;
|
|
580
|
-
/**
|
|
581
|
-
*
|
|
608
|
+
/** @deprecated NOT SENT, and likewise refused by the body contract. See
|
|
609
|
+
* {@link OneAddressCustomerMatch}. Neither this nor `customer` is present:
|
|
610
|
+
* the earlier "exactly one of" described a shape that no longer exists. */
|
|
582
611
|
customer_match?: OneAddressCustomerMatch;
|
|
583
612
|
address: OneAddressAddress;
|
|
584
613
|
/** The Letter of Authority. On D5 dispatches this is the structured
|
|
@@ -834,6 +863,12 @@ interface OneAddressHandlerOptions {
|
|
|
834
863
|
* The status is a union rather than a bare `string`: `/api/confirm` rejects
|
|
835
864
|
* anything outside the four with a 400, and a typo used to surface as an
|
|
836
865
|
* unexplained rejection at runtime instead of a compile error.
|
|
866
|
+
*
|
|
867
|
+
* ONE STATUS COVERS THE WHOLE DELIVERY. If `event.update_types` names more
|
|
868
|
+
* than one kind, this single value speaks for all of them: there is no way
|
|
869
|
+
* to say the address went in and the phone number did not. Write every kind
|
|
870
|
+
* it names in one unit of work, or stop accepting that kind. See
|
|
871
|
+
* {@link OneAddressConfirmStatus}.
|
|
837
872
|
*/
|
|
838
873
|
onUpdate: (event: OneAddressUpdateEvent) => Promise<{
|
|
839
874
|
status?: OneAddressConfirmStatus;
|
|
@@ -1472,6 +1507,23 @@ interface ConfirmUpdateResult {
|
|
|
1472
1507
|
* something your code can see and log; an exception in a fire-and-forget
|
|
1473
1508
|
* `.catch()` is how a dropped confirmation stays invisible.
|
|
1474
1509
|
*
|
|
1510
|
+
* ## One call per dispatch, and one status for everything in it
|
|
1511
|
+
*
|
|
1512
|
+
* `dispatchId` identifies a DELIVERY, not a kind of detail. A delivery that
|
|
1513
|
+
* carried an address and a new phone number is confirmed once, with one
|
|
1514
|
+
* status covering both.
|
|
1515
|
+
*
|
|
1516
|
+
* **The FIRST confirmation for a dispatch is the one that counts.** Every one
|
|
1517
|
+
* of the four statuses resolves to a terminal record, and a later confirm for
|
|
1518
|
+
* the same `dispatchId` cannot move it - that guard is deliberate, so a retry
|
|
1519
|
+
* or a replay cannot turn a recorded success into a failure. It also means you
|
|
1520
|
+
* cannot send two calls to report two kinds separately: the second is a no-op
|
|
1521
|
+
* on what the consumer is shown, not a correction.
|
|
1522
|
+
*
|
|
1523
|
+
* So make one call, with a status that is true of the whole delivery. See
|
|
1524
|
+
* {@link OneAddressConfirmStatus} for what to do when your system cannot
|
|
1525
|
+
* apply every kind atomically.
|
|
1526
|
+
*
|
|
1475
1527
|
* @example
|
|
1476
1528
|
* const res = await confirmUpdate({
|
|
1477
1529
|
* 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,20 @@ 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: `customer_match` is refused by the body contract, and the portal
|
|
446
|
+
* control that enabled it has been removed.
|
|
447
|
+
*
|
|
448
|
+
* Nothing about the consumer is knowable before decryption. Decrypt
|
|
449
|
+
* `session_envelope` and match on the verified name, known names or account
|
|
450
|
+
* number in the resulting `SessionData`.
|
|
451
|
+
*
|
|
452
|
+
* The type is retained so an existing import compiles; it will go in the next
|
|
453
|
+
* major.
|
|
430
454
|
*/
|
|
431
455
|
interface OneAddressCustomerMatch {
|
|
432
456
|
/** Blind index of the consumer's email, when present. */
|
|
@@ -573,12 +597,17 @@ interface OneAddressVerifyEvent {
|
|
|
573
597
|
dispatchId: string;
|
|
574
598
|
batch_id: number;
|
|
575
599
|
user_id: string;
|
|
576
|
-
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
600
|
+
/** @deprecated NOT SENT. `customer` is in the body contract's refused list
|
|
601
|
+
* (`D5_BODY_NEVER`), so a body carrying one fails the shape check. Nothing
|
|
602
|
+
* about the consumer travels outside the encrypted envelope, so there is no
|
|
603
|
+
* cleartext matching block to read: decrypt
|
|
604
|
+
* `session_envelope` and match on the verified name, known names or account
|
|
605
|
+
* number it carries. Kept optional so an existing narrowing check still
|
|
606
|
+
* compiles; it will never be populated. */
|
|
579
607
|
customer?: OneAddressCustomer;
|
|
580
|
-
/**
|
|
581
|
-
*
|
|
608
|
+
/** @deprecated NOT SENT, and likewise refused by the body contract. See
|
|
609
|
+
* {@link OneAddressCustomerMatch}. Neither this nor `customer` is present:
|
|
610
|
+
* the earlier "exactly one of" described a shape that no longer exists. */
|
|
582
611
|
customer_match?: OneAddressCustomerMatch;
|
|
583
612
|
address: OneAddressAddress;
|
|
584
613
|
/** The Letter of Authority. On D5 dispatches this is the structured
|
|
@@ -834,6 +863,12 @@ interface OneAddressHandlerOptions {
|
|
|
834
863
|
* The status is a union rather than a bare `string`: `/api/confirm` rejects
|
|
835
864
|
* anything outside the four with a 400, and a typo used to surface as an
|
|
836
865
|
* unexplained rejection at runtime instead of a compile error.
|
|
866
|
+
*
|
|
867
|
+
* ONE STATUS COVERS THE WHOLE DELIVERY. If `event.update_types` names more
|
|
868
|
+
* than one kind, this single value speaks for all of them: there is no way
|
|
869
|
+
* to say the address went in and the phone number did not. Write every kind
|
|
870
|
+
* it names in one unit of work, or stop accepting that kind. See
|
|
871
|
+
* {@link OneAddressConfirmStatus}.
|
|
837
872
|
*/
|
|
838
873
|
onUpdate: (event: OneAddressUpdateEvent) => Promise<{
|
|
839
874
|
status?: OneAddressConfirmStatus;
|
|
@@ -1472,6 +1507,23 @@ interface ConfirmUpdateResult {
|
|
|
1472
1507
|
* something your code can see and log; an exception in a fire-and-forget
|
|
1473
1508
|
* `.catch()` is how a dropped confirmation stays invisible.
|
|
1474
1509
|
*
|
|
1510
|
+
* ## One call per dispatch, and one status for everything in it
|
|
1511
|
+
*
|
|
1512
|
+
* `dispatchId` identifies a DELIVERY, not a kind of detail. A delivery that
|
|
1513
|
+
* carried an address and a new phone number is confirmed once, with one
|
|
1514
|
+
* status covering both.
|
|
1515
|
+
*
|
|
1516
|
+
* **The FIRST confirmation for a dispatch is the one that counts.** Every one
|
|
1517
|
+
* of the four statuses resolves to a terminal record, and a later confirm for
|
|
1518
|
+
* the same `dispatchId` cannot move it - that guard is deliberate, so a retry
|
|
1519
|
+
* or a replay cannot turn a recorded success into a failure. It also means you
|
|
1520
|
+
* cannot send two calls to report two kinds separately: the second is a no-op
|
|
1521
|
+
* on what the consumer is shown, not a correction.
|
|
1522
|
+
*
|
|
1523
|
+
* So make one call, with a status that is true of the whole delivery. See
|
|
1524
|
+
* {@link OneAddressConfirmStatus} for what to do when your system cannot
|
|
1525
|
+
* apply every kind atomically.
|
|
1526
|
+
*
|
|
1475
1527
|
* @example
|
|
1476
1528
|
* const res = await confirmUpdate({
|
|
1477
1529
|
* 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();
|
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-VGE5OE4D.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.3.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",
|