@derec-alliance/react-native 0.0.8 → 0.0.10

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 (50) hide show
  1. package/README.md +410 -9
  2. package/android/src/main/jniLibs/arm64-v8a/libderec_library.a +0 -0
  3. package/android/src/main/jniLibs/armeabi-v7a/libderec_library.a +0 -0
  4. package/android/src/main/jniLibs/x86_64/libderec_library.a +0 -0
  5. package/cpp/Convert.cpp +9 -0
  6. package/cpp/Convert.h +8 -2
  7. package/cpp/Primitives.cpp +123 -29
  8. package/cpp/ProtocolHost.cpp +4 -5
  9. package/cpp/StoreCallbacks.cpp +148 -61
  10. package/cpp/StoreCallbacks.h +8 -1
  11. package/cpp/derec_ffi.h +127 -48
  12. package/ios/DeRecFFI.xcframework/Info.plist +5 -5
  13. package/ios/DeRecFFI.xcframework/ios-arm64/Headers/derec_ffi.h +127 -48
  14. package/ios/DeRecFFI.xcframework/ios-arm64/libderec_library.a +0 -0
  15. package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/Headers/derec_ffi.h +127 -48
  16. package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/libderec_library.a +2 -2
  17. package/lib/errors.d.ts +11 -1
  18. package/lib/errors.js +66 -1
  19. package/lib/messages.js +5 -3
  20. package/lib/primitives.d.ts +3 -3
  21. package/lib/primitives.js +7 -3
  22. package/lib/protocol.d.ts +110 -10
  23. package/lib/protocol.js +166 -11
  24. package/lib/types.d.ts +474 -48
  25. package/lib/types.js +23 -1
  26. package/package.json +4 -17
  27. package/schema/derec_descriptor.bin +0 -0
  28. package/schema/proto/committedderecshare.proto +93 -0
  29. package/schema/proto/communicationinfo.proto +104 -0
  30. package/schema/proto/contact.proto +258 -0
  31. package/schema/proto/derecmessage.proto +232 -0
  32. package/schema/proto/derecsecret.proto +163 -0
  33. package/schema/proto/derectransport.proto +38 -0
  34. package/schema/proto/error.proto +68 -0
  35. package/schema/proto/getshare.proto +184 -0
  36. package/schema/proto/pair.proto +284 -0
  37. package/schema/proto/parameterrange.proto +36 -0
  38. package/schema/proto/prepair.proto +163 -0
  39. package/schema/proto/result.proto +194 -0
  40. package/schema/proto/secretidsversions.proto +199 -0
  41. package/schema/proto/storeshare.proto +242 -0
  42. package/schema/proto/transportprotocol.proto +112 -0
  43. package/schema/proto/unpair.proto +132 -0
  44. package/schema/proto/updatechannelinfo.proto +100 -0
  45. package/schema/proto/verify.proto +160 -0
  46. package/src/errors.ts +69 -1
  47. package/src/messages.ts +5 -3
  48. package/src/primitives.ts +19 -4
  49. package/src/protocol.ts +175 -13
  50. package/src/types.ts +481 -52
package/lib/types.js CHANGED
@@ -7,6 +7,7 @@ exports.channelFilterMatches = channelFilterMatches;
7
7
  exports.advertisedEndpoints = advertisedEndpoints;
8
8
  exports.protocol_version = protocol_version;
9
9
  exports.generate_replica_id = generate_replica_id;
10
+ exports.shareStoreRefusal = shareStoreRefusal;
10
11
  exports.sequentialFailover = sequentialFailover;
11
12
  exports.singleEndpointTransport = singleEndpointTransport;
12
13
  const native_1 = require("./native");
