@derec-alliance/react-native 0.0.1 → 0.0.2
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 +2 -2
- 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/derec_ffi.h +2 -3
- package/ios/DeRecFFI.xcframework/ios-arm64/Headers/derec_ffi.h +2 -3
- package/ios/DeRecFFI.xcframework/ios-arm64/libderec_library.a +0 -0
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/Headers/derec_ffi.h +2 -3
- package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/libderec_library.a +0 -0
- package/lib/errors.d.ts +2 -2
- package/lib/errors.js +2 -2
- package/lib/messages.d.ts +2 -2
- package/lib/messages.js +2 -2
- package/lib/protocol.d.ts +6 -6
- package/lib/protocol.js +6 -6
- package/lib/types.d.ts +15 -1
- package/package.json +1 -1
- package/src/errors.ts +2 -2
- package/src/messages.ts +2 -2
- package/src/protocol.ts +6 -6
- package/src/types.ts +15 -1
package/README.md
CHANGED
|
@@ -184,8 +184,8 @@ awaiting them additionally lets a failure surface instead of vanishing.
|
|
|
184
184
|
|
|
185
185
|
**The `DeRecErrorCategory` union differs from nodejs's.** This SDK's union
|
|
186
186
|
omits `"wasm"`, which a C-ABI binding can never emit, and adds `"ok"`,
|
|
187
|
-
`"ffi"` and `"state_store"`, which it can. A test pins the union to
|
|
188
|
-
|
|
187
|
+
`"ffi"` and `"state_store"`, which it can. A test pins the union to the crate's shared enum fixture so it stays in step
|
|
188
|
+
with the Rust enum.
|
|
189
189
|
|
|
190
190
|
**Ids are decimal strings in stores, `bigint | number` on `DeRecProtocol`.**
|
|
191
191
|
Store interfaces (`ChannelStore`, `ShareStore`, event fields such as
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp/derec_ffi.h
CHANGED
|
@@ -267,9 +267,8 @@
|
|
|
267
267
|
* Discriminants selecting which message [`derec_decode_message_json`] and
|
|
268
268
|
* [`derec_encode_message_json`] operate on.
|
|
269
269
|
*
|
|
270
|
-
* Mirrored in
|
|
271
|
-
*
|
|
272
|
-
* unhandled value.
|
|
270
|
+
* Mirrored in the shared enum fixture, which every SDK asserts against, so a
|
|
271
|
+
* message added here cannot reach a binding as a silently unhandled value.
|
|
273
272
|
*/
|
|
274
273
|
#define DEREC_MESSAGE_KIND_PAIR_REQUEST 0
|
|
275
274
|
|
|
@@ -267,9 +267,8 @@
|
|
|
267
267
|
* Discriminants selecting which message [`derec_decode_message_json`] and
|
|
268
268
|
* [`derec_encode_message_json`] operate on.
|
|
269
269
|
*
|
|
270
|
-
* Mirrored in
|
|
271
|
-
*
|
|
272
|
-
* unhandled value.
|
|
270
|
+
* Mirrored in the shared enum fixture, which every SDK asserts against, so a
|
|
271
|
+
* message added here cannot reach a binding as a silently unhandled value.
|
|
273
272
|
*/
|
|
274
273
|
#define DEREC_MESSAGE_KIND_PAIR_REQUEST 0
|
|
275
274
|
|
|
Binary file
|
|
@@ -267,9 +267,8 @@
|
|
|
267
267
|
* Discriminants selecting which message [`derec_decode_message_json`] and
|
|
268
268
|
* [`derec_encode_message_json`] operate on.
|
|
269
269
|
*
|
|
270
|
-
* Mirrored in
|
|
271
|
-
*
|
|
272
|
-
* unhandled value.
|
|
270
|
+
* Mirrored in the shared enum fixture, which every SDK asserts against, so a
|
|
271
|
+
* message added here cannot reach a binding as a silently unhandled value.
|
|
273
272
|
*/
|
|
274
273
|
#define DEREC_MESSAGE_KIND_PAIR_REQUEST 0
|
|
275
274
|
|
|
Binary file
|
package/lib/errors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Every category name `derec_error_category_name` can return, and no others.
|
|
3
3
|
*
|
|
4
|
-
* This is the authoritative list for this SDK,
|
|
5
|
-
*
|
|
4
|
+
* This is the authoritative list for this SDK, held to the Rust enum by a
|
|
5
|
+
* test against the shared enum fixture so the two cannot drift.
|
|
6
6
|
* It deliberately differs from `@derec-alliance/nodejs`'s union, which was
|
|
7
7
|
* the original source of this file: that union lists `"wasm"`, a category no
|
|
8
8
|
* C-ABI binding can ever emit, and omits `"ok"`, `"ffi"` and `"state_store"`,
|
package/lib/errors.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.DEREC_ERROR_CATEGORIES = void 0;
|
|
|
6
6
|
/**
|
|
7
7
|
* Every category name `derec_error_category_name` can return, and no others.
|
|
8
8
|
*
|
|
9
|
-
* This is the authoritative list for this SDK,
|
|
10
|
-
*
|
|
9
|
+
* This is the authoritative list for this SDK, held to the Rust enum by a
|
|
10
|
+
* test against the shared enum fixture so the two cannot drift.
|
|
11
11
|
* It deliberately differs from `@derec-alliance/nodejs`'s union, which was
|
|
12
12
|
* the original source of this file: that union lists `"wasm"`, a category no
|
|
13
13
|
* C-ABI binding can ever emit, and omits `"ok"`, `"ffi"` and `"state_store"`,
|
package/lib/messages.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Selects which message the JSON codec operates on.
|
|
3
3
|
*
|
|
4
|
-
* Mirrors
|
|
5
|
-
*
|
|
4
|
+
* Mirrors the crate's `MessageKind`, which the shared enum fixture holds
|
|
5
|
+
* both sides to — so a message
|
|
6
6
|
* added in Rust cannot reach this SDK as a silently unhandled value.
|
|
7
7
|
*/
|
|
8
8
|
export declare enum MessageKind {
|
package/lib/messages.js
CHANGED
|
@@ -42,8 +42,8 @@ const native_1 = require("./native");
|
|
|
42
42
|
/**
|
|
43
43
|
* Selects which message the JSON codec operates on.
|
|
44
44
|
*
|
|
45
|
-
* Mirrors
|
|
46
|
-
*
|
|
45
|
+
* Mirrors the crate's `MessageKind`, which the shared enum fixture holds
|
|
46
|
+
* both sides to — so a message
|
|
47
47
|
* added in Rust cannot reach this SDK as a silently unhandled value.
|
|
48
48
|
*/
|
|
49
49
|
var MessageKind;
|
package/lib/protocol.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type { AutoAcceptPolicy, ChannelStore, ContactMessage, ContactMode, DeRec
|
|
|
7
7
|
type NativeHost = Record<string, (...args: any[]) => any>;
|
|
8
8
|
/**
|
|
9
9
|
* Maps a transport protocol name to the `derec_proto::Protocol` discriminant.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* The shared enum fixture every other numeric mapping in this SDK is checked
|
|
11
|
+
* against does not carry this enum (it
|
|
12
12
|
* only covers the Rust-internal serde enums listed under its `"enums"` key);
|
|
13
13
|
* the transport `Protocol` enum lives in `protobufs/transportprotocol.proto`
|
|
14
14
|
* instead, where only `HTTPS = 0` is currently defined.
|
|
@@ -20,8 +20,8 @@ export declare function protocolDiscriminant(protocol: string): number;
|
|
|
20
20
|
* byte values, matching `UserSecretJson`'s plain `Vec<u8>` fields — no
|
|
21
21
|
* base64, no wrapping.
|
|
22
22
|
*
|
|
23
|
-
* Exported so it can be golden-tested against
|
|
24
|
-
*
|
|
23
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
24
|
+
* without a native module.
|
|
25
25
|
*/
|
|
26
26
|
export declare function buildProtectSecretParams(params: ProtectSecretParams): Record<string, unknown>;
|
|
27
27
|
/**
|
|
@@ -33,8 +33,8 @@ export declare function buildProtectSecretParams(params: ProtectSecretParams): R
|
|
|
33
33
|
* the shared golden fixture byte-for-byte; `replicas` is omitted entirely
|
|
34
34
|
* when the recovered secret has no replica group.
|
|
35
35
|
*
|
|
36
|
-
* Exported so it can be golden-tested against
|
|
37
|
-
*
|
|
36
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
37
|
+
* without a native module.
|
|
38
38
|
*/
|
|
39
39
|
export declare function buildRestoreParams(recoveredSecret: Extract<DeRecEvent, {
|
|
40
40
|
type: 'SecretRecovered';
|
package/lib/protocol.js
CHANGED
|
@@ -52,8 +52,8 @@ function decodeEvents(buffer) {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Maps a transport protocol name to the `derec_proto::Protocol` discriminant.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* The shared enum fixture every other numeric mapping in this SDK is checked
|
|
56
|
+
* against does not carry this enum (it
|
|
57
57
|
* only covers the Rust-internal serde enums listed under its `"enums"` key);
|
|
58
58
|
* the transport `Protocol` enum lives in `protobufs/transportprotocol.proto`
|
|
59
59
|
* instead, where only `HTTPS = 0` is currently defined.
|
|
@@ -81,8 +81,8 @@ function encodeTarget(target) {
|
|
|
81
81
|
* byte values, matching `UserSecretJson`'s plain `Vec<u8>` fields — no
|
|
82
82
|
* base64, no wrapping.
|
|
83
83
|
*
|
|
84
|
-
* Exported so it can be golden-tested against
|
|
85
|
-
*
|
|
84
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
85
|
+
* without a native module.
|
|
86
86
|
*/
|
|
87
87
|
function buildProtectSecretParams(params) {
|
|
88
88
|
const out = {
|
|
@@ -109,8 +109,8 @@ function communicationInfoOrOmit(info) {
|
|
|
109
109
|
* the shared golden fixture byte-for-byte; `replicas` is omitted entirely
|
|
110
110
|
* when the recovered secret has no replica group.
|
|
111
111
|
*
|
|
112
|
-
* Exported so it can be golden-tested against
|
|
113
|
-
*
|
|
112
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
113
|
+
* without a native module.
|
|
114
114
|
*/
|
|
115
115
|
function buildRestoreParams(recoveredSecret, version) {
|
|
116
116
|
const recovered = {
|
package/lib/types.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface SecretStore {
|
|
|
44
44
|
*
|
|
45
45
|
* Do not `JSON.parse` and re-serialise. Every id in these records is a `u64`,
|
|
46
46
|
* and `JSON.parse` silently rounds anything above 2^53 — the corruption only
|
|
47
|
-
* appears once a real id happens to be large.
|
|
47
|
+
* appears once a real id happens to be large.
|
|
48
48
|
*/
|
|
49
49
|
export interface ChannelStore {
|
|
50
50
|
load(secretId: string, channelId: string, replicaId: string): Promise<Uint8Array | null | undefined>;
|
|
@@ -788,6 +788,8 @@ export interface GetSecretIdsVersionsRequestMessage {
|
|
|
788
788
|
/** Ephemeral endpoint where the requester wants the response routed.
|
|
789
789
|
* Absent means "use the channel's stored peer endpoint". */
|
|
790
790
|
reply_to?: TransportProtocol;
|
|
791
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
792
|
+
replica_id?: bigint;
|
|
791
793
|
}
|
|
792
794
|
export interface VersionList {
|
|
793
795
|
secret_id: bigint;
|
|
@@ -801,6 +803,8 @@ export interface GetSecretIdsVersionsResponseMessage {
|
|
|
801
803
|
result?: DeRecResult;
|
|
802
804
|
secret_list: VersionList[];
|
|
803
805
|
timestamp?: Timestamp;
|
|
806
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
807
|
+
replica_id?: bigint;
|
|
804
808
|
}
|
|
805
809
|
export interface VersionEntry {
|
|
806
810
|
version: number;
|
|
@@ -879,6 +883,8 @@ export interface GetShareRequestMessage {
|
|
|
879
883
|
timestamp?: Timestamp;
|
|
880
884
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
881
885
|
reply_to?: TransportProtocol;
|
|
886
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
887
|
+
replica_id?: bigint;
|
|
882
888
|
}
|
|
883
889
|
export interface GetShareResponseMessage {
|
|
884
890
|
share_algorithm: number;
|
|
@@ -890,6 +896,8 @@ export interface GetShareResponseMessage {
|
|
|
890
896
|
secret_id: bigint;
|
|
891
897
|
/** Echoed from the request for the same correlation reasons as `secret_id`. */
|
|
892
898
|
version: number;
|
|
899
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
900
|
+
replica_id?: bigint;
|
|
893
901
|
}
|
|
894
902
|
export interface SiblingHash {
|
|
895
903
|
is_left: boolean;
|
|
@@ -910,18 +918,24 @@ export interface StoreShareRequestMessage {
|
|
|
910
918
|
secret_id: bigint;
|
|
911
919
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
912
920
|
reply_to?: TransportProtocol;
|
|
921
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
922
|
+
replica_id?: bigint;
|
|
913
923
|
}
|
|
914
924
|
export interface StoreShareResponseMessage {
|
|
915
925
|
result?: DeRecResult;
|
|
916
926
|
version: number;
|
|
917
927
|
timestamp?: Timestamp;
|
|
918
928
|
secret_id: bigint;
|
|
929
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
930
|
+
replica_id?: bigint;
|
|
919
931
|
}
|
|
920
932
|
export interface UnpairRequestMessage {
|
|
921
933
|
memo: string;
|
|
922
934
|
timestamp?: Timestamp;
|
|
923
935
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
924
936
|
reply_to?: TransportProtocol;
|
|
937
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
938
|
+
replica_id?: bigint;
|
|
925
939
|
}
|
|
926
940
|
export interface UnpairResponseMessage {
|
|
927
941
|
result?: DeRecResult;
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Every category name `derec_error_category_name` can return, and no others.
|
|
6
6
|
*
|
|
7
|
-
* This is the authoritative list for this SDK,
|
|
8
|
-
*
|
|
7
|
+
* This is the authoritative list for this SDK, held to the Rust enum by a
|
|
8
|
+
* test against the shared enum fixture so the two cannot drift.
|
|
9
9
|
* It deliberately differs from `@derec-alliance/nodejs`'s union, which was
|
|
10
10
|
* the original source of this file: that union lists `"wasm"`, a category no
|
|
11
11
|
* C-ABI binding can ever emit, and omits `"ok"`, `"ffi"` and `"state_store"`,
|
package/src/messages.ts
CHANGED
|
@@ -37,8 +37,8 @@ import { getNative } from './native';
|
|
|
37
37
|
/**
|
|
38
38
|
* Selects which message the JSON codec operates on.
|
|
39
39
|
*
|
|
40
|
-
* Mirrors
|
|
41
|
-
*
|
|
40
|
+
* Mirrors the crate's `MessageKind`, which the shared enum fixture holds
|
|
41
|
+
* both sides to — so a message
|
|
42
42
|
* added in Rust cannot reach this SDK as a silently unhandled value.
|
|
43
43
|
*/
|
|
44
44
|
export enum MessageKind {
|
package/src/protocol.ts
CHANGED
|
@@ -82,8 +82,8 @@ function decodeEvents(buffer: ArrayBuffer): DeRecEvent[] {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Maps a transport protocol name to the `derec_proto::Protocol` discriminant.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* The shared enum fixture every other numeric mapping in this SDK is checked
|
|
86
|
+
* against does not carry this enum (it
|
|
87
87
|
* only covers the Rust-internal serde enums listed under its `"enums"` key);
|
|
88
88
|
* the transport `Protocol` enum lives in `protobufs/transportprotocol.proto`
|
|
89
89
|
* instead, where only `HTTPS = 0` is currently defined.
|
|
@@ -113,8 +113,8 @@ function encodeTarget(target: Target): unknown {
|
|
|
113
113
|
* byte values, matching `UserSecretJson`'s plain `Vec<u8>` fields — no
|
|
114
114
|
* base64, no wrapping.
|
|
115
115
|
*
|
|
116
|
-
* Exported so it can be golden-tested against
|
|
117
|
-
*
|
|
116
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
117
|
+
* without a native module.
|
|
118
118
|
*/
|
|
119
119
|
export function buildProtectSecretParams(params: ProtectSecretParams): Record<string, unknown> {
|
|
120
120
|
const out: Record<string, unknown> = {
|
|
@@ -145,8 +145,8 @@ function communicationInfoOrOmit(
|
|
|
145
145
|
* the shared golden fixture byte-for-byte; `replicas` is omitted entirely
|
|
146
146
|
* when the recovered secret has no replica group.
|
|
147
147
|
*
|
|
148
|
-
* Exported so it can be golden-tested against
|
|
149
|
-
*
|
|
148
|
+
* Exported so it can be golden-tested against the shared wire fixture
|
|
149
|
+
* without a native module.
|
|
150
150
|
*/
|
|
151
151
|
export function buildRestoreParams(
|
|
152
152
|
recoveredSecret: Extract<DeRecEvent, { type: 'SecretRecovered' }>['secret'],
|
package/src/types.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface SecretStore {
|
|
|
62
62
|
*
|
|
63
63
|
* Do not `JSON.parse` and re-serialise. Every id in these records is a `u64`,
|
|
64
64
|
* and `JSON.parse` silently rounds anything above 2^53 — the corruption only
|
|
65
|
-
* appears once a real id happens to be large.
|
|
65
|
+
* appears once a real id happens to be large.
|
|
66
66
|
*/
|
|
67
67
|
export interface ChannelStore {
|
|
68
68
|
load(
|
|
@@ -757,6 +757,8 @@ export interface GetSecretIdsVersionsRequestMessage {
|
|
|
757
757
|
/** Ephemeral endpoint where the requester wants the response routed.
|
|
758
758
|
* Absent means "use the channel's stored peer endpoint". */
|
|
759
759
|
reply_to?: TransportProtocol;
|
|
760
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
761
|
+
replica_id?: bigint;
|
|
760
762
|
}
|
|
761
763
|
|
|
762
764
|
export interface VersionList {
|
|
@@ -773,6 +775,8 @@ export interface GetSecretIdsVersionsResponseMessage {
|
|
|
773
775
|
result?: DeRecResult;
|
|
774
776
|
secret_list: VersionList[];
|
|
775
777
|
timestamp?: Timestamp;
|
|
778
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
779
|
+
replica_id?: bigint;
|
|
776
780
|
}
|
|
777
781
|
|
|
778
782
|
export interface VersionEntry {
|
|
@@ -866,6 +870,8 @@ export interface GetShareRequestMessage {
|
|
|
866
870
|
timestamp?: Timestamp;
|
|
867
871
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
868
872
|
reply_to?: TransportProtocol;
|
|
873
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
874
|
+
replica_id?: bigint;
|
|
869
875
|
}
|
|
870
876
|
|
|
871
877
|
export interface GetShareResponseMessage {
|
|
@@ -879,6 +885,8 @@ export interface GetShareResponseMessage {
|
|
|
879
885
|
secret_id: bigint;
|
|
880
886
|
/** Echoed from the request for the same correlation reasons as `secret_id`. */
|
|
881
887
|
version: number;
|
|
888
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
889
|
+
replica_id?: bigint;
|
|
882
890
|
}
|
|
883
891
|
|
|
884
892
|
export interface SiblingHash {
|
|
@@ -904,6 +912,8 @@ export interface StoreShareRequestMessage {
|
|
|
904
912
|
secret_id: bigint;
|
|
905
913
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
906
914
|
reply_to?: TransportProtocol;
|
|
915
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
916
|
+
replica_id?: bigint;
|
|
907
917
|
}
|
|
908
918
|
|
|
909
919
|
export interface StoreShareResponseMessage {
|
|
@@ -911,6 +921,8 @@ export interface StoreShareResponseMessage {
|
|
|
911
921
|
version: number;
|
|
912
922
|
timestamp?: Timestamp;
|
|
913
923
|
secret_id: bigint;
|
|
924
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
925
|
+
replica_id?: bigint;
|
|
914
926
|
}
|
|
915
927
|
|
|
916
928
|
export interface UnpairRequestMessage {
|
|
@@ -918,6 +930,8 @@ export interface UnpairRequestMessage {
|
|
|
918
930
|
timestamp?: Timestamp;
|
|
919
931
|
/** Ephemeral response endpoint; see `replyTo` semantics. */
|
|
920
932
|
reply_to?: TransportProtocol;
|
|
933
|
+
/** Replica-group member that sent this; see `replicaId` semantics. */
|
|
934
|
+
replica_id?: bigint;
|
|
921
935
|
}
|
|
922
936
|
|
|
923
937
|
export interface UnpairResponseMessage {
|