@btps/sdk 1.2.0-rc.1 → 1.2.0-rc.2
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 +39 -0
- package/dist/core/server/schemas/artifacts/transporterSchema.js +16 -9
- package/dist/core/server/schemas/btpsDocsSchema.d.ts +1840 -15
- package/dist/core/server/schemas/btpsDocsSchema.js +16 -11
- package/dist/core/server/schemas/helpers.d.ts +514 -4
- package/dist/core/trust/types.d.ts +11 -1
- package/dist/server/btpsServer.d.ts +9 -0
- package/dist/server/btpsServer.js +35 -3
- package/dist/server/types.d.ts +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,45 @@ All notable changes to `@btps/sdk` and the BTPS protocol it implements. The
|
|
|
4
4
|
format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
5
5
|
versions follow [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.2.0-rc.2] — 2026-11-11 (beta, release candidate)
|
|
8
|
+
|
|
9
|
+
What eBill found running 1.2.0-rc.1. Everything in rc.1 below still holds.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **A signer's own signature on its acceptance.** An agreement statement may
|
|
14
|
+
carry `visualSignature`, typed (`{ type: 'typed', text }`) or drawn
|
|
15
|
+
(`{ type: 'drawn', strokes }`), with a letter signature's limits, on an
|
|
16
|
+
`accepted` statement only. It is inside the statement, so the statement's
|
|
17
|
+
signature covers it and the evidence bundle keeps it. It is optional in the
|
|
18
|
+
protocol; a platform may require one. A 1.2.0-rc.1 receiver refuses a
|
|
19
|
+
statement that carries one.
|
|
20
|
+
- The server option `entityTypeOf`: whether one of the platform's own
|
|
21
|
+
addresses is a person or an organisation, so the server can tell what a
|
|
22
|
+
person's trust request owes (see Changed).
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- A `1.2.0` trust request carries `permissions`. One without them is refused
|
|
27
|
+
on arrival; a request for everything is a `1.1.0` one, which every server
|
|
28
|
+
still takes.
|
|
29
|
+
- A person asking an organisation for details gives nothing in return. An
|
|
30
|
+
organisation's request still gives what it asks for to anyone, and a
|
|
31
|
+
person's to another person. Only the receiver's own server knows what the
|
|
32
|
+
receiver is, so a person's request is now checked there, against
|
|
33
|
+
`entityTypeOf`, instead of by the schema; without the option, every receiver
|
|
34
|
+
is held to be a person, as before.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- A refusal of a trust's permissions reaches the sender as itself:
|
|
39
|
+
`BTP_ERROR_PERMISSION_REQUIRED` for a grant that withholds a required name,
|
|
40
|
+
`BTP_ERROR_PERMISSION` for a name not granted or not asked for,
|
|
41
|
+
`BTP_ERROR_DOCUMENT_TYPE_MISMATCH` and `BTP_ERROR_DETAILS_NOT_HELD`. Each
|
|
42
|
+
read `BTP_ERROR_TRUST_NOT_ALLOWED` on the wire, so a platform could not tell
|
|
43
|
+
its user what to fix. Refusals about a trust's state still read "not
|
|
44
|
+
allowed", so a stranger learns nothing of it.
|
|
45
|
+
|
|
7
46
|
## [1.2.0-rc.1] — 2026-11-08 (beta, release candidate)
|
|
8
47
|
|
|
9
48
|
What's new, with a guide for each feature: [What's new in 1.2](https://www.openbtps.org/docs/next/whats-new/1-2).
|
|
@@ -60,6 +60,13 @@ const BtpSyncOfSchema = z.object({ id: z.string().min(1), sha256: sha256Hex }).s
|
|
|
60
60
|
documentType: z.enum(DOCUMENT_TYPES).optional(),
|
|
61
61
|
details: namesFrom(DETAIL_PERMISSIONS, 1).optional()
|
|
62
62
|
});
|
|
63
|
+
function detailsOwed(permissions, entityType, given = []) {
|
|
64
|
+
const identities = Object.values(IDENTITY_DETAIL);
|
|
65
|
+
return permissions.filter(({ name }) => name.startsWith("detail:")).map(({ name }) => ({
|
|
66
|
+
asked: name,
|
|
67
|
+
owed: identities.includes(name) ? IDENTITY_DETAIL[entityType] : name
|
|
68
|
+
})).filter(({ owed }) => !given.includes(owed));
|
|
69
|
+
}
|
|
63
70
|
function permissionEnvelopeProblems(data) {
|
|
64
71
|
const problems = [];
|
|
65
72
|
for (const [field, types] of Object.entries(PERMISSION_ENVELOPE_FIELDS))
|
|
@@ -74,15 +81,14 @@ function permissionEnvelopeProblems(data) {
|
|
|
74
81
|
const twice = names && duplicateOf(names);
|
|
75
82
|
twice && problems.push([field, `${twice} appears more than once`]);
|
|
76
83
|
}
|
|
84
|
+
data.type === "TRUST_REQ" && !isVersionBelow(data.version, "1.2.0") && !data.permissions && problems.push([
|
|
85
|
+
"permissions",
|
|
86
|
+
"a 1.2.0 TRUST_REQ asks for permissions; a request for everything is a 1.1.0 one"
|
|
87
|
+
]);
|
|
77
88
|
const { entityType } = data, other = entityType && IDENTITY_DETAIL[entityType === "person" ? "organisation" : "person"];
|
|
78
|
-
if (data.permissions && !entityType && problems.push(["entityType", "entityType comes with permissions"]), data.granted && !entityType && problems.push(["entityType", "entityType comes with granted"]), data.permissions && entityType)
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
if (!name.startsWith("detail:")) continue;
|
|
82
|
-
const gives = identities.includes(name) ? IDENTITY_DETAIL[entityType] : name;
|
|
83
|
-
given.includes(gives) || problems.push(["given", `asks for ${name} without giving ${gives}`]);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
89
|
+
if (data.permissions && !entityType && problems.push(["entityType", "entityType comes with permissions"]), data.granted && !entityType && problems.push(["entityType", "entityType comes with granted"]), data.permissions && entityType === "organisation")
|
|
90
|
+
for (const { asked, owed } of detailsOwed(data.permissions, entityType, data.given))
|
|
91
|
+
problems.push(["given", `asks for ${asked} without giving ${owed}`]);
|
|
86
92
|
if (other && data.given?.includes(other) && problems.push(["given", `a ${entityType} never gives ${other}`]), other && data.granted?.includes(other) && problems.push(["granted", `a ${entityType} never grants ${other}`]), DETAILS_ARTIFACT_TYPES.includes(data.type) && data.details === void 0 && problems.push(["details", `a ${data.type} names the details it is about`]), data.type === "DETAILS_RES" && data.encryption === null && problems.push(["encryption", "a DETAILS_RES is always encrypted to the requester"]), data.encryption === null) {
|
|
87
93
|
const document = documentRecord(data.document);
|
|
88
94
|
data.type === "TRUST_REQ" && document?.own !== void 0 && problems.push(["document", "a request with its own values is encrypted"]), data.type === "TRUST_REQ" && document?.verification !== void 0 && problems.push(["document", "a request with a verification is encrypted"]), data.type === "TRUST_RES" && document?.details !== void 0 && problems.push(["document", "a response with details is encrypted"]), data.type === "TRUST_RES" && data.granted && document?.decision !== "accepted" && problems.push(["granted", "only an accepted answer carries granted"]);
|
|
@@ -136,5 +142,6 @@ export {
|
|
|
136
142
|
BtpTransporterArtifactBaseSchema,
|
|
137
143
|
BtpTransporterArtifactSchema,
|
|
138
144
|
BtpTrustPermissionsSchema,
|
|
139
|
-
BtpTrustRecordPermissionsSchema
|
|
145
|
+
BtpTrustRecordPermissionsSchema,
|
|
146
|
+
detailsOwed
|
|
140
147
|
};
|