@serve.zone/interfaces 32.88.0 → 32.90.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.
Files changed (43) hide show
  1. package/changelog.md +22 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/data/cloudaccess.d.ts +402 -0
  4. package/dist_ts/data/cloudaccess.js +685 -0
  5. package/dist_ts/data/cloudlyconfig.d.ts +20 -0
  6. package/dist_ts/data/cloudlyconfig.js +21 -1
  7. package/dist_ts/data/gatewayareas.d.ts +120 -22
  8. package/dist_ts/data/gatewayareas.js +36 -1
  9. package/dist_ts/data/gatewayareas.validation.js +203 -42
  10. package/dist_ts/data/gatewayconnector.d.ts +2 -2
  11. package/dist_ts/data/gatewayconnector.js +20 -1
  12. package/dist_ts/data/gatewayintent.d.ts +181 -0
  13. package/dist_ts/data/gatewayintent.js +67 -0
  14. package/dist_ts/data/index.d.ts +2 -0
  15. package/dist_ts/data/index.js +3 -1
  16. package/dist_ts/data/mail.d.ts +6 -1
  17. package/dist_ts/data/mail.js +1 -1
  18. package/dist_ts/data/witness.js +4 -9
  19. package/dist_ts/private/bearerencoding.d.ts +9 -0
  20. package/dist_ts/private/bearerencoding.js +17 -0
  21. package/dist_ts/private/storagecontract.js +3 -3
  22. package/dist_ts/requests/cloudaccess.d.ts +125 -0
  23. package/dist_ts/requests/cloudaccess.js +2 -0
  24. package/dist_ts/requests/gatewayconnector.d.ts +33 -1
  25. package/dist_ts/requests/index.d.ts +2 -1
  26. package/dist_ts/requests/index.js +3 -2
  27. package/package.json +1 -1
  28. package/readme.md +155 -11
  29. package/ts/00_commitinfo_data.ts +1 -1
  30. package/ts/data/cloudaccess.ts +1133 -0
  31. package/ts/data/cloudlyconfig.ts +27 -0
  32. package/ts/data/gatewayareas.ts +88 -22
  33. package/ts/data/gatewayareas.validation.ts +225 -40
  34. package/ts/data/gatewayconnector.ts +19 -0
  35. package/ts/data/gatewayintent.ts +239 -0
  36. package/ts/data/index.ts +2 -0
  37. package/ts/data/mail.ts +6 -1
  38. package/ts/data/witness.ts +3 -10
  39. package/ts/private/bearerencoding.ts +24 -0
  40. package/ts/private/storagecontract.ts +2 -2
  41. package/ts/requests/cloudaccess.ts +201 -0
  42. package/ts/requests/gatewayconnector.ts +41 -1
  43. package/ts/requests/index.ts +2 -0
package/readme.md CHANGED
@@ -3270,8 +3270,11 @@ origin with `SERVEZONE_SITE_ORIGIN` and its witness with `SERVEZONE_WITNESS_ORIG
3270
3270
  `SERVEZONE_WITNESS_BEARER_PATH` (both or neither; the bearer file is a private file the host
3271
3271
  creates, holding the 43-character base64url of 32 random bytes); a start whose controller row lists
3272
3272
  another site as a shadow reads the witness and is refused without it. `SERVEZONE_ADMINACCOUNT` is deprecated and read until
3273
- Cloudly 34.0.0; `SERVEZONE_INSTALL_DEMO_DATA` is outside the contract. No host extras exist:
3274
- they arrive only through a list the host advertises, so an app never branches on `hostType`.
3273
+ Cloudly 34.0.0; `SERVEZONE_INSTALL_DEMO_DATA` is outside the contract. Host extras are optional
3274
+ offers listed in `cloudlyHostExtras`; the one declared is `relayIngress` (Linus ruling 141 C7), a
3275
+ host's second TLS listener forwarded only to Cloudly's relayed port. An extra reaches Cloudly only
3276
+ through a list the host advertises, and no carrier for that list exists yet, so none is advertised;
3277
+ an app never branches on `hostType`.
3275
3278
  `ICloudlyConfig.letsEncryptEmail`, `letsEncryptPrivateKey`, `jwtKeypair` and the `sslMode`
3276
3279
  value `'letsencrypt'` are deprecated. The full hosting guide is Cloudly's readme.
3277
3280
 
@@ -4388,12 +4391,18 @@ guard that names roles excludes it by type.
4388
4391
  (the text carries the validator's sentences), `desired-state-stale` (the text names the applied
4389
4392
  epoch and revision), `gateway-mismatch`, `unsupported-area` (an export of an area the gateway does
4390
4393
  not take), `gateway-client-unbound`, `controller-epoch-older` (a pushed peer set older than the
4391
- stored one) and `forward-sources-exceed-allowlist` (a `new` adoption whose forward sources would
4394
+ stored one), `forward-sources-exceed-allowlist` (a `new` adoption whose forward sources would
4392
4395
  make the union of every gateway's forward source prefixes exceed one cluster ingress allowlist; the
4393
- code stays unconsumed). An unknown location stays `location-not-found` (`data.locationRefusals`).
4394
- `local-changing-during-export` is the one momentary refusal (`data.gatewayConnectorMomentaryRefusals`),
4395
- and `exportGatewayArea` its only request: local writes of the area kept overtaking the read, so the
4396
- gateway answers no table and the controller asks again later. It travels as
4396
+ code stays unconsumed) and `area-controller-owned` (a local write on the gateway, by an operator or
4397
+ a gateway client on any of its calls, to an area its controller owns: nothing was written, the text
4398
+ names the area, and the change is made at the controller). An unknown location stays
4399
+ `location-not-found` (`data.locationRefusals`).
4400
+ The momentary refusals (`data.gatewayConnectorMomentaryRefusals`) describe the gateway's own state,
4401
+ and the controller asks again later: `local-changing-during-export` (`exportGatewayArea` only: local
4402
+ writes of the area kept overtaking the read, so the gateway answers no table) and
4403
+ `route-dns-unavailable` (`getGatewayRouteDnsResults` only: the gateway runs no route DNS reconciler
4404
+ now, so no outcome can be read; it refuses the whole read, and one hostname's condition stays in
4405
+ its result row). They travel as
4397
4406
  `data.IGatewayConnectorMomentaryRefusalErrorData` (`{ code, retryable: true }`);
4398
4407
  `data.createGatewayConnectorRefusalErrorData` writes either payload, and
4399
4408
  `data.readGatewayConnectorRefusalErrorData` reads a payload whose `retryable` disagrees with its code,
@@ -4500,6 +4509,30 @@ guard that names roles excludes it by type.
4500
4509
  `from` that neither overlap nor touch, at most
4501
4510
  `data.gatewayConnectorContract.maximumListeningPortRanges` (1024) per transport; one port may
4502
4511
  appear in both lists. A gateway lowercases its zone names before reporting them in `dnsZones`.
4512
+ - Takeover reads (`ts/data/gatewayintent.ts`): an administrator reads one gateway's
4513
+ `data.IGatewayTakeoverState` with `getGatewayTakeoverState`
4514
+ (`requests.gatewayconnector.IReq_Admin_Cloudly_GetGatewayTakeoverState`): whether the controller
4515
+ took the gateway over, the takeover's import revision with its actor and time, the areas the live
4516
+ session offers (`null` without a socket) and the records the compile holds
4517
+ (`data.IGatewayCompileHeld`: kind, id, the table member that holds the record as a
4518
+ `data.TGatewayCompileHeldMember`, reason, kept row ids; one entry per record and member, computed
4519
+ at the read and never stored). `getGatewayDryRun`
4520
+ (`requests.gatewayconnector.IReq_Admin_Cloudly_GetGatewayDryRun`) answers a
4521
+ `data.TGatewayDryRunReport`: `{ ok: true, passes, dryRun }` with a `data.IGatewayIntentDryRun` (per
4522
+ area `data.IGatewayAreaDryRun`: whether the tables validate, the exported and compiled digests, the
4523
+ row ids that differ as `data.IGatewayAreaRowDiff`, unclaimed client rows and held records; the
4524
+ `data.TGatewayLifeline`; the refusals; and `mailIdentities`, one
4525
+ `data.IGatewayMailIdentityPasswordReport` `{ key, serviceId, password }` per mail identity the
4526
+ compile claims, ascending by key, whose `password` is one of
4527
+ `data.gatewayMailIdentityPasswordStates`: the password Cloudly holds `verifies` against the
4528
+ verifier the compiled row carries, `does-not-verify`, or is `absent`), or `{ ok: false, code }`
4529
+ with a `data.TGatewayDryRunRefusal` (one of `data.gatewayIntentRefusals`,
4530
+ `controller-gateway-disconnected`, or a momentary connector refusal). The mail identity report is
4531
+ required and is a report only: no refusal and no pass criterion reads it. Both read only and carry
4532
+ row ids, digests, names and states, never a table value, a password or a verifier, and neither has
4533
+ a validator: a reader shows a refusal name it does not know as text and never refuses the answer.
4534
+ `data.gatewayIntentRefusals` is the controller's whole vocabulary, so it also holds names that only
4535
+ operations without a request here answer (a takeover, an operator's table write, a recompile).
4503
4536
  - Validators name every refusal and never run an accessor: `data.validateControllerPeerSet`,
4504
4537
  `data.validateControllerRevision`, `data.validateGateway`, `data.validateGatewayAdoptionFacts`,
4505
4538
  `data.validateAdoptGatewayResponse`, `data.validateRegisterGatewaySessionRequest`,
@@ -4587,16 +4620,42 @@ area name: `data.IGatewayAreaContents[area]`, also `data.TGatewayAreaContent<are
4587
4620
  the gateway's default mapping and an empty `portMapping` is refused, because the gateway maps an
4588
4621
  unnamed port to port + 10000 either way).
4589
4622
  - DNS records lie inside their zone (the zone's name or a name below it, as written), and an `A` or
4590
- `AAAA` value (operator and static records) is one address in the form the gateway's DNS encoder
4591
- takes, with nothing around it: four decimal octets of one to three digits up to 255, or hex groups
4592
- with at most one `::`, no IPv4 tail and no zone id.
4623
+ `AAAA` value (operator and static records) is one address of its family in the canonical address
4624
+ text, with nothing around it: a dotted quad without leading zeros, or the RFC 5952 text (lowercase
4625
+ hex groups without leading zeros, the longest run of zero groups written `::`), no IPv4 tail and
4626
+ no zone id. Another spelling of the same address (upper case, an uncompressed or differently
4627
+ compressed form, leading zeros) is refused; any address of the family is a value.
4628
+ - Every rule the table alone decides is the validator's; a gateway keeps only rules that need its own
4629
+ state (Linus rulings 125 and 129). A record's or static record's `name` is at most 253 characters
4630
+ of lowercase zone labels without a trailing dot, and its leftmost label may instead be exactly `*`
4631
+ with a label after it; a name outside the form is refused, never repaired. A record value has one
4632
+ spelling per type, the one the gateway emits: `CNAME` and `NS` one lowercase name without a
4633
+ trailing dot (labels of at most 63 octets, 253 in all), `MX` `<preference> <exchange>` with one
4634
+ space (`0 .` for a null MX), `SOA` its two names and five numbers (0 to 4294967295) with one space
4635
+ between each, numbers without a leading zero, `CAA` a text without whitespace around it, `TXT` the
4636
+ text itself. A protected hostname's `reason` has no whitespace around it, and an authority zone has
4637
+ at least two labels of letters, digits and inner hyphens (no `_` label; refused `invalid-row-id`).
4638
+ - Edge settings lie in `data.gatewayEdgeSettingBounds`: each integer of `performance` in its range
4639
+ (only `maxHalfClosedStreams` may be 0), `minStreamWindowBytes` and `sustainedStreamWindowBytes` at
4640
+ most a stated `maxStreamWindowBytes`, `serverFirstPorts` at most 128 ports and never 443; an
4641
+ enabled egress states `allowedPorts: [25]` exactly, at most 128 `deniedCidrs` and
4642
+ `allowedHostPatterns`, each without whitespace around it, and `maxConcurrentStreams` from 1 to
4643
+ 100,000. `hubDomain` has no whitespace around it, `publicIp` and `publicIpv6` are one canonical
4644
+ address literal of their family (a dotted quad without leading zeros, RFC 5952 text), and
4645
+ `mailHostname` is a lowercase fully qualified name without a trailing dot. An integer outside its
4646
+ range is refused `invalid-value`; only a list beyond its length is `bound-exceeded`.
4647
+ - Mail server settings: while `enabled`, `emailConfig` names a non-blank `hostname` and a non-empty
4648
+ `ports` list of ports 1 to 65535; `tlsSource: 'configuredMaterial'` needs material in the table
4649
+ (`tlsKey`, or `emailConfig.tls.certPem`).
4593
4650
  - Secret classes: `sealed` (`data.IGatewaySealedValue`, `{ version, value }`, `version` 22 base64url
4594
4651
  characters minted by whoever sets the value) for DNS provider tokens, route and mail TLS keys,
4595
4652
  basic-auth user lists, JWT secrets, route request headers and edge secrets; `verifier` for API
4596
4653
  token hashes, SMTP and WorkApp SCRAM verifiers (WorkApp: `data.gatewayMailIdentityScramIterations`,
4597
4654
  4,096) and CoreMail argon2id verifiers. The secrets the gateway needs travel in `secrets`/`tlsKey`;
4598
4655
  `security.basicAuth` and `security.jwtAuth` are objects exactly when their secret is set (no empty
4599
- user list, no secret-less JWT object; a gateway refuses to export one, by name). A basic-auth list
4656
+ user list, no secret-less JWT object; a gateway refuses to export one, by name) and absent
4657
+ otherwise: a member present in another spelling (`null`, a text, a number) is refused
4658
+ `secret-engine-mismatch` at the secret's path, in a route and in a source profile. A basic-auth list
4600
4659
  and a request-header record are sealed whole in the one spelling of
