@okee-e2ee/protocol 0.1.3 → 0.1.4
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/dist/crypto-core/model/brand.d.ts +4 -0
- package/dist/crypto-core/model/brand.d.ts.map +1 -1
- package/dist/crypto-core/signature/codecs/HybridSignatureCodec.d.ts +10 -0
- package/dist/crypto-core/signature/codecs/HybridSignatureCodec.d.ts.map +1 -0
- package/dist/crypto-core/signature/codecs/HybridSignatureCodec.js +27 -0
- package/dist/crypto-core/signature/codecs/HybridSignaturePublicKeyCodec.d.ts +10 -0
- package/dist/crypto-core/signature/codecs/HybridSignaturePublicKeyCodec.d.ts.map +1 -0
- package/dist/{transport/codecs/RelayIdentityPublicKeyCodec.js → crypto-core/signature/codecs/HybridSignaturePublicKeyCodec.js} +3 -3
- package/dist/crypto-core/signature/codecs/index.d.ts +3 -0
- package/dist/crypto-core/signature/codecs/index.d.ts.map +1 -0
- package/dist/crypto-core/signature/codecs/index.js +2 -0
- package/dist/crypto-core/signature/index.d.ts +1 -0
- package/dist/crypto-core/signature/index.d.ts.map +1 -1
- package/dist/crypto-core/signature/index.js +1 -0
- package/dist/transport/codecs/DestinationSendRequestCodec.d.ts +10 -0
- package/dist/transport/codecs/DestinationSendRequestCodec.d.ts.map +1 -0
- package/dist/transport/codecs/DestinationSendRequestCodec.js +34 -0
- package/dist/transport/codecs/DestinationSendResponseCodec.d.ts +10 -0
- package/dist/transport/codecs/DestinationSendResponseCodec.d.ts.map +1 -0
- package/dist/transport/codecs/DestinationSendResponseCodec.js +65 -0
- package/dist/transport/codecs/TransportPacketCodec.d.ts +15 -0
- package/dist/transport/codecs/TransportPacketCodec.d.ts.map +1 -0
- package/dist/transport/codecs/TransportPacketCodec.js +214 -0
- package/dist/transport/codecs/encode-destination-send-authorization-input.d.ts +4 -0
- package/dist/transport/codecs/encode-destination-send-authorization-input.d.ts.map +1 -0
- package/dist/transport/codecs/encode-destination-send-authorization-input.js +6 -0
- package/dist/transport/codecs/encode-relay-key-bundle-signature-input.d.ts.map +1 -0
- package/dist/transport/{helpers → codecs}/encode-relay-key-bundle-signature-input.js +1 -1
- package/dist/transport/codecs/encode-s2d-associated-data.d.ts +5 -0
- package/dist/transport/codecs/encode-s2d-associated-data.d.ts.map +1 -0
- package/dist/transport/codecs/encode-s2d-associated-data.js +19 -0
- package/dist/transport/codecs/encode-transport-request-authorization-input.d.ts +4 -0
- package/dist/transport/codecs/encode-transport-request-authorization-input.d.ts.map +1 -0
- package/dist/transport/codecs/encode-transport-request-authorization-input.js +35 -0
- package/dist/transport/codecs/index.d.ts +7 -2
- package/dist/transport/codecs/index.d.ts.map +1 -1
- package/dist/transport/codecs/index.js +7 -2
- package/dist/transport/codecs/internal/InternalCodec.d.ts +7 -0
- package/dist/transport/codecs/internal/InternalCodec.d.ts.map +1 -0
- package/dist/transport/codecs/internal/InternalCodec.js +16 -0
- package/dist/transport/codecs/{RelayEncryptionKeyBundleCodec.d.ts → internal/RelayEncryptionKeyBundleCodec.d.ts} +2 -3
- package/dist/transport/codecs/internal/RelayEncryptionKeyBundleCodec.d.ts.map +1 -0
- package/dist/transport/codecs/{RelayEncryptionKeyBundleCodec.js → internal/RelayEncryptionKeyBundleCodec.js} +4 -5
- package/dist/transport/codecs/internal/S2DEncryptedRequestCodec.d.ts +9 -0
- package/dist/transport/codecs/internal/S2DEncryptedRequestCodec.d.ts.map +1 -0
- package/dist/transport/codecs/internal/S2DEncryptedRequestCodec.js +45 -0
- package/dist/transport/codecs/internal/S2DEncryptedResponseCodec.d.ts +9 -0
- package/dist/transport/codecs/internal/S2DEncryptedResponseCodec.d.ts.map +1 -0
- package/dist/transport/codecs/internal/S2DEncryptedResponseCodec.js +38 -0
- package/dist/transport/codecs/internal/SignedRelayEncryptionKeyBundleCodec.d.ts +9 -0
- package/dist/transport/codecs/internal/SignedRelayEncryptionKeyBundleCodec.d.ts.map +1 -0
- package/dist/transport/codecs/internal/SignedRelayEncryptionKeyBundleCodec.js +35 -0
- package/dist/transport/codecs/internal/destination-send-codec-helpers.d.ts +5 -0
- package/dist/transport/codecs/internal/destination-send-codec-helpers.d.ts.map +1 -0
- package/dist/transport/codecs/internal/destination-send-codec-helpers.js +58 -0
- package/dist/transport/codecs/internal/transport-payload-codecs.d.ts +7 -0
- package/dist/transport/codecs/internal/transport-payload-codecs.d.ts.map +1 -0
- package/dist/transport/codecs/internal/transport-payload-codecs.js +128 -0
- package/dist/transport/constants/relay-constants.d.ts +5 -0
- package/dist/transport/constants/relay-constants.d.ts.map +1 -1
- package/dist/transport/constants/relay-constants.js +5 -0
- package/dist/transport/constants/transport-packet-constants.d.ts +3 -0
- package/dist/transport/constants/transport-packet-constants.d.ts.map +1 -1
- package/dist/transport/constants/transport-packet-constants.js +3 -0
- package/dist/transport/helpers/derive-relay-identity-fingerprint.d.ts.map +1 -1
- package/dist/transport/helpers/derive-relay-identity-fingerprint.js +2 -3
- package/dist/transport/helpers/derive-s2d-key-material.d.ts +4 -0
- package/dist/transport/helpers/derive-s2d-key-material.d.ts.map +1 -0
- package/dist/transport/helpers/derive-s2d-key-material.js +25 -0
- package/dist/transport/helpers/index.d.ts +1 -1
- package/dist/transport/helpers/index.d.ts.map +1 -1
- package/dist/transport/helpers/index.js +1 -1
- package/dist/transport/model/destination-send.d.ts +44 -0
- package/dist/transport/model/destination-send.d.ts.map +1 -0
- package/dist/transport/model/destination-send.js +14 -0
- package/dist/transport/model/index.d.ts +2 -0
- package/dist/transport/model/index.d.ts.map +1 -1
- package/dist/transport/model/index.js +2 -0
- package/dist/transport/model/relay-key-bundle.d.ts +2 -2
- package/dist/transport/model/relay-key-bundle.d.ts.map +1 -1
- package/dist/transport/model/s2d-envelope.d.ts +28 -0
- package/dist/transport/model/s2d-envelope.d.ts.map +1 -0
- package/dist/transport/model/s2d-envelope.js +1 -0
- package/dist/transport/model/transport-command.d.ts +30 -18
- package/dist/transport/model/transport-command.d.ts.map +1 -1
- package/dist/transport/model/transport-command.js +9 -0
- package/dist/transport/model/transport-packet.d.ts +15 -6
- package/dist/transport/model/transport-packet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/transport/codecs/RelayEncryptionKeyBundleCodec.d.ts.map +0 -1
- package/dist/transport/codecs/RelayIdentityPublicKeyCodec.d.ts +0 -10
- package/dist/transport/codecs/RelayIdentityPublicKeyCodec.d.ts.map +0 -1
- package/dist/transport/helpers/encode-relay-key-bundle-signature-input.d.ts.map +0 -1
- /package/dist/transport/{helpers → codecs}/encode-relay-key-bundle-signature-input.d.ts +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export * from "./destination-send";
|
|
1
2
|
export * from "./queue-model";
|
|
2
3
|
export * from "./relay-address";
|
|
3
4
|
export * from "./relay-key-bundle";
|
|
5
|
+
export * from "./s2d-envelope";
|
|
4
6
|
export * from "./transport-command";
|
|
5
7
|
export * from "./transport-packet";
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Branded, XWingPublicKey } from "../../crypto-core";
|
|
2
2
|
import { HybridSignature } from "../../crypto-core/signature/model";
|
|
3
3
|
import { RELAY_KEY_BUNDLE_FORMAT_VERSION } from "../constants";
|
|
4
|
-
export type
|
|
4
|
+
export type RelayEncryptionKeyEpoch = Branded<bigint, "TransportRelayEncryptionKeyEpoch">;
|
|
5
5
|
export type RelayEncryptionKeyBundle = {
|
|
6
6
|
readonly formatVersion: typeof RELAY_KEY_BUNDLE_FORMAT_VERSION;
|
|
7
|
-
readonly
|
|
7
|
+
readonly epoch: RelayEncryptionKeyEpoch;
|
|
8
8
|
readonly publicKey: XWingPublicKey;
|
|
9
9
|
readonly validFrom: bigint;
|
|
10
10
|
readonly expiresAt: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-key-bundle.d.ts","sourceRoot":"","sources":["../../../src/transport/model/relay-key-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"relay-key-bundle.d.ts","sourceRoot":"","sources":["../../../src/transport/model/relay-key-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC;AAE1F,MAAM,MAAM,wBAAwB,GAAG;IACtC,QAAQ,CAAC,aAAa,EAAE,OAAO,+BAA+B,CAAC;IAC/D,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,wBAAwB,GAAG;IACvE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Bytes, EncryptedPayload, XWingCiphertext } from "../../crypto-core";
|
|
2
|
+
import { S2D_ENVELOPE_FORMAT_VERSION } from "../constants";
|
|
3
|
+
import { RelayAddress } from "./relay-address";
|
|
4
|
+
import { RelayEncryptionKeyEpoch } from "./relay-key-bundle";
|
|
5
|
+
import type { RequestId } from "./transport-packet";
|
|
6
|
+
export type S2DKeyMaterial = {
|
|
7
|
+
readonly requestKey: Bytes;
|
|
8
|
+
readonly requestNonce: Bytes;
|
|
9
|
+
readonly responseKey: Bytes;
|
|
10
|
+
readonly responseNonce: Bytes;
|
|
11
|
+
};
|
|
12
|
+
export type S2DAssociatedDataInput = {
|
|
13
|
+
readonly requestId: RequestId;
|
|
14
|
+
readonly destination: RelayAddress;
|
|
15
|
+
readonly epoch: RelayEncryptionKeyEpoch;
|
|
16
|
+
readonly encapsulation: XWingCiphertext;
|
|
17
|
+
};
|
|
18
|
+
export type S2DEncryptedRequest<T> = {
|
|
19
|
+
readonly formatVersion: typeof S2D_ENVELOPE_FORMAT_VERSION;
|
|
20
|
+
readonly epoch: RelayEncryptionKeyEpoch;
|
|
21
|
+
readonly encapsulation: XWingCiphertext;
|
|
22
|
+
readonly ciphertext: EncryptedPayload<T>;
|
|
23
|
+
};
|
|
24
|
+
export type S2DEncryptedResponse<T> = {
|
|
25
|
+
readonly formatVersion: typeof S2D_ENVELOPE_FORMAT_VERSION;
|
|
26
|
+
readonly ciphertext: EncryptedPayload<T>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=s2d-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s2d-envelope.d.ts","sourceRoot":"","sources":["../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@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HybridSignaturePublicKey } from "../../crypto-core";
|
|
2
|
+
import { DestinationSendRequest, DestinationSendResponse } from "./destination-send";
|
|
3
|
+
import { DeliveryId, QueueRegistration, RecipientQueueId, SenderQueueId } from "./queue-model";
|
|
4
|
+
import { RelayAddress } from "./relay-address";
|
|
5
|
+
import { SignedRelayEncryptionKeyBundle } from "./relay-key-bundle";
|
|
6
|
+
import { S2DEncryptedRequest, S2DEncryptedResponse } from "./s2d-envelope";
|
|
3
7
|
export declare enum TransportCommandType {
|
|
4
8
|
HEALTH = 0,
|
|
5
9
|
CREATE_QUEUE = 1,
|
|
@@ -7,7 +11,15 @@ export declare enum TransportCommandType {
|
|
|
7
11
|
SUBSCRIBE_QUEUE = 3,
|
|
8
12
|
UNSUBSCRIBE_QUEUE = 4,
|
|
9
13
|
SEND = 5,
|
|
10
|
-
ACK = 6
|
|
14
|
+
ACK = 6,
|
|
15
|
+
GET_DESTINATION_BUNDLE = 7
|
|
16
|
+
}
|
|
17
|
+
export declare enum TransportErrorCode {
|
|
18
|
+
UNAVAILABLE = 0,
|
|
19
|
+
TIMEOUT = 1,
|
|
20
|
+
KEY_UNKNOWN = 2,
|
|
21
|
+
KEY_EXPIRED = 3,
|
|
22
|
+
RESPONSE_INVALID = 4
|
|
11
23
|
}
|
|
12
24
|
export type HealthCommandRequestPayload = undefined;
|
|
13
25
|
export type CreateQueueCommandRequestPayload = {
|
|
@@ -22,18 +34,13 @@ export type SubscribeQueueCommandRequestPayload = {
|
|
|
22
34
|
export type UnsubscribeQueueCommandRequestPayload = {
|
|
23
35
|
readonly recipientQueueId: RecipientQueueId;
|
|
24
36
|
};
|
|
25
|
-
type
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
readonly senderAuthPublicKey: SenderHybridAuthPublicKey;
|
|
33
|
-
} | {
|
|
34
|
-
readonly setupCapability?: never;
|
|
35
|
-
readonly senderAuthPublicKey?: never;
|
|
36
|
-
});
|
|
37
|
+
export type GetDestinationBundleCommandRequestPayload = {
|
|
38
|
+
readonly destination: RelayAddress;
|
|
39
|
+
};
|
|
40
|
+
export type SendCommandRequestPayload = {
|
|
41
|
+
readonly destination: RelayAddress;
|
|
42
|
+
readonly encryptedRequest: S2DEncryptedRequest<DestinationSendRequest>;
|
|
43
|
+
};
|
|
37
44
|
export type AckCommandRequestPayload = {
|
|
38
45
|
readonly recipientQueueId: RecipientQueueId;
|
|
39
46
|
readonly deliveryIds: readonly DeliveryId[];
|
|
@@ -46,6 +53,7 @@ export type TransportRequestPayloadMap = {
|
|
|
46
53
|
readonly [TransportCommandType.UNSUBSCRIBE_QUEUE]: UnsubscribeQueueCommandRequestPayload;
|
|
47
54
|
readonly [TransportCommandType.SEND]: SendCommandRequestPayload;
|
|
48
55
|
readonly [TransportCommandType.ACK]: AckCommandRequestPayload;
|
|
56
|
+
readonly [TransportCommandType.GET_DESTINATION_BUNDLE]: GetDestinationBundleCommandRequestPayload;
|
|
49
57
|
};
|
|
50
58
|
export type HealthCommandResponsePayload = undefined;
|
|
51
59
|
export type CreateQueueCommandResponsePayload = {
|
|
@@ -61,9 +69,13 @@ export type SubscribeQueueCommandResponsePayload = {
|
|
|
61
69
|
export type UnsubscribeQueueCommandResponsePayload = {
|
|
62
70
|
readonly recipientQueueId: RecipientQueueId;
|
|
63
71
|
};
|
|
72
|
+
export type GetDestinationBundleCommandResponsePayload = {
|
|
73
|
+
readonly destination: RelayAddress;
|
|
74
|
+
readonly identityPublicKey: HybridSignaturePublicKey;
|
|
75
|
+
readonly bundle: SignedRelayEncryptionKeyBundle;
|
|
76
|
+
};
|
|
64
77
|
export type SendCommandResponsePayload = {
|
|
65
|
-
readonly
|
|
66
|
-
readonly deliveryId: DeliveryId;
|
|
78
|
+
readonly encryptedResponse: S2DEncryptedResponse<DestinationSendResponse>;
|
|
67
79
|
};
|
|
68
80
|
export type AckCommandResponsePayload = {
|
|
69
81
|
readonly recipientQueueId: RecipientQueueId;
|
|
@@ -77,6 +89,6 @@ export type TransportResponsePayloadMap = {
|
|
|
77
89
|
readonly [TransportCommandType.UNSUBSCRIBE_QUEUE]: UnsubscribeQueueCommandResponsePayload;
|
|
78
90
|
readonly [TransportCommandType.SEND]: SendCommandResponsePayload;
|
|
79
91
|
readonly [TransportCommandType.ACK]: AckCommandResponsePayload;
|
|
92
|
+
readonly [TransportCommandType.GET_DESTINATION_BUNDLE]: GetDestinationBundleCommandResponsePayload;
|
|
80
93
|
};
|
|
81
|
-
export {};
|
|
82
94
|
//# sourceMappingURL=transport-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-command.d.ts","sourceRoot":"","sources":["../../../src/transport/model/transport-command.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"transport-command.d.ts","sourceRoot":"","sources":["../../../src/transport/model/transport-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,oBAAY,oBAAoB;IAC/B,MAAM,IAAI;IACV,YAAY,IAAI;IAChB,YAAY,IAAI;IAChB,eAAe,IAAI;IACnB,iBAAiB,IAAI;IACrB,IAAI,IAAI;IACR,GAAG,IAAI;IACP,sBAAsB,IAAI;CAC1B;AA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AAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACzC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,4BAA4B,CAAC;IACrE,QAAQ,CAAC,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE,iCAAiC,CAAC;IAChF,QAAQ,CAAC,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE,iCAAiC,CAAC;IAChF,QAAQ,CAAC,CAAC,oBAAoB,CAAC,eAAe,CAAC,EAAE,oCAAoC,CAAC;IACtF,QAAQ,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,sCAAsC,CAAC;IAC1F,QAAQ,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC;IACjE,QAAQ,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,yBAAyB,CAAC;IAC/D,QAAQ,CAAC,CAAC,oBAAoB,CAAC,sBAAsB,CAAC,EAAE,0CAA0C,CAAC;CACnG,CAAC"}
|
|
@@ -7,4 +7,13 @@ export var TransportCommandType;
|
|
|
7
7
|
TransportCommandType[TransportCommandType["UNSUBSCRIBE_QUEUE"] = 4] = "UNSUBSCRIBE_QUEUE";
|
|
8
8
|
TransportCommandType[TransportCommandType["SEND"] = 5] = "SEND";
|
|
9
9
|
TransportCommandType[TransportCommandType["ACK"] = 6] = "ACK";
|
|
10
|
+
TransportCommandType[TransportCommandType["GET_DESTINATION_BUNDLE"] = 7] = "GET_DESTINATION_BUNDLE";
|
|
10
11
|
})(TransportCommandType || (TransportCommandType = {}));
|
|
12
|
+
export var TransportErrorCode;
|
|
13
|
+
(function (TransportErrorCode) {
|
|
14
|
+
TransportErrorCode[TransportErrorCode["UNAVAILABLE"] = 0] = "UNAVAILABLE";
|
|
15
|
+
TransportErrorCode[TransportErrorCode["TIMEOUT"] = 1] = "TIMEOUT";
|
|
16
|
+
TransportErrorCode[TransportErrorCode["KEY_UNKNOWN"] = 2] = "KEY_UNKNOWN";
|
|
17
|
+
TransportErrorCode[TransportErrorCode["KEY_EXPIRED"] = 3] = "KEY_EXPIRED";
|
|
18
|
+
TransportErrorCode[TransportErrorCode["RESPONSE_INVALID"] = 4] = "RESPONSE_INVALID";
|
|
19
|
+
})(TransportErrorCode || (TransportErrorCode = {}));
|
|
@@ -2,7 +2,7 @@ import { Branded, Bytes } from "../../crypto-core";
|
|
|
2
2
|
import { HybridSignature } from "../../crypto-core/signature/model";
|
|
3
3
|
import { TRANSPORT_PACKET_FORMAT_VERSION } from "../constants";
|
|
4
4
|
import { DeliveryId, RecipientQueueId } from "./queue-model";
|
|
5
|
-
import { TransportCommandType, TransportRequestPayloadMap, TransportResponsePayloadMap } from "./transport-command";
|
|
5
|
+
import { TransportCommandType, TransportErrorCode, TransportRequestPayloadMap, TransportResponsePayloadMap } from "./transport-command";
|
|
6
6
|
export type RequestId = Branded<string, "TransportRequestId">;
|
|
7
7
|
export declare enum TransportPacketType {
|
|
8
8
|
REQUEST = 0,
|
|
@@ -23,13 +23,22 @@ type TransportRequestPacketBase<C extends TransportCommandType> = {
|
|
|
23
23
|
export type TransportHealthRequestPacket = TransportRequestPacketBase<TransportCommandType.HEALTH> & {
|
|
24
24
|
readonly authorization?: never;
|
|
25
25
|
};
|
|
26
|
-
type
|
|
26
|
+
type CommandWithoutPacketAuthorization = TransportCommandType.HEALTH | TransportCommandType.SEND | TransportCommandType.GET_DESTINATION_BUNDLE;
|
|
27
|
+
type TransportRequestPacketWithoutAuthorization = {
|
|
28
|
+
readonly [C in CommandWithoutPacketAuthorization]: TransportRequestPacketBase<C> & {
|
|
29
|
+
readonly authorization?: never;
|
|
30
|
+
};
|
|
31
|
+
}[CommandWithoutPacketAuthorization];
|
|
32
|
+
export type TransportAuthorizedCommandType = Exclude<TransportCommandType, CommandWithoutPacketAuthorization>;
|
|
33
|
+
export type TransportRequestAuthorizationInput = {
|
|
34
|
+
readonly [C in TransportAuthorizedCommandType]: TransportRequestPacketBase<C>;
|
|
35
|
+
}[TransportAuthorizedCommandType];
|
|
27
36
|
export type TransportAuthorizedRequestPacket = {
|
|
28
|
-
readonly [C in
|
|
37
|
+
readonly [C in TransportAuthorizedCommandType]: TransportRequestPacketBase<C> & {
|
|
29
38
|
readonly authorization: HybridSignature;
|
|
30
39
|
};
|
|
31
|
-
}[
|
|
32
|
-
export type TransportRequestPacket =
|
|
40
|
+
}[TransportAuthorizedCommandType];
|
|
41
|
+
export type TransportRequestPacket = TransportRequestPacketWithoutAuthorization | TransportAuthorizedRequestPacket;
|
|
33
42
|
type TransportResponsePacketBase<C extends TransportCommandType> = {
|
|
34
43
|
readonly formatVersion: typeof TRANSPORT_PACKET_FORMAT_VERSION;
|
|
35
44
|
readonly type: TransportPacketType.RESPONSE;
|
|
@@ -45,7 +54,7 @@ export type TransportSuccessResponsePacket = {
|
|
|
45
54
|
export type TransportErrorResponsePacket = {
|
|
46
55
|
readonly [C in TransportCommandType]: TransportResponsePacketBase<C> & {
|
|
47
56
|
readonly status: TransportResponseStatus.ERROR;
|
|
48
|
-
readonly errorCode:
|
|
57
|
+
readonly errorCode: TransportErrorCode;
|
|
49
58
|
};
|
|
50
59
|
}[TransportCommandType];
|
|
51
60
|
export type TransportResponsePacket = TransportSuccessResponsePacket | TransportErrorResponsePacket;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport-packet.d.ts","sourceRoot":"","sources":["../../../src/transport/model/transport-packet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACN,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,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,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,eAAe,GAC1B,sBAAsB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RelayEncryptionKeyBundleCodec.d.ts","sourceRoot":"","sources":["../../../src/transport/codecs/RelayEncryptionKeyBundleCodec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,KAAK,EAAkB,MAAM,uCAAuC,CAAC;AAG9E,OAAO,EAAE,wBAAwB,EAAwB,MAAM,UAAU,CAAC;AAE1E,qBAAa,6BAA8B,YAAW,aAAa,CAAC,wBAAwB,CAAC;IACrF,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,KAAK,CAYpD;IAEM,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAyBzE;CACD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Result } from "@okee-e2ee/core";
|
|
2
|
-
import { DecodeError } from "@okee-e2ee/core/errors";
|
|
3
|
-
import { CodecContract } from "../../crypto-core/contracts";
|
|
4
|
-
import { Bytes } from "../../crypto-core/model";
|
|
5
|
-
import { HybridSignaturePublicKey } from "../../crypto-core/signature/model";
|
|
6
|
-
export declare class RelayIdentityPublicKeyCodec implements CodecContract<HybridSignaturePublicKey> {
|
|
7
|
-
encode(value: HybridSignaturePublicKey): Bytes;
|
|
8
|
-
decode(bytes: Bytes): Result<HybridSignaturePublicKey, DecodeError>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=RelayIdentityPublicKeyCodec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RelayIdentityPublicKeyCodec.d.ts","sourceRoot":"","sources":["../../../src/transport/codecs/RelayIdentityPublicKeyCodec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAC9D,OAAO,EAEN,wBAAwB,EAExB,MAAM,iDAAiD,CAAC;AAEzD,qBAAa,2BAA4B,YAAW,aAAa,CAAC,wBAAwB,CAAC;IACnF,MAAM,CAAC,KAAK,EAAE,wBAAwB,GAAG,KAAK,CAKpD;IAEM,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAgBzE;CACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode-relay-key-bundle-signature-input.d.ts","sourceRoot":"","sources":["../../../src/transport/helpers/encode-relay-key-bundle-signature-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAwB,MAAM,iCAAiC,CAAC;AAI9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,wBAAwB,GAAG,KAAK,CAE1F"}
|
|
File without changes
|