@percayso-community/cayso-contracts 1.0.0 → 2.0.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/README.md CHANGED
@@ -26,15 +26,27 @@ Cloud verifies Cayso's authorisation acknowledgement under a key it reads from
26
26
  `ACKNOWLEDGEMENT_KEYS_ROUTE`, an unauthenticated read of public keys, published
27
27
  apart from both.
28
28
 
29
- **Percayso BizID's authority assertion** (CAY-0100) is published ahead of the
30
- binding that accepts it. `AuthorityClaims` is its own type, under the identity
31
- assertion's `AssertionHeader`, with no verification or assurance fields. It travels
32
- in the `AUTHORITY_ASSERTION_HEADER` header, beside `Authorization`, and the thin
33
- client sends it only on an Organisation operation given a per-request provider for
34
- it. The binding's refusals are the closed `AuthorityBindingRefusal`.
35
- `AssertionClaims` declares `auth_time`, which Percayso ID mints and the binding
36
- compares. `organisationAuthority` and `mandateFor` are retired and still published,
37
- until the breaking step that removes them.
29
+ **Percayso BizID's authority assertion** (CAY-0100) is published, and from `2.0.0`
30
+ it is served: an act on an Organisation Wallet needs it. `AuthorityClaims` is its own
31
+ type, under the identity assertion's `AssertionHeader`, with no verification or
32
+ assurance fields. It travels in the `AUTHORITY_ASSERTION_HEADER` header, beside
33
+ `Authorization`, and the thin client sends it only on an Organisation operation given
34
+ a per-request provider for it. Cayso binds it to the identity assertion — the same
35
+ `sub`, the same `auth_time`, its `operation` in the identity assertion's `scope` and
36
+ equal to the route's, both current at once — on `provisionOrganisation`,
37
+ `makeCommercialPayment` on the `'mandate'` route, and `authorisePurchase` with any
38
+ `onBehalfOfWalletId`, which must then name the wallet the bound Organisation is bound
39
+ to, and refuses one that does not bind with a member of the closed
40
+ `AuthorityBindingRefusal`. The payment-allowance route and a Citizen's own purchase need
41
+ none. `AssertionClaims` declares `auth_time`, which
42
+ Percayso ID mints and the binding compares. `organisationAuthority` and `mandateFor`
43
+ are retired, authorise nothing, and are still published until the major that removes
44
+ them.
45
+
46
+ **`2.0.0` is a major, breaking on the wire from `1.0.0`** (CAY-0101): it lists
47
+ nothing older, so `GET /api/version` answers `2.0.0` alone, and a consumer on `1.0.0`
48
+ or on the `0.x` line that negotiates through it stops reading this Cayso until it
49
+ moves to `2.0.0`. See `CONTRACT_VERSION`'s docblock for what changed.
38
50
 
39
51
  **The operator read surface, on its own entry point** (CAY-0026, Amendments 4 and 5).
40
52
  Four reads an operator app's *server* calls — the movement list, the purchase list, the
@@ -124,8 +136,8 @@ consumer's handshake accepts a Cayso if `contractVersion` or any entry of
124
136
  same minor. Only a
125
137
  major breaks, and its first release lists nothing from an older major and says so in
126
138
  the bump's changelog. An earlier major is listed only during a declared transition:
