@derec-alliance/react-native 0.0.9 → 0.0.11
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 +114 -7
- package/android/src/main/jniLibs/arm64-v8a/libderec_library.a +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libderec_library.a +0 -0
- package/android/src/main/jniLibs/x86_64/libderec_library.a +0 -0
- package/cpp/Primitives.cpp +38 -9
- package/cpp/Primitives.h +5 -3
- package/cpp/ProtocolHost.cpp +4 -5
- package/cpp/StoreCallbacks.cpp +31 -43
- package/cpp/derec_ffi.h +98 -33
- package/ios/DeRecFFI.xcframework/ios-arm64/Headers/derec_ffi.h +98 -33
- package/ios/DeRecFFI.xcframework/ios-arm64/libderec_library.a +0 -0
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/Headers/derec_ffi.h +98 -33
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/libderec_library.a +2 -2
- package/lib/errors.d.ts +8 -3
- package/lib/errors.js +6 -0
- package/lib/messages.js +5 -3
- package/lib/primitives.d.ts +12 -2
- package/lib/primitives.js +17 -2
- package/lib/protocol.d.ts +9 -5
- package/lib/protocol.js +9 -5
- package/lib/types.d.ts +194 -46
- package/lib/types.js +4 -1
- package/package.json +4 -17
- package/schema/derec_descriptor.bin +0 -0
- package/schema/proto/committedderecshare.proto +93 -0
- package/schema/proto/communicationinfo.proto +104 -0
- package/schema/proto/contact.proto +266 -0
- package/schema/proto/derecmessage.proto +248 -0
- package/schema/proto/derecsecret.proto +163 -0
- package/schema/proto/derectransport.proto +38 -0
- package/schema/proto/error.proto +68 -0
- package/schema/proto/getshare.proto +184 -0
- package/schema/proto/pair.proto +284 -0
- package/schema/proto/parameterrange.proto +36 -0
- package/schema/proto/prepair.proto +164 -0
- package/schema/proto/result.proto +194 -0
- package/schema/proto/secretidsversions.proto +199 -0
- package/schema/proto/storeshare.proto +242 -0
- package/schema/proto/transportprotocol.proto +112 -0
- package/schema/proto/unpair.proto +132 -0
- package/schema/proto/updatechannelinfo.proto +100 -0
- package/schema/proto/verify.proto +160 -0
- package/src/errors.ts +12 -1
- package/src/messages.ts +5 -3
- package/src/primitives.ts +23 -2
- package/src/protocol.ts +10 -6
- package/src/types.ts +185 -43
|
@@ -0,0 +1,164 @@
|
|
|
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 "result.proto";
|
|
10
|
+
import "transportprotocol.proto";
|
|
11
|
+
|
|
12
|
+
package org.derecalliance.derec.protobuf;
|
|
13
|
+
|
|
14
|
+
// PrePairRequestMessage is sent by the recipient of a ContactMessage whose
|
|
15
|
+
// `contactMode == CONTACT_MODE_HASHED_KEYS`. It asks the contact creator for
|
|
16
|
+
// the actual ML-KEM and ECIES public keys that the contact's
|
|
17
|
+
// `contactBindingHash` commits to.
|
|
18
|
+
//
|
|
19
|
+
// # When this is sent
|
|
20
|
+
//
|
|
21
|
+
// `CONTACT_MODE_HASHED_KEYS` contacts carry only a hash of the public keys
|
|
22
|
+
// so they fit in size-constrained out-of-band channels (e.g. QR codes,
|
|
23
|
+
// short URLs). The recipient must obtain the actual keys before it can
|
|
24
|
+
// construct the first encrypted `PairRequestMessage`.
|
|
25
|
+
//
|
|
26
|
+
// # Security
|
|
27
|
+
//
|
|
28
|
+
// This message is plaintext — no shared key has been established yet. The
|
|
29
|
+
// scanner-side integrity check happens after the `PrePairResponseMessage`
|
|
30
|
+
// arrives, by recomputing the hash and matching it against the original
|
|
31
|
+
// `contactBindingHash`. An attacker who intercepts the transport cannot
|
|
32
|
+
// substitute different keys without producing a hash collision.
|
|
33
|
+
//
|
|
34
|
+
// # Envelope
|
|
35
|
+
//
|
|
36
|
+
// The message is wrapped in a `DeRecMessage` envelope just like every
|
|
37
|
+
// other protocol message. The envelope's `channelId` carries the routing
|
|
38
|
+
// key; the envelope's `message` field carries the serialized
|
|
39
|
+
// `PrePairRequestMessage` bytes unencrypted (because no symmetric key
|
|
40
|
+
// exists yet).
|
|
41
|
+
//
|
|
42
|
+
// # Security: transport endpoint is observable
|
|
43
|
+
//
|
|
44
|
+
// Because the envelope is plaintext, the endpoints carried in
|
|
45
|
+
// `PrePairRequestMessage` are visible to any passive observer on the
|
|
46
|
+
// network path. The same applies to the `supportedTransports` carried in
|
|
47
|
+
// the `HASHED_KEYS`-mode `ContactMessage` itself if its out-of-band channel
|
|
48
|
+
// can be observed.
|
|
49
|
+
//
|
|
50
|
+
// The protocol relies on this contract from the application to preserve
|
|
51
|
+
// the security guarantees of `HASHED_KEYS` mode:
|
|
52
|
+
//
|
|
53
|
+
// - The endpoints used during pairing (those advertised in the
|
|
54
|
+
// `ContactMessage` and in `PrePairRequestMessage`) MUST be
|
|
55
|
+
// ephemeral and short-lived — bound to the pairing attempt, not to the
|
|
56
|
+
// long-term identity of either peer.
|
|
57
|
+
// - Once pairing completes, the application MUST swap to a long-term
|
|
58
|
+
// endpoint via an `UpdateChannelInfoRequestMessage`. The ephemeral
|
|
59
|
+
// pairing endpoint is retired after the changeover (see the endpoint-
|
|
60
|
+
// changeover discipline on `UpdateChannelInfoRequestMessage`).
|
|
61
|
+
//
|
|
62
|
+
// `INLINE_KEYS`-mode contacts do not have this constraint because the
|
|
63
|
+
// `PairRequestMessage` is asymmetrically encrypted; only the
|
|
64
|
+
// `ContactMessage` itself crosses an unencrypted channel, which is by
|
|
65
|
+
// definition the trusted out-of-band one.
|
|
66
|
+
message PrePairRequestMessage {
|
|
67
|
+
|
|
68
|
+
// The same `nonce` the original `ContactMessage` advertised. Bound to
|
|
69
|
+
// the contact session; mismatches indicate a stale or spoofed request
|
|
70
|
+
// and the receiver MUST refuse to serve the keys.
|
|
71
|
+
uint64 nonce = 1;
|
|
72
|
+
|
|
73
|
+
// Formerly the singular `transportProtocol`, superseded by `supportedTransports`.
|
|
74
|
+
reserved 2;
|
|
75
|
+
reserved "transportProtocol";
|
|
76
|
+
|
|
77
|
+
// Timestamp indicating when this message was created.
|
|
78
|
+
//
|
|
79
|
+
// This value is expressed in UTC and is used for envelope-vs-body
|
|
80
|
+
// timestamp validation, replay detection, and observability.
|
|
81
|
+
google.protobuf.Timestamp timestamp = 3;
|
|
82
|
+
|
|
83
|
+
// Every transport endpoint the sender of this PrePair request can be
|
|
84
|
+
// reached on for the `PrePairResponseMessage`.
|
|
85
|
+
//
|
|
86
|
+
// Each entry is a complete endpoint: a URI plus the protocol that says
|
|
87
|
+
// how to interpret it. The list is written in the sender's own
|
|
88
|
+
// preference order.
|
|
89
|
+
//
|
|
90
|
+
// # Selection is the recipient's
|
|
91
|
+
//
|
|
92
|
+
// A recipient picks whichever entry suits it, ordered by its **own**
|
|
93
|
+
// preference rather than the sender's. The order here expresses
|
|
94
|
+
// availability, not a ranking the recipient must honor.
|
|
95
|
+
//
|
|
96
|
+
// The list MUST carry at least one entry: a request naming no endpoint
|
|
97
|
+
// gives the recipient nowhere to send the response.
|
|
98
|
+
//
|
|
99
|
+
// # Security
|
|
100
|
+
//
|
|
101
|
+
// PrePair traffic is plaintext — no shared key exists yet — so these
|
|
102
|
+
// endpoints are visible to a passive observer. The recipient's transport
|
|
103
|
+
// policy still refuses plaintext entries unless plaintext has been opted
|
|
104
|
+
// into.
|
|
105
|
+
repeated TransportProtocol supportedTransports = 4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// PrePairResponseMessage is the contact creator's reply to a
|
|
109
|
+
// `PrePairRequestMessage`. On success it carries the real public keys; on
|
|
110
|
+
// failure it carries only a non-`Ok` `DeRecResult`.
|
|
111
|
+
//
|
|
112
|
+
// # Validation by the receiver
|
|
113
|
+
//
|
|
114
|
+
// The recipient (the original scanner of the `ContactMessage`) MUST:
|
|
115
|
+
//
|
|
116
|
+
// - Confirm `result.status == OK`. On non-`Ok`, surface a typed error to
|
|
117
|
+
// the application and do not proceed.
|
|
118
|
+
// - Recompute
|
|
119
|
+
//
|
|
120
|
+
// ```text
|
|
121
|
+
// SHA-384(mlkemEncapsulationKey || eciesPublicKey
|
|
122
|
+
// || u64_be(nonce) || u64_be(channelId))
|
|
123
|
+
// ```
|
|
124
|
+
//
|
|
125
|
+
// and verify it matches the original `ContactMessage.contactBindingHash`.
|
|
126
|
+
// Keys whose sizes are not the fixed ones count as a mismatch.
|
|
127
|
+
// - Only on a match, proceed to construct and send a normal
|
|
128
|
+
// `PairRequestMessage`.
|
|
129
|
+
//
|
|
130
|
+
// # Envelope
|
|
131
|
+
//
|
|
132
|
+
// Plaintext-in-`DeRecMessage`-envelope, same as `PrePairRequestMessage`.
|
|
133
|
+
message PrePairResponseMessage {
|
|
134
|
+
|
|
135
|
+
// Result of processing the `PrePairRequestMessage`. On `OK`, the two
|
|
136
|
+
// key fields below are present. On any non-`Ok` status, the key fields
|
|
137
|
+
// MUST be absent.
|
|
138
|
+
DeRecResult result = 1;
|
|
139
|
+
|
|
140
|
+
// Serialized ML-KEM-1024 encapsulation key. Present only when
|
|
141
|
+
// `result.status == OK`.
|
|
142
|
+
optional bytes mlkemEncapsulationKey = 2;
|
|
143
|
+
|
|
144
|
+
// Serialized ECIES public key. Present only when
|
|
145
|
+
// `result.status == OK`.
|
|
146
|
+
optional bytes eciesPublicKey = 3;
|
|
147
|
+
|
|
148
|
+
// Echoed from the request for session correlation.
|
|
149
|
+
uint64 nonce = 4;
|
|
150
|
+
|
|
151
|
+
// Timestamp indicating when this message was created.
|
|
152
|
+
google.protobuf.Timestamp timestamp = 5;
|
|
153
|
+
|
|
154
|
+
// The creator's commitment to the fingerprint nonce it reveals in
|
|
155
|
+
// `PairResponseMessage.fingerprintNonce`, computed over the two keys
|
|
156
|
+
// above exactly as `ContactMessage.fingerprintCommitment` defines.
|
|
157
|
+
// Present, exactly 32 bytes, only when `result.status == OK`.
|
|
158
|
+
//
|
|
159
|
+
// The receiver MUST refuse a response without one, and MUST later refuse
|
|
160
|
+
// a `PairResponseMessage` whose nonce does not open it. Because the
|
|
161
|
+
// commitment covers the keys, one made for another creator's keys cannot
|
|
162
|
+
// be replayed here.
|
|
163
|
+
optional bytes fingerprintCommitment = 6;
|
|
164
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
// Result represents the outcome of processing a DeRec protocol request.
|
|
11
|
+
//
|
|
12
|
+
// # Purpose
|
|
13
|
+
//
|
|
14
|
+
// This message is included in response messages to communicate:
|
|
15
|
+
//
|
|
16
|
+
// - whether a request was successfully processed
|
|
17
|
+
// - the type of failure (if any)
|
|
18
|
+
// - optional human-readable context for debugging or user display
|
|
19
|
+
//
|
|
20
|
+
// # Semantics
|
|
21
|
+
//
|
|
22
|
+
// A Result consists of:
|
|
23
|
+
//
|
|
24
|
+
// - a machine-readable `status` code
|
|
25
|
+
// - an optional `memo` providing additional context
|
|
26
|
+
//
|
|
27
|
+
// The `status` field MUST be used by implementations to determine
|
|
28
|
+
// protocol behavior. The `memo` field is informational only.
|
|
29
|
+
//
|
|
30
|
+
// # Usage
|
|
31
|
+
//
|
|
32
|
+
// - Every response message that can fail SHOULD include a Result
|
|
33
|
+
// - Senders MUST inspect the `status` field to determine next steps
|
|
34
|
+
// - The `memo` field MAY be displayed to users or logged for diagnostics
|
|
35
|
+
//
|
|
36
|
+
// # Security Considerations
|
|
37
|
+
//
|
|
38
|
+
// - The `memo` field SHOULD NOT include sensitive internal details
|
|
39
|
+
// - Only high-level or user-safe information should be exposed
|
|
40
|
+
//
|
|
41
|
+
// # Idempotency
|
|
42
|
+
//
|
|
43
|
+
// The Result reflects the outcome of a specific request. Repeated identical
|
|
44
|
+
// requests SHOULD produce consistent Result values unless system state changes.
|
|
45
|
+
message DeRecResult {
|
|
46
|
+
// Status code indicating the outcome of the request.
|
|
47
|
+
StatusEnum status = 1;
|
|
48
|
+
|
|
49
|
+
// Optional human-readable description providing additional details.
|
|
50
|
+
//
|
|
51
|
+
// This field is intended for debugging, logging, or user display.
|
|
52
|
+
// It MUST NOT be relied upon for programmatic decision-making.
|
|
53
|
+
string memo = 2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// StatusEnum defines the set of possible outcomes for processing
|
|
57
|
+
// DeRec protocol requests.
|
|
58
|
+
//
|
|
59
|
+
// # Semantics
|
|
60
|
+
//
|
|
61
|
+
// These values are used across all response messages to provide a consistent
|
|
62
|
+
// interpretation of success and failure conditions.
|
|
63
|
+
//
|
|
64
|
+
// Implementations MUST handle all known values and SHOULD safely ignore
|
|
65
|
+
// unknown values for forward compatibility.
|
|
66
|
+
enum StatusEnum {
|
|
67
|
+
|
|
68
|
+
// The request was successfully handled.
|
|
69
|
+
//
|
|
70
|
+
// No further action is required by the sender.
|
|
71
|
+
OK = 0;
|
|
72
|
+
|
|
73
|
+
// The request was partially fulfilled.
|
|
74
|
+
//
|
|
75
|
+
// The `memo` field SHOULD provide additional context explaining which
|
|
76
|
+
// parts succeeded and which did not.
|
|
77
|
+
PARTIAL = 1;
|
|
78
|
+
|
|
79
|
+
// The request failed for a generic or unspecified reason.
|
|
80
|
+
//
|
|
81
|
+
// The `memo` field MAY provide additional details.
|
|
82
|
+
FAIL = 2;
|
|
83
|
+
|
|
84
|
+
// The request failed because it would exceed the allowed storage limit
|
|
85
|
+
// for this sharer and secret ID.
|
|
86
|
+
//
|
|
87
|
+
// This typically applies to share storage operations.
|
|
88
|
+
SIZE_LIMIT_EXCEEDED = 3;
|
|
89
|
+
|
|
90
|
+
// The request was ignored because it exceeded the allowed frequency.
|
|
91
|
+
//
|
|
92
|
+
// This may be used for rate limiting to prevent abuse or excessive load.
|
|
93
|
+
TOO_FREQUENT = 4;
|
|
94
|
+
|
|
95
|
+
// The specified secret ID is not recognized by the Helper.
|
|
96
|
+
//
|
|
97
|
+
// This may occur during recovery or share retrieval.
|
|
98
|
+
UNKNOWN_SECRET_ID = 5;
|
|
99
|
+
|
|
100
|
+
// The specified share version does not exist for the given secret ID.
|
|
101
|
+
//
|
|
102
|
+
// This may occur if the version was never stored or has been deleted.
|
|
103
|
+
UNKNOWN_SHARE_VERSION = 6;
|
|
104
|
+
|
|
105
|
+
// The message could not be decrypted successfully.
|
|
106
|
+
//
|
|
107
|
+
// This indicates a failure in the cryptographic layer, such as:
|
|
108
|
+
//
|
|
109
|
+
// - incorrect key material
|
|
110
|
+
// - corrupted ciphertext
|
|
111
|
+
DECRYPTION_FAILED = 7;
|
|
112
|
+
|
|
113
|
+
// The message signature or authentication could not be verified.
|
|
114
|
+
//
|
|
115
|
+
// This indicates that the message integrity or authenticity check failed.
|
|
116
|
+
VERIFICATION_FAILED = 8;
|
|
117
|
+
|
|
118
|
+
// The message format is invalid.
|
|
119
|
+
//
|
|
120
|
+
// This includes errors such as:
|
|
121
|
+
//
|
|
122
|
+
// - protobuf parsing failures
|
|
123
|
+
// - missing required fields
|
|
124
|
+
// - structurally invalid messages
|
|
125
|
+
FORMAT_ERROR = 9;
|
|
126
|
+
|
|
127
|
+
// The request was rejected by the counter-party
|
|
128
|
+
//
|
|
129
|
+
// This might be used to indicate the user or system that received the
|
|
130
|
+
// requested rejected it.
|
|
131
|
+
REJECTED = 10;
|
|
132
|
+
|
|
133
|
+
// The pair handshake failed because the two parties' advertised
|
|
134
|
+
// `ParameterRange` values do not overlap on at least one field
|
|
135
|
+
// (e.g. local `minShareSize` exceeds peer `maxShareSize`).
|
|
136
|
+
//
|
|
137
|
+
// Sent on a `PairResponseMessage`; the `memo` field SHOULD describe
|
|
138
|
+
// the offending field and the two `(min, max)` pairs so the
|
|
139
|
+
// initiator can surface a useful diagnostic.
|
|
140
|
+
INCOMPATIBLE_PARAMETER_RANGE = 11;
|
|
141
|
+
|
|
142
|
+
// The announced transport protocol is one the recipient cannot serve.
|
|
143
|
+
//
|
|
144
|
+
// Returned only for a transport change on an **already-established**
|
|
145
|
+
// channel — an `UpdateChannelInfo` announcing a switch the recipient
|
|
146
|
+
// cannot follow. The recipient still holds the peer's previous working
|
|
147
|
+
// endpoint, which is what makes this refusal deliverable at all.
|
|
148
|
+
//
|
|
149
|
+
// It is deliberately **not** used during pairing. Delivery is push-only,
|
|
150
|
+
// so a party that cannot reach a peer also cannot deliver a rejection to
|
|
151
|
+
// it; pairing incompatibility surfaces locally to the application
|
|
152
|
+
// instead.
|
|
153
|
+
UNSUPPORTED_TRANSPORT_PROTOCOL = 12;
|
|
154
|
+
|
|
155
|
+
// A share already exists for this (secretId, version) with different
|
|
156
|
+
// content, so the write was refused.
|
|
157
|
+
//
|
|
158
|
+
// Exactly one writer owns a version. A recipient stores the first write
|
|
159
|
+
// it sees at a version; a later write carrying different bytes is
|
|
160
|
+
// rejected with this status rather than overwriting or coexisting. A
|
|
161
|
+
// byte-identical re-send is an idempotent retry and returns `OK`.
|
|
162
|
+
//
|
|
163
|
+
// Because a single writer always derives `version` as
|
|
164
|
+
// `latest_version + 1`, it can never rewrite a version with different
|
|
165
|
+
// content. Receiving this status therefore means a *second* writer
|
|
166
|
+
// published concurrently — typically the same user acting on two
|
|
167
|
+
// devices at once. Resolution is the application's responsibility: the
|
|
168
|
+
// round has failed and should be republished at a new version.
|
|
169
|
+
VERSION_CONFLICT = 13;
|
|
170
|
+
|
|
171
|
+
// A replica pairing named a `replicaId` that is already in use by another
|
|
172
|
+
// member of the group — including the recipient itself.
|
|
173
|
+
//
|
|
174
|
+
// Every member of a group must be uniquely identified: the roster is keyed
|
|
175
|
+
// by `replicaId`, and messages between members are attributed by it. Two
|
|
176
|
+
// members sharing an id would overwrite each other's roster row and make
|
|
177
|
+
// every acknowledgement ambiguous.
|
|
178
|
+
//
|
|
179
|
+
// `replicaId` is assigned by the application, so a collision is a
|
|
180
|
+
// configuration fault — most often the same identity reused on two devices,
|
|
181
|
+
// such as a cloned device image. Resolution is the application's: assign a
|
|
182
|
+
// distinct id and pair again. The protocol cannot pick one, because it
|
|
183
|
+
// cannot know which device is meant to keep the original.
|
|
184
|
+
//
|
|
185
|
+
// Reported before fingerprint verification: there is no point asking a user
|
|
186
|
+
// to confirm a pairing that cannot be completed.
|
|
187
|
+
REPLICA_ID_CONFLICT = 14;
|
|
188
|
+
|
|
189
|
+
// The Helper is requesting that the Owner terminate the relationship.
|
|
190
|
+
//
|
|
191
|
+
// The Owner SHOULD respond by sending an UnpairRequestMessage and
|
|
192
|
+
// ceasing further communication on the channel.
|
|
193
|
+
REQUEST_TO_CLOSE = 99;
|
|
194
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
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 "result.proto";
|
|
10
|
+
import "transportprotocol.proto";
|
|
11
|
+
|
|
12
|
+
package org.derecalliance.derec.protobuf;
|
|
13
|
+
|
|
14
|
+
// GetSecretIdsVersionsRequestMessage requests the list of all secrets and
|
|
15
|
+
// corresponding share versions that a Helper stores for a given Owner.
|
|
16
|
+
//
|
|
17
|
+
// # Context
|
|
18
|
+
//
|
|
19
|
+
// This message is used during the recovery flow, after the Owner has
|
|
20
|
+
// re-paired with a Helper (typically in recovery mode).
|
|
21
|
+
//
|
|
22
|
+
// Since the recovering Owner does not know which secrets or versions
|
|
23
|
+
// the Helper holds, this message allows discovery of:
|
|
24
|
+
//
|
|
25
|
+
// - all secretIds associated with the Owner
|
|
26
|
+
// - all share versions stored for each secret
|
|
27
|
+
//
|
|
28
|
+
// # Semantics
|
|
29
|
+
//
|
|
30
|
+
// The Helper responds with a GetSecretIdsVersionsResponseMessage containing:
|
|
31
|
+
//
|
|
32
|
+
// - one entry per secretId
|
|
33
|
+
// - the list of versions stored for each secret
|
|
34
|
+
//
|
|
35
|
+
// # Authorization Rules
|
|
36
|
+
//
|
|
37
|
+
// The Helper MUST only fully process this request if it is received through
|
|
38
|
+
// a communication channel that was established in recovery mode and has been
|
|
39
|
+
// associated (via authentication) with the same Owner as previously stored
|
|
40
|
+
// secrets.
|
|
41
|
+
//
|
|
42
|
+
// If this condition is not met, the Helper MAY:
|
|
43
|
+
//
|
|
44
|
+
// - return only partial information (e.g., for the current channel), or
|
|
45
|
+
// - reject the request entirely
|
|
46
|
+
//
|
|
47
|
+
// # Authentication
|
|
48
|
+
//
|
|
49
|
+
// The Helper MUST authenticate the requester at the application level before
|
|
50
|
+
// disclosing any information about stored secrets. Authentication is outside
|
|
51
|
+
// the scope of the protocol and may include:
|
|
52
|
+
//
|
|
53
|
+
// - in-person verification
|
|
54
|
+
// - KYC processes
|
|
55
|
+
// - biometrics or credentials
|
|
56
|
+
//
|
|
57
|
+
// # Idempotency
|
|
58
|
+
//
|
|
59
|
+
// This request is idempotent. Repeated requests SHOULD return the same
|
|
60
|
+
// information unless the underlying storage changes.
|
|
61
|
+
message GetSecretIdsVersionsRequestMessage {
|
|
62
|
+
// Timestamp indicating when this message was created.
|
|
63
|
+
//
|
|
64
|
+
// This value is expressed in UTC and can be used for:
|
|
65
|
+
//
|
|
66
|
+
// - observability and logging
|
|
67
|
+
// - replay detection (in combination with sequence numbers)
|
|
68
|
+
// - timeout handling
|
|
69
|
+
google.protobuf.Timestamp timestamp = 1;
|
|
70
|
+
|
|
71
|
+
// Formerly the singular `replyTo`, superseded by `replyToTransports`.
|
|
72
|
+
reserved 2;
|
|
73
|
+
reserved "replyTo";
|
|
74
|
+
|
|
75
|
+
// Every ephemeral endpoint the requester wants this exchange's response
|
|
76
|
+
// delivered to, in its own preference order.
|
|
77
|
+
//
|
|
78
|
+
// See `StoreShareRequestMessage.replyToTransports` for full semantics.
|
|
79
|
+
repeated TransportProtocol replyToTransports = 4;
|
|
80
|
+
|
|
81
|
+
// Identity of the replica-group member this message concerns.
|
|
82
|
+
//
|
|
83
|
+
// Present **only** on the replica path, where a member drives catch-up
|
|
84
|
+
// against another member. Absent on the owner ↔ helper path, which is
|
|
85
|
+
// unchanged.
|
|
86
|
+
//
|
|
87
|
+
// Every member of a group is addressed on one shared `channel_id`, so the
|
|
88
|
+
// channel cannot name the peer — this field does. Its presence is also what
|
|
89
|
+
// tells the receiver which path a message belongs to.
|
|
90
|
+
optional uint64 replicaId = 3;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// GetSecretIdsVersionsResponseMessage returns the list of all secrets and
|
|
95
|
+
// their corresponding share versions stored by the Helper for the Owner.
|
|
96
|
+
//
|
|
97
|
+
// # Semantics
|
|
98
|
+
//
|
|
99
|
+
// Each entry in `secretList` represents:
|
|
100
|
+
//
|
|
101
|
+
// - a `secretId` previously shared by the Owner
|
|
102
|
+
// - the list of share versions currently stored for that secret
|
|
103
|
+
//
|
|
104
|
+
// This allows the recovering Owner to:
|
|
105
|
+
//
|
|
106
|
+
// - discover which secrets exist
|
|
107
|
+
// - determine which versions to request via GetShareRequestMessage
|
|
108
|
+
//
|
|
109
|
+
// # Authorization and Privacy
|
|
110
|
+
//
|
|
111
|
+
// The Helper MUST ensure that:
|
|
112
|
+
//
|
|
113
|
+
// - the requester is authenticated as the same Owner
|
|
114
|
+
// - the request originates from a recovery-mode channel
|
|
115
|
+
//
|
|
116
|
+
// Only under these conditions may the Helper return the full list of secrets.
|
|
117
|
+
//
|
|
118
|
+
// Otherwise, the Helper MUST:
|
|
119
|
+
//
|
|
120
|
+
// - return partial data (e.g., only for the current secretId), or
|
|
121
|
+
// - return a failure result
|
|
122
|
+
//
|
|
123
|
+
// # Security Considerations
|
|
124
|
+
//
|
|
125
|
+
// - This message reveals metadata about stored secrets
|
|
126
|
+
// - It MUST only be sent over an authenticated and encrypted channel
|
|
127
|
+
// - Unauthorized disclosure could leak information about user activity
|
|
128
|
+
//
|
|
129
|
+
// # Idempotency
|
|
130
|
+
//
|
|
131
|
+
// For a given Helper state, repeated responses SHOULD return the same data.
|
|
132
|
+
message GetSecretIdsVersionsResponseMessage {
|
|
133
|
+
|
|
134
|
+
// Result of processing the request.
|
|
135
|
+
//
|
|
136
|
+
// Indicates whether the request was successfully processed or rejected.
|
|
137
|
+
DeRecResult result = 1;
|
|
138
|
+
|
|
139
|
+
// List of secrets and their stored versions.
|
|
140
|
+
//
|
|
141
|
+
// Each entry corresponds to one secretId and the versions available
|
|
142
|
+
// for that secret.
|
|
143
|
+
repeated VersionList secretList = 2;
|
|
144
|
+
|
|
145
|
+
// Timestamp indicating when this message was created.
|
|
146
|
+
//
|
|
147
|
+
// This value is expressed in UTC and can be used for:
|
|
148
|
+
//
|
|
149
|
+
// - observability and logging
|
|
150
|
+
// - replay detection (in combination with sequence numbers)
|
|
151
|
+
// - timeout handling
|
|
152
|
+
google.protobuf.Timestamp timestamp = 3;
|
|
153
|
+
|
|
154
|
+
// Identity of the replica-group member this message concerns.
|
|
155
|
+
//
|
|
156
|
+
// Present **only** on the replica path, where a member drives catch-up
|
|
157
|
+
// against another member. Absent on the owner ↔ helper path, which is
|
|
158
|
+
// unchanged.
|
|
159
|
+
//
|
|
160
|
+
// Every member of a group is addressed on one shared `channel_id`, so the
|
|
161
|
+
// channel cannot name the peer — this field does. Its presence is also what
|
|
162
|
+
// tells the receiver which path a message belongs to.
|
|
163
|
+
optional uint64 replicaId = 4;
|
|
164
|
+
|
|
165
|
+
// VersionList groups the share versions stored for a single secretId.
|
|
166
|
+
//
|
|
167
|
+
// # Semantics
|
|
168
|
+
//
|
|
169
|
+
// - `secretId` uniquely identifies a secret
|
|
170
|
+
// - `versions` lists all share versions currently stored for that secret,
|
|
171
|
+
// each paired with a human-readable description
|
|
172
|
+
//
|
|
173
|
+
// The order of versions is not significant unless defined by the
|
|
174
|
+
// implementation.
|
|
175
|
+
message VersionList {
|
|
176
|
+
// Identifier of the secret.
|
|
177
|
+
uint64 secretId = 1;
|
|
178
|
+
|
|
179
|
+
// List of share versions stored for this secret.
|
|
180
|
+
//
|
|
181
|
+
// Each entry carries the numeric version identifier together with the
|
|
182
|
+
// human-readable description that was supplied by the Owner when the
|
|
183
|
+
// share was stored. Descriptions help the recovering Owner identify
|
|
184
|
+
// which secret corresponds to which identifier without relying on
|
|
185
|
+
// raw bytes alone.
|
|
186
|
+
repeated VersionEntry versions = 2;
|
|
187
|
+
|
|
188
|
+
// One stored version of a secret, paired with its human-readable label.
|
|
189
|
+
message VersionEntry {
|
|
190
|
+
// Numeric version identifier.
|
|
191
|
+
uint32 version = 1;
|
|
192
|
+
|
|
193
|
+
// Human-readable description supplied by the Owner at share-storage time.
|
|
194
|
+
//
|
|
195
|
+
// May be empty if no description was provided.
|
|
196
|
+
string versionDescription = 2;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|