4601
4660
  `data.encodeGatewayBasicAuthUsers` and `data.encodeGatewayRequestHeaders`.
4602
4661
  - Hard references (validated): `metadata.networkTargetRef`, `sourceBindings[].sourceProfileRef`,
@@ -4780,6 +4839,91 @@ data.judgeWitnessChange({ ...record, inSyncStandbyOrigin: null, revision: 5 }, '
4780
4839
  { epoch: 2, activeOrigin: 'https://nbg.cloudly.example.com', inSyncStandbyOrigin: null }); // 'standby-not-in-sync'
4781
4840
  ```
4782
4841
 
4842
+ ### Cloud Access
4843
+
4844
+ Cloud access (AGL-1181, Linus ruling 141 and amendment 141a) is `cloudaccess.serve.zone`: a
4845
+ directory of controllers with an SNI-passthrough relay, bound to idp.global organizations. It is a
4846
+ directory, never an authority: it holds no controller credential, sends no command and terminates
4847
+ no customer name. Cloudly dials one typedsocket to it with WebPKI verification and sends
4848
+ `requests.cloudaccess` (`Cloudly_CloudAccess`) over it; cloud access calls back with exactly one
4849
+ request, `IReq_CloudAccess_Cloudly_OpenCloudAccessStream` (`openCloudAccessStream`), which Cloudly
4850
+ serves on a dedicated TypedRouter that registers that one handler, never its main router. Nothing
4851
+ is pushed.
4852
+
4853
+ - Pairing: Cloudly creates a bearer (the unpadded base64url of
4854
+ `data.cloudAccessContract.bearerRandomBytes`, 32, random bytes), keeps it in its secret store and
4855
+ enrolls (`enrollCloudAccessBinding`) with `{ controllerId, publicOrigin, version, interfacesVersion,
4856
+ bearerSha256 }` (`data.validateEnrollCloudAccessBindingRequest`; `publicOrigin` is `https` on port
4857
+ 443 without a path, its host a DNS name outside `serve.zone`, `data.validateCloudAccessPublicOrigin`).
4858
+ Cloud access answers `{ bindingId, pairingCode, expiresAt }`: a random 128-bit `bindingId` as 32
4859
+ lowercase hex characters, and a code of `pairingCodeSymbols` (8) Crockford base32 symbols shown as
4860
+ `XXXX-XXXX` (`data.isCloudAccessPairingCode`), valid `pairingCodeLifetimeMs` (10 minutes) and only
4861
+ while the enrolling socket lives. Minting codes and reading typed input are cloud access's own. A
4862
+ person who enters the code records a pending claim (`data.ICloudAccessPendingClaim`: organization
4863
+ id and name, claimant subject, name and email); Cloudly polls `getCloudAccessEnrollmentState`
4864
+ (`waiting` or `claimed`) and only its Administrator's `confirmCloudAccessEnrollment` activates the
4865
+ binding (`rejectCloudAccessEnrollment` ends it).
4866
+ - Session: every socket authenticates (`authenticateCloudAccessBinding`, `{ bindingId, bearer }`,
4867
+ compared by SHA-256 in constant time) and registers (`registerCloudAccessSession`, `{ controllerId,
4868
+ epoch, active, version, interfacesVersion }`, answered `{ interfacesVersion }`). Both sides state
4869
+ the release of this package they speak and send a later member or value only to a peer whose
4870
+ release knows it. Only the live socket registered `active: true` with the highest epoch is
4871
+ counted: its reports count and it alone receives streams. `getCloudAccessBindingState`
4872
+ (`{ recheck }`) answers the hostname proof (`txt`, `address` for A/AAAA without aliases, `caa`,
4873
+ each `unchecked`, `passing`, `failing` or `lookup-error`), whether the name is routed, the
4874
+ organization and the records to publish (`data.ICloudAccessBindingState`).
4875
+ `disconnectCloudAccessBinding` deletes the binding; Cloudly deletes its bearer even when cloud
4876
+ access cannot be reached.
4877
+ - Reports (`reportCloudAccessStatus`, `data.ICloudAccessReport`, every `reportIntervalMs`, 30 s,
4878
+ refused sooner than `minimumReportIntervalMs`, 10 s): `healthy`, `versions` (each
4879
+ `(product, running)` once, with the `offered` update and a `count`, so cloud access never asks a
4880
+ registry), `counts`, `locations` with their controller role (`active`, `shadow` with `inSync`,
4881
+ `none`), `attention` items `{ key, severity, kind, object, location, since, text }` and `people`,
4882
+ the idp.global subjects with their Cloudly role. `data.validateCloudAccessReport` keeps the bounds
4883
+ of `data.cloudAccessContract`: at most 200 attention items with text of at most 500 characters,
4884
+ 1,000 people, every string bounded, and the whole report at most 256 KiB as the UTF-8 of its JSON
4885
+ (`data.measureCloudAccessReportBytes`, the bound inclusive); a peer's message cap sits at least
4886
+ 64 KiB above it. One attention key outside the identifier rule refuses the whole report, so
4887
+ Cloudly runs the validator before it sends. Cloud access renders every reported string as text
4888
+ only.
4889
+ - Streams: `openCloudAccessStream` carries `{ streamId, token, clientAddress }` and no target
4890
+ (`data.validateOpenCloudAccessStreamRequest` refuses any other member). The connector dials
4891
+ `tunnel.cloudaccess.serve.zone` and the host's relay ingress, never an address from a request, and
4892
+ only after the tunnel's TLS verified writes the preamble `data.cloudAccessTunnelPreamble`: the
4893
+ 13-byte ASCII tag `szca-tunnel-1`, always first, and the token's 32 raw bytes. Another layout gets
4894
+ another 13-byte tag.
4895
+ - Host extra: a host that carries relayed sessions advertises `relayIngress` (the host contract's
4896
+ `data.cloudlyHostExtras`, § Cloudly Hosting Contract). No carrier advertises an extra yet.
4897
+ - Refusals: one of `data.cloudAccessRefusals`, as a `TypedResponseError` whose `errorData` is
4898
+ `data.ICloudAccessRefusalErrorData` (`{ code, retryable }`, `data.createCloudAccessRefusalErrorData`,
4899
+ `data.readCloudAccessRefusalErrorData`). Only `rate-limited`, `report-too-soon`, `stream-limit` and
4900
+ `cloud-access-unavailable` (`data.cloudAccessMomentaryRefusals`) are momentary. `binding-gone` is
4901
+ one code for an unknown binding, a deleted one and a wrong bearer; `handshake-incomplete` answers a
4902
+ call before authentication or session registration. What cloud access answers a person on its own
4903
+ pages belongs to its own API, not to this contract. No refusal carries a bearer, a code or a token.
4904
+
4905
+ ```typescript
4906
+ import { data, requests } from '@serve.zone/interfaces';
4907
+
4908
+ // Cloudly's enrollment, with the hash of the bearer it keeps.
4909
+ declare const bearerSha256: string;
4910
+ const enroll: requests.cloudaccess.IReq_Cloudly_CloudAccess_EnrollCloudAccessBinding['request'] = {
4911
+ controllerId: 'controller-fra',
4912
+ publicOrigin: 'https://cloudly.example.com',
4913
+ version: '33.25.1',
4914
+ interfacesVersion: '32.89.0',
4915
+ bearerSha256,
4916
+ };
4917
+ data.validateEnrollCloudAccessBindingRequest(enroll); // []
4918
+ // A stream request that names a target is refused whole.
4919
+ data.validateOpenCloudAccessStreamRequest({
4920
+ streamId: 'fedcba9876543210fedcba9876543210',
4921
+ token: 'q6urq6urq6urq6urq6urq6urq6urq6urq6urq6urq6s',
4922
+ clientAddress: '198.51.100.7',
4923
+ target: '10.0.1.10:443',
4924
+ }); // ['open cloud access stream request must use its exact schema']
4925
+ ```
4926
+
4783
4927
  ### CoreMail contracts
4784
4928
 
4785
4929
  `requests.coremail` is the shared contract boundary for authenticated workload
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/interfaces',
6
- version: '32.88.0',
6
+ version: '32.90.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.'
8
8
  }