127
- `1.0.0` keeps `0.32.0`, `0.31.0`, `0.30.0` and `0.29.0`, and the next major drops them
128
- ([CAY-0101](../../docs/architectural-decision-record/CAY-0101-the-contracts-follow-ordinary-semantic-versioning-from-1-0-0.md),
139
+ `1.0.0` kept `0.32.0`, `0.31.0`, `0.30.0` and `0.29.0`, and `2.0.0`, the next major,
140
+ dropped them ([CAY-0101](../../docs/architectural-decision-record/CAY-0101-the-contracts-follow-ordinary-semantic-versioning-from-1-0-0.md),
129
141
  amending CAY-0086).
130
142
 
131
143
  Alongside it, `GET /api/version/schema` serves the same machine-readable
@@ -9,11 +9,11 @@
9
9
  * mandate. It is not a second identity assertion and shares no type with
10
10
  * `AssertionClaims`.
11
11
  *
12
- * This file is the SHAPE ALONE, published so that Piper can build against it
13
- * before Cayso accepts it. Nothing here reads, verifies or binds a credential.
12
+ * This file is the SHAPE ALONE. Nothing here reads, verifies or binds a credential.
14
13
  * BizID's registration as an authority issuer, its verifier and the binding to
15
- * Percayso ID's assertion are later slices (#415–#417), and until they are served
16
- * an Organisation operation answers exactly as it did.
14
+ * Percayso ID's assertion are Cayso's (#415–#417), and from `2.0.0` the binding is
15
+ * served: an act on an Organisation Wallet without a binding authority assertion is
16
+ * refused with a member of {@link AuthorityBindingRefusal}.
17
17
  *
18
18
  * ## The envelope is the identity assertion's
19
19
  *
@@ -178,9 +178,9 @@ export interface AuthorityClaims {
178
178
  * Why the binding refused an Organisation operation: CAY-0100 §4's working shape,
179
179
  * closed and spelled here.
180
180
  *
181
- * Published before anything produces it, as `founder_wallet_lapsed` was, so a
182
- * consumer exhausting `CaysoApiErrorCode` renders it from the version that declared
183
- * it. A new reason is a new member and a contract version, never a free-text field.
181
+ * Published at `0.31.0`, before anything produced it, as `founder_wallet_lapsed` was,
182
+ * and produced from `2.0.0` on the Organisation operations (#417). A new reason is a
183
+ * new member and a contract version, never a free-text field.
184
184
  * Every member means the same thing: the operation did not happen.
185
185
  *
186
186
  * It is the BINDING's refusal, not the operation's. Each operation keeps its own
package/dist/client.d.ts CHANGED
@@ -182,24 +182,22 @@ export interface CaysoClient {
182
182
  */
183
183
  claimFounderWallet(): Promise<CitizenshipFounderClaimed>;
184
184
  /**
185
- * Provision the ORGANISATION the caller's assertion attests authority for, and
186
- * answer its wallet (CAY-0059).
185
+ * Provision the ORGANISATION BizID's authority assertion names, and answer its
186
+ * wallet (CAY-0059, CAY-0100 §1).
187
187
  *
188
- * IT TAKES NO ARGUMENT, AND THAT IS THE DECISION RATHER THAN AN OVERSIGHT. The
189
- * Organisation ID is read from the organisation-authority claim on the verified
190
- * assertion and from nowhere else — so there is no value a caller could pass
191
- * that would reach the holder key, and a signature here naming an organisation
192
- * would be the wallet-creation oracle CAY-0057 describes.
188
+ * IT NAMES NO ORGANISATION, AND THAT IS THE DECISION RATHER THAN AN OVERSIGHT. The
189
+ * Organisation ID is read from the `organisationId` of BizID's authority assertion,
190
+ * bound to the verified identity assertion, and from nowhere else — so there is no
191
+ * value a caller could pass that would reach the holder key, and a signature here
192
+ * naming an organisation would be the wallet-creation oracle CAY-0057 describes.
193
193
  *
194
- * IDEMPOTENT on the attested Organisation ID, exactly as
195
- * {@link provisionCitizenship} is idempotent on the caller's own identity, so it
196
- * carries no idempotency key and a repeat is the same act rather than a second
197
- * one. A credential carrying no organisation authority is refused; absence
198
- * provisions nothing.
194
+ * IDEMPOTENT on the Organisation ID, exactly as {@link provisionCitizenship} is
195
+ * idempotent on the caller's own identity, so it carries no idempotency key and a
196
+ * repeat is the same act rather than a second one.
199
197
  *
200
198
  * `authority` supplies BizID's authority assertion for `provision-organisation`
201
- * (CAY-0100 §4). Optional, and sent only when given: no route reads it until the
202
- * binding is served, and from then an Organisation operation without it is refused.
199
+ * (CAY-0100 §4). From `2.0.0` it is required: without it the call is refused
200
+ * `authority_assertion_missing`, and nothing is provisioned.
203
201
  */
204
202
  provisionOrganisation(authority?: AuthorityAssertionProvider): Promise<OrganisationView>;
205
203
  /**
@@ -219,9 +217,9 @@ export interface CaysoClient {
219
217
  * repeat of it will keep answering `'terminal'` forever, and the remedy is a new
220
218
  * purchase under a NEW key.
221
219
  *
222
- * `authority` supplies BizID's authority assertion for a purchase on behalf of an
223
- * Organisation Wallet, when `onBehalfOfWalletId` names one (CAY-0100 §4a). A
224
- * Citizen's own purchase needs none and passes none.
220
+ * `authority` supplies BizID's authority assertion for a purchase on behalf of a wallet:
221
+ * every `onBehalfOfWalletId` needs one, naming the Organisation that wallet is bound to
222
+ * (CAY-0100 §4a). A Citizen's own purchase needs none and passes none.
225
223
  */
226
224
  authorisePurchase(req: PurchaseRequest, authority?: AuthorityAssertionProvider): Promise<PurchaseAuthorised | PurchaseTerminal>;
227
225
  getPurchase(purchaseId: string): Promise<PurchaseResult>;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const CONTRACT_SCHEMA = {
17
- "contractVersion": "1.0.0",
17
+ "contractVersion": "2.0.0",
18
18
  "packageName": "@percayso-community/cayso-contracts",
19
19
  "capabilities": {
20
20
  "wallet": "cayso.wallet",
package/dist/errors.d.ts CHANGED
@@ -227,8 +227,8 @@ export type CaysoApiErrorCode =
227
227
  * No authority issuer is registered on this deployment, so no authority assertion
228
228
  * from Percayso BizID is verified and no act that needs one is performed (CAY-0100).
229
229
  * A closed door, never a refusal of the assertion and never "act as the Citizen
230
- * alone". Declared before any route answers it: the binding to the identity
231
- * assertion is the first to serve it. Not `authority_assertion_invalid`, which says
230
+ * alone". Declared before any route answered it, and now answered, as a closed door, by the
231
+ * binding to the identity assertion. Not `authority_assertion_invalid`, which says
232
232
  * the assertion was presented and refused.
233
233
  */
234
234
  | 'authority_issuer_not_configured'
package/dist/index.d.ts CHANGED
@@ -84,6 +84,29 @@
84
84
  * `supportedContractVersions` is on its own line: from `1.0.0` the same major, below
85
85
  * it the same minor.
86
86
  *
87
+ * `1.0.0` → `2.0.0` SERVES the two-signer binding (CAY-0100 §4, §4a, #417), and it is
88
+ * a MAJOR, BREAKING ON THE WIRE, declared so under CAY-0101. It lists nothing older: a
89
+ * deployment of it serves `2.0.0` alone, so `1.0.0` and the `0.x` transition major 1
90
+ * carried are no longer served. No type in this package changed shape; the behaviour
91
+ * behind three routes a `1.0.0` consumer already calls did:
92
+ *
93
+ * - **`ROUTES.organisationProvision`** reads the Organisation ID from BizID's
94
+ * {@link AuthorityClaims}, sent in {@link AUTHORITY_ASSERTION_HEADER} and bound to
95
+ * the identity assertion, and no longer from `organisationAuthority`. Without the
96
+ * header it answers `401 authority_assertion_missing`, where it used to provision
97
+ * or answer `403 no_organisation_authority`.
98
+ * - **`ROUTES.commercialPayment` on the `'mandate'` route** is authorised by the bound
99
+ * `AuthorityClaims`, not by `mandateFor`. The payment-allowance route is unchanged.
100
+ * - **`ROUTES.purchaseAuthorise` with any `onBehalfOfWalletId`** is authorised the
101
+ * same way, and the wallet named must be the one the bound Organisation is bound to;
102
+ * `mandateFor` authorises no delegated purchase, into any wallet. A Citizen's own
103
+ * purchase is unchanged.
104
+ *
105
+ * On those three acts the members of {@link AuthorityBindingRefusal} and
106
+ * `authority_issuer_not_configured` now reach the wire, which `0.31.0` declared and no
107
+ * route produced up to `1.0.0`. `organisationAuthority` and `mandateFor` stay declared,
108
+ * and are removed by a later major (#419).
109
+ *
87
110
  * `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
88
111
  * `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
89
112
  * `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
@@ -652,7 +675,7 @@
652
675
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
653
676
  * is where a breaking change goes, so the minor moves and the patch does not.
654
677
  */
655
- export declare const CONTRACT_VERSION: "1.0.0";
678
+ export declare const CONTRACT_VERSION: "2.0.0";
656
679
  /** The package's own name, so a consumer can name what it depends on. */
657
680
  export declare const packageName = "@percayso-community/cayso-contracts";
658
681
  /**
package/dist/index.js CHANGED
@@ -100,6 +100,29 @@
100
100
  * `supportedContractVersions` is on its own line: from `1.0.0` the same major, below
101
101
  * it the same minor.
102
102
  *
103
+ * `1.0.0` → `2.0.0` SERVES the two-signer binding (CAY-0100 §4, §4a, #417), and it is
104
+ * a MAJOR, BREAKING ON THE WIRE, declared so under CAY-0101. It lists nothing older: a
105
+ * deployment of it serves `2.0.0` alone, so `1.0.0` and the `0.x` transition major 1
106
+ * carried are no longer served. No type in this package changed shape; the behaviour
107
+ * behind three routes a `1.0.0` consumer already calls did:
108
+ *
109
+ * - **`ROUTES.organisationProvision`** reads the Organisation ID from BizID's
110
+ * {@link AuthorityClaims}, sent in {@link AUTHORITY_ASSERTION_HEADER} and bound to
111
+ * the identity assertion, and no longer from `organisationAuthority`. Without the
112
+ * header it answers `401 authority_assertion_missing`, where it used to provision
113
+ * or answer `403 no_organisation_authority`.
114
+ * - **`ROUTES.commercialPayment` on the `'mandate'` route** is authorised by the bound
115
+ * `AuthorityClaims`, not by `mandateFor`. The payment-allowance route is unchanged.
116
+ * - **`ROUTES.purchaseAuthorise` with any `onBehalfOfWalletId`** is authorised the
117
+ * same way, and the wallet named must be the one the bound Organisation is bound to;
118
+ * `mandateFor` authorises no delegated purchase, into any wallet. A Citizen's own
119
+ * purchase is unchanged.
120
+ *
121
+ * On those three acts the members of {@link AuthorityBindingRefusal} and
122
+ * `authority_issuer_not_configured` now reach the wire, which `0.31.0` declared and no
123
+ * route produced up to `1.0.0`. `organisationAuthority` and `mandateFor` stay declared,
124
+ * and are removed by a later major (#419).
125
+ *
103
126
  * `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
104
127
  * `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
105
128
  * `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
@@ -668,7 +691,7 @@
668
691
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
669
692
  * is where a breaking change goes, so the minor moves and the patch does not.
670
693
  */
671
- export const CONTRACT_VERSION = '1.0.0';
694
+ export const CONTRACT_VERSION = '2.0.0';
672
695
  /** The package's own name, so a consumer can name what it depends on. */
673
696
  export const packageName = '@percayso-community/cayso-contracts';
674
697
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percayso-community/cayso-contracts",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "The versioned capability contract surface through which anything outside this repository reads a wallet. Published; keep it the surface of every consumer outside this tree, Piper and the Percayso Cloud, and nothing internal.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {