@oneaddress/partner-sdk 2.4.1 → 2.6.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 +80 -0
- package/README.md +39 -0
- package/dist/{chunk-FDMB4BNC.mjs → chunk-QAOGKPD3.mjs} +1105 -1204
- package/dist/{chunk-4WYW6BM3.mjs → chunk-XPQERNNN.mjs} +300 -31
- package/dist/edge.js +1225 -1291
- package/dist/edge.mjs +2 -2
- package/dist/index.d.mts +198 -6
- package/dist/index.d.ts +198 -6
- package/dist/index.js +1455 -1300
- package/dist/index.mjs +6 -2
- package/dist/{src-SNMMZ4BT.mjs → src-BPES2DKY.mjs} +19 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,86 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.6.0] - 2026-10-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`checkRegistryHead` and `parsePinnedRegistryRoots`: ask OneAddress which
|
|
15
|
+
key it says is yours, and check the answer against a root you pinned.**
|
|
16
|
+
OneAddress publishes a root-signed document naming, per partner, the one key
|
|
17
|
+
id that is current. Consumer browsers check it before they encrypt, and that
|
|
18
|
+
check cannot see a deployment that serves a matching substitute for all three
|
|
19
|
+
of the document, the root set and the checking code. A recipient can, because
|
|
20
|
+
it holds its own keys and its own copy of the root.
|
|
21
|
+
|
|
22
|
+
What it does: fetches `/.well-known/oneaddress-key-registry-head.json`,
|
|
23
|
+
verifies the root signature against `pinnedRoots`, and reports whether the
|
|
24
|
+
head names a key you hold (`ok`, `names-key-we-hold`), a key you have never
|
|
25
|
+
held (`names-key-we-lack`, the alarm), or nothing for your partner id. Thirteen
|
|
26
|
+
verdicts, one per distinguishable problem; `checked: false` means the check
|
|
27
|
+
did not run and is never reported as a pass.
|
|
28
|
+
|
|
29
|
+
What it does not do: it refuses to fetch the root set from OneAddress, with no
|
|
30
|
+
option to make it. A root set fetched from the same origin as the head would
|
|
31
|
+
pass against a compromised deployment, which is worse than no check. Pin it
|
|
32
|
+
out of band (see the README). It is detection after the fact: by the time the
|
|
33
|
+
head names a key you lack, any envelope sealed to that key has already gone
|
|
34
|
+
elsewhere. Run it on a schedule, not per dispatch, because the substitution
|
|
35
|
+
diverts the dispatch you would have hung the check on. The drop-in receiver
|
|
36
|
+
runs it hourly when `OA_REGISTRY_ROOTS` is set.
|
|
37
|
+
|
|
38
|
+
## [2.5.0] - 2026-10-14
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **A key you do not hold no longer answers the same as your database being
|
|
43
|
+
down.** The handler holds one key and never looks one up, so a dispatch
|
|
44
|
+
sealed to a key it does not hold reached `decryptSession`, failed inside
|
|
45
|
+
AES-GCM tag verification, and fell through to the catch-all:
|
|
46
|
+
`500 {"error":"Internal handler error"}`. That is also this SDK's answer for
|
|
47
|
+
a database outage, a bug in your own `onUpdate`, and a missing LOA key, so
|
|
48
|
+
neither you nor OneAddress could tell them apart. OneAddress stores that body
|
|
49
|
+
verbatim, which means the one record that would have named a key mismatch
|
|
50
|
+
said nothing.
|
|
51
|
+
|
|
52
|
+
Two refusals now, because only one of them is yours to fix:
|
|
53
|
+
|
|
54
|
+
- `503` with `{"error":"missing_key","key_id":"..."}` when the dispatch names
|
|
55
|
+
a `key_id` that is not the one you configured. Refused before any crypto
|
|
56
|
+
runs, and retryable: installing the key fixes it. Only possible when you
|
|
57
|
+
pass the `keyId` option, since without it the SDK cannot know which key it
|
|
58
|
+
holds.
|
|
59
|
+
- `422` with `{"error":"decrypt_failed","detail":"..."}` when the unwrap
|
|
60
|
+
itself fails. Ambiguous by nature (wrong key, wrong `partner_id`, tampered
|
|
61
|
+
or truncated ciphertext), so it says so rather than guessing, and `detail`
|
|
62
|
+
carries the underlying message. An algorithm downgrade and a key-source
|
|
63
|
+
capability refusal still name themselves there rather than being relabelled
|
|
64
|
+
as a key problem.
|
|
65
|
+
|
|
66
|
+
Both still write the same `console.error` line they always did. The response
|
|
67
|
+
is for OneAddress; the log is for you.
|
|
68
|
+
|
|
69
|
+
**If you monitor on status codes, this is the change to read.** A receiver
|
|
70
|
+
that treated 500 as the signal for an undecryptable dispatch will now see 503
|
|
71
|
+
or 422. Nothing about the envelope, the wire format or the crypto changed.
|
|
72
|
+
|
|
73
|
+
This is the behaviour the drop-in receiver has had since it was written, so
|
|
74
|
+
the two now agree.
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- **The `decryptSession` docstring described a record we do not keep.** It said
|
|
79
|
+
a destroyed retired key is recorded on the OneAddress side as a
|
|
80
|
+
`partner_key_custody_failure` outcome on the reconstruction audit log. No such
|
|
81
|
+
outcome and no such log exist. Destroying a retired key before your configured
|
|
82
|
+
retention window closes is still a key-custody breach under the partner terms,
|
|
83
|
+
which is unchanged; what was wrong was the claim about what we record.
|
|
84
|
+
|
|
85
|
+
- **The same docstring called the retention window "90-day".** It is the window
|
|
86
|
+
you configure, with a 14 day minimum, and the authoritative horizon for any
|
|
87
|
+
key is its own `destroy_after` date. 90 is a column default. A partner on 14
|
|
88
|
+
days would have over-retained; one on 365 would have destroyed early.
|
|
89
|
+
|
|
10
90
|
## [2.4.1] - 2026-10-06
|
|
11
91
|
|
|
12
92
|
### Fixed
|
package/README.md
CHANGED
|
@@ -904,6 +904,45 @@ Failure mode: `no_match` and `no_account` are **informational only**. The consum
|
|
|
904
904
|
|
|
905
905
|
---
|
|
906
906
|
|
|
907
|
+
## Checking which key OneAddress says is yours (added in v2.6.0)
|
|
908
|
+
|
|
909
|
+
OneAddress publishes a root-signed document naming the one key id that is current for each
|
|
910
|
+
partner. `checkRegistryHead` fetches it, verifies the root signature against a root set you
|
|
911
|
+
supply, and tells you whether the named key is one you hold.
|
|
912
|
+
|
|
913
|
+
**Pin the root out of band.** Get the root set once by a route that is not the OneAddress
|
|
914
|
+
website: ask us over a channel you already trust, or compare what a colleague fetched
|
|
915
|
+
separately, and keep it with your other pinned fingerprints. The SDK will not fetch the root
|
|
916
|
+
set for you, because a root fetched from the same origin as the head gives you a check that
|
|
917
|
+
passes against a compromised deployment, which is worse than no check. The roots change on the
|
|
918
|
+
order of years.
|
|
919
|
+
|
|
920
|
+
```typescript
|
|
921
|
+
import { checkRegistryHead, parsePinnedRegistryRoots } from '@oneaddress/partner-sdk';
|
|
922
|
+
|
|
923
|
+
const roots = parsePinnedRegistryRoots(process.env.OA_REGISTRY_ROOTS); // the published document, pasted
|
|
924
|
+
if (!roots.ok) throw new Error(roots.reason);
|
|
925
|
+
|
|
926
|
+
const result = await checkRegistryHead({
|
|
927
|
+
partnerId: process.env.OA_PARTNER_ID!,
|
|
928
|
+
keyId: process.env.OA_KEY_ID, // the key you expect to be named
|
|
929
|
+
pinnedRoots: roots.roots,
|
|
930
|
+
holdsKey: async (keyId) => myKeyStore.has(keyId),
|
|
931
|
+
});
|
|
932
|
+
if (!result.checked) console.warn('registry check did not run:', result.detail);
|
|
933
|
+
if (result.alarm) page('oneaddress registry head', result.verdict, result.detail);
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
`names-key-we-lack` is the alarm: the head names a key you have never held, so unless you
|
|
937
|
+
rotated to it, envelopes are being sealed to a key you cannot read. Raise it with us through a
|
|
938
|
+
channel that is not `oneaddress.io`. `names-key-we-hold` is a normal cutover during a rotation.
|
|
939
|
+
`roots-not-pinned`, `head-unreachable` and the other `checked: false` verdicts mean the check did
|
|
940
|
+
not run and should not be read as green.
|
|
941
|
+
|
|
942
|
+
Run it on a schedule (the drop-in receiver runs it hourly), not per dispatch: a substituted key
|
|
943
|
+
diverts the dispatch you would have hung the check on. It detects after the fact and prevents
|
|
944
|
+
nothing on its own; the consumer-side check is what refuses at encrypt time.
|
|
945
|
+
|
|
907
946
|
## Edge runtime (Cloudflare Workers, Next.js Edge)
|
|
908
947
|
|
|
909
948
|
```typescript
|