@oneaddress/partner-sdk 2.5.0 → 2.7.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 +60 -0
- package/README.md +39 -0
- package/dist/{chunk-ZY2K54LD.mjs → chunk-CLV6TLSP.mjs} +1260 -131
- package/dist/{chunk-DIUGEFIK.mjs → chunk-OKAJO4T6.mjs} +293 -33
- package/dist/edge.js +1396 -189
- package/dist/edge.mjs +2 -2
- package/dist/index.d.mts +208 -1
- package/dist/index.d.ts +208 -1
- package/dist/index.js +1645 -198
- package/dist/index.mjs +8 -2
- package/dist/{src-RBLFVBGY.mjs → src-FPYBM6X6.mjs} +25 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.7.0] - 2026-10-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`signPullRequest`: headers for a signed request to the pull API, signature
|
|
15
|
+
version 2.** Version 2 covers the method, path and query as well as the
|
|
16
|
+
timestamp, so a captured header pair cannot be replayed against another
|
|
17
|
+
endpoint or query: `v2.${timestamp}.${METHOD}.${path}${query}.${body}`, sent
|
|
18
|
+
with `X-OneAddress-Signature-Version: 2`. Version 1 (timestamp only, no
|
|
19
|
+
version header) is still accepted during the transition and will be
|
|
20
|
+
withdrawn.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **The dispatch id is read from the signed body.** The handler used the
|
|
25
|
+
unsigned `X-OneAddress-Dispatch` header for its idempotency claim and the
|
|
26
|
+
confirm, so a captured, validly signed request replayed with a different
|
|
27
|
+
header could dodge the claim. It now prefers `body.dispatch_id`, and answers
|
|
28
|
+
`400 dispatch_id_mismatch` when the header disagrees. A body without the
|
|
29
|
+
field still falls back to the header.
|
|
30
|
+
- **`user_id` is now your own id for the consumer.** It is stable for you and
|
|
31
|
+
unrelated to the value any other partner receives; it is no longer the
|
|
32
|
+
consumer's OneAddress account or guest id. No code change is needed, but a
|
|
33
|
+
value stored before this change will not match the new one for the same
|
|
34
|
+
person.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **`verifySignature` refuses an empty secret.** An HMAC under an empty key is
|
|
39
|
+
something anyone can compute, so it verified a forged request.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [2.6.0] - 2026-10-18
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- **`checkRegistryHead` and `parsePinnedRegistryRoots`: ask OneAddress which
|
|
47
|
+
key it says is yours, and check the answer against a root you pinned.**
|
|
48
|
+
OneAddress publishes a root-signed document naming, per partner, the one key
|
|
49
|
+
id that is current. Consumer browsers check it before they encrypt, and that
|
|
50
|
+
check cannot see a deployment that serves a matching substitute for all three
|
|
51
|
+
of the document, the root set and the checking code. A recipient can, because
|
|
52
|
+
it holds its own keys and its own copy of the root.
|
|
53
|
+
|
|
54
|
+
What it does: fetches `/.well-known/oneaddress-key-registry-head.json`,
|
|
55
|
+
verifies the root signature against `pinnedRoots`, and reports whether the
|
|
56
|
+
head names a key you hold (`ok`, `names-key-we-hold`), a key you have never
|
|
57
|
+
held (`names-key-we-lack`, the alarm), or nothing for your partner id. Thirteen
|
|
58
|
+
verdicts, one per distinguishable problem; `checked: false` means the check
|
|
59
|
+
did not run and is never reported as a pass.
|
|
60
|
+
|
|
61
|
+
What it does not do: it refuses to fetch the root set from OneAddress, with no
|
|
62
|
+
option to make it. A root set fetched from the same origin as the head would
|
|
63
|
+
pass against a compromised deployment, which is worse than no check. Pin it
|
|
64
|
+
out of band (see the README). It is detection after the fact: by the time the
|
|
65
|
+
head names a key you lack, any envelope sealed to that key has already gone
|
|
66
|
+
elsewhere. Run it on a schedule, not per dispatch, because the substitution
|
|
67
|
+
diverts the dispatch you would have hung the check on. The drop-in receiver
|
|
68
|
+
runs it hourly when `OA_REGISTRY_ROOTS` is set.
|
|
69
|
+
|
|
10
70
|
## [2.5.0] - 2026-10-14
|
|
11
71
|
|
|
12
72
|
### Changed
|
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
|