@@ -65,6 +66,24 @@ function protocol_version() {
65
66
  function generate_replica_id() {
66
67
  return (0, native_1.getNative)().generate_replica_id();
67
68
  }
69
+ const SHARE_STORE_REFUSAL_REASONS = [
70
+ "too_frequent",
71
+ "size_limit_exceeded",
72
+ "rejected",
73
+ ];
74
+ /**
75
+ * Builds the `Error` a `ShareStore`'s `save`/`recordVerification` throws, or
76
+ * rejects its promise with, to refuse the call: `reason` tagged onto the
77
+ * error's `refusal` property.
78
+ */
79
+ function shareStoreRefusal(reason) {
80
+ if (!SHARE_STORE_REFUSAL_REASONS.includes(reason)) {
81
+ throw new Error(`unknown share store refusal reason ${JSON.stringify(reason)}; expected one of ${JSON.stringify(SHARE_STORE_REFUSAL_REASONS)}`);
82
+ }
83
+ const error = new Error(`share store refused: ${reason}`);
84
+ error.refusal = reason;
85
+ return error;
86
+ }
68
87
  /**
69
88
  * Builds a {@link Transport} that tries each endpoint in the order the peer
70
89
  * offered it and stops at the first success.
@@ -150,7 +169,10 @@ var SenderKind;
150
169
  * are ignored. A man-in-the-middle on the plaintext `PrePair` leg leaves
151
170
  * the two sides with different shared keys and so different fingerprints,
152
171
  * which is what the comparison catches — the role `contact_binding_hash`
153
- * plays for `HashedKeys`.
172
+ * plays for `HashedKeys`. The creator's `PrePair` response also carries a
173
+ * commitment to a nonce it reveals only in its `PairResponse`, and the
174
+ * channel key depends on that nonce, so whoever answers the scanner cannot
175
+ * search offline for keys that make the two fingerprints agree.
154
176
  */
155
177
  var ContactMode;
156
178
  (function (ContactMode) {
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@derec-alliance/react-native",
3
- "version": "0.0.8",
4
3
  "description": "React Native bindings for derec-library, the Rust SDK for the DeRec protocol.",
5
- "license": "Apache-2.0",
6
4
  "repository": {
7
5
  "type": "git",
8
6
  "url": "git+https://github.com/derecalliance/lib-derec"
9
7
  },
10
- "homepage": "https://derec.org",
11
8
  "main": "lib/index.js",
12
9
  "types": "lib/index.d.ts",
13
10
  "files": [
@@ -21,26 +18,14 @@
21
18
  "!cpp/tests",
22
19
  "DeRec.podspec",
23
20
  "react-native.config.js",
21
+ "schema",
24
22
  "README.md",
25
23
  "LICENSE"
26
24
  ],
27
- "scripts": {
28
- "build": "tsc --project tsconfig.build.json",
29
- "test": "jest",
30
- "typecheck": "tsc --noEmit"
31
- },
32
25
  "peerDependencies": {
33
26
  "react": ">=18.2.0",
34
27
  "react-native": ">=0.76.0"
35
28
  },
36
- "devDependencies": {
37
- "@types/jest": "^30.0.0",
38
- "@types/node": "^26.3.0",
39
- "jest": "^30.4.2",
40
- "react-native": "^0.87.0",
41
- "ts-jest": "^29.4.12",
42
- "typescript": "^5.9.3"
43
- },
44
29
  "keywords": [
45
30
  "derec",
46
31
  "decentralized",
@@ -52,5 +37,7 @@
52
37
  "android",
53
38
  "typescript",
54
39
  "jsi"
55
- ]
40
+ ],
41
+ "version": "0.0.10",
42
+ "license": "Apache-2.0"
56
43
  }
Binary file
@@ -0,0 +1,93 @@
1
+ /*
2
+ * Copyright (c) DeRec Alliance and its Contributors.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ syntax = "proto3";
7
+
8
+ package org.derecalliance.derec.protobuf;
9
+
10
+ // CommittedDeRecShare represents a DeRec share that has been committed and
11
+ // is ready to be given to a helper for storage.
12
+ //
13
+ // During recovery, this protobuf message is returned.
14
+ //
15
+ // The commitment uses a Merkle tree. The hash of the share given to each
16
+ // helper forms a leaf in the tree, committing to that share's subshares in
17
+ // order. Each leaf and internal node hash is a SHA-256 hash: a leaf is
18
+ // SHA-256(0x00 || k || for each subshare: len(x) || x || len(y) || y), with k
19
+ // (the number of subshares) and every length as an 8-byte big-endian integer,
20
+ // and an internal node is SHA-256(0x02 || left || right). The tree has a fixed depth of 7, unused
21
+ // leaf slots are leaf hashes of random bytes, and every merklePath has
22
+ // exactly 7 entries.
23
+ //
24
+ // The Merkle path from a leaf to the root (i.e., the sibling nodes along
25
+ // that route) is called merklePath. The root hash is referred to as the
26
+ // "commitment".
27
+ message CommittedDeRecShare {
28
+
29
+ // Protobuf serialization of DeRecShare.
30
+ bytes deRecShare = 1;
31
+
32
+ // The Merkle root.
33
+ bytes commitment = 2;
34
+
35
+ // Represents a leaf or interior node in the Merkle path.
36
+ // isLeft is true if the sibling is a left child.
37
+ message SiblingHash {
38
+ bool isLeft = 1;
39
+ bytes hash = 2;
40
+ }
41
+
42
+ // The bottom-up Merkle path from the leaf to the root.
43
+ repeated SiblingHash merklePath = 3;
44
+ }
45
+
46
+
47
+ // DeRecShare contains the information that a sharer provides to a helper.
48
+ //
49
+ // The sharer first generates a random AES-256 key k and uses it to
50
+ // AES-GCM encrypt the secret. A random polynomial f is generated such
51
+ // that f(0) = k. The polynomial is evaluated at random non-zero x values,
52
+ // and each helper receives one or more of the resulting subshares (x, f(x)).
53
+ // The number of subshares a helper holds is its weight; a weight is always
54
+ // below the threshold, so no single helper can reconstruct on its own.
55
+ //
56
+ // The computation is done in the scalar field of the BW6-761 curve. The
57
+ // degree of the polynomial determines the threshold: t distinct subshares,
58
+ // from any combination of helpers, reconstruct k at x = 0.
59
+ //
60
+ // The message also includes the secretId and the share version number,
61
+ // because they must be serialized together with the share so that they
62
+ // are covered by the same signature.
63
+ message DeRecShare {
64
+
65
+ // One subshare: a Shamir (x, y) pair with y = f(x).
66
+ message Subshare {
67
+ // A random non-zero field element, in arkworks compressed
68
+ // serialization (48 bytes, little-endian).
69
+ bytes x = 1;
70
+
71
+ // The value y = f(x), in the same encoding.
72
+ bytes y = 2;
73
+ }
74
+
75
+ // The result of serializing the secret to be shared and encrypting it
76
+ // with a randomly generated AES-256 key.
77
+ bytes encryptedSecret = 1;
78
+
79
+ // The subshares this helper holds, in the order the Merkle leaf
80
+ // commits to. At least one.
81
+ repeated Subshare subshares = 2;
82
+
83
+ // Numeric identifier of the secret associated with the share.
84
+ //
85
+ // Must be unique for each secret created by a sharer.
86
+ uint64 secretId = 3;
87
+
88
+ // Version number of the share.
89
+ //
90
+ // A helper is entitled to ignore any StoreShareRequestMessage whose
91
+ // version is less than or equal to the last seen version.
92
+ uint32 version = 4;
93
+ }
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Copyright (c) DeRec Alliance and its Contributors.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ syntax = "proto3";
7
+
8
+ package org.derecalliance.derec.protobuf;
9
+
10
+ // CommunicationInfoKeyValue represents a single application-defined
11
+ // key-value pair used to convey user-facing identification data.
12
+ //
13
+ // # Purpose
14
+ //
15
+ // This structure is intended for:
16
+ //
17
+ // - displaying human-readable information to users during pairing
18
+ // - helping users identify and confirm counterparties
19
+ // - providing contextual metadata for UI/UX purposes
20
+ //
21
+ // # Semantics
22
+ //
23
+ // - The `key` is an application-defined identifier (e.g., "name", "phone")
24
+ // - The `value` contains the associated data, either as a string or raw bytes
25
+ //
26
+ // The protocol does not interpret these fields; they are opaque to the
27
+ // DeRec protocol and are only intended for application-level use.
28
+ //
29
+ // # Encoding
30
+ //
31
+ // Exactly one of the `value` fields MUST be set.
32
+ //
33
+ // Implementations SHOULD:
34
+ //
35
+ // - prefer `stringValue` for human-readable data
36
+ // - use `bytesValue` for structured or binary data (e.g., encoded identifiers)
37
+ //
38
+ // # Interoperability
39
+ //
40
+ // Applications SHOULD use consistent and well-known keys where possible
41
+ // (e.g., "name", "email", "phone") to improve cross-implementation UX,
42
+ // but no global registry is enforced by the protocol.
43
+ message CommunicationInfoKeyValue {
44
+ // Application-defined key identifying the type of information.
45
+ //
46
+ // Examples include "name", "email", "phone", or "accountId".
47
+ string key = 1;
48
+
49
+ // Value associated with the key.
50
+ //
51
+ // Exactly one of the following fields MUST be set.
52
+ oneof value {
53
+ // Human-readable string value.
54
+ //
55
+ // This is the preferred representation for most user-facing data.
56
+ string stringValue = 2;
57
+
58
+ // Binary value.
59
+ //
60
+ // May be used for structured or encoded data that is not naturally
61
+ // represented as a string.
62
+ bytes bytesValue = 3;
63
+ }
64
+ }
65
+
66
+ // CommunicationInfo contains application-level identifying information
67
+ // about a participant (Owner or Helper).
68
+ //
69
+ // # Purpose
70
+ //
71
+ // This message is used to:
72
+ //
73
+ // - present identifying details to users during pairing
74
+ // - assist users in verifying the identity of the counterparty
75
+ // - provide contextual metadata for UI display
76
+ //
77
+ // # Semantics
78
+ //
79
+ // - The contents are entirely application-defined
80
+ // - The protocol does not validate, interpret, or enforce any schema
81
+ // - Entries are independent key-value pairs
82
+ //
83
+ // # Security Considerations
84
+ //
85
+ // - This data MUST NOT be relied upon for authentication
86
+ // - Authentication is handled outside the protocol (e.g., in-person,
87
+ // KYC, or application-specific mechanisms)
88
+ //
89
+ // # Privacy Considerations
90
+ //
91
+ // - Applications SHOULD avoid including sensitive information unless
92
+ // necessary for the user experience
93
+ // - Users should be informed about what data is being shared
94
+ //
95
+ // # Interoperability
96
+ //
97
+ // While no schema is enforced, using common keys improves usability
98
+ // across implementations.
99
+ message CommunicationInfo {
100
+ // List of key-value entries describing the participant.
101
+ //
102
+ // Each entry represents one piece of identifying information.
103
+ repeated CommunicationInfoKeyValue communicationInfoEntries = 1;
104
+ }
@@ -0,0 +1,258 @@
1
+ /*
2
+ * Copyright (c) DeRec Alliance and its Contributors.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ syntax = "proto3";
7
+
8
+ import "google/protobuf/timestamp.proto";
9
+ import "transportprotocol.proto";
10
+
11
+ package org.derecalliance.derec.protobuf;
12
+
13
+ // ContactMessage is the only DeRec protocol message that is not wrapped
14
+ // inside a DeRecMessage.
15
+ //
16
+ // This message is exchanged out-of-band before pairing begins. It provides
17
+ // the minimum information required for another party to initiate contact and
18
+ // send the first protocol message for a new pairing session.
19
+ //
20
+ // Unlike normal DeRec protocol messages, a ContactMessage:
21
+ //
22
+ // - is not wrapped in a DeRecMessage
23
+ // - is not signed
24
+ // - is not encrypted
25
+ // - is not delivered through an already-established DeRec channel
26
+ //
27
+ // Because it is exchanged before any secure channel exists, this message
28
+ // should only contain bootstrap information needed to establish that channel.
29
+ // It is typically transferred through a trusted or user-mediated mechanism.
30
+ //
31
+ // Typical exchange mechanisms include:
32
+ //
33
+ // - QR codes displayed by either the Owner or Helper and scanned by the other
34
+ // party
35
+ // - distribution inside an application controlled by one of the parties
36
+ // - transmission over an already-existing communication channel when the
37
+ // parties have a prior relationship
38
+ //
39
+ // The recipient of this message uses its contents to construct and send the
40
+ // initial pairing request. In particular, the ContactMessage conveys:
41
+ //
42
+ // - the public encryption key material needed to protect the first inbound
43
+ // pairing message
44
+ // - a channel identifier that the recipient must echo in subsequent protocol
45
+ // messages sent to this contact
46
+ // - a nonce that binds the pairing attempt to the out-of-band contact exchange
47
+ // - the transport information required to deliver the pairing request
48
+ //
49
+ // The nonce may be transmitted together with the rest of the message or
50
+ // delivered separately by the application, depending on the authentication
51
+ // and pairing UX.
52
+ //
53
+ // # Modes
54
+ //
55
+ // `ContactMessage` supports three delivery modes for the public encryption
56
+ // material, selected by `contactMode`:
57
+ //
58
+ // - `INLINE_KEYS` (default): both `mlkemEncapsulationKey` and
59
+ // `eciesPublicKey` are present in the contact. The recipient may proceed
60
+ // directly to `PairRequestMessage`. This is the original, wire-equivalent
61
+ // behavior — existing contacts (which have no `contactMode` set) are
62
+ // parsed as `INLINE_KEYS` by virtue of the proto3 default.
63
+ //
64
+ // - `HASHED_KEYS`: `contactBindingHash` is present and both
65
+ // key fields are absent. The contact is small enough to fit in a QR code
66
+ // or short URL. The recipient must first exchange a `PrePairRequest` /
67
+ // `PrePairResponse` pair to obtain the actual keys, then verify them
68
+ // against the hash before sending `PairRequestMessage`. The hash binding
69
+ // gives the OOB-shared contact the same MITM resistance as inline-keys
70
+ // mode despite the keys traveling over the (unauthenticated) transport.
71
+ // Because the `PrePair*` messages are plaintext, the `supportedTransports`
72
+ // carried in this mode MUST be ephemeral — see the security note on
73
+ // `PrePairRequestMessage` for the required ephemeral-then-swap discipline.
74
+ //
75
+ // - `NO_KEYS`: all of `mlkemEncapsulationKey`, `eciesPublicKey`, and
76
+ // `contactBindingHash` are absent. The contact carries only
77
+ // `channelId`, `nonce`, and `supportedTransports` — small enough to be
78
+ // hand-typed or dictated over the phone. There is no cryptographic
79
+ // binding: the recipient's `PrePairRequest` triggers on-the-fly key
80
+ // generation on the contact creator, and the returned keys are used
81
+ // without hash verification. The security model rests **entirely** on
82
+ // the out-of-band delivery channel being fully trusted (e.g. a
83
+ // verified email from an already-KYC-authenticated institution). The
84
+ // `nonce` correlates the incoming request to the intended user; because
85
+ // the nonce is intentionally small for human typability, applications
86
+ // MUST rate-limit incoming `PrePairRequest`s per `channelId` and expire
87
+ // outstanding NoKeys contacts on a short timer. Not appropriate for
88
+ // peer-to-peer pairing over untrusted channels — use `HASHED_KEYS` or
89
+ // `INLINE_KEYS` there.
90
+ //
91
+ // Because nothing binds the published keys to the contact, a `NO_KEYS`
92
+ // channel MUST NOT be used until the pair is confirmed out of band. An
93
+ // implementation MUST hold it unusable — no secrets sent, inbound
94
+ // messages ignored — until both sides compare the human-readable
95
+ // fingerprint derived from the established channel key and it matches. A
96
+ // man-in-the-middle on the `PrePair` leg yields two different channel
97
+ // keys and therefore two different fingerprints, so this comparison is
98
+ // what `HASHED_KEYS` gets from its `contactBindingHash` and `NO_KEYS`
99
+ // can get no other way. This is a requirement of the mode, not a
100
+ // deployment choice. The creator's `fingerprintCommitment` is what keeps
101
+ // the man-in-the-middle from searching offline for a key pair whose two
102
+ // fingerprints agree.
103
+ //
104
+ // The mode selector and the per-mode field-presence invariants are enforced
105
+ // by the implementation; mixing fields across modes is a protocol error.
106
+
107
+ // Selects the delivery mode for the public encryption material in
108
+ // `ContactMessage`. See `ContactMessage` for details.
109
+ enum ContactMode {
110
+ // Default. `mlkemEncapsulationKey` and `eciesPublicKey` are inlined
111
+ // in the contact.
112
+ INLINE_KEYS = 0;
113
+ // `contactBindingHash` is inlined in the contact; keys are obtained via
114
+ // `PrePairRequest` / `PrePairResponse` and verified against the hash.
115
+ HASHED_KEYS = 1;
116
+ // No key material and no hash are inlined. The contact carries only
117
+ // `channelId`, `nonce`, and `supportedTransports`; the contact creator
118
+ // generates key material on the fly when the corresponding
119
+ // `PrePairRequest` arrives. Only appropriate when the out-of-band
120
+ // delivery channel is fully trusted, and the channel stays unusable
121
+ // until both sides confirm the fingerprint out of band — nothing else
122
+ // binds the published keys to the contact.
123
+ NO_KEYS = 2;
124
+ }
125
+
126
+ message ContactMessage {
127
+
128
+ // Selects how the public encryption material is delivered. Defaults to
129
+ // `INLINE_KEYS` (current behavior) when unset.
130
+ ContactMode contactMode = 1;
131
+
132
+ // Serialized ML-KEM-1024 encapsulation key.
133
+ //
134
+ // Present only when `contactMode == INLINE_KEYS`. Used by
135
+ // the recipient to construct the initial pairing message.
136
+ optional bytes mlkemEncapsulationKey = 2;
137
+
138
+ // Serialized ECIES public key.
139
+ //
140
+ // Present only when `contactMode == INLINE_KEYS`. Used by
141
+ // the recipient to construct the initial pairing message.
142
+ optional bytes eciesPublicKey = 3;
143
+
144
+ // SHA-384 commitment to the public encryption material.
145
+ //
146
+ // Present only when `contactMode == HASHED_KEYS`. Computed
147
+ // as:
148
+ //
149
+ // ```text
150
+ // SHA-384(
151
+ // mlkemEncapsulationKey
152
+ // || eciesPublicKey
153
+ // || u64_be(nonce)
154
+ // || u64_be(channelId)
155
+ // )
156
+ // ```
157
+ //
158
+ // The recipient obtains the actual keys via `PrePairRequest` and
159
+ // recomputes this hash to confirm integrity before proceeding to
160
+ // `PairRequestMessage`.
161
+ optional bytes contactBindingHash = 4;
162
+
163
+ // Channel identifier associated with this contact.
164
+ //
165
+ // This value identifies the communication channel that the creator of this
166
+ // ContactMessage expects to use for the new pairing. After receiving this
167
+ // contact, the initiating party includes this channelId in subsequent
168
+ // protocol messages sent to the contact creator.
169
+ //
170
+ // The recipient uses this identifier to determine which local key material
171
+ // and pairing state should be used when processing the message.
172
+ //
173
+ // If an implementation generates multiple pending contact records or
174
+ // multiple encryption key pairs for different pairing attempts, it should
175
+ // retain the mapping from channelId to the corresponding local state so it
176
+ // can process inbound messages without trial decryption across all keys.
177
+ //
178
+ // This value MUST be unique within the scope required by the implementation
179
+ // to disambiguate concurrent or stored pairing sessions.
180
+ uint64 channelId = 5;
181
+
182
+ // Random nonce used to bind the pairing request to this contact exchange.
183
+ //
184
+ // The initiator includes this value in the pairing request so the creator
185
+ // of the ContactMessage can confirm that the request corresponds to the
186
+ // same out-of-band contact information that was just shared.
187
+ //
188
+ // This helps the application detect mismatched, stale, or spoofed pairing
189
+ // attempts during the bootstrap phase.
190
+ //
191
+ // Applications may choose to reveal this nonce only after sufficient
192
+ // out-of-band authentication has taken place.
193
+ uint64 nonce = 6;
194
+
195
+ // Formerly the singular `transportProtocol`, superseded by `supportedTransports`.
196
+ reserved 7;
197
+ reserved "transportProtocol";
198
+
199
+ // Timestamp indicating when the sender created this message.
200
+ //
201
+ // This value is expressed in UTC and can be used for:
202
+ //
203
+ // - replay detection
204
+ // - timeout handling
205
+ // - logging and observability
206
+ google.protobuf.Timestamp timestamp = 8;
207
+
208
+ // Every transport endpoint the creator of this contact can be reached on.
209
+ //
210
+ // Each entry is a complete endpoint: a URI plus the protocol that says
211
+ // how to interpret it. The list is written in the creator's own
212
+ // preference order.
213
+ //
214
+ // # Selection is the recipient's
215
+ //
216
+ // A recipient picks whichever entry suits it, ordered by its **own**
217
+ // preference rather than the sender's. The order here expresses
218
+ // availability, not a ranking the recipient must honor.
219
+ //
220
+ // A contact MUST carry at least one entry: it is the only way the
221
+ // recipient learns where to send its first message.
222
+ //
223
+ // # Security
224
+ //
225
+ // `contactBindingHash` does not cover this field. An attacker able to
226
+ // rewrite an out-of-band contact can therefore remove entries. Removing
227
+ // the secure ones leaves only plaintext, which the recipient's transport
228
+ // policy refuses unless plaintext has been explicitly opted into. DeRec
229
+ // messages are signed and encrypted at the application layer on every
230
+ // transport, so substituting one secure transport for another is not a
231
+ // loss of confidentiality or authenticity.
232
+ repeated TransportProtocol supportedTransports = 9;
233
+
234
+ // The creator's commitment to the fingerprint nonce it reveals in
235
+ // `PairResponseMessage.fingerprintNonce`:
236
+ //
237
+ // ```text
238
+ // SHA-256("DeRec fingerprint commitment v1"
239
+ // || mlkemEncapsulationKey || eciesPublicKey || fingerprintNonce)
240
+ // ```
241
+ //
242
+ // Present, exactly 32 bytes, in `INLINE_KEYS` mode only. In
243
+ // `HASHED_KEYS` and `NO_KEYS` mode the commitment travels with the keys,
244
+ // in `PrePairResponseMessage.fingerprintCommitment`, and this field MUST
245
+ // be absent.
246
+ //
247
+ // # Why the creator commits
248
+ //
249
+ // The responder picks every random input of the handshake key after it
250
+ // has seen the creator's keys. Without a commitment, whoever answers the
251
+ // creator's keys can try handshake contributions offline until one
252
+ // yields the fingerprint it needs, and send only that one. The creator
253
+ // therefore fixes a random nonce before the responder contributes, and
254
+ // reveals it only after the responder's `PairRequestMessage` has fixed
255
+ // the handshake key. The channel key, and so the fingerprint, depends on
256
+ // both, so no contribution can be chosen to match a target fingerprint.
257
+ optional bytes fingerprintCommitment = 10;
258
+ }