@oneaddress/partner-sdk 2.10.0 → 2.11.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 +21 -2
- package/README.md +10 -9
- package/dist/{chunk-JJ2B5VFO.mjs → chunk-RU6G6PIM.mjs} +17 -2
- package/dist/{chunk-NJGZ6ISS.mjs → chunk-WHVGOWN6.mjs} +18 -6
- package/dist/edge.js +32 -6
- package/dist/edge.mjs +2 -2
- package/dist/index.d.mts +31 -16
- package/dist/index.d.ts +31 -16
- package/dist/index.js +34 -6
- package/dist/index.mjs +4 -2
- package/dist/{src-XBG2QHG4.mjs → src-4WJQTYDA.mjs} +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.11.0] - 2026-11-30
|
|
11
|
+
|
|
12
|
+
### Fixed: what the docs say happens to a confirm `note`
|
|
13
|
+
|
|
14
|
+
- The `note` on `confirmUpdate`, the `onUpdate` result and `sendVerifyResult` is kept only when it is a short code such as `crm_updated`, and the consumer sees a kept code beside the result. Any other text is replaced by OneAddress's own sentence for the status. The docs had said the note was free text for OneAddress support and never shown to the consumer. Documentation only.
|
|
15
|
+
|
|
16
|
+
### Fixed: the LOA key fetch no longer follows redirects
|
|
17
|
+
|
|
18
|
+
- `fetchLoaPublicKey` (and so `cachedLoaPublicKey` and the handler's default key lookup) refuses a redirect rather than following it, and gives up after 10 seconds. The host allowlist is checked on the URL asked for, so a followed redirect could have served the key that consent proofs are verified against from another host. The Java and C# SDKs already refused redirects.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Added: `isIsoDate`
|
|
22
|
+
|
|
23
|
+
- The `YYYY-MM-DD` check the handler applies to a body's `effective_date`, exported so code that calls `decryptSession` itself refuses the same values before calling `assertEffectiveDateBound`.
|
|
24
|
+
|
|
25
|
+
### Added: the account check for RSA-OAEP and X-Wing keys
|
|
26
|
+
|
|
27
|
+
- `account.verify` now opens `customer_encrypted` in either shape. An ECDH key still receives the single blob opened with `decryptAddress`. An RSA-OAEP or X-Wing key receives the shape `loa_encrypted` uses (`session_envelope` and `session_key_share`), opened with `decryptSession`, so it also works through a `PrivateKeyOperations` delegate. Until now OneAddress could not seal an account check to an RSA-OAEP or X-Wing key at all. Vectors: `account_check_sealed`.
|
|
28
|
+
|
|
29
|
+
## [2.10.0] - 2026-11-06
|
|
30
|
+
|
|
10
31
|
### Added: the confirm names the SDK version
|
|
11
32
|
|
|
12
33
|
- Every confirm sends `X-OneAddress-Client: partner-sdk-ts/<version>`. Software name and version only, outside the signature. OneAddress records it after the confirm verifies and the partner portal shows whether an update exists.
|
|
@@ -15,8 +36,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
15
36
|
|
|
16
37
|
- `startUpdateCheck()`, `checkForUpdate()` and `updateCheckMetric()`: ask the public registry, at most once a day, whether a newer SDK is published, and log one line, `update available: X -> Y, see <guide URL>`, when it is. Opt-in (nothing runs unless you start it), sends no identifying data, never installs anything, and `ONEADDRESS_UPDATE_CHECK=off` stops it.
|
|
17
38
|
|
|
18
|
-
## [2.10.0] (repo bump only, not published)
|
|
19
|
-
|
|
20
39
|
### Added: a signed answer to the connection verification
|
|
21
40
|
|
|
22
41
|
- **An indexed `address.test` / `address.test-dispatch` is answered with
|
package/README.md
CHANGED
|
@@ -482,7 +482,7 @@ const res = await confirmUpdate({
|
|
|
482
482
|
secret: process.env.OA_CONFIRM_SECRET!, // see "which secret" below
|
|
483
483
|
dispatchId: event.dispatchId, // from X-OneAddress-Dispatch
|
|
484
484
|
status: 'confirmed',
|
|
485
|
-
note: '
|
|
485
|
+
note: 'crm_updated', // a short code, never the address
|
|
486
486
|
});
|
|
487
487
|
|
|
488
488
|
if (!res.ok) console.error('[oneaddress] confirm failed', res.status, res.error);
|
|
@@ -494,7 +494,7 @@ if (!res.ok) console.error('[oneaddress] confirm failed', res.status, res.error)
|
|
|
494
494
|
| --- | --- |
|
|
495
495
|
| `confirmed` | You applied the change. |
|
|
496
496
|
| `already_current` | You already held that address; nothing to write. **Not a failure** — return it honestly rather than reporting `confirmed`. |
|
|
497
|
-
| `failed` | Your system could not apply it. OneAddress retries, and a run of these makes the update our fault and refunds the consumer. Send a `note` saying why (what happened, never the address). |
|
|
497
|
+
| `failed` | Your system could not apply it. OneAddress retries, and a run of these makes the update our fault and refunds the consumer. Send a `note` code saying why (what happened, never the address). |
|
|
498
498
|
| `no_match` | You looked, and this person is not a customer of yours. Nothing is broken and retrying cannot help, so the consumer is told to check their account reference with you. No refund is triggered. |
|
|
499
499
|
|
|
500
500
|
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.
|
|
@@ -507,7 +507,7 @@ A dispatch can carry an address together with a new phone number or email addres
|
|
|
507
507
|
|
|
508
508
|
**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.
|
|
509
509
|
|
|
510
|
-
`note` is
|
|
510
|
+
`note` is optional. OneAddress keeps it only when it is a short code such as `crm_updated`: a letter first, then letters, digits or `_ . : -`, up to 64 characters, with no run of five or more digits. Any other text is replaced by OneAddress's own sentence for the status. A kept code is shown to the consumer beside the result, on their dashboard and in their Transmission Report. Nothing is driven off it: the status alone decides what happens next.
|
|
511
511
|
|
|
512
512
|
### Which secret
|
|
513
513
|
|
|
@@ -545,15 +545,16 @@ What each response status means to us:
|
|
|
545
545
|
|---|---|---|
|
|
546
546
|
| `2xx` (and no `ok: false`) | delivered, awaiting your confirm | Wait for `confirmUpdate`. |
|
|
547
547
|
| `400` | partner error | Retry on the backoff. A malformed request cannot be fixed by retrying, but the class of problem (a stale timestamp, a body that is not JSON) usually clears on the next attempt. |
|
|
548
|
-
| `401`
|
|
548
|
+
| `401` | **auth failed** | **Not retried.** See the warning below. |
|
|
549
|
+
| `403` | partner error | Retry on the backoff. A WAF or proxy in front of your receiver answers 403 for its own rules (rate, geography, a bot check), which usually clears. |
|
|
549
550
|
| `422` | partner error | Retry. The handler sends this for a kind you have not declared in `acceptedUpdateTypes`; once you widen the declaration the retry is processed. |
|
|
550
551
|
| `500` | partner error | Retry. This is what the handler answers for a decrypt failure, a missing or invalid consent proof, or a throwing `onUpdate`, and it is the right answer for anything you want retried. |
|
|
551
552
|
| no response / timeout | unreachable | Retry. |
|
|
552
553
|
|
|
553
|
-
> **A 401
|
|
554
|
+
> **A 401 ends the delivery. It is not retried, and this README said the
|
|
554
555
|
> opposite until 5 October 2026.**
|
|
555
556
|
>
|
|
556
|
-
>
|
|
557
|
+
> That status is the only one we read as a **rejected signature**, and
|
|
557
558
|
> a rejected signature does not fix itself: nothing about waiting and sending
|
|
558
559
|
> the same bytes again makes them verify. So the dispatch is parked in the
|
|
559
560
|
> `auth_failed` state and the retry cron excludes it from its candidate set.
|
|
@@ -571,7 +572,7 @@ What each response status means to us:
|
|
|
571
572
|
> broken signing deploy or an unsynced secret - and worth telling us about
|
|
572
573
|
> rather than waiting out.
|
|
573
574
|
|
|
574
|
-
Every 4xx EXCEPT 401
|
|
575
|
+
Every 4xx EXCEPT 401 is filed as "partner error" and retried; a 401 is filed as "auth failed" and is not. A 403 was filed with 401 until 13 November 2026. Either way a 4xx you send deliberately reads, to the consumer, as a problem between you and OneAddress. Prefer a 500 for "try again" and a confirm of `no_match` for "not my customer".
|
|
575
576
|
|
|
576
577
|
---
|
|
577
578
|
|
|
@@ -987,7 +988,7 @@ forged request could reach, so keep it empty in production.
|
|
|
987
988
|
|
|
988
989
|
OneAddress runs an optional pre-payment existence check during the guest checkout flow. Implement `onAccountVerify` to participate — partners that don't implement it are silently skipped, the consumer is allowed to continue, and the regular `address.updated` event still arrives after payment.
|
|
989
990
|
|
|
990
|
-
The payload carries **no address
|
|
991
|
+
The payload carries **no address**, only the customer identity block (name / known-names / account number), and it travels **encrypted** as `customer_encrypted`, never in cleartext: the legacy ECDH blob for an ECDH key, or the shape `loa_encrypted` uses (`session_envelope` and `session_key_share`) for an RSA-OAEP or X-Wing key. `createOneAddressHandler` decrypts it for you and populates `event.customer`. The consumer is waiting for your response, so reply synchronously within 10 seconds.
|
|
991
992
|
|
|
992
993
|
```typescript
|
|
993
994
|
export const handler = createOneAddressHandler({
|
|
@@ -1227,7 +1228,7 @@ The address is encrypted to you and to nobody else. Four ways to undo that, each
|
|
|
1227
1228
|
|
|
1228
1229
|
- **Never log the plaintext address**, at any level, in any format. A log line is a copy at rest with no retention policy and a wider audience than your database.
|
|
1229
1230
|
- **Never persist the plaintext address anywhere but the record it belongs to.** Not a debug table, not a queue payload, not a crash dump. `transformSession` exists so an outbox can hold it re-encrypted to your own key.
|
|
1230
|
-
- **Never put the address in a confirm `note`.** The note travels back to OneAddress in the clear and is
|
|
1231
|
+
- **Never put the address in a confirm `note`.** The note travels back to OneAddress in the clear, and a code in it is shown to the consumer. Say what happened, not what the address was.
|
|
1231
1232
|
- **Never route a test record to `onUpdate`.** `address.test` and `address.test-dispatch` carry fabricated identities and go to `onTest`; the handler keeps them apart, and so must anything you build beside it.
|
|
1232
1233
|
- **Never skip the idempotency store in production.** Retries are normal (28 over 48 hours); without a store each one applies the update again. The handler will tell you once, in the log, and then keep going.
|
|
1233
1234
|
|
|
@@ -4142,11 +4142,18 @@ function classifyEndpointProbe(input) {
|
|
|
4142
4142
|
summary: `Receiver accepted a signed test request (HTTP ${status}).`
|
|
4143
4143
|
};
|
|
4144
4144
|
}
|
|
4145
|
-
if (status === 401
|
|
4145
|
+
if (status === 401) {
|
|
4146
4146
|
return {
|
|
4147
4147
|
health: "auth",
|
|
4148
4148
|
dispatchable: false,
|
|
4149
|
-
summary: `Receiver rejected our signature (HTTP
|
|
4149
|
+
summary: `Receiver rejected our signature (HTTP 401). Check the signing secret matches on both sides.`
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
if (status === 403) {
|
|
4153
|
+
return {
|
|
4154
|
+
health: "rejected",
|
|
4155
|
+
dispatchable: false,
|
|
4156
|
+
summary: `Something in front of the receiver refused the request (HTTP 403), usually a firewall rule on rate, location or bots. Our signature is refused with a 401, not this.`
|
|
4150
4157
|
};
|
|
4151
4158
|
}
|
|
4152
4159
|
if (MISSING_STATUSES.has(status)) {
|
|
@@ -5138,6 +5145,13 @@ async function encryptPayloadForPartner(payload, partner) {
|
|
|
5138
5145
|
hkdfSalt: bytesToB64(hkdfSaltBytes)
|
|
5139
5146
|
};
|
|
5140
5147
|
}
|
|
5148
|
+
async function encryptAccountCheckForPartner(payload, partner) {
|
|
5149
|
+
if (isRsaScheme(partner.algorithm) || isHybridScheme(partner.algorithm)) {
|
|
5150
|
+
const { session_envelope, session_key_share } = await encryptEnvelopeForPartner(payload, partner);
|
|
5151
|
+
return { session_envelope, session_key_share };
|
|
5152
|
+
}
|
|
5153
|
+
return encryptPayloadForPartner(payload, { partnerId: partner.partner_id, publicKeyB64: partner.public_key_b64 });
|
|
5154
|
+
}
|
|
5141
5155
|
async function encryptAddressForAll(address, partners) {
|
|
5142
5156
|
const results = await Promise.all(
|
|
5143
5157
|
partners.map((p) => encryptAddressForPartner(address, p))
|
|
@@ -5632,6 +5646,7 @@ export {
|
|
|
5632
5646
|
generateHybridPartnerKeyPair,
|
|
5633
5647
|
encryptAddressForPartner,
|
|
5634
5648
|
encryptPayloadForPartner,
|
|
5649
|
+
encryptAccountCheckForPartner,
|
|
5635
5650
|
encryptAddressForAll,
|
|
5636
5651
|
decryptAddress,
|
|
5637
5652
|
encryptSessionForPartner,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isFreshTimestamp,
|
|
6
6
|
isSafeWebhookUrl,
|
|
7
7
|
verifyRegistryHead
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RU6G6PIM.mjs";
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
import crypto from "crypto";
|
|
@@ -267,7 +267,7 @@ function resolveAppOrigin(baseUrl, label, extraHosts) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
// src/update-check.ts
|
|
270
|
-
var SDK_VERSION = "2.
|
|
270
|
+
var SDK_VERSION = "2.11.0";
|
|
271
271
|
var UPDATE_GUIDE_URL = "https://partners.oneaddress.io/#updating-safely";
|
|
272
272
|
var REGISTRY_URL = "https://registry.npmjs.org/@oneaddress/partner-sdk/latest";
|
|
273
273
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -1105,7 +1105,7 @@ function normaliseSessionProduct(data) {
|
|
|
1105
1105
|
return { ...data, product };
|
|
1106
1106
|
}
|
|
1107
1107
|
async function decryptSession(share, envelopeB64, privateKeyPem, partnerId, expectedAlg) {
|
|
1108
|
-
const { decryptSession: decryptSessionCrypto } = await import("./src-
|
|
1108
|
+
const { decryptSession: decryptSessionCrypto } = await import("./src-4WJQTYDA.mjs");
|
|
1109
1109
|
const data = await decryptSessionCrypto(
|
|
1110
1110
|
share,
|
|
1111
1111
|
envelopeB64,
|
|
@@ -1249,10 +1249,11 @@ async function confirmUpdate(opts) {
|
|
|
1249
1249
|
}
|
|
1250
1250
|
return { ok: false, status: res.status, error };
|
|
1251
1251
|
}
|
|
1252
|
+
var LOA_KEY_FETCH_TIMEOUT_MS = 1e4;
|
|
1252
1253
|
async function fetchLoaPublicKey(appBaseUrl = OA_APP_BASE_URL2) {
|
|
1253
1254
|
const origin = resolveAppOrigin(appBaseUrl, "fetchLoaPublicKey");
|
|
1254
1255
|
const url = `${origin}/.well-known/oneaddress-loa-key.pem`;
|
|
1255
|
-
const res = await fetch(url);
|
|
1256
|
+
const res = await fetch(url, { redirect: "error", signal: AbortSignal.timeout(LOA_KEY_FETCH_TIMEOUT_MS) });
|
|
1256
1257
|
if (!res.ok) {
|
|
1257
1258
|
throw new Error(`[OneAddress SDK] Failed to fetch LOA public key: HTTP ${res.status}`);
|
|
1258
1259
|
}
|
|
@@ -1766,6 +1767,9 @@ function assertUsablePrivateKey(privateKeyPem) {
|
|
|
1766
1767
|
throw refused;
|
|
1767
1768
|
}
|
|
1768
1769
|
}
|
|
1770
|
+
function isSessionSealed(v) {
|
|
1771
|
+
return typeof v.session_envelope === "string" && !!v.session_key_share && typeof v.session_key_share === "object" && !Array.isArray(v.session_key_share);
|
|
1772
|
+
}
|
|
1769
1773
|
function requirePemFor(purpose, key) {
|
|
1770
1774
|
if (typeof key === "string") return key;
|
|
1771
1775
|
throw new Error(
|
|
@@ -2267,8 +2271,15 @@ function createOneAddressHandler(options) {
|
|
|
2267
2271
|
if (body.event === "account.verify" && onAccountVerify) {
|
|
2268
2272
|
let customer;
|
|
2269
2273
|
if (body.customer_encrypted && typeof body.customer_encrypted === "object") {
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2274
|
+
const sealed = body.customer_encrypted;
|
|
2275
|
+
const raw = isSessionSealed(sealed) ? await decryptSession(
|
|
2276
|
+
sealed.session_key_share,
|
|
2277
|
+
sealed.session_envelope,
|
|
2278
|
+
privateKeyPem,
|
|
2279
|
+
partnerId,
|
|
2280
|
+
expectedAlg
|
|
2281
|
+
) : await decryptAddress(
|
|
2282
|
+
sealed,
|
|
2272
2283
|
requirePemFor("account.verify decryption", privateKeyPem),
|
|
2273
2284
|
partnerId
|
|
2274
2285
|
);
|
|
@@ -2546,6 +2557,7 @@ async function buildSignedTestWebhook(opts) {
|
|
|
2546
2557
|
export {
|
|
2547
2558
|
CURRENT_VERSION,
|
|
2548
2559
|
SUPPORTED_VERSIONS,
|
|
2560
|
+
isIsoDate,
|
|
2549
2561
|
LOA_MAX_TYPED_ALIASES,
|
|
2550
2562
|
normaliseLoaName,
|
|
2551
2563
|
loaSurname,
|
package/dist/edge.js
CHANGED
|
@@ -4351,11 +4351,18 @@ function classifyEndpointProbe(input) {
|
|
|
4351
4351
|
summary: `Receiver accepted a signed test request (HTTP ${status}).`
|
|
4352
4352
|
};
|
|
4353
4353
|
}
|
|
4354
|
-
if (status === 401
|
|
4354
|
+
if (status === 401) {
|
|
4355
4355
|
return {
|
|
4356
4356
|
health: "auth",
|
|
4357
4357
|
dispatchable: false,
|
|
4358
|
-
summary: `Receiver rejected our signature (HTTP
|
|
4358
|
+
summary: `Receiver rejected our signature (HTTP 401). Check the signing secret matches on both sides.`
|
|
4359
|
+
};
|
|
4360
|
+
}
|
|
4361
|
+
if (status === 403) {
|
|
4362
|
+
return {
|
|
4363
|
+
health: "rejected",
|
|
4364
|
+
dispatchable: false,
|
|
4365
|
+
summary: `Something in front of the receiver refused the request (HTTP 403), usually a firewall rule on rate, location or bots. Our signature is refused with a 401, not this.`
|
|
4359
4366
|
};
|
|
4360
4367
|
}
|
|
4361
4368
|
if (MISSING_STATUSES.has(status)) {
|
|
@@ -5218,6 +5225,7 @@ __export(src_exports, {
|
|
|
5218
5225
|
createSenderHeldKeyBinder: () => createSenderHeldKeyBinder,
|
|
5219
5226
|
decryptAddress: () => decryptAddress,
|
|
5220
5227
|
decryptSession: () => decryptSession,
|
|
5228
|
+
encryptAccountCheckForPartner: () => encryptAccountCheckForPartner,
|
|
5221
5229
|
encryptAddressForAll: () => encryptAddressForAll,
|
|
5222
5230
|
encryptAddressForPartner: () => encryptAddressForPartner,
|
|
5223
5231
|
encryptEnvelopeForPartner: () => encryptEnvelopeForPartner,
|
|
@@ -5441,6 +5449,13 @@ async function encryptPayloadForPartner(payload, partner) {
|
|
|
5441
5449
|
hkdfSalt: bytesToB64(hkdfSaltBytes)
|
|
5442
5450
|
};
|
|
5443
5451
|
}
|
|
5452
|
+
async function encryptAccountCheckForPartner(payload, partner) {
|
|
5453
|
+
if (isRsaScheme(partner.algorithm) || isHybridScheme(partner.algorithm)) {
|
|
5454
|
+
const { session_envelope, session_key_share } = await encryptEnvelopeForPartner(payload, partner);
|
|
5455
|
+
return { session_envelope, session_key_share };
|
|
5456
|
+
}
|
|
5457
|
+
return encryptPayloadForPartner(payload, { partnerId: partner.partner_id, publicKeyB64: partner.public_key_b64 });
|
|
5458
|
+
}
|
|
5444
5459
|
async function encryptAddressForAll(address, partners) {
|
|
5445
5460
|
const results = await Promise.all(
|
|
5446
5461
|
partners.map((p) => encryptAddressForPartner(address, p))
|
|
@@ -6211,7 +6226,7 @@ function resolveAppOrigin(baseUrl, label, extraHosts) {
|
|
|
6211
6226
|
}
|
|
6212
6227
|
|
|
6213
6228
|
// src/update-check.ts
|
|
6214
|
-
var SDK_VERSION = "2.
|
|
6229
|
+
var SDK_VERSION = "2.11.0";
|
|
6215
6230
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
6216
6231
|
|
|
6217
6232
|
// src/index.ts
|
|
@@ -6533,10 +6548,11 @@ async function confirmUpdate(opts2) {
|
|
|
6533
6548
|
}
|
|
6534
6549
|
return { ok: false, status: res.status, error };
|
|
6535
6550
|
}
|
|
6551
|
+
var LOA_KEY_FETCH_TIMEOUT_MS = 1e4;
|
|
6536
6552
|
async function fetchLoaPublicKey(appBaseUrl = OA_APP_BASE_URL) {
|
|
6537
6553
|
const origin = resolveAppOrigin(appBaseUrl, "fetchLoaPublicKey");
|
|
6538
6554
|
const url = `${origin}/.well-known/oneaddress-loa-key.pem`;
|
|
6539
|
-
const res = await fetch(url);
|
|
6555
|
+
const res = await fetch(url, { redirect: "error", signal: AbortSignal.timeout(LOA_KEY_FETCH_TIMEOUT_MS) });
|
|
6540
6556
|
if (!res.ok) {
|
|
6541
6557
|
throw new Error(`[OneAddress SDK] Failed to fetch LOA public key: HTTP ${res.status}`);
|
|
6542
6558
|
}
|
|
@@ -7014,6 +7030,9 @@ function assertUsablePrivateKey(privateKeyPem) {
|
|
|
7014
7030
|
throw refused;
|
|
7015
7031
|
}
|
|
7016
7032
|
}
|
|
7033
|
+
function isSessionSealed(v) {
|
|
7034
|
+
return typeof v.session_envelope === "string" && !!v.session_key_share && typeof v.session_key_share === "object" && !Array.isArray(v.session_key_share);
|
|
7035
|
+
}
|
|
7017
7036
|
function requirePemFor(purpose, key) {
|
|
7018
7037
|
if (typeof key === "string") return key;
|
|
7019
7038
|
throw new Error(
|
|
@@ -7515,8 +7534,15 @@ function createOneAddressHandler(options) {
|
|
|
7515
7534
|
if (body.event === "account.verify" && onAccountVerify) {
|
|
7516
7535
|
let customer;
|
|
7517
7536
|
if (body.customer_encrypted && typeof body.customer_encrypted === "object") {
|
|
7518
|
-
const
|
|
7519
|
-
|
|
7537
|
+
const sealed = body.customer_encrypted;
|
|
7538
|
+
const raw = isSessionSealed(sealed) ? await decryptSession2(
|
|
7539
|
+
sealed.session_key_share,
|
|
7540
|
+
sealed.session_envelope,
|
|
7541
|
+
privateKeyPem,
|
|
7542
|
+
partnerId,
|
|
7543
|
+
expectedAlg
|
|
7544
|
+
) : await decryptAddress2(
|
|
7545
|
+
sealed,
|
|
7520
7546
|
requirePemFor("account.verify decryption", privateKeyPem),
|
|
7521
7547
|
partnerId
|
|
7522
7548
|
);
|
package/dist/edge.mjs
CHANGED
|
@@ -38,13 +38,13 @@ import {
|
|
|
38
38
|
verifyLOA,
|
|
39
39
|
verifySignature,
|
|
40
40
|
verifyWithGrace
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-WHVGOWN6.mjs";
|
|
42
42
|
import {
|
|
43
43
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
44
44
|
computeBlindIndex,
|
|
45
45
|
isFreshTimestamp,
|
|
46
46
|
normalizeForBlindIndex
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-RU6G6PIM.mjs";
|
|
48
48
|
export {
|
|
49
49
|
CURRENT_VERSION,
|
|
50
50
|
DEFAULT_REPLAY_WINDOW_SECS,
|
package/dist/index.d.mts
CHANGED
|
@@ -165,6 +165,11 @@ declare const CURRENT_VERSION: "2026.1";
|
|
|
165
165
|
/** All protocol versions this build of the SDK recognises. */
|
|
166
166
|
declare const SUPPORTED_VERSIONS: readonly ["2026.1"];
|
|
167
167
|
|
|
168
|
+
/** A calendar date, `YYYY-MM-DD`. */
|
|
169
|
+
type IsoDate = string;
|
|
170
|
+
/** True for a real calendar date in `YYYY-MM-DD` form. `2026-02-30` is false. */
|
|
171
|
+
declare function isIsoDate(value: unknown): value is IsoDate;
|
|
172
|
+
|
|
168
173
|
/** The most typed aliases a v2 record carries. A longer list is malformed. */
|
|
169
174
|
declare const LOA_MAX_TYPED_ALIASES = 3;
|
|
170
175
|
/** The name normalisation every SDK applies before comparing. See the module notes. */
|
|
@@ -633,7 +638,7 @@ declare function checkRegistryHead(opts: RegistryHeadCheckOptions): Promise<Regi
|
|
|
633
638
|
* `ONEADDRESS_UPDATE_CHECK=off` turns it off.
|
|
634
639
|
*/
|
|
635
640
|
/** Must equal `version` in this package's package.json. Pinned by test. */
|
|
636
|
-
declare const SDK_VERSION = "2.
|
|
641
|
+
declare const SDK_VERSION = "2.11.0";
|
|
637
642
|
/** The partner guide's page on updating safely. Behind portal sign-in. */
|
|
638
643
|
declare const UPDATE_GUIDE_URL = "https://partners.oneaddress.io/#updating-safely";
|
|
639
644
|
type UpdateCheckState = 'current' | 'available' | 'unknown' | 'disabled';
|
|
@@ -776,8 +781,9 @@ declare function startUpdateCheck(opts?: StartUpdateCheckOptions): UpdateCheckHa
|
|
|
776
781
|
* two apart.
|
|
777
782
|
*
|
|
778
783
|
* If you need to record that something did not apply, `note` on
|
|
779
|
-
* {@link confirmUpdate}
|
|
780
|
-
*
|
|
784
|
+
* {@link confirmUpdate} can carry a short code for it (see
|
|
785
|
+
* {@link ConfirmUpdateOptions.note}), but nothing is driven off it: the status
|
|
786
|
+
* alone decides what happens next.
|
|
781
787
|
*/
|
|
782
788
|
type OneAddressConfirmStatus = 'confirmed' | 'already_current' | 'failed' | 'no_match';
|
|
783
789
|
interface OneAddressAddress {
|
|
@@ -1144,10 +1150,12 @@ interface OneAddressHandlerOptions {
|
|
|
1144
1150
|
* OR a {@link PrivateKeyOperations} delegate for a key held in a KMS or HSM
|
|
1145
1151
|
* that will not export it. The name is kept for compatibility. A delegate
|
|
1146
1152
|
* covers the session-envelope paths (`address.updated`, `contact.updated`,
|
|
1147
|
-
* the test events and `
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1153
|
+
* the test events, `loa_encrypted`, and `customer_encrypted` on
|
|
1154
|
+
* `account.verify` when it arrives in the session shape, which it does for an
|
|
1155
|
+
* RSA-OAEP or X-Wing key); the legacy single-blob paths (`address_encrypted`
|
|
1156
|
+
* on `address.verify`, and `customer_encrypted` in the ECDH shape) need the
|
|
1157
|
+
* raw key and are refused with a named error (500) when a delegate is
|
|
1158
|
+
* supplied.
|
|
1151
1159
|
*
|
|
1152
1160
|
* A PEM that does not import is refused at construction rather than on the
|
|
1153
1161
|
* first delivery, where it surfaces as a 500 and a retry storm.
|
|
@@ -1326,7 +1334,7 @@ interface OneAddressHandlerOptions {
|
|
|
1326
1334
|
reference?: string;
|
|
1327
1335
|
/**
|
|
1328
1336
|
* Sent as the confirm's `note` when `confirm` is set, so a `failed` can say
|
|
1329
|
-
* why.
|
|
1337
|
+
* why. Kept only as a short code, which the consumer sees. NEVER the
|
|
1330
1338
|
* address or any other decrypted detail: see {@link ConfirmUpdateOptions.note}.
|
|
1331
1339
|
*/
|
|
1332
1340
|
note?: string;
|
|
@@ -2097,13 +2105,16 @@ interface ConfirmUpdateOptions {
|
|
|
2097
2105
|
/** Defaults to `'confirmed'`. See {@link OneAddressConfirmStatus}. */
|
|
2098
2106
|
status?: OneAddressConfirmStatus;
|
|
2099
2107
|
/**
|
|
2100
|
-
*
|
|
2108
|
+
* Optional. OneAddress keeps it only when it is a short code such as
|
|
2109
|
+
* `crm_updated`: a letter first, then letters, digits or `_ . : -`, up to
|
|
2110
|
+
* 64 characters, with no run of five or more digits. Any other text is
|
|
2111
|
+
* replaced by OneAddress's own sentence for the status. A kept code is shown
|
|
2112
|
+
* to the consumer beside the result, on their dashboard and in their
|
|
2113
|
+
* Transmission Report.
|
|
2101
2114
|
*
|
|
2102
2115
|
* NEVER put the address, or any other decrypted detail, in it. The note
|
|
2103
|
-
* travels back to OneAddress in cleartext
|
|
2104
|
-
*
|
|
2105
|
-
* happened ("applied to CRM record", "account closed"), not what the
|
|
2106
|
-
* address was.
|
|
2116
|
+
* travels back to OneAddress in cleartext. Say what happened
|
|
2117
|
+
* (`crm_updated`, `account_closed`), not what the address was.
|
|
2107
2118
|
*/
|
|
2108
2119
|
note?: string;
|
|
2109
2120
|
/** Echo of `event.loa_ref`, proving you decrypted the signed consent. */
|
|
@@ -2185,7 +2196,7 @@ interface ConfirmUpdateResult {
|
|
|
2185
2196
|
* secret: process.env.OA_CONFIRM_SECRET!,
|
|
2186
2197
|
* dispatchId: event.dispatchId,
|
|
2187
2198
|
* status: 'confirmed',
|
|
2188
|
-
* note: '
|
|
2199
|
+
* note: 'crm_updated',
|
|
2189
2200
|
* });
|
|
2190
2201
|
* if (!res.ok) console.error('[oneaddress] confirm failed', res.status, res.error);
|
|
2191
2202
|
*/
|
|
@@ -2543,7 +2554,11 @@ interface VerifyResultCallbackParams {
|
|
|
2543
2554
|
partnerId: string;
|
|
2544
2555
|
/** `true` if the submitted address matches what you hold on file. */
|
|
2545
2556
|
match: boolean;
|
|
2546
|
-
/**
|
|
2557
|
+
/**
|
|
2558
|
+
* Optional short code, kept on the same rule as {@link ConfirmUpdateOptions.note}
|
|
2559
|
+
* and shown to the consumer with the result. Any other text is replaced by
|
|
2560
|
+
* OneAddress's own sentence for the result. Never a decrypted detail.
|
|
2561
|
+
*/
|
|
2547
2562
|
note?: string;
|
|
2548
2563
|
/**
|
|
2549
2564
|
* Extra hostnames the callback may be POSTed to, beside `oneaddress.io` and
|
|
@@ -2860,4 +2875,4 @@ interface SignedTestWebhook {
|
|
|
2860
2875
|
*/
|
|
2861
2876
|
declare function buildSignedTestWebhook(opts: SignedTestWebhookOptions): Promise<SignedTestWebhook>;
|
|
2862
2877
|
|
|
2863
|
-
export { type AddressParts, type BlindIndexField, CURRENT_VERSION, type CheckForUpdateOptions, type ComparableAddress, type ConfirmUpdateOptions, type ConfirmUpdateResult, DEFAULT_IDEMPOTENCY_LEASE_SECS, DEFAULT_MAX_BODY_BYTES, DEFAULT_REPLAY_WINDOW_SECS, EffectiveDateMismatchError, type EncryptedPayload, type ExpressLikeRequest, type ExpressLikeResponse, type HandlerConfirmOptions, type HandlerRequest, type HandlerResponse, type IdempotencyClaim, type IdempotencyDialect, type IdempotencyStore, LOA_MAX_TYPED_ALIASES, LOA_MIN_SHORT_FORM_LETTERS, LOA_PUBLIC_KEY_CACHE_MS, LOA_V2_REFUSALS, LoaPublicKeyUnavailableError, type LoaV2Context, type LoaV2Refusal, LoaV2RefusedError, MAX_ADDRESS_FIELD_CHARS, OUTBOX_LEASE_COLUMNS, type OneAddressAccountVerifyEvent, type OneAddressAddress, type OneAddressConfirmStatus, type OneAddressCustomer, type OneAddressCustomerMatch, type OneAddressD5LOA, type OneAddressHandlerOptions, type OneAddressIdVerification, type OneAddressLOA, type OneAddressProduct, type OneAddressTestEvent, type OneAddressUpdateEvent, type OneAddressVerifyEvent, type OutboxBacklog, type OutboxConsumer, type OutboxConsumerOptions, type OutboxDialect, type OutboxQueryFn, type OutboxRow, PRODUCT_CODE_PATTERN, type PinnedRegistryRoot, type PrivateKeyOperations, type RegistryHeadCheckOptions, type RegistryHeadCheckResult, type RegistryHeadCheckVerdict, SDK_VERSION, SUPPORTED_VERSIONS, type SessionData, type SessionKeyShare, type SessionUpdateType, type SignedTestWebhook, type SignedTestWebhookOptions, type StartUpdateCheckOptions, UPDATE_GUIDE_URL, type UpdateCheckHandle, type UpdateCheckResult, type UpdateCheckState, VERIFICATION_COMMITMENT_VERSION, type VerificationCommitmentRecord, type VerifyResultCallbackParams, _resetLoaKeyCacheForTests, _resetOnceWarningsForTests, acceptTypedAliases, assertEffectiveDateBound, buildSignedTestWebhook, cachedLoaPublicKey, canonicalD5LoaForm, canonicalD5LoaFormV2, checkForUpdate, checkLoaV2, checkRegistryHead, compareAddresses, computeBlindIndex, computeVerificationCommitment, confirmUpdate, createOneAddressHandler, createOutboxConsumer, createSqlIdempotencyStore, d5LoaRef, decryptAddress as decrypt, decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, formatAddressParts, fromOutboxTimestamp, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, isNewerVersion, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, matchingWebhookSecret, namePoolMatches, normaliseCommitmentField, normaliseLoaName, normalizeForBlindIndex, parsePinnedRegistryRoots, readAddressParts, readSessionProduct, sendVerifyResult, signPullRequest, startUpdateCheck, toExpressHandler, toOutboxTimestamp, transformAddress as transform, transformAddress, transformSession, typedAliasesOf, updateAvailableLine, updateCheckEnabled, updateCheckMetric, validateAddress, verificationCommitmentString, verifySignature as verify, verifyD5LOA, verifyD5LOAv2, verifyWithGrace as verifyGrace, verifyLOA, verifySignature, verifyWithGrace };
|
|
2878
|
+
export { type AddressParts, type BlindIndexField, CURRENT_VERSION, type CheckForUpdateOptions, type ComparableAddress, type ConfirmUpdateOptions, type ConfirmUpdateResult, DEFAULT_IDEMPOTENCY_LEASE_SECS, DEFAULT_MAX_BODY_BYTES, DEFAULT_REPLAY_WINDOW_SECS, EffectiveDateMismatchError, type EncryptedPayload, type ExpressLikeRequest, type ExpressLikeResponse, type HandlerConfirmOptions, type HandlerRequest, type HandlerResponse, type IdempotencyClaim, type IdempotencyDialect, type IdempotencyStore, LOA_MAX_TYPED_ALIASES, LOA_MIN_SHORT_FORM_LETTERS, LOA_PUBLIC_KEY_CACHE_MS, LOA_V2_REFUSALS, LoaPublicKeyUnavailableError, type LoaV2Context, type LoaV2Refusal, LoaV2RefusedError, MAX_ADDRESS_FIELD_CHARS, OUTBOX_LEASE_COLUMNS, type OneAddressAccountVerifyEvent, type OneAddressAddress, type OneAddressConfirmStatus, type OneAddressCustomer, type OneAddressCustomerMatch, type OneAddressD5LOA, type OneAddressHandlerOptions, type OneAddressIdVerification, type OneAddressLOA, type OneAddressProduct, type OneAddressTestEvent, type OneAddressUpdateEvent, type OneAddressVerifyEvent, type OutboxBacklog, type OutboxConsumer, type OutboxConsumerOptions, type OutboxDialect, type OutboxQueryFn, type OutboxRow, PRODUCT_CODE_PATTERN, type PinnedRegistryRoot, type PrivateKeyOperations, type RegistryHeadCheckOptions, type RegistryHeadCheckResult, type RegistryHeadCheckVerdict, SDK_VERSION, SUPPORTED_VERSIONS, type SessionData, type SessionKeyShare, type SessionUpdateType, type SignedTestWebhook, type SignedTestWebhookOptions, type StartUpdateCheckOptions, UPDATE_GUIDE_URL, type UpdateCheckHandle, type UpdateCheckResult, type UpdateCheckState, VERIFICATION_COMMITMENT_VERSION, type VerificationCommitmentRecord, type VerifyResultCallbackParams, _resetLoaKeyCacheForTests, _resetOnceWarningsForTests, acceptTypedAliases, assertEffectiveDateBound, buildSignedTestWebhook, cachedLoaPublicKey, canonicalD5LoaForm, canonicalD5LoaFormV2, checkForUpdate, checkLoaV2, checkRegistryHead, compareAddresses, computeBlindIndex, computeVerificationCommitment, confirmUpdate, createOneAddressHandler, createOutboxConsumer, createSqlIdempotencyStore, d5LoaRef, decryptAddress as decrypt, decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, formatAddressParts, fromOutboxTimestamp, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, isIsoDate, isNewerVersion, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, matchingWebhookSecret, namePoolMatches, normaliseCommitmentField, normaliseLoaName, normalizeForBlindIndex, parsePinnedRegistryRoots, readAddressParts, readSessionProduct, sendVerifyResult, signPullRequest, startUpdateCheck, toExpressHandler, toOutboxTimestamp, transformAddress as transform, transformAddress, transformSession, typedAliasesOf, updateAvailableLine, updateCheckEnabled, updateCheckMetric, validateAddress, verificationCommitmentString, verifySignature as verify, verifyD5LOA, verifyD5LOAv2, verifyWithGrace as verifyGrace, verifyLOA, verifySignature, verifyWithGrace };
|
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,11 @@ declare const CURRENT_VERSION: "2026.1";
|
|
|
165
165
|
/** All protocol versions this build of the SDK recognises. */
|
|
166
166
|
declare const SUPPORTED_VERSIONS: readonly ["2026.1"];
|
|
167
167
|
|
|
168
|
+
/** A calendar date, `YYYY-MM-DD`. */
|
|
169
|
+
type IsoDate = string;
|
|
170
|
+
/** True for a real calendar date in `YYYY-MM-DD` form. `2026-02-30` is false. */
|
|
171
|
+
declare function isIsoDate(value: unknown): value is IsoDate;
|
|
172
|
+
|
|
168
173
|
/** The most typed aliases a v2 record carries. A longer list is malformed. */
|
|
169
174
|
declare const LOA_MAX_TYPED_ALIASES = 3;
|
|
170
175
|
/** The name normalisation every SDK applies before comparing. See the module notes. */
|
|
@@ -633,7 +638,7 @@ declare function checkRegistryHead(opts: RegistryHeadCheckOptions): Promise<Regi
|
|
|
633
638
|
* `ONEADDRESS_UPDATE_CHECK=off` turns it off.
|
|
634
639
|
*/
|
|
635
640
|
/** Must equal `version` in this package's package.json. Pinned by test. */
|
|
636
|
-
declare const SDK_VERSION = "2.
|
|
641
|
+
declare const SDK_VERSION = "2.11.0";
|
|
637
642
|
/** The partner guide's page on updating safely. Behind portal sign-in. */
|
|
638
643
|
declare const UPDATE_GUIDE_URL = "https://partners.oneaddress.io/#updating-safely";
|
|
639
644
|
type UpdateCheckState = 'current' | 'available' | 'unknown' | 'disabled';
|
|
@@ -776,8 +781,9 @@ declare function startUpdateCheck(opts?: StartUpdateCheckOptions): UpdateCheckHa
|
|
|
776
781
|
* two apart.
|
|
777
782
|
*
|
|
778
783
|
* If you need to record that something did not apply, `note` on
|
|
779
|
-
* {@link confirmUpdate}
|
|
780
|
-
*
|
|
784
|
+
* {@link confirmUpdate} can carry a short code for it (see
|
|
785
|
+
* {@link ConfirmUpdateOptions.note}), but nothing is driven off it: the status
|
|
786
|
+
* alone decides what happens next.
|
|
781
787
|
*/
|
|
782
788
|
type OneAddressConfirmStatus = 'confirmed' | 'already_current' | 'failed' | 'no_match';
|
|
783
789
|
interface OneAddressAddress {
|
|
@@ -1144,10 +1150,12 @@ interface OneAddressHandlerOptions {
|
|
|
1144
1150
|
* OR a {@link PrivateKeyOperations} delegate for a key held in a KMS or HSM
|
|
1145
1151
|
* that will not export it. The name is kept for compatibility. A delegate
|
|
1146
1152
|
* covers the session-envelope paths (`address.updated`, `contact.updated`,
|
|
1147
|
-
* the test events and `
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1153
|
+
* the test events, `loa_encrypted`, and `customer_encrypted` on
|
|
1154
|
+
* `account.verify` when it arrives in the session shape, which it does for an
|
|
1155
|
+
* RSA-OAEP or X-Wing key); the legacy single-blob paths (`address_encrypted`
|
|
1156
|
+
* on `address.verify`, and `customer_encrypted` in the ECDH shape) need the
|
|
1157
|
+
* raw key and are refused with a named error (500) when a delegate is
|
|
1158
|
+
* supplied.
|
|
1151
1159
|
*
|
|
1152
1160
|
* A PEM that does not import is refused at construction rather than on the
|
|
1153
1161
|
* first delivery, where it surfaces as a 500 and a retry storm.
|
|
@@ -1326,7 +1334,7 @@ interface OneAddressHandlerOptions {
|
|
|
1326
1334
|
reference?: string;
|
|
1327
1335
|
/**
|
|
1328
1336
|
* Sent as the confirm's `note` when `confirm` is set, so a `failed` can say
|
|
1329
|
-
* why.
|
|
1337
|
+
* why. Kept only as a short code, which the consumer sees. NEVER the
|
|
1330
1338
|
* address or any other decrypted detail: see {@link ConfirmUpdateOptions.note}.
|
|
1331
1339
|
*/
|
|
1332
1340
|
note?: string;
|
|
@@ -2097,13 +2105,16 @@ interface ConfirmUpdateOptions {
|
|
|
2097
2105
|
/** Defaults to `'confirmed'`. See {@link OneAddressConfirmStatus}. */
|
|
2098
2106
|
status?: OneAddressConfirmStatus;
|
|
2099
2107
|
/**
|
|
2100
|
-
*
|
|
2108
|
+
* Optional. OneAddress keeps it only when it is a short code such as
|
|
2109
|
+
* `crm_updated`: a letter first, then letters, digits or `_ . : -`, up to
|
|
2110
|
+
* 64 characters, with no run of five or more digits. Any other text is
|
|
2111
|
+
* replaced by OneAddress's own sentence for the status. A kept code is shown
|
|
2112
|
+
* to the consumer beside the result, on their dashboard and in their
|
|
2113
|
+
* Transmission Report.
|
|
2101
2114
|
*
|
|
2102
2115
|
* NEVER put the address, or any other decrypted detail, in it. The note
|
|
2103
|
-
* travels back to OneAddress in cleartext
|
|
2104
|
-
*
|
|
2105
|
-
* happened ("applied to CRM record", "account closed"), not what the
|
|
2106
|
-
* address was.
|
|
2116
|
+
* travels back to OneAddress in cleartext. Say what happened
|
|
2117
|
+
* (`crm_updated`, `account_closed`), not what the address was.
|
|
2107
2118
|
*/
|
|
2108
2119
|
note?: string;
|
|
2109
2120
|
/** Echo of `event.loa_ref`, proving you decrypted the signed consent. */
|
|
@@ -2185,7 +2196,7 @@ interface ConfirmUpdateResult {
|
|
|
2185
2196
|
* secret: process.env.OA_CONFIRM_SECRET!,
|
|
2186
2197
|
* dispatchId: event.dispatchId,
|
|
2187
2198
|
* status: 'confirmed',
|
|
2188
|
-
* note: '
|
|
2199
|
+
* note: 'crm_updated',
|
|
2189
2200
|
* });
|
|
2190
2201
|
* if (!res.ok) console.error('[oneaddress] confirm failed', res.status, res.error);
|
|
2191
2202
|
*/
|
|
@@ -2543,7 +2554,11 @@ interface VerifyResultCallbackParams {
|
|
|
2543
2554
|
partnerId: string;
|
|
2544
2555
|
/** `true` if the submitted address matches what you hold on file. */
|
|
2545
2556
|
match: boolean;
|
|
2546
|
-
/**
|
|
2557
|
+
/**
|
|
2558
|
+
* Optional short code, kept on the same rule as {@link ConfirmUpdateOptions.note}
|
|
2559
|
+
* and shown to the consumer with the result. Any other text is replaced by
|
|
2560
|
+
* OneAddress's own sentence for the result. Never a decrypted detail.
|
|
2561
|
+
*/
|
|
2547
2562
|
note?: string;
|
|
2548
2563
|
/**
|
|
2549
2564
|
* Extra hostnames the callback may be POSTed to, beside `oneaddress.io` and
|
|
@@ -2860,4 +2875,4 @@ interface SignedTestWebhook {
|
|
|
2860
2875
|
*/
|
|
2861
2876
|
declare function buildSignedTestWebhook(opts: SignedTestWebhookOptions): Promise<SignedTestWebhook>;
|
|
2862
2877
|
|
|
2863
|
-
export { type AddressParts, type BlindIndexField, CURRENT_VERSION, type CheckForUpdateOptions, type ComparableAddress, type ConfirmUpdateOptions, type ConfirmUpdateResult, DEFAULT_IDEMPOTENCY_LEASE_SECS, DEFAULT_MAX_BODY_BYTES, DEFAULT_REPLAY_WINDOW_SECS, EffectiveDateMismatchError, type EncryptedPayload, type ExpressLikeRequest, type ExpressLikeResponse, type HandlerConfirmOptions, type HandlerRequest, type HandlerResponse, type IdempotencyClaim, type IdempotencyDialect, type IdempotencyStore, LOA_MAX_TYPED_ALIASES, LOA_MIN_SHORT_FORM_LETTERS, LOA_PUBLIC_KEY_CACHE_MS, LOA_V2_REFUSALS, LoaPublicKeyUnavailableError, type LoaV2Context, type LoaV2Refusal, LoaV2RefusedError, MAX_ADDRESS_FIELD_CHARS, OUTBOX_LEASE_COLUMNS, type OneAddressAccountVerifyEvent, type OneAddressAddress, type OneAddressConfirmStatus, type OneAddressCustomer, type OneAddressCustomerMatch, type OneAddressD5LOA, type OneAddressHandlerOptions, type OneAddressIdVerification, type OneAddressLOA, type OneAddressProduct, type OneAddressTestEvent, type OneAddressUpdateEvent, type OneAddressVerifyEvent, type OutboxBacklog, type OutboxConsumer, type OutboxConsumerOptions, type OutboxDialect, type OutboxQueryFn, type OutboxRow, PRODUCT_CODE_PATTERN, type PinnedRegistryRoot, type PrivateKeyOperations, type RegistryHeadCheckOptions, type RegistryHeadCheckResult, type RegistryHeadCheckVerdict, SDK_VERSION, SUPPORTED_VERSIONS, type SessionData, type SessionKeyShare, type SessionUpdateType, type SignedTestWebhook, type SignedTestWebhookOptions, type StartUpdateCheckOptions, UPDATE_GUIDE_URL, type UpdateCheckHandle, type UpdateCheckResult, type UpdateCheckState, VERIFICATION_COMMITMENT_VERSION, type VerificationCommitmentRecord, type VerifyResultCallbackParams, _resetLoaKeyCacheForTests, _resetOnceWarningsForTests, acceptTypedAliases, assertEffectiveDateBound, buildSignedTestWebhook, cachedLoaPublicKey, canonicalD5LoaForm, canonicalD5LoaFormV2, checkForUpdate, checkLoaV2, checkRegistryHead, compareAddresses, computeBlindIndex, computeVerificationCommitment, confirmUpdate, createOneAddressHandler, createOutboxConsumer, createSqlIdempotencyStore, d5LoaRef, decryptAddress as decrypt, decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, formatAddressParts, fromOutboxTimestamp, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, isNewerVersion, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, matchingWebhookSecret, namePoolMatches, normaliseCommitmentField, normaliseLoaName, normalizeForBlindIndex, parsePinnedRegistryRoots, readAddressParts, readSessionProduct, sendVerifyResult, signPullRequest, startUpdateCheck, toExpressHandler, toOutboxTimestamp, transformAddress as transform, transformAddress, transformSession, typedAliasesOf, updateAvailableLine, updateCheckEnabled, updateCheckMetric, validateAddress, verificationCommitmentString, verifySignature as verify, verifyD5LOA, verifyD5LOAv2, verifyWithGrace as verifyGrace, verifyLOA, verifySignature, verifyWithGrace };
|
|
2878
|
+
export { type AddressParts, type BlindIndexField, CURRENT_VERSION, type CheckForUpdateOptions, type ComparableAddress, type ConfirmUpdateOptions, type ConfirmUpdateResult, DEFAULT_IDEMPOTENCY_LEASE_SECS, DEFAULT_MAX_BODY_BYTES, DEFAULT_REPLAY_WINDOW_SECS, EffectiveDateMismatchError, type EncryptedPayload, type ExpressLikeRequest, type ExpressLikeResponse, type HandlerConfirmOptions, type HandlerRequest, type HandlerResponse, type IdempotencyClaim, type IdempotencyDialect, type IdempotencyStore, LOA_MAX_TYPED_ALIASES, LOA_MIN_SHORT_FORM_LETTERS, LOA_PUBLIC_KEY_CACHE_MS, LOA_V2_REFUSALS, LoaPublicKeyUnavailableError, type LoaV2Context, type LoaV2Refusal, LoaV2RefusedError, MAX_ADDRESS_FIELD_CHARS, OUTBOX_LEASE_COLUMNS, type OneAddressAccountVerifyEvent, type OneAddressAddress, type OneAddressConfirmStatus, type OneAddressCustomer, type OneAddressCustomerMatch, type OneAddressD5LOA, type OneAddressHandlerOptions, type OneAddressIdVerification, type OneAddressLOA, type OneAddressProduct, type OneAddressTestEvent, type OneAddressUpdateEvent, type OneAddressVerifyEvent, type OutboxBacklog, type OutboxConsumer, type OutboxConsumerOptions, type OutboxDialect, type OutboxQueryFn, type OutboxRow, PRODUCT_CODE_PATTERN, type PinnedRegistryRoot, type PrivateKeyOperations, type RegistryHeadCheckOptions, type RegistryHeadCheckResult, type RegistryHeadCheckVerdict, SDK_VERSION, SUPPORTED_VERSIONS, type SessionData, type SessionKeyShare, type SessionUpdateType, type SignedTestWebhook, type SignedTestWebhookOptions, type StartUpdateCheckOptions, UPDATE_GUIDE_URL, type UpdateCheckHandle, type UpdateCheckResult, type UpdateCheckState, VERIFICATION_COMMITMENT_VERSION, type VerificationCommitmentRecord, type VerifyResultCallbackParams, _resetLoaKeyCacheForTests, _resetOnceWarningsForTests, acceptTypedAliases, assertEffectiveDateBound, buildSignedTestWebhook, cachedLoaPublicKey, canonicalD5LoaForm, canonicalD5LoaFormV2, checkForUpdate, checkLoaV2, checkRegistryHead, compareAddresses, computeBlindIndex, computeVerificationCommitment, confirmUpdate, createOneAddressHandler, createOutboxConsumer, createSqlIdempotencyStore, d5LoaRef, decryptAddress as decrypt, decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, formatAddressParts, fromOutboxTimestamp, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, isIsoDate, isNewerVersion, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, matchingWebhookSecret, namePoolMatches, normaliseCommitmentField, normaliseLoaName, normalizeForBlindIndex, parsePinnedRegistryRoots, readAddressParts, readSessionProduct, sendVerifyResult, signPullRequest, startUpdateCheck, toExpressHandler, toOutboxTimestamp, transformAddress as transform, transformAddress, transformSession, typedAliasesOf, updateAvailableLine, updateCheckEnabled, updateCheckMetric, validateAddress, verificationCommitmentString, verifySignature as verify, verifyD5LOA, verifyD5LOAv2, verifyWithGrace as verifyGrace, verifyLOA, verifySignature, verifyWithGrace };
|
package/dist/index.js
CHANGED
|
@@ -4351,11 +4351,18 @@ function classifyEndpointProbe(input) {
|
|
|
4351
4351
|
summary: `Receiver accepted a signed test request (HTTP ${status}).`
|
|
4352
4352
|
};
|
|
4353
4353
|
}
|
|
4354
|
-
if (status === 401
|
|
4354
|
+
if (status === 401) {
|
|
4355
4355
|
return {
|
|
4356
4356
|
health: "auth",
|
|
4357
4357
|
dispatchable: false,
|
|
4358
|
-
summary: `Receiver rejected our signature (HTTP
|
|
4358
|
+
summary: `Receiver rejected our signature (HTTP 401). Check the signing secret matches on both sides.`
|
|
4359
|
+
};
|
|
4360
|
+
}
|
|
4361
|
+
if (status === 403) {
|
|
4362
|
+
return {
|
|
4363
|
+
health: "rejected",
|
|
4364
|
+
dispatchable: false,
|
|
4365
|
+
summary: `Something in front of the receiver refused the request (HTTP 403), usually a firewall rule on rate, location or bots. Our signature is refused with a 401, not this.`
|
|
4359
4366
|
};
|
|
4360
4367
|
}
|
|
4361
4368
|
if (MISSING_STATUSES.has(status)) {
|
|
@@ -5218,6 +5225,7 @@ __export(src_exports, {
|
|
|
5218
5225
|
createSenderHeldKeyBinder: () => createSenderHeldKeyBinder,
|
|
5219
5226
|
decryptAddress: () => decryptAddress,
|
|
5220
5227
|
decryptSession: () => decryptSession,
|
|
5228
|
+
encryptAccountCheckForPartner: () => encryptAccountCheckForPartner,
|
|
5221
5229
|
encryptAddressForAll: () => encryptAddressForAll,
|
|
5222
5230
|
encryptAddressForPartner: () => encryptAddressForPartner,
|
|
5223
5231
|
encryptEnvelopeForPartner: () => encryptEnvelopeForPartner,
|
|
@@ -5441,6 +5449,13 @@ async function encryptPayloadForPartner(payload, partner) {
|
|
|
5441
5449
|
hkdfSalt: bytesToB64(hkdfSaltBytes)
|
|
5442
5450
|
};
|
|
5443
5451
|
}
|
|
5452
|
+
async function encryptAccountCheckForPartner(payload, partner) {
|
|
5453
|
+
if (isRsaScheme(partner.algorithm) || isHybridScheme(partner.algorithm)) {
|
|
5454
|
+
const { session_envelope, session_key_share } = await encryptEnvelopeForPartner(payload, partner);
|
|
5455
|
+
return { session_envelope, session_key_share };
|
|
5456
|
+
}
|
|
5457
|
+
return encryptPayloadForPartner(payload, { partnerId: partner.partner_id, publicKeyB64: partner.public_key_b64 });
|
|
5458
|
+
}
|
|
5444
5459
|
async function encryptAddressForAll(address, partners) {
|
|
5445
5460
|
const results = await Promise.all(
|
|
5446
5461
|
partners.map((p) => encryptAddressForPartner(address, p))
|
|
@@ -5976,6 +5991,7 @@ __export(index_exports, {
|
|
|
5976
5991
|
isAcceptableAlias: () => isAcceptableAlias,
|
|
5977
5992
|
isEmailLike: () => isEmailLike2,
|
|
5978
5993
|
isFreshTimestamp: () => isFreshTimestamp,
|
|
5994
|
+
isIsoDate: () => isIsoDate,
|
|
5979
5995
|
isNewerVersion: () => isNewerVersion,
|
|
5980
5996
|
loaEnvelopeSha256: () => loaEnvelopeSha256,
|
|
5981
5997
|
loaFirstName: () => loaFirstName,
|
|
@@ -6272,7 +6288,7 @@ function resolveAppOrigin(baseUrl, label, extraHosts) {
|
|
|
6272
6288
|
}
|
|
6273
6289
|
|
|
6274
6290
|
// src/update-check.ts
|
|
6275
|
-
var SDK_VERSION = "2.
|
|
6291
|
+
var SDK_VERSION = "2.11.0";
|
|
6276
6292
|
var UPDATE_GUIDE_URL = "https://partners.oneaddress.io/#updating-safely";
|
|
6277
6293
|
var REGISTRY_URL = "https://registry.npmjs.org/@oneaddress/partner-sdk/latest";
|
|
6278
6294
|
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -7259,10 +7275,11 @@ async function confirmUpdate(opts2) {
|
|
|
7259
7275
|
}
|
|
7260
7276
|
return { ok: false, status: res.status, error };
|
|
7261
7277
|
}
|
|
7278
|
+
var LOA_KEY_FETCH_TIMEOUT_MS = 1e4;
|
|
7262
7279
|
async function fetchLoaPublicKey(appBaseUrl = OA_APP_BASE_URL2) {
|
|
7263
7280
|
const origin = resolveAppOrigin(appBaseUrl, "fetchLoaPublicKey");
|
|
7264
7281
|
const url = `${origin}/.well-known/oneaddress-loa-key.pem`;
|
|
7265
|
-
const res = await fetch(url);
|
|
7282
|
+
const res = await fetch(url, { redirect: "error", signal: AbortSignal.timeout(LOA_KEY_FETCH_TIMEOUT_MS) });
|
|
7266
7283
|
if (!res.ok) {
|
|
7267
7284
|
throw new Error(`[OneAddress SDK] Failed to fetch LOA public key: HTTP ${res.status}`);
|
|
7268
7285
|
}
|
|
@@ -7776,6 +7793,9 @@ function assertUsablePrivateKey(privateKeyPem) {
|
|
|
7776
7793
|
throw refused;
|
|
7777
7794
|
}
|
|
7778
7795
|
}
|
|
7796
|
+
function isSessionSealed(v) {
|
|
7797
|
+
return typeof v.session_envelope === "string" && !!v.session_key_share && typeof v.session_key_share === "object" && !Array.isArray(v.session_key_share);
|
|
7798
|
+
}
|
|
7779
7799
|
function requirePemFor(purpose, key) {
|
|
7780
7800
|
if (typeof key === "string") return key;
|
|
7781
7801
|
throw new Error(
|
|
@@ -8277,8 +8297,15 @@ function createOneAddressHandler(options) {
|
|
|
8277
8297
|
if (body.event === "account.verify" && onAccountVerify) {
|
|
8278
8298
|
let customer;
|
|
8279
8299
|
if (body.customer_encrypted && typeof body.customer_encrypted === "object") {
|
|
8280
|
-
const
|
|
8281
|
-
|
|
8300
|
+
const sealed = body.customer_encrypted;
|
|
8301
|
+
const raw = isSessionSealed(sealed) ? await decryptSession2(
|
|
8302
|
+
sealed.session_key_share,
|
|
8303
|
+
sealed.session_envelope,
|
|
8304
|
+
privateKeyPem,
|
|
8305
|
+
partnerId,
|
|
8306
|
+
expectedAlg
|
|
8307
|
+
) : await decryptAddress2(
|
|
8308
|
+
sealed,
|
|
8282
8309
|
requirePemFor("account.verify decryption", privateKeyPem),
|
|
8283
8310
|
partnerId
|
|
8284
8311
|
);
|
|
@@ -8603,6 +8630,7 @@ async function buildSignedTestWebhook(opts2) {
|
|
|
8603
8630
|
isAcceptableAlias,
|
|
8604
8631
|
isEmailLike,
|
|
8605
8632
|
isFreshTimestamp,
|
|
8633
|
+
isIsoDate,
|
|
8606
8634
|
isNewerVersion,
|
|
8607
8635
|
loaEnvelopeSha256,
|
|
8608
8636
|
loaFirstName,
|
package/dist/index.mjs
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
hasLoaV2,
|
|
45
45
|
isAcceptableAlias,
|
|
46
46
|
isEmailLike,
|
|
47
|
+
isIsoDate,
|
|
47
48
|
isNewerVersion,
|
|
48
49
|
loaEnvelopeSha256,
|
|
49
50
|
loaFirstName,
|
|
@@ -74,13 +75,13 @@ import {
|
|
|
74
75
|
verifyLOA,
|
|
75
76
|
verifySignature,
|
|
76
77
|
verifyWithGrace
|
|
77
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-WHVGOWN6.mjs";
|
|
78
79
|
import {
|
|
79
80
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
80
81
|
computeBlindIndex,
|
|
81
82
|
isFreshTimestamp,
|
|
82
83
|
normalizeForBlindIndex
|
|
83
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-RU6G6PIM.mjs";
|
|
84
85
|
export {
|
|
85
86
|
CURRENT_VERSION,
|
|
86
87
|
DEFAULT_IDEMPOTENCY_LEASE_SECS,
|
|
@@ -131,6 +132,7 @@ export {
|
|
|
131
132
|
isAcceptableAlias,
|
|
132
133
|
isEmailLike,
|
|
133
134
|
isFreshTimestamp,
|
|
135
|
+
isIsoDate,
|
|
134
136
|
isNewerVersion,
|
|
135
137
|
loaEnvelopeSha256,
|
|
136
138
|
loaFirstName,
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
createSenderHeldKeyBinder,
|
|
30
30
|
decryptAddress,
|
|
31
31
|
decryptSession,
|
|
32
|
+
encryptAccountCheckForPartner,
|
|
32
33
|
encryptAddressForAll,
|
|
33
34
|
encryptAddressForPartner,
|
|
34
35
|
encryptEnvelopeForPartner,
|
|
@@ -68,7 +69,7 @@ import {
|
|
|
68
69
|
verifyPartnerKeyAttestationWithRoots,
|
|
69
70
|
verifyRegistryHead,
|
|
70
71
|
verifyWebhookSignature
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RU6G6PIM.mjs";
|
|
72
73
|
export {
|
|
73
74
|
DEFAULT_REPLAY_WINDOW_SECS,
|
|
74
75
|
ENDPOINT_FAILURE_THRESHOLD,
|
|
@@ -100,6 +101,7 @@ export {
|
|
|
100
101
|
createSenderHeldKeyBinder,
|
|
101
102
|
decryptAddress,
|
|
102
103
|
decryptSession,
|
|
104
|
+
encryptAccountCheckForPartner,
|
|
103
105
|
encryptAddressForAll,
|
|
104
106
|
encryptAddressForPartner,
|
|
105
107
|
encryptEnvelopeForPartner,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneaddress/partner-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.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",
|