@dynamic-labs-wallet/forward-mpc-shared 0.1.0-alpha.6 → 0.1.0-alpha.7
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/index.cjs +823 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1030 -0
- package/dist/index.d.ts +1030 -9
- package/dist/index.js +768 -17
- package/dist/index.js.map +1 -1
- package/package.json +9 -7
- package/dist/attestation/index.d.ts +0 -1
- package/dist/attestation/index.d.ts.map +0 -1
- package/dist/attestation/index.js +0 -4
- package/dist/attestation/index.js.map +0 -1
- package/dist/codecs/DomainCodec.d.ts +0 -11
- package/dist/codecs/DomainCodec.d.ts.map +0 -1
- package/dist/codecs/DomainCodec.js +0 -25
- package/dist/codecs/DomainCodec.js.map +0 -1
- package/dist/codecs/EncryptedKeyshareCodec.d.ts +0 -11
- package/dist/codecs/EncryptedKeyshareCodec.d.ts.map +0 -1
- package/dist/codecs/EncryptedKeyshareCodec.js +0 -11
- package/dist/codecs/EncryptedKeyshareCodec.js.map +0 -1
- package/dist/codecs/Uint32ArrayCodec.d.ts +0 -3
- package/dist/codecs/Uint32ArrayCodec.d.ts.map +0 -1
- package/dist/codecs/Uint32ArrayCodec.js +0 -37
- package/dist/codecs/Uint32ArrayCodec.js.map +0 -1
- package/dist/codecs/Uint8ArrayCodec.d.ts +0 -3
- package/dist/codecs/Uint8ArrayCodec.d.ts.map +0 -1
- package/dist/codecs/Uint8ArrayCodec.js +0 -26
- package/dist/codecs/Uint8ArrayCodec.js.map +0 -1
- package/dist/codecs/Uint8ArrayOrHexCodec.d.ts +0 -3
- package/dist/codecs/Uint8ArrayOrHexCodec.d.ts.map +0 -1
- package/dist/codecs/Uint8ArrayOrHexCodec.js +0 -35
- package/dist/codecs/Uint8ArrayOrHexCodec.js.map +0 -1
- package/dist/codecs/WebSocketErrorCodec.d.ts +0 -15
- package/dist/codecs/WebSocketErrorCodec.d.ts.map +0 -1
- package/dist/codecs/WebSocketErrorCodec.js +0 -14
- package/dist/codecs/WebSocketErrorCodec.js.map +0 -1
- package/dist/codecs/index.d.ts +0 -4
- package/dist/codecs/index.d.ts.map +0 -1
- package/dist/codecs/index.js +0 -4
- package/dist/codecs/index.js.map +0 -1
- package/dist/constants/algorithms.d.ts +0 -56
- package/dist/constants/algorithms.d.ts.map +0 -1
- package/dist/constants/algorithms.js +0 -60
- package/dist/constants/algorithms.js.map +0 -1
- package/dist/constants/index.d.ts +0 -2
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -2
- package/dist/constants/index.js.map +0 -1
- package/dist/crypto/decapsulate.d.ts +0 -2
- package/dist/crypto/decapsulate.d.ts.map +0 -1
- package/dist/crypto/decapsulate.js +0 -5
- package/dist/crypto/decapsulate.js.map +0 -1
- package/dist/crypto/encapsulate.d.ts +0 -5
- package/dist/crypto/encapsulate.d.ts.map +0 -1
- package/dist/crypto/encapsulate.js +0 -5
- package/dist/crypto/encapsulate.js.map +0 -1
- package/dist/crypto/generateKeypair.d.ts +0 -5
- package/dist/crypto/generateKeypair.d.ts.map +0 -1
- package/dist/crypto/generateKeypair.js +0 -17
- package/dist/crypto/generateKeypair.js.map +0 -1
- package/dist/crypto/index.d.ts +0 -6
- package/dist/crypto/index.d.ts.map +0 -1
- package/dist/crypto/index.js +0 -6
- package/dist/crypto/index.js.map +0 -1
- package/dist/crypto/keyDerivation.d.ts +0 -14
- package/dist/crypto/keyDerivation.d.ts.map +0 -1
- package/dist/crypto/keyDerivation.js +0 -21
- package/dist/crypto/keyDerivation.js.map +0 -1
- package/dist/crypto/keyshareEncryption.d.ts +0 -13
- package/dist/crypto/keyshareEncryption.d.ts.map +0 -1
- package/dist/crypto/keyshareEncryption.js +0 -39
- package/dist/crypto/keyshareEncryption.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/messages/ConnectionAckV1Request.d.ts +0 -43
- package/dist/messages/ConnectionAckV1Request.d.ts.map +0 -1
- package/dist/messages/ConnectionAckV1Request.js +0 -17
- package/dist/messages/ConnectionAckV1Request.js.map +0 -1
- package/dist/messages/ConnectionAckV1Response.d.ts +0 -45
- package/dist/messages/ConnectionAckV1Response.d.ts.map +0 -1
- package/dist/messages/ConnectionAckV1Response.js +0 -18
- package/dist/messages/ConnectionAckV1Response.js.map +0 -1
- package/dist/messages/HandshakeV1Request.d.ts +0 -45
- package/dist/messages/HandshakeV1Request.d.ts.map +0 -1
- package/dist/messages/HandshakeV1Request.js +0 -28
- package/dist/messages/HandshakeV1Request.js.map +0 -1
- package/dist/messages/HandshakeV1Response.d.ts +0 -47
- package/dist/messages/HandshakeV1Response.d.ts.map +0 -1
- package/dist/messages/HandshakeV1Response.js +0 -20
- package/dist/messages/HandshakeV1Response.js.map +0 -1
- package/dist/messages/SignMessageV1Request.d.ts +0 -63
- package/dist/messages/SignMessageV1Request.d.ts.map +0 -1
- package/dist/messages/SignMessageV1Request.js +0 -42
- package/dist/messages/SignMessageV1Request.js.map +0 -1
- package/dist/messages/SignMessageV1Response.d.ts +0 -47
- package/dist/messages/SignMessageV1Response.d.ts.map +0 -1
- package/dist/messages/SignMessageV1Response.js +0 -28
- package/dist/messages/SignMessageV1Response.js.map +0 -1
- package/dist/messages/allMessages.d.ts +0 -259
- package/dist/messages/allMessages.d.ts.map +0 -1
- package/dist/messages/allMessages.js +0 -57
- package/dist/messages/allMessages.js.map +0 -1
- package/dist/messages/base.d.ts +0 -27
- package/dist/messages/base.d.ts.map +0 -1
- package/dist/messages/base.js +0 -12
- package/dist/messages/base.js.map +0 -1
- package/dist/messages/index.d.ts +0 -11
- package/dist/messages/index.d.ts.map +0 -1
- package/dist/messages/index.js +0 -14
- package/dist/messages/index.js.map +0 -1
- package/dist/messages/registry.d.ts +0 -136
- package/dist/messages/registry.d.ts.map +0 -1
- package/dist/messages/registry.js +0 -67
- package/dist/messages/registry.js.map +0 -1
- package/dist/messages/utils/StandardMessage.d.ts +0 -97
- package/dist/messages/utils/StandardMessage.d.ts.map +0 -1
- package/dist/messages/utils/StandardMessage.js +0 -98
- package/dist/messages/utils/StandardMessage.js.map +0 -1
- package/dist/messages/utils/encodingHelpers.d.ts +0 -20
- package/dist/messages/utils/encodingHelpers.d.ts.map +0 -1
- package/dist/messages/utils/encodingHelpers.js +0 -50
- package/dist/messages/utils/encodingHelpers.js.map +0 -1
- package/dist/messages/utils/index.d.ts +0 -4
- package/dist/messages/utils/index.d.ts.map +0 -1
- package/dist/messages/utils/index.js +0 -5
- package/dist/messages/utils/index.js.map +0 -1
- package/dist/messages/utils/schemaBuilder.d.ts +0 -19
- package/dist/messages/utils/schemaBuilder.d.ts.map +0 -1
- package/dist/messages/utils/schemaBuilder.js +0 -31
- package/dist/messages/utils/schemaBuilder.js.map +0 -1
- package/dist/signing/algorithms/BIP340SigningAlgorithm.d.ts +0 -20
- package/dist/signing/algorithms/BIP340SigningAlgorithm.d.ts.map +0 -1
- package/dist/signing/algorithms/BIP340SigningAlgorithm.js +0 -35
- package/dist/signing/algorithms/BIP340SigningAlgorithm.js.map +0 -1
- package/dist/signing/algorithms/EcdsaSigningAlgorithm.d.ts +0 -20
- package/dist/signing/algorithms/EcdsaSigningAlgorithm.d.ts.map +0 -1
- package/dist/signing/algorithms/EcdsaSigningAlgorithm.js +0 -43
- package/dist/signing/algorithms/EcdsaSigningAlgorithm.js.map +0 -1
- package/dist/signing/algorithms/Ed25519SigningAlgorithm.d.ts +0 -18
- package/dist/signing/algorithms/Ed25519SigningAlgorithm.d.ts.map +0 -1
- package/dist/signing/algorithms/Ed25519SigningAlgorithm.js +0 -34
- package/dist/signing/algorithms/Ed25519SigningAlgorithm.js.map +0 -1
- package/dist/signing/allAlgorithms.d.ts +0 -50
- package/dist/signing/allAlgorithms.d.ts.map +0 -1
- package/dist/signing/allAlgorithms.js +0 -59
- package/dist/signing/allAlgorithms.js.map +0 -1
- package/dist/signing/base.d.ts +0 -42
- package/dist/signing/base.d.ts.map +0 -1
- package/dist/signing/base.js +0 -6
- package/dist/signing/base.js.map +0 -1
- package/dist/signing/index.d.ts +0 -7
- package/dist/signing/index.d.ts.map +0 -1
- package/dist/signing/index.js +0 -9
- package/dist/signing/index.js.map +0 -1
- package/dist/signing/registry.d.ts +0 -26
- package/dist/signing/registry.d.ts.map +0 -1
- package/dist/signing/registry.js +0 -36
- package/dist/signing/registry.js.map +0 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -12
- package/dist/types.js.map +0 -1
- package/dist/utils/assertDefined.d.ts +0 -16
- package/dist/utils/assertDefined.d.ts.map +0 -1
- package/dist/utils/assertDefined.js +0 -27
- package/dist/utils/assertDefined.js.map +0 -1
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { TypeOf } from 'io-ts';
|
|
2
|
-
/**
|
|
3
|
-
* Handshake Response Runtime Data
|
|
4
|
-
*/
|
|
5
|
-
export interface HandshakeResponseData {
|
|
6
|
-
encapsulatedSharedSecret: string;
|
|
7
|
-
attestationDoc: string;
|
|
8
|
-
connectionId: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Handshake Response Wire Format
|
|
12
|
-
*/
|
|
13
|
-
export interface HandshakeResponseWire {
|
|
14
|
-
type: 'handshake_response';
|
|
15
|
-
version: 1;
|
|
16
|
-
encapsulatedSharedSecret: string;
|
|
17
|
-
attestationDoc: string;
|
|
18
|
-
connectionId: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Handshake Response Schema (built using Ultra-DRY utilities)
|
|
22
|
-
*/
|
|
23
|
-
export declare const HandshakeResponseSchema: import("io-ts").Type<any, any, unknown>;
|
|
24
|
-
export type HandshakeResponse = TypeOf<typeof HandshakeResponseSchema>;
|
|
25
|
-
/**
|
|
26
|
-
* Handshake V1 Response Message Class (Ultra-DRY implementation)
|
|
27
|
-
*/
|
|
28
|
-
export declare const HandshakeV1ResponseMessage: {
|
|
29
|
-
new (data: HandshakeResponseData): {
|
|
30
|
-
readonly type: "handshake_response";
|
|
31
|
-
readonly version: 1;
|
|
32
|
-
encode(): any;
|
|
33
|
-
readonly data: HandshakeResponseData;
|
|
34
|
-
getData(): HandshakeResponseData;
|
|
35
|
-
};
|
|
36
|
-
readonly MESSAGE_TYPE: "handshake_response";
|
|
37
|
-
readonly MESSAGE_VERSION: 1;
|
|
38
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
39
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
40
|
-
readonly type: "handshake_response";
|
|
41
|
-
readonly version: 1;
|
|
42
|
-
encode(): any;
|
|
43
|
-
readonly data: HandshakeResponseData;
|
|
44
|
-
getData(): HandshakeResponseData;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=HandshakeV1Response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HandshakeV1Response.d.ts","sourceRoot":"","sources":["../../src/messages/HandshakeV1Response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,OAAO,CAAC;AAGvC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wBAAwB,EAAE,MAAM,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC;IACX,wBAAwB,EAAE,MAAM,CAAC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,yCAQnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;CAQrC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { string } from 'io-ts';
|
|
2
|
-
import { buildMessageSchema, createSimpleMessage } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* Handshake Response Schema (built using Ultra-DRY utilities)
|
|
5
|
-
*/
|
|
6
|
-
export const HandshakeResponseSchema = buildMessageSchema('handshake_response', 1, {
|
|
7
|
-
encapsulatedSharedSecret: string,
|
|
8
|
-
attestationDoc: string,
|
|
9
|
-
connectionId: string,
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Handshake V1 Response Message Class (Ultra-DRY implementation)
|
|
13
|
-
*/
|
|
14
|
-
export const HandshakeV1ResponseMessage = createSimpleMessage({
|
|
15
|
-
messageType: 'handshake_response',
|
|
16
|
-
version: 1,
|
|
17
|
-
schema: HandshakeResponseSchema,
|
|
18
|
-
});
|
|
19
|
-
// HandshakeResponse naturally implements IMessageConstructor through its static properties
|
|
20
|
-
//# sourceMappingURL=HandshakeV1Response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HandshakeV1Response.js","sourceRoot":"","sources":["../../src/messages/HandshakeV1Response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAsBlE;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CACvD,oBAAoB,EACpB,CAAC,EACD;IACE,wBAAwB,EAAE,MAAM;IAChC,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,MAAM;CACrB,CACF,CAAC;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAAmB,CAI3D;IACA,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,uBAAuB;CAChC,CAAC,CAAC;AAEH,2FAA2F","sourcesContent":["import { string, TypeOf } from 'io-ts';\nimport { buildMessageSchema, createSimpleMessage } from './utils';\n\n/**\n * Handshake Response Runtime Data\n */\nexport interface HandshakeResponseData {\n encapsulatedSharedSecret: string; // hex-encoded\n attestationDoc: string; // hex-encoded\n connectionId: string; // Server's connection ID for key derivation\n}\n\n/**\n * Handshake Response Wire Format\n */\nexport interface HandshakeResponseWire {\n type: 'handshake_response';\n version: 1;\n encapsulatedSharedSecret: string; // hex-encoded\n attestationDoc: string; // base64-encoded\n connectionId: string; // Server's connection ID for key derivation\n}\n\n/**\n * Handshake Response Schema (built using Ultra-DRY utilities)\n */\nexport const HandshakeResponseSchema = buildMessageSchema(\n 'handshake_response',\n 1,\n {\n encapsulatedSharedSecret: string,\n attestationDoc: string,\n connectionId: string,\n }\n);\n\nexport type HandshakeResponse = TypeOf<typeof HandshakeResponseSchema>;\n\n/**\n * Handshake V1 Response Message Class (Ultra-DRY implementation)\n */\nexport const HandshakeV1ResponseMessage = createSimpleMessage<\n HandshakeResponseData,\n 'handshake_response',\n 1\n>({\n messageType: 'handshake_response',\n version: 1,\n schema: HandshakeResponseSchema,\n});\n\n// HandshakeResponse naturally implements IMessageConstructor through its static properties\n"]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { TypeOf } from 'io-ts';
|
|
2
|
-
import { HashAlgorithm } from '../constants';
|
|
3
|
-
import { type EncryptedKeyshare } from '../codecs/EncryptedKeyshareCodec';
|
|
4
|
-
import { SigningAlgorithm } from '@dynamic-labs-wallet/core';
|
|
5
|
-
/**
|
|
6
|
-
* Sign Message Request Runtime Data
|
|
7
|
-
*/
|
|
8
|
-
export interface SignMessageRequestData {
|
|
9
|
-
relayDomain: string;
|
|
10
|
-
signingAlgo: SigningAlgorithm;
|
|
11
|
-
hashAlgo?: HashAlgorithm;
|
|
12
|
-
derivationPath?: Uint32Array;
|
|
13
|
-
tweak?: Uint8Array;
|
|
14
|
-
keyshare: EncryptedKeyshare;
|
|
15
|
-
message: Uint8Array | string;
|
|
16
|
-
roomUuid: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Sign Message Request Wire Format
|
|
20
|
-
*/
|
|
21
|
-
export interface SignMessageRequestWire {
|
|
22
|
-
type: 'signMessage';
|
|
23
|
-
version: 1;
|
|
24
|
-
relayDomain: string;
|
|
25
|
-
signingAlgo: SigningAlgorithm;
|
|
26
|
-
hashAlgo?: HashAlgorithm;
|
|
27
|
-
derivationPath?: string;
|
|
28
|
-
tweak?: string;
|
|
29
|
-
keyshare: {
|
|
30
|
-
salt: string;
|
|
31
|
-
encryptedPayload: string;
|
|
32
|
-
};
|
|
33
|
-
message: string;
|
|
34
|
-
roomUuid: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Sign Message Request Schema - uses codecs that handle both formats automatically
|
|
38
|
-
*/
|
|
39
|
-
export declare const SignMessageRequestSchema: import("io-ts").Type<any, any, unknown>;
|
|
40
|
-
export type SignMessageRequest = TypeOf<typeof SignMessageRequestSchema>;
|
|
41
|
-
/**
|
|
42
|
-
* Sign Message V1 Request Message Class - Clean implementation using createComplexEncoder
|
|
43
|
-
*/
|
|
44
|
-
export declare const SignMessageV1RequestMessage: {
|
|
45
|
-
new (data: SignMessageRequestData): {
|
|
46
|
-
readonly type: "signMessage";
|
|
47
|
-
readonly version: 1;
|
|
48
|
-
encode(): unknown;
|
|
49
|
-
readonly data: SignMessageRequestData;
|
|
50
|
-
getData(): SignMessageRequestData;
|
|
51
|
-
};
|
|
52
|
-
readonly MESSAGE_TYPE: "signMessage";
|
|
53
|
-
readonly MESSAGE_VERSION: 1;
|
|
54
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
55
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
56
|
-
readonly type: "signMessage";
|
|
57
|
-
readonly version: 1;
|
|
58
|
-
encode(): unknown;
|
|
59
|
-
readonly data: SignMessageRequestData;
|
|
60
|
-
getData(): SignMessageRequestData;
|
|
61
|
-
}>;
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=SignMessageV1Request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignMessageV1Request.d.ts","sourceRoot":"","sources":["../../src/messages/SignMessageV1Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EACL,aAAa,EAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,yCAUpC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;CAuBtC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { string } from 'io-ts';
|
|
2
|
-
import { Uint32ArrayCodec, Uint8ArrayCodec } from '../codecs';
|
|
3
|
-
import { SignatureAlgoSchema, fromDynamicSigningAlgorithm, } from '../constants';
|
|
4
|
-
import { DomainCodec } from '../codecs/DomainCodec';
|
|
5
|
-
import { EncryptedKeyshareCodec, } from '../codecs/EncryptedKeyshareCodec';
|
|
6
|
-
import { buildMessageSchema, createStandardMessage, createStandardDecoder, createComplexEncoder, } from './utils';
|
|
7
|
-
import { Uint8ArrayOrHexCodec } from '../codecs/Uint8ArrayOrHexCodec';
|
|
8
|
-
/**
|
|
9
|
-
* Sign Message Request Schema - uses codecs that handle both formats automatically
|
|
10
|
-
*/
|
|
11
|
-
export const SignMessageRequestSchema = buildMessageSchema('signMessage', 1, {
|
|
12
|
-
relayDomain: DomainCodec,
|
|
13
|
-
keyshare: EncryptedKeyshareCodec,
|
|
14
|
-
message: Uint8ArrayOrHexCodec,
|
|
15
|
-
roomUuid: string,
|
|
16
|
-
}, SignatureAlgoSchema);
|
|
17
|
-
/**
|
|
18
|
-
* Sign Message V1 Request Message Class - Clean implementation using createComplexEncoder
|
|
19
|
-
*/
|
|
20
|
-
export const SignMessageV1RequestMessage = createStandardMessage({
|
|
21
|
-
messageType: 'signMessage',
|
|
22
|
-
version: 1,
|
|
23
|
-
schema: SignMessageRequestSchema,
|
|
24
|
-
encodeData: createComplexEncoder('signMessage', 1, {
|
|
25
|
-
signingAlgo: (value) => fromDynamicSigningAlgorithm(value),
|
|
26
|
-
derivationPath: (value) => Uint32ArrayCodec.encode(value),
|
|
27
|
-
tweak: (value) => Uint8ArrayCodec.encode(value),
|
|
28
|
-
keyshare: (value) => EncryptedKeyshareCodec.encode(value),
|
|
29
|
-
message: (value) => Uint8ArrayOrHexCodec.encode(value),
|
|
30
|
-
}),
|
|
31
|
-
decodeData: createStandardDecoder((decoded) => ({
|
|
32
|
-
relayDomain: decoded.relayDomain,
|
|
33
|
-
signingAlgo: decoded.signingAlgo,
|
|
34
|
-
hashAlgo: decoded.hashAlgo,
|
|
35
|
-
derivationPath: decoded.derivationPath,
|
|
36
|
-
tweak: decoded.tweak,
|
|
37
|
-
keyshare: decoded.keyshare,
|
|
38
|
-
message: decoded.message,
|
|
39
|
-
roomUuid: decoded.roomUuid,
|
|
40
|
-
})),
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=SignMessageV1Request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignMessageV1Request.js","sourceRoot":"","sources":["../../src/messages/SignMessageV1Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAEL,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,sBAAsB,GAEvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAoCtE;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CACxD,aAAa,EACb,CAAC,EACD;IACE,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,sBAAsB;IAChC,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,MAAM;CACjB,EACD,mBAAmB,CACpB,CAAC;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;IAC/D,WAAW,EAAE,aAAsB;IACnC,OAAO,EAAE,CAAU;IACnB,MAAM,EAAE,wBAAwB;IAChC,UAAU,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAAC,EAAE;QACjD,WAAW,EAAE,CAAC,KAAuB,EAAE,EAAE,CACvC,2BAA2B,CAAC,KAAK,CAAC;QACpC,cAAc,EAAE,CAAC,KAAkB,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC;QACtE,KAAK,EAAE,CAAC,KAAiB,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3D,QAAQ,EAAE,CAAC,KAAwB,EAAE,EAAE,CACrC,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,OAAO,EAAE,CAAC,KAA0B,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC;KAC5E,CAAC;IACF,UAAU,EAAE,qBAAqB,CAAyB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtE,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { string, TypeOf } from 'io-ts';\nimport { Uint32ArrayCodec, Uint8ArrayCodec } from '../codecs';\nimport {\n HashAlgorithm,\n SignatureAlgoSchema,\n fromDynamicSigningAlgorithm,\n} from '../constants';\nimport { DomainCodec } from '../codecs/DomainCodec';\nimport {\n EncryptedKeyshareCodec,\n type EncryptedKeyshare,\n} from '../codecs/EncryptedKeyshareCodec';\nimport {\n buildMessageSchema,\n createStandardMessage,\n createStandardDecoder,\n createComplexEncoder,\n} from './utils';\nimport { Uint8ArrayOrHexCodec } from '../codecs/Uint8ArrayOrHexCodec';\nimport { SigningAlgorithm } from '@dynamic-labs-wallet/core';\n\n/**\n * Sign Message Request Runtime Data\n */\nexport interface SignMessageRequestData {\n relayDomain: string;\n signingAlgo: SigningAlgorithm;\n hashAlgo?: HashAlgorithm;\n derivationPath?: Uint32Array;\n tweak?: Uint8Array;\n keyshare: EncryptedKeyshare;\n message: Uint8Array | string;\n roomUuid: string;\n}\n\n/**\n * Sign Message Request Wire Format\n */\nexport interface SignMessageRequestWire {\n type: 'signMessage';\n version: 1;\n relayDomain: string;\n signingAlgo: SigningAlgorithm;\n hashAlgo?: HashAlgorithm;\n derivationPath?: string; // hex string\n tweak?: string; // hex string\n keyshare: {\n salt: string; // hex string\n encryptedPayload: string; // hex string\n };\n message: string; // hex string\n roomUuid: string;\n}\n\n/**\n * Sign Message Request Schema - uses codecs that handle both formats automatically\n */\nexport const SignMessageRequestSchema = buildMessageSchema(\n 'signMessage',\n 1,\n {\n relayDomain: DomainCodec,\n keyshare: EncryptedKeyshareCodec,\n message: Uint8ArrayOrHexCodec,\n roomUuid: string,\n },\n SignatureAlgoSchema\n);\n\nexport type SignMessageRequest = TypeOf<typeof SignMessageRequestSchema>;\n\n/**\n * Sign Message V1 Request Message Class - Clean implementation using createComplexEncoder\n */\nexport const SignMessageV1RequestMessage = createStandardMessage({\n messageType: 'signMessage' as const,\n version: 1 as const,\n schema: SignMessageRequestSchema,\n encodeData: createComplexEncoder('signMessage', 1, {\n signingAlgo: (value: SigningAlgorithm) =>\n fromDynamicSigningAlgorithm(value),\n derivationPath: (value: Uint32Array) => Uint32ArrayCodec.encode(value),\n tweak: (value: Uint8Array) => Uint8ArrayCodec.encode(value),\n keyshare: (value: EncryptedKeyshare) =>\n EncryptedKeyshareCodec.encode(value),\n message: (value: Uint8Array | string) => Uint8ArrayOrHexCodec.encode(value),\n }),\n decodeData: createStandardDecoder<SignMessageRequestData>((decoded) => ({\n relayDomain: decoded.relayDomain,\n signingAlgo: decoded.signingAlgo,\n hashAlgo: decoded.hashAlgo,\n derivationPath: decoded.derivationPath,\n tweak: decoded.tweak,\n keyshare: decoded.keyshare,\n message: decoded.message,\n roomUuid: decoded.roomUuid,\n })),\n});\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { TypeOf } from 'io-ts';
|
|
2
|
-
import { WebSocketError } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Sign Message Response Runtime Data
|
|
5
|
-
*/
|
|
6
|
-
export interface SignMessageResponseData {
|
|
7
|
-
signature?: Uint8Array;
|
|
8
|
-
error?: WebSocketError;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Sign Message Response Wire Format
|
|
12
|
-
*/
|
|
13
|
-
export interface SignMessageResponseWire {
|
|
14
|
-
type: 'signMessage_response';
|
|
15
|
-
version: 1;
|
|
16
|
-
signature?: string;
|
|
17
|
-
error?: WebSocketError;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Sign Message Response Schema (built using Ultra-DRY utilities)
|
|
21
|
-
* Schema expects wire format types (string for signature)
|
|
22
|
-
*/
|
|
23
|
-
export declare const SignMessageResponseSchema: import("io-ts").Type<any, any, unknown>;
|
|
24
|
-
export type SignMessageResponse = TypeOf<typeof SignMessageResponseSchema>;
|
|
25
|
-
/**
|
|
26
|
-
* Sign Message V1 Response Message Class (Ultra-DRY implementation)
|
|
27
|
-
*/
|
|
28
|
-
export declare const SignMessageV1ResponseMessage: {
|
|
29
|
-
new (data: SignMessageResponseData): {
|
|
30
|
-
readonly type: "signMessage_response";
|
|
31
|
-
readonly version: 1;
|
|
32
|
-
encode(): SignMessageResponseWire;
|
|
33
|
-
readonly data: SignMessageResponseData;
|
|
34
|
-
getData(): SignMessageResponseData;
|
|
35
|
-
};
|
|
36
|
-
readonly MESSAGE_TYPE: "signMessage_response";
|
|
37
|
-
readonly MESSAGE_VERSION: 1;
|
|
38
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
39
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
40
|
-
readonly type: "signMessage_response";
|
|
41
|
-
readonly version: 1;
|
|
42
|
-
encode(): SignMessageResponseWire;
|
|
43
|
-
readonly data: SignMessageResponseData;
|
|
44
|
-
getData(): SignMessageResponseData;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=SignMessageV1Response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignMessageV1Response.d.ts","sourceRoot":"","sources":["../../src/messages/SignMessageV1Response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqC,MAAM,OAAO,CAAC;AAOlE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,yCAOrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;CAgBvC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { union, undefined as undefinedType } from 'io-ts';
|
|
2
|
-
import { buildMessageSchema, createStandardMessage, createComplexEncoder, createStandardDecoder, } from './utils';
|
|
3
|
-
import { WebSocketErrorCodec } from '../codecs/WebSocketErrorCodec';
|
|
4
|
-
import { Uint8ArrayOrHexCodec } from '../codecs/Uint8ArrayOrHexCodec';
|
|
5
|
-
/**
|
|
6
|
-
* Sign Message Response Schema (built using Ultra-DRY utilities)
|
|
7
|
-
* Schema expects wire format types (string for signature)
|
|
8
|
-
*/
|
|
9
|
-
export const SignMessageResponseSchema = buildMessageSchema('signMessage_response', 1, {
|
|
10
|
-
signature: union([Uint8ArrayOrHexCodec, undefinedType]), // Codec handles both hex string and Uint8Array
|
|
11
|
-
error: union([WebSocketErrorCodec, undefinedType]),
|
|
12
|
-
});
|
|
13
|
-
/**
|
|
14
|
-
* Sign Message V1 Response Message Class (Ultra-DRY implementation)
|
|
15
|
-
*/
|
|
16
|
-
export const SignMessageV1ResponseMessage = createStandardMessage({
|
|
17
|
-
messageType: 'signMessage_response',
|
|
18
|
-
version: 1,
|
|
19
|
-
schema: SignMessageResponseSchema,
|
|
20
|
-
encodeData: createComplexEncoder('signMessage_response', 1, {
|
|
21
|
-
signature: (value) => Uint8ArrayOrHexCodec.encode(value),
|
|
22
|
-
}),
|
|
23
|
-
decodeData: createStandardDecoder((decoded) => ({
|
|
24
|
-
signature: decoded.signature,
|
|
25
|
-
error: decoded.error,
|
|
26
|
-
})),
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=SignMessageV1Response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignMessageV1Response.js","sourceRoot":"","sources":["../../src/messages/SignMessageV1Response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAoBtE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CACzD,sBAAsB,EACtB,CAAC,EACD;IACE,SAAS,EAAE,KAAK,CAAC,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC,EAAE,+CAA+C;IACxG,KAAK,EAAE,KAAK,CAAC,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;CACnD,CACF,CAAC;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAK/D;IACA,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,yBAAyB;IACjC,UAAU,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,EAAE;QAC1D,SAAS,EAAE,CAAC,KAAiB,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC;KACrE,CAAC;IACF,UAAU,EAAE,qBAAqB,CAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvE,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { TypeOf, union, undefined as undefinedType } from 'io-ts';\nimport {\n buildMessageSchema,\n createStandardMessage,\n createComplexEncoder,\n createStandardDecoder,\n} from './utils';\nimport { WebSocketError } from '../types';\nimport { WebSocketErrorCodec } from '../codecs/WebSocketErrorCodec';\nimport { Uint8ArrayOrHexCodec } from '../codecs/Uint8ArrayOrHexCodec';\n\n/**\n * Sign Message Response Runtime Data\n */\nexport interface SignMessageResponseData {\n signature?: Uint8Array; // The signature as byte array - present on success\n error?: WebSocketError; // Error details - present on failure\n}\n\n/**\n * Sign Message Response Wire Format\n */\nexport interface SignMessageResponseWire {\n type: 'signMessage_response';\n version: 1;\n signature?: string; // The signature (hex-encoded) - present on success\n error?: WebSocketError; // Error details - present on failure\n}\n\n/**\n * Sign Message Response Schema (built using Ultra-DRY utilities)\n * Schema expects wire format types (string for signature)\n */\nexport const SignMessageResponseSchema = buildMessageSchema(\n 'signMessage_response',\n 1,\n {\n signature: union([Uint8ArrayOrHexCodec, undefinedType]), // Codec handles both hex string and Uint8Array\n error: union([WebSocketErrorCodec, undefinedType]),\n }\n);\n\nexport type SignMessageResponse = TypeOf<typeof SignMessageResponseSchema>;\n\n/**\n * Sign Message V1 Response Message Class (Ultra-DRY implementation)\n */\nexport const SignMessageV1ResponseMessage = createStandardMessage<\n SignMessageResponseData,\n SignMessageResponseWire,\n 'signMessage_response',\n 1\n>({\n messageType: 'signMessage_response',\n version: 1,\n schema: SignMessageResponseSchema,\n encodeData: createComplexEncoder('signMessage_response', 1, {\n signature: (value: Uint8Array) => Uint8ArrayOrHexCodec.encode(value),\n }),\n decodeData: createStandardDecoder<SignMessageResponseData>((decoded) => ({\n signature: decoded.signature,\n error: decoded.error,\n })),\n});\n"]}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 🎯 SINGLE SOURCE OF TRUTH - Add new messages here and everything else is automatic!
|
|
3
|
-
* This is the ONLY place you need to add new message types
|
|
4
|
-
*/
|
|
5
|
-
export declare const ALL_MESSAGE_CLASSES: {
|
|
6
|
-
readonly 'handshake@1': {
|
|
7
|
-
new (data: import("./HandshakeV1Request").HandshakeRequestData): {
|
|
8
|
-
readonly type: "handshake";
|
|
9
|
-
readonly version: 1;
|
|
10
|
-
encode(): import("./HandshakeV1Request").HandshakeRequestWire;
|
|
11
|
-
readonly data: import("./HandshakeV1Request").HandshakeRequestData;
|
|
12
|
-
getData(): import("./HandshakeV1Request").HandshakeRequestData;
|
|
13
|
-
};
|
|
14
|
-
readonly MESSAGE_TYPE: "handshake";
|
|
15
|
-
readonly MESSAGE_VERSION: 1;
|
|
16
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
17
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
18
|
-
readonly type: "handshake";
|
|
19
|
-
readonly version: 1;
|
|
20
|
-
encode(): import("./HandshakeV1Request").HandshakeRequestWire;
|
|
21
|
-
readonly data: import("./HandshakeV1Request").HandshakeRequestData;
|
|
22
|
-
getData(): import("./HandshakeV1Request").HandshakeRequestData;
|
|
23
|
-
}>;
|
|
24
|
-
};
|
|
25
|
-
readonly 'handshake_response@1': {
|
|
26
|
-
new (data: import("./HandshakeV1Response").HandshakeResponseData): {
|
|
27
|
-
readonly type: "handshake_response";
|
|
28
|
-
readonly version: 1;
|
|
29
|
-
encode(): any;
|
|
30
|
-
readonly data: import("./HandshakeV1Response").HandshakeResponseData;
|
|
31
|
-
getData(): import("./HandshakeV1Response").HandshakeResponseData;
|
|
32
|
-
};
|
|
33
|
-
readonly MESSAGE_TYPE: "handshake_response";
|
|
34
|
-
readonly MESSAGE_VERSION: 1;
|
|
35
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
36
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
37
|
-
readonly type: "handshake_response";
|
|
38
|
-
readonly version: 1;
|
|
39
|
-
encode(): any;
|
|
40
|
-
readonly data: import("./HandshakeV1Response").HandshakeResponseData;
|
|
41
|
-
getData(): import("./HandshakeV1Response").HandshakeResponseData;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
readonly 'signMessage@1': {
|
|
45
|
-
new (data: import("./SignMessageV1Request").SignMessageRequestData): {
|
|
46
|
-
readonly type: "signMessage";
|
|
47
|
-
readonly version: 1;
|
|
48
|
-
encode(): unknown;
|
|
49
|
-
readonly data: import("./SignMessageV1Request").SignMessageRequestData;
|
|
50
|
-
getData(): import("./SignMessageV1Request").SignMessageRequestData;
|
|
51
|
-
};
|
|
52
|
-
readonly MESSAGE_TYPE: "signMessage";
|
|
53
|
-
readonly MESSAGE_VERSION: 1;
|
|
54
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
55
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
56
|
-
readonly type: "signMessage";
|
|
57
|
-
readonly version: 1;
|
|
58
|
-
encode(): unknown;
|
|
59
|
-
readonly data: import("./SignMessageV1Request").SignMessageRequestData;
|
|
60
|
-
getData(): import("./SignMessageV1Request").SignMessageRequestData;
|
|
61
|
-
}>;
|
|
62
|
-
};
|
|
63
|
-
readonly 'signMessage_response@1': {
|
|
64
|
-
new (data: import("./SignMessageV1Response").SignMessageResponseData): {
|
|
65
|
-
readonly type: "signMessage_response";
|
|
66
|
-
readonly version: 1;
|
|
67
|
-
encode(): import("./SignMessageV1Response").SignMessageResponseWire;
|
|
68
|
-
readonly data: import("./SignMessageV1Response").SignMessageResponseData;
|
|
69
|
-
getData(): import("./SignMessageV1Response").SignMessageResponseData;
|
|
70
|
-
};
|
|
71
|
-
readonly MESSAGE_TYPE: "signMessage_response";
|
|
72
|
-
readonly MESSAGE_VERSION: 1;
|
|
73
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
74
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
75
|
-
readonly type: "signMessage_response";
|
|
76
|
-
readonly version: 1;
|
|
77
|
-
encode(): import("./SignMessageV1Response").SignMessageResponseWire;
|
|
78
|
-
readonly data: import("./SignMessageV1Response").SignMessageResponseData;
|
|
79
|
-
getData(): import("./SignMessageV1Response").SignMessageResponseData;
|
|
80
|
-
}>;
|
|
81
|
-
};
|
|
82
|
-
readonly 'connection_ack@1': {
|
|
83
|
-
new (data: import("./ConnectionAckV1Request").ConnectionAckRequestData): {
|
|
84
|
-
readonly type: "connection_ack";
|
|
85
|
-
readonly version: 1;
|
|
86
|
-
encode(): any;
|
|
87
|
-
readonly data: import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
88
|
-
getData(): import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
89
|
-
};
|
|
90
|
-
readonly MESSAGE_TYPE: "connection_ack";
|
|
91
|
-
readonly MESSAGE_VERSION: 1;
|
|
92
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
93
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
94
|
-
readonly type: "connection_ack";
|
|
95
|
-
readonly version: 1;
|
|
96
|
-
encode(): any;
|
|
97
|
-
readonly data: import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
98
|
-
getData(): import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
99
|
-
}>;
|
|
100
|
-
};
|
|
101
|
-
readonly 'connection_ack_response@1': {
|
|
102
|
-
new (data: import("./ConnectionAckV1Response").ConnectionAckResponseData): {
|
|
103
|
-
readonly type: "connection_ack_response";
|
|
104
|
-
readonly version: 1;
|
|
105
|
-
encode(): any;
|
|
106
|
-
readonly data: import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
107
|
-
getData(): import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
108
|
-
};
|
|
109
|
-
readonly MESSAGE_TYPE: "connection_ack_response";
|
|
110
|
-
readonly MESSAGE_VERSION: 1;
|
|
111
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
112
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
113
|
-
readonly type: "connection_ack_response";
|
|
114
|
-
readonly version: 1;
|
|
115
|
-
encode(): any;
|
|
116
|
-
readonly data: import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
117
|
-
getData(): import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
118
|
-
}>;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Derive message type union from classes
|
|
123
|
-
*/
|
|
124
|
-
export type AllMessageTypes = keyof typeof ALL_MESSAGE_CLASSES;
|
|
125
|
-
/**
|
|
126
|
-
* Derive runtime array of message keys from classes
|
|
127
|
-
*/
|
|
128
|
-
export declare const ALL_MESSAGE_KEYS: AllMessageTypes[];
|
|
129
|
-
/**
|
|
130
|
-
* Get message class by type and version (derived from single source)
|
|
131
|
-
*/
|
|
132
|
-
export declare function getMessageClass(type: string, version: number): {
|
|
133
|
-
new (data: import("./HandshakeV1Request").HandshakeRequestData): {
|
|
134
|
-
readonly type: "handshake";
|
|
135
|
-
readonly version: 1;
|
|
136
|
-
encode(): import("./HandshakeV1Request").HandshakeRequestWire;
|
|
137
|
-
readonly data: import("./HandshakeV1Request").HandshakeRequestData;
|
|
138
|
-
getData(): import("./HandshakeV1Request").HandshakeRequestData;
|
|
139
|
-
};
|
|
140
|
-
readonly MESSAGE_TYPE: "handshake";
|
|
141
|
-
readonly MESSAGE_VERSION: 1;
|
|
142
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
143
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
144
|
-
readonly type: "handshake";
|
|
145
|
-
readonly version: 1;
|
|
146
|
-
encode(): import("./HandshakeV1Request").HandshakeRequestWire;
|
|
147
|
-
readonly data: import("./HandshakeV1Request").HandshakeRequestData;
|
|
148
|
-
getData(): import("./HandshakeV1Request").HandshakeRequestData;
|
|
149
|
-
}>;
|
|
150
|
-
} | {
|
|
151
|
-
new (data: import("./HandshakeV1Response").HandshakeResponseData): {
|
|
152
|
-
readonly type: "handshake_response";
|
|
153
|
-
readonly version: 1;
|
|
154
|
-
encode(): any;
|
|
155
|
-
readonly data: import("./HandshakeV1Response").HandshakeResponseData;
|
|
156
|
-
getData(): import("./HandshakeV1Response").HandshakeResponseData;
|
|
157
|
-
};
|
|
158
|
-
readonly MESSAGE_TYPE: "handshake_response";
|
|
159
|
-
readonly MESSAGE_VERSION: 1;
|
|
160
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
161
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
162
|
-
readonly type: "handshake_response";
|
|
163
|
-
readonly version: 1;
|
|
164
|
-
encode(): any;
|
|
165
|
-
readonly data: import("./HandshakeV1Response").HandshakeResponseData;
|
|
166
|
-
getData(): import("./HandshakeV1Response").HandshakeResponseData;
|
|
167
|
-
}>;
|
|
168
|
-
} | {
|
|
169
|
-
new (data: import("./SignMessageV1Request").SignMessageRequestData): {
|
|
170
|
-
readonly type: "signMessage";
|
|
171
|
-
readonly version: 1;
|
|
172
|
-
encode(): unknown;
|
|
173
|
-
readonly data: import("./SignMessageV1Request").SignMessageRequestData;
|
|
174
|
-
getData(): import("./SignMessageV1Request").SignMessageRequestData;
|
|
175
|
-
};
|
|
176
|
-
readonly MESSAGE_TYPE: "signMessage";
|
|
177
|
-
readonly MESSAGE_VERSION: 1;
|
|
178
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
179
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
180
|
-
readonly type: "signMessage";
|
|
181
|
-
readonly version: 1;
|
|
182
|
-
encode(): unknown;
|
|
183
|
-
readonly data: import("./SignMessageV1Request").SignMessageRequestData;
|
|
184
|
-
getData(): import("./SignMessageV1Request").SignMessageRequestData;
|
|
185
|
-
}>;
|
|
186
|
-
} | {
|
|
187
|
-
new (data: import("./SignMessageV1Response").SignMessageResponseData): {
|
|
188
|
-
readonly type: "signMessage_response";
|
|
189
|
-
readonly version: 1;
|
|
190
|
-
encode(): import("./SignMessageV1Response").SignMessageResponseWire;
|
|
191
|
-
readonly data: import("./SignMessageV1Response").SignMessageResponseData;
|
|
192
|
-
getData(): import("./SignMessageV1Response").SignMessageResponseData;
|
|
193
|
-
};
|
|
194
|
-
readonly MESSAGE_TYPE: "signMessage_response";
|
|
195
|
-
readonly MESSAGE_VERSION: 1;
|
|
196
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
197
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
198
|
-
readonly type: "signMessage_response";
|
|
199
|
-
readonly version: 1;
|
|
200
|
-
encode(): import("./SignMessageV1Response").SignMessageResponseWire;
|
|
201
|
-
readonly data: import("./SignMessageV1Response").SignMessageResponseData;
|
|
202
|
-
getData(): import("./SignMessageV1Response").SignMessageResponseData;
|
|
203
|
-
}>;
|
|
204
|
-
} | {
|
|
205
|
-
new (data: import("./ConnectionAckV1Request").ConnectionAckRequestData): {
|
|
206
|
-
readonly type: "connection_ack";
|
|
207
|
-
readonly version: 1;
|
|
208
|
-
encode(): any;
|
|
209
|
-
readonly data: import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
210
|
-
getData(): import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
211
|
-
};
|
|
212
|
-
readonly MESSAGE_TYPE: "connection_ack";
|
|
213
|
-
readonly MESSAGE_VERSION: 1;
|
|
214
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
215
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
216
|
-
readonly type: "connection_ack";
|
|
217
|
-
readonly version: 1;
|
|
218
|
-
encode(): any;
|
|
219
|
-
readonly data: import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
220
|
-
getData(): import("./ConnectionAckV1Request").ConnectionAckRequestData;
|
|
221
|
-
}>;
|
|
222
|
-
} | {
|
|
223
|
-
new (data: import("./ConnectionAckV1Response").ConnectionAckResponseData): {
|
|
224
|
-
readonly type: "connection_ack_response";
|
|
225
|
-
readonly version: 1;
|
|
226
|
-
encode(): any;
|
|
227
|
-
readonly data: import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
228
|
-
getData(): import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
229
|
-
};
|
|
230
|
-
readonly MESSAGE_TYPE: "connection_ack_response";
|
|
231
|
-
readonly MESSAGE_VERSION: 1;
|
|
232
|
-
readonly schema: import("io-ts").Type<any, any, unknown>;
|
|
233
|
-
decode(wireData: unknown): import("fp-ts/lib/Either").Either<import("io-ts").Errors, {
|
|
234
|
-
readonly type: "connection_ack_response";
|
|
235
|
-
readonly version: 1;
|
|
236
|
-
encode(): any;
|
|
237
|
-
readonly data: import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
238
|
-
getData(): import("./ConnectionAckV1Response").ConnectionAckResponseData;
|
|
239
|
-
}>;
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* Type-safe check if message type exists
|
|
243
|
-
*/
|
|
244
|
-
export declare function isValidMessageType(type: string, version: number): boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Get all supported message types and versions
|
|
247
|
-
*/
|
|
248
|
-
export declare function getAllSupportedMessages(): Array<{
|
|
249
|
-
type: string;
|
|
250
|
-
version: number;
|
|
251
|
-
}>;
|
|
252
|
-
/**
|
|
253
|
-
* Helper to extract message type and version from key
|
|
254
|
-
*/
|
|
255
|
-
export declare function parseMessageKey(key: AllMessageTypes): {
|
|
256
|
-
type: string;
|
|
257
|
-
version: number;
|
|
258
|
-
};
|
|
259
|
-
//# sourceMappingURL=allMessages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allMessages.d.ts","sourceRoot":"","sources":["../../src/messages/allMessages.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOtB,CAAC;AAMX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAExB,eAAe,EAAE,CAAC;AAEvB;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGzE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,KAAK,CAAC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAKD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAGA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { HandshakeV1RequestMessage } from './HandshakeV1Request';
|
|
2
|
-
import { HandshakeV1ResponseMessage } from './HandshakeV1Response';
|
|
3
|
-
import { SignMessageV1RequestMessage } from './SignMessageV1Request';
|
|
4
|
-
import { SignMessageV1ResponseMessage } from './SignMessageV1Response';
|
|
5
|
-
import { ConnectionAckV1RequestMessage } from './ConnectionAckV1Request';
|
|
6
|
-
import { ConnectionAckV1ResponseMessage } from './ConnectionAckV1Response';
|
|
7
|
-
/**
|
|
8
|
-
* 🎯 SINGLE SOURCE OF TRUTH - Add new messages here and everything else is automatic!
|
|
9
|
-
* This is the ONLY place you need to add new message types
|
|
10
|
-
*/
|
|
11
|
-
export const ALL_MESSAGE_CLASSES = {
|
|
12
|
-
'handshake@1': HandshakeV1RequestMessage,
|
|
13
|
-
'handshake_response@1': HandshakeV1ResponseMessage,
|
|
14
|
-
'signMessage@1': SignMessageV1RequestMessage,
|
|
15
|
-
'signMessage_response@1': SignMessageV1ResponseMessage,
|
|
16
|
-
'connection_ack@1': ConnectionAckV1RequestMessage,
|
|
17
|
-
'connection_ack_response@1': ConnectionAckV1ResponseMessage,
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Derive runtime array of message keys from classes
|
|
21
|
-
*/
|
|
22
|
-
export const ALL_MESSAGE_KEYS = Object.keys(ALL_MESSAGE_CLASSES);
|
|
23
|
-
/**
|
|
24
|
-
* Get message class by type and version (derived from single source)
|
|
25
|
-
*/
|
|
26
|
-
export function getMessageClass(type, version) {
|
|
27
|
-
const key = `${type}@${version}`;
|
|
28
|
-
const MessageClass = ALL_MESSAGE_CLASSES[key];
|
|
29
|
-
if (!MessageClass) {
|
|
30
|
-
throw new Error(`Unknown message type: ${type} version ${version}`);
|
|
31
|
-
}
|
|
32
|
-
return MessageClass;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Type-safe check if message type exists
|
|
36
|
-
*/
|
|
37
|
-
export function isValidMessageType(type, version) {
|
|
38
|
-
const key = `${type}@${version}`;
|
|
39
|
-
return key in ALL_MESSAGE_CLASSES;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get all supported message types and versions
|
|
43
|
-
*/
|
|
44
|
-
export function getAllSupportedMessages() {
|
|
45
|
-
return ALL_MESSAGE_KEYS.map((key) => {
|
|
46
|
-
const [type, versionStr] = key.split('@');
|
|
47
|
-
return { type, version: parseInt(versionStr, 10) };
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Helper to extract message type and version from key
|
|
52
|
-
*/
|
|
53
|
-
export function parseMessageKey(key) {
|
|
54
|
-
const [type, versionStr] = key.split('@');
|
|
55
|
-
return { type, version: parseInt(versionStr, 10) };
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=allMessages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allMessages.js","sourceRoot":"","sources":["../../src/messages/allMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,aAAa,EAAE,yBAAyB;IACxC,sBAAsB,EAAE,0BAA0B;IAClD,eAAe,EAAE,2BAA2B;IAC5C,wBAAwB,EAAE,4BAA4B;IACtD,kBAAkB,EAAE,6BAA6B;IACjD,2BAA2B,EAAE,8BAA8B;CACnD,CAAC;AAWX;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CACzC,mBAAmB,CACC,CAAC;AAEvB;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,OAAe;IAC3D,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,EAAqB,CAAC;IACpD,MAAM,YAAY,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAE9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,OAAe;IAC9D,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;IACjC,OAAO,GAAG,IAAI,mBAAmB,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IAIrC,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAoB;IAIlD,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import { HandshakeV1RequestMessage } from './HandshakeV1Request';\nimport { HandshakeV1ResponseMessage } from './HandshakeV1Response';\nimport { SignMessageV1RequestMessage } from './SignMessageV1Request';\nimport { SignMessageV1ResponseMessage } from './SignMessageV1Response';\nimport { ConnectionAckV1RequestMessage } from './ConnectionAckV1Request';\nimport { ConnectionAckV1ResponseMessage } from './ConnectionAckV1Response';\n\n/**\n * 🎯 SINGLE SOURCE OF TRUTH - Add new messages here and everything else is automatic!\n * This is the ONLY place you need to add new message types\n */\nexport const ALL_MESSAGE_CLASSES = {\n 'handshake@1': HandshakeV1RequestMessage,\n 'handshake_response@1': HandshakeV1ResponseMessage,\n 'signMessage@1': SignMessageV1RequestMessage,\n 'signMessage_response@1': SignMessageV1ResponseMessage,\n 'connection_ack@1': ConnectionAckV1RequestMessage,\n 'connection_ack_response@1': ConnectionAckV1ResponseMessage,\n} as const;\n\n// ========================================\n// 🤖 EVERYTHING BELOW IS AUTOMATICALLY DERIVED\n// ========================================\n\n/**\n * Derive message type union from classes\n */\nexport type AllMessageTypes = keyof typeof ALL_MESSAGE_CLASSES;\n\n/**\n * Derive runtime array of message keys from classes\n */\nexport const ALL_MESSAGE_KEYS = Object.keys(\n ALL_MESSAGE_CLASSES\n) as AllMessageTypes[];\n\n/**\n * Get message class by type and version (derived from single source)\n */\nexport function getMessageClass(type: string, version: number) {\n const key = `${type}@${version}` as AllMessageTypes;\n const MessageClass = ALL_MESSAGE_CLASSES[key];\n\n if (!MessageClass) {\n throw new Error(`Unknown message type: ${type} version ${version}`);\n }\n\n return MessageClass;\n}\n\n/**\n * Type-safe check if message type exists\n */\nexport function isValidMessageType(type: string, version: number): boolean {\n const key = `${type}@${version}`;\n return key in ALL_MESSAGE_CLASSES;\n}\n\n/**\n * Get all supported message types and versions\n */\nexport function getAllSupportedMessages(): Array<{\n type: string;\n version: number;\n}> {\n return ALL_MESSAGE_KEYS.map((key) => {\n const [type, versionStr] = key.split('@');\n return { type, version: parseInt(versionStr, 10) };\n });\n}\n\n/**\n * Helper to extract message type and version from key\n */\nexport function parseMessageKey(key: AllMessageTypes): {\n type: string;\n version: number;\n} {\n const [type, versionStr] = key.split('@');\n return { type, version: parseInt(versionStr, 10) };\n}\n"]}
|
package/dist/messages/base.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base interface for all messages
|
|
3
|
-
*/
|
|
4
|
-
export interface IMessage<TRuntime = any, TWire = any> {
|
|
5
|
-
readonly type: string;
|
|
6
|
-
readonly version: number;
|
|
7
|
-
/**
|
|
8
|
-
* Encode this message to wire format for transmission
|
|
9
|
-
*/
|
|
10
|
-
encode(): TWire;
|
|
11
|
-
/**
|
|
12
|
-
* Get the runtime data of this message
|
|
13
|
-
*/
|
|
14
|
-
getData(): TRuntime;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Abstract base class for all messages
|
|
18
|
-
*/
|
|
19
|
-
export declare abstract class BaseMessage<TRuntime = any, TWire = any> implements IMessage<TRuntime, TWire> {
|
|
20
|
-
readonly data: TRuntime;
|
|
21
|
-
abstract readonly type: string;
|
|
22
|
-
abstract readonly version: number;
|
|
23
|
-
protected constructor(data: TRuntime);
|
|
24
|
-
abstract encode(): TWire;
|
|
25
|
-
getData(): TRuntime;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=base.d.ts.map
|