@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.
- package/README.md +410 -9
- 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/Convert.cpp +9 -0
- package/cpp/Convert.h +8 -2
- package/cpp/Primitives.cpp +123 -29
- package/cpp/ProtocolHost.cpp +4 -5
- package/cpp/StoreCallbacks.cpp +148 -61
- package/cpp/StoreCallbacks.h +8 -1
- package/cpp/derec_ffi.h +127 -48
- package/ios/DeRecFFI.xcframework/Info.plist +5 -5
- package/ios/DeRecFFI.xcframework/ios-arm64/Headers/derec_ffi.h +127 -48
- package/ios/DeRecFFI.xcframework/ios-arm64/libderec_library.a +0 -0
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/Headers/derec_ffi.h +127 -48
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/libderec_library.a +2 -2
- package/lib/errors.d.ts +11 -1
- package/lib/errors.js +66 -1
- package/lib/messages.js +5 -3
- package/lib/primitives.d.ts +3 -3
- package/lib/primitives.js +7 -3
- package/lib/protocol.d.ts +110 -10
- package/lib/protocol.js +166 -11
- package/lib/types.d.ts +474 -48
- package/lib/types.js +23 -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 +258 -0
- package/schema/proto/derecmessage.proto +232 -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 +163 -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 +69 -1
- package/src/messages.ts +5 -3
- package/src/primitives.ts +19 -4
- package/src/protocol.ts +175 -13
- package/src/types.ts +481 -52
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
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
|
+
// StoreShareRequestMessage instructs a Helper to store a share for a given
|
|
15
|
+
// secret and manage the set of retained share versions.
|
|
16
|
+
//
|
|
17
|
+
// # Context
|
|
18
|
+
//
|
|
19
|
+
// This message is used in the sharing flow when:
|
|
20
|
+
//
|
|
21
|
+
// - a new secret is created
|
|
22
|
+
// - an existing secret is updated
|
|
23
|
+
// - the helper set or recovery threshold changes
|
|
24
|
+
//
|
|
25
|
+
// The Owner sends this message to each Helper to:
|
|
26
|
+
//
|
|
27
|
+
// - store (or replace) a specific share version
|
|
28
|
+
// - name the one older version that must be retained (keepVersion)
|
|
29
|
+
//
|
|
30
|
+
// # Semantics
|
|
31
|
+
//
|
|
32
|
+
// This message carries two instructions:
|
|
33
|
+
//
|
|
34
|
+
// 1. Share storage/update:
|
|
35
|
+
// - If `share` is present, the Helper MUST store this share under the
|
|
36
|
+
// specified `version`
|
|
37
|
+
// - If the version already exists, the Helper MUST replace it
|
|
38
|
+
//
|
|
39
|
+
// 2. Retention:
|
|
40
|
+
// - Once the share is stored, the Helper MUST delete every version it
|
|
41
|
+
// holds for this secret on this channel other than `version` and
|
|
42
|
+
// `keepVersion`
|
|
43
|
+
// - `keepVersion = 0` retains no version other than `version`
|
|
44
|
+
//
|
|
45
|
+
// A Helper therefore holds at most two versions of a secret: the one being
|
|
46
|
+
// shared and the last version the Owner considers valid.
|
|
47
|
+
//
|
|
48
|
+
// # Consistency Requirements
|
|
49
|
+
//
|
|
50
|
+
// The Owner MUST ensure that for a given (secretId, version):
|
|
51
|
+
//
|
|
52
|
+
// - all Helpers receive identical share contents
|
|
53
|
+
//
|
|
54
|
+
// It is an error for different shares to be associated with the same
|
|
55
|
+
// version and secretId.
|
|
56
|
+
//
|
|
57
|
+
// # Replay Protection
|
|
58
|
+
//
|
|
59
|
+
// To prevent replay attacks:
|
|
60
|
+
//
|
|
61
|
+
// - If `version` is less than the latest stored version,
|
|
62
|
+
// the Helper MUST ignore the `keepVersion` field
|
|
63
|
+
//
|
|
64
|
+
// This ensures that stale messages cannot cause deletion of newer shares.
|
|
65
|
+
//
|
|
66
|
+
// # Share Opacity
|
|
67
|
+
//
|
|
68
|
+
// The Helper MUST treat the `share` field as opaque data. It is not required
|
|
69
|
+
// to understand or validate the share contents.
|
|
70
|
+
//
|
|
71
|
+
// # Idempotency
|
|
72
|
+
//
|
|
73
|
+
// This message is idempotent:
|
|
74
|
+
//
|
|
75
|
+
// - Re-sending the same (version, share) pair SHOULD result in the same state
|
|
76
|
+
// - Re-applying the same keepVersion SHOULD not change state after the first time
|
|
77
|
+
message StoreShareRequestMessage {
|
|
78
|
+
|
|
79
|
+
// Share bytes to be stored by the Helper.
|
|
80
|
+
//
|
|
81
|
+
// This is an opaque byte array produced by the share distribution
|
|
82
|
+
// algorithm. The Helper MUST store it without interpretation.
|
|
83
|
+
bytes share = 1;
|
|
84
|
+
|
|
85
|
+
// Identifier of the algorithm used to produce the share.
|
|
86
|
+
//
|
|
87
|
+
// This allows the Owner and Helper to coordinate on how the share
|
|
88
|
+
// should be interpreted during recovery.
|
|
89
|
+
//
|
|
90
|
+
// Algorithm 0 defines the share as a serialized `CommittedDeRecShare`
|
|
91
|
+
// protobuf message (see DeRec cryptography repository).
|
|
92
|
+
//
|
|
93
|
+
// Implementations SHOULD support algorithm 0 for interoperability.
|
|
94
|
+
int32 shareAlgorithm = 2;
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// Identifier of the secret to which this share belongs.
|
|
98
|
+
//
|
|
99
|
+
// Used by the Helper to associate the share with the correct secret in the
|
|
100
|
+
// share store under the composite key (channel_id, secret_id, version).
|
|
101
|
+
uint64 secretId = 3;
|
|
102
|
+
|
|
103
|
+
// Version number of the share.
|
|
104
|
+
//
|
|
105
|
+
// Each resharing event increments this value.
|
|
106
|
+
uint32 version = 4;
|
|
107
|
+
|
|
108
|
+
// The one version, other than `version`, that the Helper MUST retain.
|
|
109
|
+
//
|
|
110
|
+
// The Owner sets it to the last version it considers valid, which is never
|
|
111
|
+
// the version being shared. Every other stored version MUST be deleted
|
|
112
|
+
// once the share is stored. `0` retains no other version.
|
|
113
|
+
//
|
|
114
|
+
// A value equal to or greater than `version` is invalid: the Helper MUST
|
|
115
|
+
// reject the request and store nothing.
|
|
116
|
+
//
|
|
117
|
+
// This field MUST be ignored if `version` is older than the latest
|
|
118
|
+
// version already stored, to prevent replay attacks.
|
|
119
|
+
uint32 keepVersion = 5;
|
|
120
|
+
|
|
121
|
+
// Optional human-readable description of this share version.
|
|
122
|
+
//
|
|
123
|
+
// This field is visible to the Helper and is not intended to carry
|
|
124
|
+
// sensitive information. It may be used for debugging, labeling, or
|
|
125
|
+
// user-facing display.
|
|
126
|
+
string versionDescription = 6;
|
|
127
|
+
|
|
128
|
+
// Timestamp indicating when this message was created.
|
|
129
|
+
//
|
|
130
|
+
// Used for observability, replay detection, and timeout handling.
|
|
131
|
+
google.protobuf.Timestamp timestamp = 7;
|
|
132
|
+
|
|
133
|
+
// Formerly the singular `replyTo`, superseded by `replyToTransports`.
|
|
134
|
+
reserved 8;
|
|
135
|
+
reserved "replyTo";
|
|
136
|
+
|
|
137
|
+
// Every ephemeral endpoint the requester wants this exchange's response
|
|
138
|
+
// delivered to, in its own preference order, overriding the channel's
|
|
139
|
+
// stored peer endpoints for this round-trip only.
|
|
140
|
+
//
|
|
141
|
+
// # When to use
|
|
142
|
+
//
|
|
143
|
+
// Set when the requester's outbound endpoint does not match the endpoint
|
|
144
|
+
// the responder has on file for the channel — for example a replica
|
|
145
|
+
// talking to a helper that was paired with a sibling replica. The
|
|
146
|
+
// responder routes the response here but does NOT persist these
|
|
147
|
+
// endpoints; use `UpdateChannelInfoRequestMessage` for permanent changes.
|
|
148
|
+
//
|
|
149
|
+
// # Semantics
|
|
150
|
+
//
|
|
151
|
+
// - Empty (the default): the responder routes to the endpoints stored on
|
|
152
|
+
// its `Channel` record for this `channelId`.
|
|
153
|
+
// - Non-empty: the responder routes the response to any one of these, in
|
|
154
|
+
// the order given, and leaves the stored endpoints unchanged. Delivery
|
|
155
|
+
// to any one is success.
|
|
156
|
+
repeated TransportProtocol replyToTransports = 10;
|
|
157
|
+
|
|
158
|
+
// Identity of the replica that authored this update.
|
|
159
|
+
//
|
|
160
|
+
// # Audience
|
|
161
|
+
//
|
|
162
|
+
// This field is for **replicas only**. Helpers know nothing about
|
|
163
|
+
// replicas and never receive it:
|
|
164
|
+
//
|
|
165
|
+
// - helper-bound (`SHARE_ALGORITHM_VSS`) — MUST be absent.
|
|
166
|
+
// - replica-bound (`SHARE_ALGORITHM_REPLICA_SECRET`) — MUST be present.
|
|
167
|
+
//
|
|
168
|
+
// The invariant is `replicaId.is_some() == (shareAlgorithm ==
|
|
169
|
+
// SHARE_ALGORITHM_REPLICA_SECRET)`, asserted on send and on receive; a
|
|
170
|
+
// violation is a protocol error, not a tolerated variation.
|
|
171
|
+
//
|
|
172
|
+
// # Why the receiver needs it
|
|
173
|
+
//
|
|
174
|
+
// Every member of a replica group shares one `channelId`, so the
|
|
175
|
+
// channel identifies the *group*, not the sender. The channel's
|
|
176
|
+
// counterparty says who established it, which after admission by a
|
|
177
|
+
// third member is not who wrote this message. Author attribution
|
|
178
|
+
// therefore comes from this field and never from the channel record.
|
|
179
|
+
//
|
|
180
|
+
// Applications use it to resolve which member published an update, and
|
|
181
|
+
// to route the response back to that member's endpoint.
|
|
182
|
+
//
|
|
183
|
+
// # Out of scope for the protocol
|
|
184
|
+
//
|
|
185
|
+
// The protocol does not authenticate the claim; anyone holding the
|
|
186
|
+
// group key may write any `replicaId`. It is an identifier, not an
|
|
187
|
+
// authenticator.
|
|
188
|
+
optional uint64 replicaId = 9;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// StoreShareResponseMessage is the response to a StoreShareRequestMessage.
|
|
192
|
+
//
|
|
193
|
+
// # Semantics
|
|
194
|
+
//
|
|
195
|
+
// This message indicates whether the Helper successfully:
|
|
196
|
+
//
|
|
197
|
+
// - stored or updated the requested share version
|
|
198
|
+
// - applied the retention policy (keepVersion)
|
|
199
|
+
//
|
|
200
|
+
// # Idempotency
|
|
201
|
+
//
|
|
202
|
+
// Multiple identical requests SHOULD produce identical responses.
|
|
203
|
+
message StoreShareResponseMessage {
|
|
204
|
+
|
|
205
|
+
// Result of processing the request.
|
|
206
|
+
//
|
|
207
|
+
// Indicates success or failure of the storage/update operation.
|
|
208
|
+
DeRecResult result = 1;
|
|
209
|
+
|
|
210
|
+
// Identifier of the secret to which this response refers.
|
|
211
|
+
//
|
|
212
|
+
// Echoed from the corresponding StoreShareRequestMessage so the Owner can
|
|
213
|
+
// correlate responses with the correct secret without inspecting the share
|
|
214
|
+
// bytes.
|
|
215
|
+
uint64 secretId = 2;
|
|
216
|
+
|
|
217
|
+
// Version number from the corresponding request.
|
|
218
|
+
//
|
|
219
|
+
// This allows the sender to correlate responses with requests.
|
|
220
|
+
uint32 version = 3;
|
|
221
|
+
|
|
222
|
+
// Timestamp indicating when this message was created.
|
|
223
|
+
//
|
|
224
|
+
// Used for observability, replay detection, and timeout handling.
|
|
225
|
+
google.protobuf.Timestamp timestamp = 4;
|
|
226
|
+
|
|
227
|
+
// Identity of the replica that produced this response.
|
|
228
|
+
//
|
|
229
|
+
// Present only when the corresponding request was replica-bound
|
|
230
|
+
// (`shareAlgorithm == SHARE_ALGORITHM_REPLICA_SECRET`); absent on
|
|
231
|
+
// helper responses, which carry no replica identity in either
|
|
232
|
+
// direction.
|
|
233
|
+
//
|
|
234
|
+
// # Why the requester needs it
|
|
235
|
+
//
|
|
236
|
+
// Every member of a replica group answers on the same `channelId`, and
|
|
237
|
+
// `secretId` and `version` are echoed identically by all of them. Two
|
|
238
|
+
// members responding to one publish are otherwise indistinguishable —
|
|
239
|
+
// the requester cannot tell whether both acknowledged or one
|
|
240
|
+
// acknowledged twice, and so cannot track a sharing round per member.
|
|
241
|
+
optional uint64 replicaId = 5;
|
|
242
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
/// Enumeration of supported transport protocols.
|
|
11
|
+
///
|
|
12
|
+
/// Additional values MAY be introduced in future versions of the protocol.
|
|
13
|
+
enum Protocol {
|
|
14
|
+
/// HTTPS-based transport.
|
|
15
|
+
///
|
|
16
|
+
/// Delivery is push-only. Each delivery to the peer's `uri` carries
|
|
17
|
+
/// exactly one serialized `DeRecMessage`. A response is never returned
|
|
18
|
+
/// on the delivery that carried the request: it is a separate delivery
|
|
19
|
+
/// to the sender's own advertised endpoint, so both parties must run a
|
|
20
|
+
/// reachable endpoint.
|
|
21
|
+
///
|
|
22
|
+
/// The HTTP method, headers, status codes and size limits are not part
|
|
23
|
+
/// of the protocol. Recommended conventions are in the Transports
|
|
24
|
+
/// section of the DeRec documentation.
|
|
25
|
+
///
|
|
26
|
+
/// URI forms:
|
|
27
|
+
///
|
|
28
|
+
/// - `https://host[:port]/path` — HTTP over TLS
|
|
29
|
+
/// - `http://host[:port]/path` — plaintext, development only
|
|
30
|
+
///
|
|
31
|
+
/// This is the default transport.
|
|
32
|
+
HTTPS = 0;
|
|
33
|
+
|
|
34
|
+
/// gRPC-based transport.
|
|
35
|
+
///
|
|
36
|
+
/// Messages are delivered as unary `DeRecTransport.Send` calls carrying a
|
|
37
|
+
/// `DeRecMessage` directly. Delivery is push-only: the call returns
|
|
38
|
+
/// `google.protobuf.Empty`, and every response is a fresh `Send` to the
|
|
39
|
+
/// peer's own endpoint, so both parties must run a reachable server.
|
|
40
|
+
///
|
|
41
|
+
/// URI forms:
|
|
42
|
+
///
|
|
43
|
+
/// - `grpcs://host:port` — gRPC over TLS
|
|
44
|
+
/// - `grpc://host:port` — plaintext, development only
|
|
45
|
+
GRPC = 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// TransportProtocol defines how a DeRec participant (Owner or Helper)
|
|
49
|
+
/// can be reached over the network.
|
|
50
|
+
///
|
|
51
|
+
/// This message encapsulates the transport-layer endpoint and the protocol
|
|
52
|
+
/// required to deliver DeRec messages to that endpoint. It is typically
|
|
53
|
+
/// exchanged during pairing (via ContactMessage) so that both parties know
|
|
54
|
+
/// how to establish communication channels.
|
|
55
|
+
///
|
|
56
|
+
/// A TransportProtocol does not itself provide security guarantees.
|
|
57
|
+
/// All DeRec protocol messages MUST still be signed and encrypted at the
|
|
58
|
+
/// application layer, regardless of the underlying transport.
|
|
59
|
+
///
|
|
60
|
+
/// # Semantics
|
|
61
|
+
///
|
|
62
|
+
/// - The `uri` identifies the remote endpoint (e.g., HTTPS URL, message queue).
|
|
63
|
+
/// - The `protocol` specifies how the URI should be interpreted and how
|
|
64
|
+
/// messages must be transmitted.
|
|
65
|
+
/// - The combination of (`protocol`, `uri`) MUST be sufficient for the sender
|
|
66
|
+
/// to deliver a DeRec message to the receiver.
|
|
67
|
+
///
|
|
68
|
+
/// # Usage
|
|
69
|
+
///
|
|
70
|
+
/// - Included in ContactMessage during pairing to advertise reachable endpoints.
|
|
71
|
+
/// - May be stored by peers as part of the communication channel state.
|
|
72
|
+
/// - Used by the sender to select the correct transport mechanism when
|
|
73
|
+
/// delivering protocol messages.
|
|
74
|
+
///
|
|
75
|
+
/// # Extensibility
|
|
76
|
+
///
|
|
77
|
+
/// The Protocol enum is expected to grow as new transport mechanisms are
|
|
78
|
+
/// supported (e.g., message queues, peer-to-peer transports). Implementations
|
|
79
|
+
/// MUST ignore unknown enum values unless explicitly required otherwise.
|
|
80
|
+
///
|
|
81
|
+
/// # Reliability
|
|
82
|
+
///
|
|
83
|
+
/// Every transport delivers one `DeRecMessage` per delivery and is push:
|
|
84
|
+
/// a response travels as a separate delivery to the requester's own
|
|
85
|
+
/// endpoint. Transports may be:
|
|
86
|
+
/// - direct (e.g., HTTPS, gRPC)
|
|
87
|
+
/// - store-and-forward (e.g., message queues)
|
|
88
|
+
///
|
|
89
|
+
/// Implementations MUST handle retries and idempotency at the protocol layer,
|
|
90
|
+
/// independent of transport guarantees.
|
|
91
|
+
message TransportProtocol {
|
|
92
|
+
/// URI endpoint used to contact the peer.
|
|
93
|
+
///
|
|
94
|
+
/// The format of this field depends on the selected `protocol`.
|
|
95
|
+
/// Examples:
|
|
96
|
+
///
|
|
97
|
+
/// - HTTPS: "https://example.com/derec" or "http://example.com/derec"
|
|
98
|
+
/// - gRPC: "grpcs://example.com:443" or "grpc://example.com:50051"
|
|
99
|
+
/// - Future protocols MAY define other URI schemes.
|
|
100
|
+
///
|
|
101
|
+
/// The URI MUST be sufficient to route messages to the intended recipient.
|
|
102
|
+
string uri = 1;
|
|
103
|
+
|
|
104
|
+
/// Transport protocol associated with the URI.
|
|
105
|
+
///
|
|
106
|
+
/// This determines:
|
|
107
|
+
/// - how the `uri` should be interpreted
|
|
108
|
+
/// - how messages are serialized and delivered
|
|
109
|
+
///
|
|
110
|
+
/// Implementations MUST support all mandatory protocol types defined here.
|
|
111
|
+
Protocol protocol = 2;
|
|
112
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
// UnpairRequestMessage requests termination of the DeRec relationship
|
|
15
|
+
// between two parties (Owner and Helper).
|
|
16
|
+
//
|
|
17
|
+
// # Context
|
|
18
|
+
//
|
|
19
|
+
// This message is used when:
|
|
20
|
+
//
|
|
21
|
+
// - the Owner no longer wants a Helper to store shares
|
|
22
|
+
// - the Helper chooses to stop acting as a Helper
|
|
23
|
+
// - the relationship must be terminated due to policy, failure, or user action
|
|
24
|
+
//
|
|
25
|
+
// # Semantics
|
|
26
|
+
//
|
|
27
|
+
// Upon receiving this message, the recipient MUST:
|
|
28
|
+
//
|
|
29
|
+
// - stop acting as a Helper for the corresponding channel
|
|
30
|
+
// - cease all protocol interactions for that channel
|
|
31
|
+
//
|
|
32
|
+
// The recipient SHOULD:
|
|
33
|
+
//
|
|
34
|
+
// - delete all stored shares and related state for the Owner
|
|
35
|
+
//
|
|
36
|
+
// However, deletion MAY be subject to:
|
|
37
|
+
//
|
|
38
|
+
// - regulatory requirements
|
|
39
|
+
// - contractual obligations
|
|
40
|
+
// - service-specific retention policies
|
|
41
|
+
//
|
|
42
|
+
// # Effects on Protocol State
|
|
43
|
+
//
|
|
44
|
+
// After a successful unpair:
|
|
45
|
+
//
|
|
46
|
+
// - the channel is considered permanently closed
|
|
47
|
+
// - the Owner MUST NOT rely on this Helper for recovery
|
|
48
|
+
// - the Owner SHOULD reshare secrets with remaining Helpers if necessary
|
|
49
|
+
//
|
|
50
|
+
// # Idempotency
|
|
51
|
+
//
|
|
52
|
+
// This message is idempotent. Repeated unpair requests SHOULD result in
|
|
53
|
+
// the same final state.
|
|
54
|
+
message UnpairRequestMessage {
|
|
55
|
+
|
|
56
|
+
// Optional human-readable explanation for the unpairing.
|
|
57
|
+
//
|
|
58
|
+
// This field is intended for logging, debugging, or user display.
|
|
59
|
+
// It MUST NOT be relied upon for protocol behavior.
|
|
60
|
+
string memo = 1;
|
|
61
|
+
|
|
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 = 2;
|
|
70
|
+
|
|
71
|
+
// Formerly the singular `replyTo`, superseded by `replyToTransports`.
|
|
72
|
+
reserved 3;
|
|
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 = 5;
|
|
80
|
+
|
|
81
|
+
// Identity of the replica-group member being removed. It names the target,
|
|
82
|
+
// not the sender: a removal is announced to every member, and the target is
|
|
83
|
+
// the one value they all agree on.
|
|
84
|
+
//
|
|
85
|
+
// A replica-originated unpair MUST carry it; an owner-originated one MUST
|
|
86
|
+
// NOT. Its presence is what tells the receiver which path the message
|
|
87
|
+
// belongs to, exactly as on `StoreShareRequestMessage`. Asserted on send
|
|
88
|
+
// and on receive; a violation is a protocol error.
|
|
89
|
+
//
|
|
90
|
+
// Removing a replica is not the same operation as unpairing a helper. A
|
|
91
|
+
// helper channel serves exactly one peer, so unpairing deletes it. Every
|
|
92
|
+
// member of a replica group shares one channel, so deleting it would sever
|
|
93
|
+
// the whole group — replica removal edits a member row instead, and this
|
|
94
|
+
// field says which row.
|
|
95
|
+
optional uint64 replicaId = 4;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// UnpairResponseMessage is the response to an UnpairRequestMessage.
|
|
99
|
+
//
|
|
100
|
+
// # Semantics
|
|
101
|
+
//
|
|
102
|
+
// This message indicates whether the recipient successfully processed
|
|
103
|
+
// the unpair request.
|
|
104
|
+
//
|
|
105
|
+
// On success:
|
|
106
|
+
//
|
|
107
|
+
// - the relationship is considered terminated
|
|
108
|
+
// - the recipient has ceased participation in the protocol for this channel
|
|
109
|
+
//
|
|
110
|
+
// On failure:
|
|
111
|
+
//
|
|
112
|
+
// - the relationship state is undefined and SHOULD be handled by the
|
|
113
|
+
// application (e.g., retry or escalate)
|
|
114
|
+
//
|
|
115
|
+
// # Idempotency
|
|
116
|
+
//
|
|
117
|
+
// Multiple identical unpair requests SHOULD produce consistent responses.
|
|
118
|
+
message UnpairResponseMessage {
|
|
119
|
+
// Result of processing the unpair request.
|
|
120
|
+
//
|
|
121
|
+
// Indicates whether the unpair operation was successfully completed.
|
|
122
|
+
DeRecResult result = 1;
|
|
123
|
+
|
|
124
|
+
// Timestamp indicating when this message was created.
|
|
125
|
+
//
|
|
126
|
+
// This value is expressed in UTC and can be used for:
|
|
127
|
+
//
|
|
128
|
+
// - observability and logging
|
|
129
|
+
// - replay detection (in combination with sequence numbers)
|
|
130
|
+
// - timeout handling
|
|
131
|
+
google.protobuf.Timestamp timestamp = 2;
|
|
132
|
+
}
|