p2party 0.14.2 → 0.14.7
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 +230 -30
- package/docs/getting-started.md +15 -0
- package/docs/protocol-v4-security.md +40 -0
- package/docs/references.md +28 -8
- package/docs/session-api.md +10 -2
- package/lib/api/signalingServerApi.d.ts +13 -2
- package/lib/api/webrtc/applyIceConfiguration.d.ts +9 -0
- package/lib/api/webrtc/dataChannelHandler.d.ts +10 -0
- package/lib/api/webrtc/deleteRoomData.d.ts +13 -0
- package/lib/api/webrtc/disconnectFromAllRoomsQuery.d.ts +2 -1
- package/lib/api/webrtc/disconnectFromRoomQuery.d.ts +2 -1
- package/lib/api/webrtc/disconnectQuery.d.ts +2 -1
- package/lib/api/webrtc/iceRepair.d.ts +3 -1
- package/lib/api/webrtc/index.d.ts +2 -1
- package/lib/api/webrtc/interfaces.d.ts +37 -0
- package/lib/api/webrtc/negotiationLock.d.ts +24 -0
- package/lib/api/webrtc/pendingOffer.d.ts +29 -0
- package/lib/api/webrtc/rebindDeadline.d.ts +61 -0
- package/lib/api/webrtc/remoteTransportChange.d.ts +142 -0
- package/lib/api/webrtc/retiredRemoteTransports.d.ts +70 -0
- package/lib/api/webrtc/roomEdgeBudget.d.ts +10 -0
- package/lib/api/webrtc/setDescriptionQuery.d.ts +8 -1
- package/lib/api/webrtc/settleOnClose.d.ts +36 -0
- package/lib/blindRendezvous/admissionInput.d.ts +11 -0
- package/lib/blindRendezvous/admissionPolicy.d.ts +217 -0
- package/lib/blindRendezvous/canonicalSchema.d.ts +139 -0
- package/lib/blindRendezvous/carrierEnvelope.d.ts +105 -0
- package/lib/blindRendezvous/coreReduce.d.ts +199 -0
- package/lib/blindRendezvous/derivations.d.ts +381 -0
- package/lib/blindRendezvous/identityHelloAdmission.d.ts +89 -0
- package/lib/blindRendezvous/identityHelloAdmissionPersistence.d.ts +133 -0
- package/lib/blindRendezvous/identityHelloHistoricalEvidence.d.ts +52 -0
- package/lib/blindRendezvous/identityHelloOpen.d.ts +167 -0
- package/lib/blindRendezvous/identityHelloTrial.d.ts +271 -0
- package/lib/blindRendezvous/localAdmissibleProject.d.ts +101 -0
- package/lib/blindRendezvous/localPresenceKeyBinding.d.ts +108 -0
- package/lib/blindRendezvous/localStableIdentityCustody.d.ts +46 -0
- package/lib/blindRendezvous/normativeKernel.d.ts +222 -0
- package/lib/blindRendezvous/operation.d.ts +137 -0
- package/lib/blindRendezvous/operationPayload.d.ts +134 -0
- package/lib/blindRendezvous/pairBootstrapSuite.d.ts +93 -0
- package/lib/blindRendezvous/pairCrypto.d.ts +122 -0
- package/lib/blindRendezvous/pairLedger.d.ts +154 -0
- package/lib/blindRendezvous/pairOpenBudget.d.ts +67 -0
- package/lib/blindRendezvous/pairOpenReservation.d.ts +157 -0
- package/lib/blindRendezvous/pairPlaintext.d.ts +240 -0
- package/lib/blindRendezvous/pairStepEnvelope.d.ts +60 -0
- package/lib/blindRendezvous/plannerState.d.ts +61 -0
- package/lib/blindRendezvous/projections.d.ts +71 -0
- package/lib/blindRendezvous/publicWindow.d.ts +330 -0
- package/lib/blindRendezvous/retainedOperationStore.d.ts +187 -0
- package/lib/blindRendezvous/roomInviteV2.d.ts +92 -0
- package/lib/blindRendezvous/roomPolicyV4.d.ts +90 -0
- package/lib/blindRendezvous/schemas.d.ts +221 -0
- package/lib/blindRendezvous/storeDescriptor.d.ts +160 -0
- package/lib/cryptography/aeadWasm.d.ts +18 -0
- package/lib/cryptography/byteInput.d.ts +12 -0
- package/lib/cryptography/carrierAead.d.ts +23 -0
- package/lib/cryptography/chacha20poly1305.d.ts +7 -0
- package/lib/cryptography/fips202.d.ts +10 -0
- package/lib/cryptography/hpke.d.ts +84 -0
- package/lib/cryptography/hpkeSuite.d.ts +39 -0
- package/lib/cryptography/hybridKem.d.ts +42 -0
- package/lib/cryptography/hybridKemSuite.d.ts +22 -0
- package/lib/cryptography/interfaces.d.ts +3 -0
- package/lib/cryptography/mlkem.d.ts +27 -1
- package/lib/cryptography/mnemonic.d.ts +65 -1
- package/lib/cryptography/ownedEd25519KeyMaterial.d.ts +27 -0
- package/lib/cryptography/webCryptoSha256.d.ts +20 -0
- package/lib/cryptography/x25519.d.ts +18 -0
- package/lib/cryptography/xchacha20poly1305.d.ts +7 -0
- package/lib/db/api.d.ts +6 -3
- package/lib/db/identityEd25519ClientBoundary.d.ts +13 -0
- package/lib/db/src/getDB.d.ts +2 -2
- package/lib/db/types.d.ts +52 -4
- package/lib/db.worker.js +1 -1
- package/lib/handlers/coverChannelRegistry.d.ts +22 -0
- package/lib/handlers/edgeTeardownFollowUp.d.ts +35 -0
- package/lib/handlers/handleChallenge.d.ts +2 -1
- package/lib/handlers/handleConnectToPeer.d.ts +1 -1
- package/lib/handlers/handleHandshake.d.ts +2 -6
- package/lib/handlers/handleSendMessage.d.ts +60 -7
- package/lib/handlers/handleWebSocketMessage.d.ts +1 -1
- package/lib/handlers/handshakeCore.d.ts +2 -7
- package/lib/handlers/handshakeFrame.d.ts +25 -0
- package/lib/handlers/ratchetGateWait.d.ts +13 -0
- package/lib/handlers/reconcile.d.ts +24 -0
- package/lib/handlers/requestRoom.d.ts +30 -0
- package/lib/handlers/roomResponse.d.ts +53 -0
- package/lib/index.d.ts +99 -12
- package/lib/index.js +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/libcrypto.provenance.json +5 -5
- package/lib/libcrypto.wasm +0 -0
- package/lib/middleware/roomListenerMiddleware.d.ts +4 -1
- package/lib/reducers/commonSlice.d.ts +3 -2
- package/lib/reducers/keyPairSlice.d.ts +3 -6
- package/lib/reducers/roomSlice.d.ts +81 -5
- package/lib/reducers/signalingServerSlice.d.ts +3 -2
- package/lib/session.d.ts +6 -3
- package/lib/session.js +1 -1
- package/lib/session.mjs +1 -1
- package/lib/store.d.ts +4 -2
- package/lib/utils/constants.d.ts +12 -0
- package/lib/utils/correlationId.d.ts +4 -0
- package/lib/utils/identityRestore.d.ts +108 -0
- package/lib/utils/interfaces.d.ts +25 -6
- package/lib/utils/roomConnectAdmission.d.ts +15 -0
- package/lib/utils/roomLeaveCoordinator.d.ts +38 -0
- package/lib/utils/roomRequestCoordinator.d.ts +104 -0
- package/lib/utils/roomRosterReconciler.d.ts +83 -0
- package/lib/utils/sdpFingerprint.d.ts +6 -0
- package/lib/utils/signalingAttemptLifecycle.d.ts +33 -0
- package/lib/utils/signalingAuth.d.ts +21 -2
- package/lib/utils/signalingBounds.d.ts +6 -0
- package/lib/utils/signalingFrame.d.ts +21 -0
- package/lib/utils/signalingHeartbeatWatchdog.d.ts +45 -0
- package/lib/utils/signalingIngressQueue.d.ts +49 -0
- package/lib/utils/signalingPeerRequestDebouncer.d.ts +13 -0
- package/lib/utils/signalingRoomLifecycle.d.ts +7 -0
- package/lib/utils/signalingRoomOperationLifecycle.d.ts +14 -0
- package/lib/utils/signalingServerBoundary.d.ts +11 -0
- package/lib/utils/terminalSettlement.d.ts +53 -0
- package/lib/utils/transportIdentity.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RoomPolicyV4`: the immutable security semantics of a blind room.
|
|
3
|
+
*
|
|
4
|
+
* Section 4.1 keeps delivery profiles, stores, routes, planner preferences,
|
|
5
|
+
* and local frontend controls out of this object: it is hashed into
|
|
6
|
+
* `RoomContextId`, so anything that can change without creating a different
|
|
7
|
+
* room must live elsewhere.
|
|
8
|
+
*
|
|
9
|
+
* The existing 32-byte `RoomPolicyV1` session policy is nested by value, not
|
|
10
|
+
* copied field by field, so `authMode`, `pqMode`, `rendezvousMode`, and the
|
|
11
|
+
* cover schedule keep exactly one encoder and one source of truth.
|
|
12
|
+
*/
|
|
13
|
+
import { PAIR_BOOTSTRAP_SUITE_ID_V1 } from "./pairBootstrapSuite";
|
|
14
|
+
import type { RoomPolicyV1 } from "../roomPolicy";
|
|
15
|
+
export type AdmissionFloorV4 = {
|
|
16
|
+
mode: "capability";
|
|
17
|
+
} | {
|
|
18
|
+
mode: "authority-grant";
|
|
19
|
+
authorityEd25519PublicKey: Uint8Array;
|
|
20
|
+
maxAuthorityCredentialLifetimeWindows: number;
|
|
21
|
+
};
|
|
22
|
+
export interface RoomProtocolLimitsV1 {
|
|
23
|
+
logicalWindowMs: bigint;
|
|
24
|
+
maxClockSkewWindows: number;
|
|
25
|
+
operationRetentionWindows: number;
|
|
26
|
+
pairControlRetentionWindows: number;
|
|
27
|
+
receiverKeyOverlapWindows: number;
|
|
28
|
+
maxFutureLogicalWindows: number;
|
|
29
|
+
maxDependenciesPerOperation: number;
|
|
30
|
+
maxOperationsPerAuthorWindow: number;
|
|
31
|
+
}
|
|
32
|
+
export interface RoomPolicyV4 {
|
|
33
|
+
version: 4;
|
|
34
|
+
/** Exact `encodeRoomPolicyV1(...)` bytes. */
|
|
35
|
+
sessionPolicyV1: Uint8Array;
|
|
36
|
+
roomCryptoSuite: 1;
|
|
37
|
+
operationCodec: 1;
|
|
38
|
+
pairBootstrapSuite: typeof PAIR_BOOTSTRAP_SUITE_ID_V1;
|
|
39
|
+
protocolLimits: RoomProtocolLimitsV1;
|
|
40
|
+
admissionFloor: AdmissionFloorV4;
|
|
41
|
+
maxRoomMembers: number;
|
|
42
|
+
}
|
|
43
|
+
export declare class RoomPolicyV4Error extends Error {
|
|
44
|
+
readonly name = "RoomPolicyV4Error";
|
|
45
|
+
constructor(message: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Semantic validation beyond the canonical encoding's width checks.
|
|
49
|
+
*
|
|
50
|
+
* The schema already rejects out-of-range widths, unknown enum values, and
|
|
51
|
+
* noncanonical encodings. This adds the Section 4.1 cross-field inequalities
|
|
52
|
+
* and the nested-session-policy requirement, which no width check can express.
|
|
53
|
+
*/
|
|
54
|
+
export declare const validateRoomPolicyV4: (policy: RoomPolicyV4) => void;
|
|
55
|
+
/** The unique canonical encoding of a validated policy. */
|
|
56
|
+
export declare const encodeRoomPolicyV4: (policy: RoomPolicyV4) => Uint8Array;
|
|
57
|
+
/** Decode, prove the bytes are the unique encoding, then validate semantics. */
|
|
58
|
+
export declare const decodeRoomPolicyV4: (encoded: Uint8Array) => RoomPolicyV4;
|
|
59
|
+
export declare const roomPoliciesEqualV4: (left: RoomPolicyV4, right: RoomPolicyV4) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The nested session policy of the byte-frozen blind default: the existing
|
|
62
|
+
* canonical v1 default (revision 0, no PIN, ML-KEM-768, immediate cover) with
|
|
63
|
+
* only `rendezvousMode` changed to `blind-meeting-point`.
|
|
64
|
+
*
|
|
65
|
+
* Section 4.1 publishes these exact 32 bytes; `tests/blindRendezvous`
|
|
66
|
+
* re-derives them from `encodeRoomPolicyV1` rather than trusting the literal.
|
|
67
|
+
*/
|
|
68
|
+
export declare const DEFAULT_BLIND_SESSION_POLICY_V1: Readonly<RoomPolicyV1>;
|
|
69
|
+
/**
|
|
70
|
+
* The room policy a capability-only `v2.` invitation resolves to.
|
|
71
|
+
*
|
|
72
|
+
* Fixing this here rather than reading a mutable application default is the
|
|
73
|
+
* point: a later default change must not reinterpret an already shared bare v2
|
|
74
|
+
* invitation.
|
|
75
|
+
*
|
|
76
|
+
* Status: the field values are transcribed from Section 4.1, but the object's
|
|
77
|
+
* canonical bytes and therefore its `PolicyHash` depend on the unfrozen
|
|
78
|
+
* `canonicalSchema`. Neither is a published v0.4 release artifact yet.
|
|
79
|
+
*/
|
|
80
|
+
export declare const DEFAULT_BLIND_POLICY_V4_0: Readonly<RoomPolicyV4>;
|
|
81
|
+
/**
|
|
82
|
+
* A fresh, independently owned copy of the blind default policy.
|
|
83
|
+
*
|
|
84
|
+
* `Object.freeze` does not protect the elements of a `Uint8Array`, and
|
|
85
|
+
* `Object.freeze` on a non-empty typed array throws, so the only way to keep
|
|
86
|
+
* `DEFAULT_BLIND_POLICY_V4_0` byte-frozen in practice is to never hand out a
|
|
87
|
+
* reference to its `sessionPolicyV1` storage. Callers that resolve a bare v2
|
|
88
|
+
* invitation get this copy.
|
|
89
|
+
*/
|
|
90
|
+
export declare const copyBlindDefaultPolicy: () => RoomPolicyV4;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical descriptors for the blind-rendezvous wire objects.
|
|
3
|
+
*
|
|
4
|
+
* These descriptors are the schema SSOT named in Section 1.4: they own field
|
|
5
|
+
* order, integer widths, enum bytes, collection ordering, and bounds. Every
|
|
6
|
+
* other module derives its encoder, decoder, key table, and bound check from
|
|
7
|
+
* here rather than restating them.
|
|
8
|
+
*
|
|
9
|
+
* Field order below follows the specification's declaration order in Sections
|
|
10
|
+
* 4.0 through 4.5. A TypeScript interface may list the same fields in a
|
|
11
|
+
* different order for readability; interface order is not wire order.
|
|
12
|
+
*
|
|
13
|
+
* Status: PROPOSED, NOT FROZEN. Integer widths are this artifact's proposal
|
|
14
|
+
* for the Phase-0 freeze, not published v0.4 release bytes.
|
|
15
|
+
*/
|
|
16
|
+
import type { TypeDescriptor } from "./canonicalSchema";
|
|
17
|
+
/** Section 4.4 operation payload classes: exact signed inner byte counts. */
|
|
18
|
+
export declare const OPERATION_PAYLOAD_CLASS_BYTES: Readonly<Record<0 | 1, number>>;
|
|
19
|
+
export declare const MAX_OPERATION_PAYLOAD_BYTES: number;
|
|
20
|
+
/** Absolute profile bound for one carried signed room operation. */
|
|
21
|
+
export declare const MAX_CARRIED_ROOM_OPERATION_BYTES_V1: number;
|
|
22
|
+
/** Section 4.11 suite-1 bootstrap KEM ciphertext width. */
|
|
23
|
+
export declare const PAIR_BOOTSTRAP_KEM_CIPHERTEXT_BYTES_V1: 1120;
|
|
24
|
+
/** Sections 4.9/4.11 suite-1 ML-KEM-768 + X25519 public-key width. */
|
|
25
|
+
export declare const RENDEZVOUS_HYBRID_KEM_PUBLIC_KEY_BYTES_V1: 1216;
|
|
26
|
+
/** Section 4.11: every currently defined pair step has zero or one dependency. */
|
|
27
|
+
export declare const MAX_PAIR_DEPENDENCIES_V1 = 1;
|
|
28
|
+
/**
|
|
29
|
+
* The largest unique pair-padding suffix.
|
|
30
|
+
*
|
|
31
|
+
* An established class-1 plaintext is minimal only when its empty-padding
|
|
32
|
+
* encoding is at least 4,018 bytes. Its target is 69,553 bytes, so the largest
|
|
33
|
+
* possible canonical suffix is 69,553 - 4,018 = 65,535 bytes.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MAX_PAIR_PADDING_BYTES_V1 = 65535;
|
|
36
|
+
/** Section 4.12 permits one through three transport candidates. */
|
|
37
|
+
export declare const MAX_PAIR_TRANSPORT_CANDIDATES_V1 = 3;
|
|
38
|
+
export declare const MAX_PAIR_WEBRTC_SDP_BYTES_V1 = 32768;
|
|
39
|
+
export declare const MAX_PAIR_LOCAL_CANDIDATE_BYTES_V1 = 2048;
|
|
40
|
+
/** Section 4.2 bounds one encrypted store hint to 255 exact routes. */
|
|
41
|
+
export declare const MAX_STORE_HINT_ROUTES_V1 = 255;
|
|
42
|
+
/** Section 4.8 bounds each frontend-owned canonical identity set. */
|
|
43
|
+
export declare const MAX_FRONTEND_ROOM_CONTROL_SET_ENTRIES_V1 = 65535;
|
|
44
|
+
/**
|
|
45
|
+
* Leaves one 16-bit collection slot for the canonical quota+1 physical proof.
|
|
46
|
+
*/
|
|
47
|
+
export declare const MAX_OPERATIONS_PER_AUTHOR_WINDOW_V1 = 65534;
|
|
48
|
+
/** Section 4.0 closes the kernel at 8 modules and 9 entrypoints. */
|
|
49
|
+
export declare const KERNEL_MODULE_IDS: readonly [1, 2, 3, 4, 5, 6, 7, 8];
|
|
50
|
+
export declare const KERNEL_ENTRYPOINT_IDS: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
51
|
+
/**
|
|
52
|
+
* Section 4.0: modules 1..5 own entrypoints 1..5; module 6 owns the delivery
|
|
53
|
+
* scheduler (6) and `R2Conforms` (7); module 7 owns the eventual pair-control
|
|
54
|
+
* transition (8); module 8 owns claim evaluation (9).
|
|
55
|
+
*/
|
|
56
|
+
export declare const KERNEL_ENTRYPOINT_IDS_BY_MODULE: Readonly<Record<(typeof KERNEL_MODULE_IDS)[number], readonly number[]>>;
|
|
57
|
+
/** Section 4.0: a v0.4 release must carry FPO-001 through FPO-006. */
|
|
58
|
+
export declare const V04_REQUIRED_FORMAL_OBLIGATION_IDS: readonly [1, 2, 3, 4, 5, 6];
|
|
59
|
+
export declare const roomProtocolLimitsV1Schema: TypeDescriptor;
|
|
60
|
+
export declare const admissionFloorV4Schema: TypeDescriptor;
|
|
61
|
+
export declare const roomPolicyV4Schema: TypeDescriptor;
|
|
62
|
+
export declare const appendScheduleRoleV1Schema: TypeDescriptor;
|
|
63
|
+
export declare const appendScheduleEntryV1Schema: TypeDescriptor;
|
|
64
|
+
export declare const deliverySizeClassV1Schema: TypeDescriptor;
|
|
65
|
+
export declare const deliveryProfileV1Schema: TypeDescriptor;
|
|
66
|
+
export declare const operationKindV1Schema: TypeDescriptor;
|
|
67
|
+
export declare const operationLifetimeV1Schema: TypeDescriptor;
|
|
68
|
+
export declare const authenticatedRoomOperationUnsignedV1Schema: TypeDescriptor;
|
|
69
|
+
export declare const authenticatedRoomOperationV1Schema: TypeDescriptor;
|
|
70
|
+
export declare const pairBootstrapHeaderV1Schema: TypeDescriptor;
|
|
71
|
+
export declare const pairStepEnvelopeV1Schema: TypeDescriptor;
|
|
72
|
+
export declare const carrierEnvelopeV1Schema: TypeDescriptor;
|
|
73
|
+
export declare const carrierPlaintextV1Schema: TypeDescriptor;
|
|
74
|
+
/** The sorted duplicate-free operation-ID projection hashed by
|
|
75
|
+
* `operationsDigest` and by the R2 required-operation digest. */
|
|
76
|
+
export declare const operationIdSetSchema: TypeDescriptor;
|
|
77
|
+
export declare const kernelEntrypointV1Schema: TypeDescriptor;
|
|
78
|
+
export declare const executableRendezvousKernelModuleV1Schema: TypeDescriptor;
|
|
79
|
+
export declare const executableRendezvousKernelManifestV1Schema: TypeDescriptor;
|
|
80
|
+
export declare const blindRendezvousImplementationBuildManifestV1Schema: TypeDescriptor;
|
|
81
|
+
export declare const claimEvaluationStateV1Schema: TypeDescriptor;
|
|
82
|
+
export declare const claimScopeKindV1Schema: TypeDescriptor;
|
|
83
|
+
export declare const claimAssumptionKindV1Schema: TypeDescriptor;
|
|
84
|
+
export declare const claimAssumptionVerificationV1Schema: TypeDescriptor;
|
|
85
|
+
export declare const claimAssumptionV1Schema: TypeDescriptor;
|
|
86
|
+
export declare const claimEvidenceKindV1Schema: TypeDescriptor;
|
|
87
|
+
export declare const claimWordingByStateV1Schema: TypeDescriptor;
|
|
88
|
+
export declare const claimDefinitionV1Schema: TypeDescriptor;
|
|
89
|
+
export declare const claimRegistryV1Schema: TypeDescriptor;
|
|
90
|
+
export declare const claimWordingEntryV1Schema: TypeDescriptor;
|
|
91
|
+
export declare const claimReasonEntryV1Schema: TypeDescriptor;
|
|
92
|
+
export declare const claimWordingCatalogV1Schema: TypeDescriptor;
|
|
93
|
+
export declare const claimEvidenceBindingV1Schema: TypeDescriptor;
|
|
94
|
+
export declare const claimPrerequisiteBindingV1Schema: TypeDescriptor;
|
|
95
|
+
export declare const claimFormalResultBindingV1Schema: TypeDescriptor;
|
|
96
|
+
export declare const claimAssumptionBindingV1Schema: TypeDescriptor;
|
|
97
|
+
export declare const claimEvaluationDatasetV1Schema: TypeDescriptor;
|
|
98
|
+
export declare const claimEvaluationInputV1Schema: TypeDescriptor;
|
|
99
|
+
export declare const claimEvaluationV1Schema: TypeDescriptor;
|
|
100
|
+
export declare const formalObligationKindV1Schema: TypeDescriptor;
|
|
101
|
+
export declare const formalObligationV1Schema: TypeDescriptor;
|
|
102
|
+
export declare const formalObligationRegistryV1Schema: TypeDescriptor;
|
|
103
|
+
export declare const formalProofScopeArtifactV1Schema: TypeDescriptor;
|
|
104
|
+
export declare const formalProofResultKindV1Schema: TypeDescriptor;
|
|
105
|
+
export declare const formalProofResultV1Schema: TypeDescriptor;
|
|
106
|
+
/** The resolved assumption sequence hashed by `FormalAssumptionSetHash`. */
|
|
107
|
+
export declare const resolvedAssumptionSetSchema: TypeDescriptor;
|
|
108
|
+
/** The normalized source-tree projection hashed by `KernelSourceTreeHash`. */
|
|
109
|
+
export declare const kernelSourceTreeEntrySchema: TypeDescriptor;
|
|
110
|
+
export declare const kernelSourceTreeSchema: TypeDescriptor;
|
|
111
|
+
/** The per-entrypoint projection hashed by `KernelModuleSemanticsHash`. */
|
|
112
|
+
export declare const kernelModuleSemanticsEntrySchema: TypeDescriptor;
|
|
113
|
+
export declare const kernelModuleSemanticsSchema: TypeDescriptor;
|
|
114
|
+
/** No room-derived value appears here: every room in a profile shares it. */
|
|
115
|
+
export declare const publicBucketV1Schema: TypeDescriptor;
|
|
116
|
+
export declare const publicChunkBodyV1Schema: TypeDescriptor;
|
|
117
|
+
export declare const publicChunkV1Schema: TypeDescriptor;
|
|
118
|
+
export declare const publicStoreCheckpointBodyV1Schema: TypeDescriptor;
|
|
119
|
+
export declare const publicStoreCheckpointV1Schema: TypeDescriptor;
|
|
120
|
+
export declare const publicCheckpointChunkLeafV1Schema: TypeDescriptor;
|
|
121
|
+
export declare const publicCheckpointChunkInclusionProofV1Schema: TypeDescriptor;
|
|
122
|
+
export declare const storeCheckpointChainStartV1Schema: TypeDescriptor;
|
|
123
|
+
export declare const storeDescriptorUnsignedV1Schema: TypeDescriptor;
|
|
124
|
+
export declare const storeDescriptorV1Schema: TypeDescriptor;
|
|
125
|
+
export declare const storeRouteUnsignedV1Schema: TypeDescriptor;
|
|
126
|
+
export declare const storeRouteV1Schema: TypeDescriptor;
|
|
127
|
+
export declare const canonicalBytes32SetV1Schema: TypeDescriptor;
|
|
128
|
+
export declare const initializedRoomAdmissionFenceV1Schema: TypeDescriptor;
|
|
129
|
+
export declare const localPresenceOwnershipV1Schema: TypeDescriptor;
|
|
130
|
+
export declare const authorityCustodyStatusV1Schema: TypeDescriptor;
|
|
131
|
+
export declare const authorityCustodyProjectionV1Schema: TypeDescriptor;
|
|
132
|
+
export declare const frontendRoomControlsV1Schema: TypeDescriptor;
|
|
133
|
+
export declare const bootstrapAdmissionDecisionLeaseV1Schema: TypeDescriptor;
|
|
134
|
+
export declare const admissionGrantUnsignedV1Schema: TypeDescriptor;
|
|
135
|
+
export declare const admissionGrantV1Schema: TypeDescriptor;
|
|
136
|
+
export declare const pairStepKindV1Schema: TypeDescriptor;
|
|
137
|
+
export declare const pairAttemptModeV1Schema: TypeDescriptor;
|
|
138
|
+
export declare const pairAttemptLeaseV1Schema: TypeDescriptor;
|
|
139
|
+
export declare const pairBootstrapRecipientKindV1Schema: TypeDescriptor;
|
|
140
|
+
export declare const pairTransportCandidateKindV1Schema: TypeDescriptor;
|
|
141
|
+
export declare const stableIdentityBundleV1Schema: TypeDescriptor;
|
|
142
|
+
export declare const pairIdentityHelloUnsignedV1Schema: TypeDescriptor;
|
|
143
|
+
export declare const pairIdentityHelloV1Schema: TypeDescriptor;
|
|
144
|
+
export declare const pairIdentityAcceptUnsignedV1Schema: TypeDescriptor;
|
|
145
|
+
export declare const pairIdentityAcceptV1Schema: TypeDescriptor;
|
|
146
|
+
export declare const stableEdgeAttemptClaimUnsignedV1Schema: TypeDescriptor;
|
|
147
|
+
export declare const stableEdgeAttemptClaimV1Schema: TypeDescriptor;
|
|
148
|
+
export declare const pairTransportCandidateV1Schema: TypeDescriptor;
|
|
149
|
+
export declare const pairTransportOfferV1Schema: TypeDescriptor;
|
|
150
|
+
export declare const pairTransportAnswerV1Schema: TypeDescriptor;
|
|
151
|
+
export declare const quiesceProposeV1Schema: TypeDescriptor;
|
|
152
|
+
export declare const quiesceAckV1Schema: TypeDescriptor;
|
|
153
|
+
export declare const healCompleteV1Schema: TypeDescriptor;
|
|
154
|
+
export declare const pairCheckpointV1Schema: TypeDescriptor;
|
|
155
|
+
export declare const pairStepBodyV1Schema: TypeDescriptor;
|
|
156
|
+
export declare const pairPlaintextV1Schema: TypeDescriptor;
|
|
157
|
+
export declare const pairIdentityUnsignedProjectionV1Schema: TypeDescriptor;
|
|
158
|
+
export declare const pairOuterPrebindingV1Schema: TypeDescriptor;
|
|
159
|
+
export declare const pairOuterBindingV1Schema: TypeDescriptor;
|
|
160
|
+
export declare const pairFlightSlotV1Schema: TypeDescriptor;
|
|
161
|
+
export declare const pairBootstrapRecipientBindingV1Schema: TypeDescriptor;
|
|
162
|
+
export declare const pairBootstrapInfoV1Schema: TypeDescriptor;
|
|
163
|
+
export declare const pairAcceptedSlotCoordinateV1Schema: TypeDescriptor;
|
|
164
|
+
export declare const pairAuthorChainPrefixEvidenceV1Schema: TypeDescriptor;
|
|
165
|
+
export declare const identityHelloHistoricalPresenceEvidenceV1Schema: TypeDescriptor;
|
|
166
|
+
/**
|
|
167
|
+
* Exact pair-subject evidence retained for one authenticated IDENTITY_HELLO.
|
|
168
|
+
*
|
|
169
|
+
* Endpoint order is protocol-visible: remote HELLO author first, local
|
|
170
|
+
* responder second. The semantic codec requires exactly two entries.
|
|
171
|
+
*/
|
|
172
|
+
export declare const identityHelloHistoricalEvidenceBundleV1Schema: TypeDescriptor;
|
|
173
|
+
/**
|
|
174
|
+
* Canonical post-authentication input. Its descriptor is shared by the live
|
|
175
|
+
* transition and durable entry so neither path can drift in field order or
|
|
176
|
+
* bounds.
|
|
177
|
+
*/
|
|
178
|
+
export declare const pairSlotAcceptanceCandidateV1Schema: TypeDescriptor;
|
|
179
|
+
export declare const pairAcceptedSlotEntryV1Schema: TypeDescriptor;
|
|
180
|
+
export declare const pairAcceptedSlotLedgerSnapshotV1Schema: TypeDescriptor;
|
|
181
|
+
export declare const pairOpenBudgetCoordinateV1Schema: TypeDescriptor;
|
|
182
|
+
export declare const pairOpenBudgetChargeV1Schema: TypeDescriptor;
|
|
183
|
+
export declare const pairOpenBudgetSnapshotV1Schema: TypeDescriptor;
|
|
184
|
+
export declare const admissionRevokeUnsignedV1Schema: TypeDescriptor;
|
|
185
|
+
export declare const admissionRevokeV1Schema: TypeDescriptor;
|
|
186
|
+
export declare const presenceCoreV1Schema: TypeDescriptor;
|
|
187
|
+
export declare const presencePermitUnsignedV1Schema: TypeDescriptor;
|
|
188
|
+
export declare const presencePermitV1Schema: TypeDescriptor;
|
|
189
|
+
export declare const presenceV1Schema: TypeDescriptor;
|
|
190
|
+
/**
|
|
191
|
+
* Canonical input to `PresenceProofTranscriptHash`.
|
|
192
|
+
*
|
|
193
|
+
* The declaration order is protocol-visible. Keeping it in the schema SSOT
|
|
194
|
+
* prevents an implementation from silently reordering the outer bindings.
|
|
195
|
+
*/
|
|
196
|
+
export declare const presenceProofTranscriptV1Schema: TypeDescriptor;
|
|
197
|
+
export declare const leaveV1Schema: TypeDescriptor;
|
|
198
|
+
export declare const storeHintOperationV1Schema: TypeDescriptor;
|
|
199
|
+
export declare const corePresenceFactV1Schema: TypeDescriptor;
|
|
200
|
+
export declare const coreStoreFactV1Schema: TypeDescriptor;
|
|
201
|
+
export declare const coreRevocationFloorV1Schema: TypeDescriptor;
|
|
202
|
+
export declare const authorityWindowFaultV1Schema: TypeDescriptor;
|
|
203
|
+
export declare const authorityAdmissionStatusV1Schema: TypeDescriptor;
|
|
204
|
+
/**
|
|
205
|
+
* Exact canonical tuple hashed by AuthorityAdmissionStateDigest. It excludes
|
|
206
|
+
* the reference window, whole-Core digest, custody digest source material,
|
|
207
|
+
* and unrelated authority facts by construction.
|
|
208
|
+
*/
|
|
209
|
+
export declare const authorityAdmissionStateDigestInputV1Schema: TypeDescriptor;
|
|
210
|
+
/**
|
|
211
|
+
* Variant order is the canonical fault order and therefore protocol-visible.
|
|
212
|
+
* Reducer sorting derives its order from this descriptor.
|
|
213
|
+
*/
|
|
214
|
+
export declare const coreFaultV1Schema: TypeDescriptor;
|
|
215
|
+
export declare const roomCapacityStateV1Schema: TypeDescriptor;
|
|
216
|
+
export declare const coreRoomStateV1Schema: TypeDescriptor;
|
|
217
|
+
export declare const connectionPlannerModeV1Schema: TypeDescriptor;
|
|
218
|
+
export declare const connectionPlannerPolicyV1Schema: TypeDescriptor;
|
|
219
|
+
export declare const provisionalTopologyEdgeV1Schema: TypeDescriptor;
|
|
220
|
+
export declare const activeStableTopologyEdgeV1Schema: TypeDescriptor;
|
|
221
|
+
export declare const plannerAndExplicitStateV1Schema: TypeDescriptor;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store identity and routes (Section 4.2).
|
|
3
|
+
*
|
|
4
|
+
* A `StoreId` is stable across compatible descriptor and route rotation, so
|
|
5
|
+
* adding a route or refreshing a lease does not create a different store. What
|
|
6
|
+
* changes with each descriptor is `DescriptorHash` and a monotonic generation.
|
|
7
|
+
*
|
|
8
|
+
* Neither a descriptor nor a route is part of room identity. That separation is
|
|
9
|
+
* the point: a client can add, deny, or replace a store without rekeying a room
|
|
10
|
+
* or reissuing an invitation, and a store learns nothing about the room from
|
|
11
|
+
* either object.
|
|
12
|
+
*
|
|
13
|
+
* The descriptor signature proves possession of the store's identity key, and
|
|
14
|
+
* every route signature is made with that same key — so a route binds the exact
|
|
15
|
+
* `StoreId`, `DescriptorHash`, locator, parameters, family, and lease, and a
|
|
16
|
+
* route cannot be transplanted onto another store or another descriptor.
|
|
17
|
+
*/
|
|
18
|
+
import type { LibCrypto } from "../cryptography/libcrypto";
|
|
19
|
+
export interface StoreCheckpointChainStartV1 {
|
|
20
|
+
deliveryProfileHash: Uint8Array;
|
|
21
|
+
chainStartIngressWindow: bigint;
|
|
22
|
+
}
|
|
23
|
+
export interface StoreDescriptorV1 {
|
|
24
|
+
version: 1;
|
|
25
|
+
storeIdentityEd25519Key: Uint8Array;
|
|
26
|
+
allocationIssuerPublicKeyDer: Uint8Array;
|
|
27
|
+
descriptorGeneration: bigint;
|
|
28
|
+
compatibilityHash: Uint8Array;
|
|
29
|
+
supportedDeliveryProfileHashes: readonly Uint8Array[];
|
|
30
|
+
checkpointChainStarts: readonly StoreCheckpointChainStartV1[];
|
|
31
|
+
notBeforeUnixMs: bigint;
|
|
32
|
+
notAfterUnixMs: bigint;
|
|
33
|
+
descriptorSignature: Uint8Array;
|
|
34
|
+
}
|
|
35
|
+
export interface StoreRouteV1 {
|
|
36
|
+
version: 1;
|
|
37
|
+
storeId: Uint8Array;
|
|
38
|
+
descriptorHash: Uint8Array;
|
|
39
|
+
routeFamily: number;
|
|
40
|
+
opaqueLocator: Uint8Array;
|
|
41
|
+
routePublicParameters: Uint8Array;
|
|
42
|
+
notBeforeUnixMs: bigint;
|
|
43
|
+
notAfterUnixMs: bigint;
|
|
44
|
+
routeSignature: Uint8Array;
|
|
45
|
+
}
|
|
46
|
+
export declare class StoreDescriptorError extends Error {
|
|
47
|
+
readonly name = "StoreDescriptorError";
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `StoreId = H("p2party/store-id/v1" || storeIdentityEd25519Key)`
|
|
52
|
+
*
|
|
53
|
+
* Derived from the key alone, which is what makes it survive descriptor and
|
|
54
|
+
* route rotation.
|
|
55
|
+
*/
|
|
56
|
+
export declare const storeId: (storeIdentityEd25519Key: Uint8Array) => Promise<Uint8Array>;
|
|
57
|
+
/**
|
|
58
|
+
* `DescriptorHash = H("p2party/store-descriptor/v1" ||
|
|
59
|
+
* Canonical(StoreDescriptorV1 without descriptorSignature))`
|
|
60
|
+
*/
|
|
61
|
+
export declare const descriptorHash: (descriptor: StoreDescriptorV1) => Promise<Uint8Array>;
|
|
62
|
+
/**
|
|
63
|
+
* `RouteId = H("p2party/store-route/v1" ||
|
|
64
|
+
* Canonical(StoreRouteV1 without routeSignature))`
|
|
65
|
+
*/
|
|
66
|
+
export declare const routeId: (route: StoreRouteV1) => Promise<Uint8Array>;
|
|
67
|
+
/** `"p2party/store-descriptor-signature/v1" || DescriptorHash` */
|
|
68
|
+
export declare const storeDescriptorSignedMessage: (descriptor: StoreDescriptorV1) => Promise<Uint8Array>;
|
|
69
|
+
/** `"p2party/store-route-signature/v1" || RouteId` */
|
|
70
|
+
export declare const storeRouteSignedMessage: (route: StoreRouteV1) => Promise<Uint8Array>;
|
|
71
|
+
/**
|
|
72
|
+
* `PublicCarrierContextId = H("p2party/public-carrier-context/v1" ||
|
|
73
|
+
* StoreId || DeliveryProfileHash)`
|
|
74
|
+
*
|
|
75
|
+
* This scopes cryptography and store idempotency: one wrapping, allocation and
|
|
76
|
+
* scheduled-work domain per store and profile, no matter how many routes reach
|
|
77
|
+
* it.
|
|
78
|
+
*/
|
|
79
|
+
export declare const publicCarrierContextId: (storeIdBytes: Uint8Array, deliveryProfileHash: Uint8Array) => Promise<Uint8Array>;
|
|
80
|
+
/**
|
|
81
|
+
* `PublicRouteInstanceId = H("p2party/public-route-instance/v1" ||
|
|
82
|
+
* PublicCarrierContextId || RouteId)`
|
|
83
|
+
*
|
|
84
|
+
* This scopes path health and assurance evidence. Two routes to one store are
|
|
85
|
+
* two instances of one context — never two stores, and never two chances to
|
|
86
|
+
* publish the same object.
|
|
87
|
+
*/
|
|
88
|
+
export declare const publicRouteInstanceId: (carrierContextId: Uint8Array, routeIdBytes: Uint8Array) => Promise<Uint8Array>;
|
|
89
|
+
export type StoreValidity = {
|
|
90
|
+
readonly valid: true;
|
|
91
|
+
} | {
|
|
92
|
+
readonly valid: false;
|
|
93
|
+
readonly reason: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* `StoreDescriptorAuthentic(descriptor)`.
|
|
97
|
+
*
|
|
98
|
+
* This predicate is deliberately timeless. It proves that the descriptor has
|
|
99
|
+
* one canonical encoding, a non-empty signed lease, a complete profile/chain
|
|
100
|
+
* projection, and a valid store-identity signature. Historical verification
|
|
101
|
+
* and core reduction must not make this answer depend on the wall clock.
|
|
102
|
+
*/
|
|
103
|
+
export declare const storeDescriptorAuthentic: (descriptor: StoreDescriptorV1, module?: LibCrypto) => Promise<StoreValidity>;
|
|
104
|
+
/**
|
|
105
|
+
* `StoreDescriptorActiveAt(descriptor, atUnixMs)`.
|
|
106
|
+
*
|
|
107
|
+
* Network adapters use an explicit transaction instant. The cheap half-open
|
|
108
|
+
* lease check precedes signature verification.
|
|
109
|
+
*/
|
|
110
|
+
export declare const storeDescriptorActiveAt: (descriptor: StoreDescriptorV1, atUnixMs: bigint, module?: LibCrypto) => Promise<StoreValidity>;
|
|
111
|
+
/**
|
|
112
|
+
* `StoreRouteAuthentic(route, descriptor)`.
|
|
113
|
+
*
|
|
114
|
+
* Descriptor authenticity is part of this predicate. The route signature is
|
|
115
|
+
* made with that descriptor's store identity key, so a route lifted from
|
|
116
|
+
* another store or descriptor generation cannot become an authorized path.
|
|
117
|
+
*/
|
|
118
|
+
export declare const storeRouteAuthentic: (route: StoreRouteV1, descriptor: StoreDescriptorV1, module?: LibCrypto) => Promise<StoreValidity>;
|
|
119
|
+
/**
|
|
120
|
+
* `StoreRouteActiveAt(route, descriptor, atUnixMs)`.
|
|
121
|
+
*
|
|
122
|
+
* This checks the route's own half-open lease before timeless route and
|
|
123
|
+
* descriptor authenticity. Callers that also require the descriptor itself to
|
|
124
|
+
* be active at the same instant must check `storeDescriptorActiveAt` as the
|
|
125
|
+
* specification requires for that operation.
|
|
126
|
+
*/
|
|
127
|
+
export declare const storeRouteActiveAt: (route: StoreRouteV1, descriptor: StoreDescriptorV1, atUnixMs: bigint, module?: LibCrypto) => Promise<StoreValidity>;
|
|
128
|
+
/**
|
|
129
|
+
* Compatibility wrapper for callers that validate descriptor activation.
|
|
130
|
+
*
|
|
131
|
+
* New timeless protocol checks should call `storeDescriptorAuthentic`
|
|
132
|
+
* directly.
|
|
133
|
+
*/
|
|
134
|
+
export declare const validateStoreDescriptor: (descriptor: StoreDescriptorV1, atUnixMs: bigint, module?: LibCrypto) => Promise<StoreValidity>;
|
|
135
|
+
/**
|
|
136
|
+
* Compatibility wrapper for callers that validate route activation.
|
|
137
|
+
*
|
|
138
|
+
* New timeless protocol checks should call `storeRouteAuthentic` directly.
|
|
139
|
+
*/
|
|
140
|
+
export declare const validateStoreRoute: (route: StoreRouteV1, descriptor: StoreDescriptorV1, atUnixMs: bigint, module?: LibCrypto) => Promise<StoreValidity>;
|
|
141
|
+
/** Whether a descriptor serves a given delivery profile. */
|
|
142
|
+
export declare const descriptorSupportsProfile: (descriptor: StoreDescriptorV1, deliveryProfileHash: Uint8Array) => boolean;
|
|
143
|
+
/** The immutable chain start this store declares for a profile, if any. */
|
|
144
|
+
export declare const descriptorChainStart: (descriptor: StoreDescriptorV1, deliveryProfileHash: Uint8Array) => bigint | null;
|
|
145
|
+
/**
|
|
146
|
+
* Two valid descriptors deriving one `StoreId` that name different chain
|
|
147
|
+
* starts for one profile.
|
|
148
|
+
*
|
|
149
|
+
* This is signed equivocation about where the accountability chain begins, and
|
|
150
|
+
* the specification makes it permanent for that store and profile: a higher
|
|
151
|
+
* descriptor generation cannot clear it, because a clean reset requires a new
|
|
152
|
+
* store identity. Canonical order is by descriptor hash, so one fault yields
|
|
153
|
+
* one proof.
|
|
154
|
+
*/
|
|
155
|
+
export declare const chainStartConflict: (first: StoreDescriptorV1, second: StoreDescriptorV1, deliveryProfileHash: Uint8Array, module?: LibCrypto) => Promise<{
|
|
156
|
+
readonly conflicting: false;
|
|
157
|
+
} | {
|
|
158
|
+
readonly conflicting: true;
|
|
159
|
+
readonly canonicalOrder: readonly [StoreDescriptorV1, StoreDescriptorV1];
|
|
160
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LibCrypto } from "./libcrypto";
|
|
2
|
+
export declare const WASM_AEAD_MAX_BYTES = 2147483647;
|
|
3
|
+
type AeadPrimitive = (module: LibCrypto, output: number, input: number, inputLength: number, key: number, nonce: number, associatedData: number, associatedDataLength: number) => number;
|
|
4
|
+
export interface WasmAeadSuite {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly keyBytes: number;
|
|
7
|
+
readonly nonceBytes: number;
|
|
8
|
+
readonly tagBytes: number;
|
|
9
|
+
readonly encrypt: AeadPrimitive;
|
|
10
|
+
readonly decrypt: AeadPrimitive;
|
|
11
|
+
}
|
|
12
|
+
export declare class WasmAeadError extends Error {
|
|
13
|
+
readonly name = "WasmAeadError";
|
|
14
|
+
}
|
|
15
|
+
export declare const maxAeadPlaintextBytes: (suite: WasmAeadSuite) => number;
|
|
16
|
+
export declare const sealWasmAead: (suite: WasmAeadSuite, module: LibCrypto, key: Uint8Array, nonce: Uint8Array, plaintext: Uint8Array, associatedData: Uint8Array) => Uint8Array;
|
|
17
|
+
export declare const openWasmAead: (suite: WasmAeadSuite, module: LibCrypto, key: Uint8Array, nonce: Uint8Array, ciphertextAndTag: Uint8Array, associatedData: Uint8Array) => Uint8Array | null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ByteInputConstraints {
|
|
2
|
+
readonly exactLength?: number;
|
|
3
|
+
readonly maximumLength?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Take an ordinary, owned snapshot of borrowed bytes before a WASM boundary.
|
|
7
|
+
*
|
|
8
|
+
* Typed-array intrinsics are used deliberately: a Proxy can pass `instanceof`
|
|
9
|
+
* while lying about its length, and a real view can shadow `length`, iteration,
|
|
10
|
+
* or species properties. None of those surfaces influence this copy.
|
|
11
|
+
*/
|
|
12
|
+
export declare const snapshotByteInput: (value: unknown, label: string, constraints?: ByteInputConstraints) => Uint8Array;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LibCrypto } from "./libcrypto";
|
|
2
|
+
/**
|
|
3
|
+
* XChaCha20-Poly1305 as required by the blind-rendezvous delivery profile's
|
|
4
|
+
* `carrierAeadSuite = 1` (`draft-irtf-cfrg-xchacha-03`).
|
|
5
|
+
*
|
|
6
|
+
* The construction comes from the pinned libsodium build. The reusable
|
|
7
|
+
* XChaCha adapter owns the hardened WASM boundary; this compatibility wrapper
|
|
8
|
+
* preserves the established carrier call shape and errors. Application code
|
|
9
|
+
* implements no cryptography, which is what SEC-002 and SEC-019 require.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CarrierAeadError extends Error {
|
|
12
|
+
readonly name = "CarrierAeadError";
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare const xchacha20poly1305Seal: (key: Uint8Array, nonce: Uint8Array, associatedData: Uint8Array, plaintext: Uint8Array, module: LibCrypto) => Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Returns null on authentication failure.
|
|
18
|
+
*
|
|
19
|
+
* libsodium verifies the tag in constant time and writes no plaintext when it
|
|
20
|
+
* fails, so a caller can treat null as "not for this room" — which is exactly
|
|
21
|
+
* how a dummy object reads — without having to scrub a partial buffer.
|
|
22
|
+
*/
|
|
23
|
+
export declare const xchacha20poly1305Open: (key: Uint8Array, nonce: Uint8Array, associatedData: Uint8Array, ciphertextAndTag: Uint8Array, module: LibCrypto) => Uint8Array | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LibCrypto } from "./libcrypto";
|
|
2
|
+
export declare const CHACHA20POLY1305_MAX_WASM_BYTES = 2147483647;
|
|
3
|
+
export declare const CHACHA20POLY1305_MAX_PLAINTEXT_BYTES: number;
|
|
4
|
+
/** Seal to RFC 8439 `ciphertext || 16-byte Poly1305 tag`. */
|
|
5
|
+
export declare const chacha20Poly1305Seal: (module: LibCrypto, key: Uint8Array, nonce: Uint8Array, plaintext: Uint8Array, associatedData: Uint8Array) => Uint8Array;
|
|
6
|
+
/** Open RFC 8439 `ciphertext || tag`, returning null on authentication failure. */
|
|
7
|
+
export declare const chacha20Poly1305Open: (module: LibCrypto, key: Uint8Array, nonce: Uint8Array, ciphertextAndTag: Uint8Array, associatedData: Uint8Array) => Uint8Array | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LibCrypto } from "./libcrypto";
|
|
2
|
+
export declare const SHA3_256_BYTES = 32;
|
|
3
|
+
/**
|
|
4
|
+
* The one-shot bound proved by the pinned mlkem-native FIPS 202 backend.
|
|
5
|
+
*
|
|
6
|
+
* WASM uses a 32-bit size_t, so this is `(SIZE_MAX >> 12)` from mlkem768.h.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FIPS202_MAX_BUFFER_BYTES = 1048575;
|
|
9
|
+
export declare const shake256: (input: Uint8Array, outputLength: number, module: LibCrypto) => Uint8Array;
|
|
10
|
+
export declare const sha3_256: (input: Uint8Array, module: LibCrypto) => Uint8Array;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { MlKem768X25519KeyPair } from "./hybridKem";
|
|
2
|
+
import type { LibCrypto } from "./libcrypto";
|
|
3
|
+
export { HPKE_CHACHA20POLY1305_AEAD_ID, HPKE_HASH_BYTES, HPKE_HKDF_SHA256_KDF_ID, HPKE_KEY_BYTES, HPKE_MAX_APPLICATION_CONTEXT_BYTES, HPKE_MAX_EXPORT_BYTES, HPKE_MLKEM768_X25519_KEM_ID, HPKE_MLKEM768_X25519_SUITE, HPKE_MODE_BASE, HPKE_MODE_PSK, HPKE_NONCE_BYTES, HPKE_PAIR_PSK_BYTES, HPKE_PAIR_PSK_ID_BYTES, HPKE_TAG_BYTES, } from "./hpkeSuite";
|
|
4
|
+
export interface HpkeContext {
|
|
5
|
+
readonly sequence: bigint;
|
|
6
|
+
readonly destroyed: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* RFC 9180 Export. It does not consume a nonce and has no replay protection.
|
|
9
|
+
*/
|
|
10
|
+
exportSecret(exporterContext: Uint8Array, length: number): Promise<Uint8Array>;
|
|
11
|
+
/** Idempotently wipe the AEAD and exporter state. */
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface HpkeSenderContext extends HpkeContext {
|
|
15
|
+
readonly role: "sender";
|
|
16
|
+
seal(associatedData: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
export interface HpkeRecipientContext extends HpkeContext {
|
|
19
|
+
readonly role: "recipient";
|
|
20
|
+
/**
|
|
21
|
+
* Return null on authentication failure. A failed Open does not advance the
|
|
22
|
+
* sequence number.
|
|
23
|
+
*/
|
|
24
|
+
open(associatedData: Uint8Array, ciphertextAndTag: Uint8Array): Uint8Array | null;
|
|
25
|
+
}
|
|
26
|
+
export interface HpkePskSenderSetup {
|
|
27
|
+
readonly encapsulatedKey: Uint8Array;
|
|
28
|
+
readonly context: HpkeSenderContext;
|
|
29
|
+
}
|
|
30
|
+
export interface HpkePskSenderOptions {
|
|
31
|
+
readonly module: LibCrypto;
|
|
32
|
+
readonly recipientPublicKey: Uint8Array;
|
|
33
|
+
readonly info: Uint8Array;
|
|
34
|
+
/** Pair suite 1 requires the exact 32-byte RoomRoot or HelloRoot. */
|
|
35
|
+
readonly psk: Uint8Array;
|
|
36
|
+
/** Pair suite 1 requires the exact 32-byte transcript-derived PSK ID. */
|
|
37
|
+
readonly pskId: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
export interface HpkePskRecipientOptions {
|
|
40
|
+
readonly module: LibCrypto;
|
|
41
|
+
readonly encapsulatedKey: Uint8Array;
|
|
42
|
+
readonly recipientSecretKey: Uint8Array;
|
|
43
|
+
readonly info: Uint8Array;
|
|
44
|
+
readonly psk: Uint8Array;
|
|
45
|
+
readonly pskId: Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
/** RFC 9180 SetupPSKS for the fixed pair-bootstrap suite. */
|
|
48
|
+
export declare const setupHpkePskSender: (options: HpkePskSenderOptions) => Promise<HpkePskSenderSetup>;
|
|
49
|
+
/**
|
|
50
|
+
* Deterministic SetupPSKS hook for pinned vectors only.
|
|
51
|
+
*
|
|
52
|
+
* Reusing or predicting its 64-byte randomness destroys KEM security. Normal
|
|
53
|
+
* protocol code must call setupHpkePskSender(), which obtains fresh CSPRNG
|
|
54
|
+
* bytes internally.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare const setupHpkePskSenderDeterministically: (options: HpkePskSenderOptions & {
|
|
59
|
+
readonly encapsulationRandomness: Uint8Array;
|
|
60
|
+
}) => Promise<HpkePskSenderSetup>;
|
|
61
|
+
/** RFC 9180 SetupPSKR for the fixed pair-bootstrap suite. */
|
|
62
|
+
export declare const setupHpkePskRecipient: (options: HpkePskRecipientOptions) => Promise<HpkeRecipientContext>;
|
|
63
|
+
/**
|
|
64
|
+
* Generate a production recipient key pair using the hybrid KEM's CSPRNG path.
|
|
65
|
+
*/
|
|
66
|
+
export declare const generateHpkeRecipientKeyPair: (module: LibCrypto) => Promise<MlKem768X25519KeyPair>;
|
|
67
|
+
/**
|
|
68
|
+
* HPKE KEM DeriveKeyPair mapping used by the official conformance vectors.
|
|
69
|
+
* The pair profile restricts IKM to one exact 32-byte seed.
|
|
70
|
+
*/
|
|
71
|
+
export declare const deriveHpkeRecipientKeyPair: (ikm: Uint8Array, module: LibCrypto) => Promise<MlKem768X25519KeyPair>;
|
|
72
|
+
/**
|
|
73
|
+
* Base-mode deterministic setup exists solely to verify the official
|
|
74
|
+
* draft-ietf-hpke-pq vector for this exact KEM/KDF/AEAD tuple. Pair protocol
|
|
75
|
+
* code must never use base mode.
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export declare const setupHpkeBaseSenderForConformance: (options: {
|
|
80
|
+
readonly module: LibCrypto;
|
|
81
|
+
readonly recipientPublicKey: Uint8Array;
|
|
82
|
+
readonly info: Uint8Array;
|
|
83
|
+
readonly encapsulationRandomness: Uint8Array;
|
|
84
|
+
}) => Promise<HpkePskSenderSetup>;
|