@openlfcp/wire 0.1.1 → 0.1.3

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
@@ -12,9 +12,9 @@ ESM only; Node.js 24 or later (browsers and Electron for every package except `@
12
12
 
13
13
  Part of the OpenLFCP TypeScript SDK, which implements the OpenLFCP MVP 0.1
14
14
  subset of [LFCP-WIRE-01](https://github.com/openlfcp/spec/blob/main/wire/LFCP-WIRE-01.md)
15
- at `mvp-0.1-baseline.8`, not every deferred WIRE-01 feature. It does not
15
+ at `mvp-0.1-baseline.9`, not every deferred WIRE-01 feature. It does not
16
16
  claim full LFCP-WIRE-01 conformance. This is the MVP 0.1 release
17
- (`0.1.1`, npm dist-tag `latest`). Until 1.0, minor versions may change APIs.
17
+ (`0.1.3`, npm dist-tag `latest`). Until 1.0, minor versions may change APIs.
18
18
 
19
19
  ## Links
20
20
 
package/dist/have.d.ts CHANGED
@@ -91,6 +91,16 @@ export declare function unionHaves(a: HaveVector, b: HaveVector): HaveVector;
91
91
  * tail, holes, and remote extras; never requests what local already holds.
92
92
  */
93
93
  export declare function missingFrom(local: HaveVector, remote: HaveVector): ActorRange[];
94
+ /**
95
+ * Both directions of anti-entropy (§28, §68.1): what a replica requests
96
+ * from its peer (the units `remote` holds and `local` lacks) and what it
97
+ * offers to it (the units `local` holds and `remote` lacks), each as the
98
+ * fewest ranges, by ascending raw Principal ID and then sequence.
99
+ */
100
+ export declare function haveDifference(local: HaveVector, remote: HaveVector): {
101
+ readonly request: ActorRange[];
102
+ readonly offer: ActorRange[];
103
+ };
94
104
  /**
95
105
  * Catch-up after loading a Snapshot (§29, §66 step 4): what `theirs` holds
96
106
  * that is neither in `ours` nor covered by the Snapshot's frontier.
package/dist/have.js CHANGED
@@ -251,6 +251,15 @@ export function missingFrom(local, remote) {
251
251
  }
252
252
  return out;
253
253
  }
254
+ /**
255
+ * Both directions of anti-entropy (§28, §68.1): what a replica requests
256
+ * from its peer (the units `remote` holds and `local` lacks) and what it
257
+ * offers to it (the units `local` holds and `remote` lacks), each as the
258
+ * fewest ranges, by ascending raw Principal ID and then sequence.
259
+ */
260
+ export function haveDifference(local, remote) {
261
+ return Object.freeze({ request: missingFrom(local, remote), offer: missingFrom(remote, local) });
262
+ }
254
263
  /**
255
264
  * Catch-up after loading a Snapshot (§29, §66 step 4): what `theirs` holds
256
265
  * that is neither in `ours` nor covered by the Snapshot's frontier.
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { checkDataUnit, type DataProfileCodec, type DataUnitAadFields, type Data
9
9
  export { checkReceivedUrl, checkWriterUrl, ENDPOINT_FLAGS, type Endpoint, endpointFromCbor, endpointToCbor, } from "./endpoint.js";
10
10
  export { type ControlView, classifyDataUnit, type DataPutDecision, type DataUnitHeader, type EpochClassification, type EpochRotation, isSequenceWithinFrontier, KEY_EPOCH_REASON, rotateEpoch, serverAcceptsDataPut, } from "./epoch.js";
11
11
  export { type AuthenticatedSession, type AuthProofCheck, type AuthTranscriptFields, authTranscript, type ClientHandshakeConfig, type ClientSession, type ClientStep, clientReceive, decodeAuthTranscript, isResourceMessage, type RandomSource, type ReadySession, type ServerHandshakeConfig, type ServerSession, type ServerStep, selectWireProfile, serverReceive, signAuthProof, startClientHandshake, startServerSession, verifyAuthProof, WIRE_PROFILE, } from "./handshake.js";
12
- export { type ActorHave, type ActorRange, actorHaveFromCbor, actorHaveToCbor, addRange, addSequence, batchDataRanges, canonicalFrontierFromCbor, canonicalFrontierToCbor, checkLiveHave, type HaveVector, hasSequence, type LiveHaveEntry, liveHavesOf, MAX_DATA_GET_RANGES, missingAfter, missingFrom, normalizeLiveHaves, type SequenceRange, unionHaves, } from "./have.js";
12
+ export { type ActorHave, type ActorRange, actorHaveFromCbor, actorHaveToCbor, addRange, addSequence, batchDataRanges, canonicalFrontierFromCbor, canonicalFrontierToCbor, checkLiveHave, type HaveVector, hasSequence, haveDifference, type LiveHaveEntry, liveHavesOf, MAX_DATA_GET_RANGES, missingAfter, missingFrom, normalizeLiveHaves, type SequenceRange, unionHaves, } from "./have.js";
13
13
  export { assembleInviteUri, decodeInviteSecret, encodeInviteSecret, INVITE_SECRET_VERSION, type Invitation, invitationPrincipal, parseInviteUri, verifyInvitationSecret, } from "./invite.js";
14
14
  export { type KeyPackageCheck, type KeyPackageRecipient, keyPackageHpkeAad, keyPackageHpkeInfo, openKeyPackage, type ReceivedKeyPackage, receiveKeyPackage, type SealedKeyPackage, sealKeyPackage, verifyKeyPackage, } from "./key-package.js";
15
15
  export { type AckBody, type AnyMessage, type AuthBody, type ChallengeBody, type ControlGetBody, type ControlHaveBody, type ControlHeadRef, type CoreMessageType, createMessage, type DataGetBody, type DataHaveBody, type DataRange, DEFAULT_MAX_MESSAGE_BYTES, type DecodedEnvelope, type DecodeOptions, decodeEnvelope, decodeFrame, decodeMessage, ERROR_CODE, type ErrorBody, type ExtensionMessage, encodeMessage, FIRST_EXTENSION_MESSAGE_TYPE, type Frame, type FrameResult, type HelloBody, type KeyPackageGetBody, type LfcpMessage, type LiveActorHave, MESSAGE_TYPE, type MessageBodies, messageErrorWireCode, newMessageId, type ObjectListBody, type PingBody, type PresenceBody, type PresenceLeaveBody, type ReadyBody, type ResourceBody, type ResourceHostBody, type ResourceHostedBody, type ResourceOpenBody, type ResourceOpenedBody, replyTo, type SnapshotBody, type SnapshotGetBody, type SnapshotSummary, type WireErrorName, } from "./message.js";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { checkDataUnit, dataUnitAad, encodeDataUnitPayload, InMemorySeenUnits, r
9
9
  export { checkReceivedUrl, checkWriterUrl, ENDPOINT_FLAGS, endpointFromCbor, endpointToCbor, } from "./endpoint.js";
10
10
  export { classifyDataUnit, isSequenceWithinFrontier, KEY_EPOCH_REASON, rotateEpoch, serverAcceptsDataPut, } from "./epoch.js";
11
11
  export { authTranscript, clientReceive, decodeAuthTranscript, isResourceMessage, selectWireProfile, serverReceive, signAuthProof, startClientHandshake, startServerSession, verifyAuthProof, WIRE_PROFILE, } from "./handshake.js";
12
- export { actorHaveFromCbor, actorHaveToCbor, addRange, addSequence, batchDataRanges, canonicalFrontierFromCbor, canonicalFrontierToCbor, checkLiveHave, hasSequence, liveHavesOf, MAX_DATA_GET_RANGES, missingAfter, missingFrom, normalizeLiveHaves, unionHaves, } from "./have.js";
12
+ export { actorHaveFromCbor, actorHaveToCbor, addRange, addSequence, batchDataRanges, canonicalFrontierFromCbor, canonicalFrontierToCbor, checkLiveHave, hasSequence, haveDifference, liveHavesOf, MAX_DATA_GET_RANGES, missingAfter, missingFrom, normalizeLiveHaves, unionHaves, } from "./have.js";
13
13
  export { assembleInviteUri, decodeInviteSecret, encodeInviteSecret, INVITE_SECRET_VERSION, invitationPrincipal, parseInviteUri, verifyInvitationSecret, } from "./invite.js";
14
14
  export { keyPackageHpkeAad, keyPackageHpkeInfo, openKeyPackage, receiveKeyPackage, sealKeyPackage, verifyKeyPackage, } from "./key-package.js";
15
15
  export { createMessage, DEFAULT_MAX_MESSAGE_BYTES, decodeEnvelope, decodeFrame, decodeMessage, ERROR_CODE, encodeMessage, FIRST_EXTENSION_MESSAGE_TYPE, MESSAGE_TYPE, messageErrorWireCode, newMessageId, replyTo, } from "./message.js";
package/dist/message.d.ts CHANGED
@@ -89,6 +89,8 @@ export declare const ERROR_CODE: Readonly<{
89
89
  HOSTING_DENIED: 20n;
90
90
  RESOURCE_TOMBSTONED: 21n;
91
91
  INTERNAL_ERROR: 22n;
92
+ /** §51.1 (baseline.9): a Data Unit whose `previous` the server does not store. */
93
+ UNKNOWN_PREVIOUS: 23n;
92
94
  }>;
93
95
  export type WireErrorName = keyof typeof ERROR_CODE;
94
96
  /** §31: the default maximum LFCP message size, unless READY advertises another. */
package/dist/message.js CHANGED
@@ -90,6 +90,8 @@ export const ERROR_CODE = Object.freeze({
90
90
  HOSTING_DENIED: 20n,
91
91
  RESOURCE_TOMBSTONED: 21n,
92
92
  INTERNAL_ERROR: 22n,
93
+ /** §51.1 (baseline.9): a Data Unit whose `previous` the server does not store. */
94
+ UNKNOWN_PREVIOUS: 23n,
93
95
  });
94
96
  /** §31: the default maximum LFCP message size, unless READY advertises another. */
95
97
  export const DEFAULT_MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openlfcp/wire",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Deterministic CBOR, COSE and LFCP Wire structures and codecs.",
5
5
  "keywords": [
6
6
  "openlfcp",
@@ -47,7 +47,7 @@
47
47
  "tag": "latest"
48
48
  },
49
49
  "dependencies": {
50
- "@openlfcp/core": "^0.1.1",
51
- "@openlfcp/crypto": "^0.1.1"
50
+ "@openlfcp/core": "^0.1.3",
51
+ "@openlfcp/crypto": "^0.1.3"
52
52
  }
53
53
  }