@bitgo/public-types 2.20.0 → 2.22.0
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/src/index.d.ts +0 -1
- package/dist/src/schema/index.d.ts +0 -1
- package/dist/src/schema/keyGen/index.d.ts +0 -1
- package/dist/src/schema/keyGen/keyGenState.d.ts +0 -1
- package/dist/src/schema/keyGen/keyGenType.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts +0 -1
- package/dist/src/schema/mpcv2/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/keyGen/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts +1 -1
- package/dist/src/schema/mpcv2/keyGen/keygenRound.js +1 -0
- package/dist/src/schema/mpcv2/keyGen/keygenRound.js.map +1 -1
- package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/index.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts +0 -1
- package/dist/src/schema/mpcv2/signing/signingRound.d.ts +0 -1
- package/dist/src/schema/transactionRequest/index.d.ts +0 -1
- package/dist/src/schema/transactionRequest/transactionRequestState.d.ts +0 -1
- package/dist/src/schema/transactionRequest/transactionState.d.ts +0 -1
- package/dist/src/schema/transactions/coinSpecific.d.ts +0 -1
- package/dist/src/schema/transactions/index.d.ts +0 -1
- package/dist/src/schema/transactions/sendTransactions.d.ts +0 -1
- package/dist/src/schema/wallet/index.d.ts +0 -1
- package/dist/src/schema/wallet/wallet.d.ts +0 -1
- package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts +0 -1
- package/dist/src/schema/webhook/enterpriseWebhooks.d.ts +0 -1
- package/dist/src/schema/webhook/index.d.ts +0 -1
- package/dist/src/schema/webhook/webhook.d.ts +0 -1
- package/dist/src/schema/webhook/webhookNotification.d.ts +0 -1
- package/dist/src/schema/webhook/webhookScope.d.ts +0 -1
- package/dist/src/schema/webhook/webhookState.d.ts +0 -1
- package/dist/src/schema/webhook/webhookType.d.ts +0 -1
- package/dist/src/utils/arrayFromSingle.d.ts +0 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/minMaxArray.d.ts +0 -1
- package/dist/src/utils/optional.d.ts +0 -1
- package/dist/src/utils/primitives.d.ts +0 -1
- package/package.json +4 -3
- package/src/index.ts +2 -0
- package/src/schema/index.ts +6 -0
- package/src/schema/keyGen/index.ts +2 -0
- package/src/schema/keyGen/keyGenState.ts +8 -0
- package/src/schema/keyGen/keyGenType.ts +7 -0
- package/src/schema/mpcv2/common/index.ts +3 -0
- package/src/schema/mpcv2/common/mpcv2BroadcastMessage.ts +24 -0
- package/src/schema/mpcv2/common/mpcv2P2PMessage.ts +14 -0
- package/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.ts +13 -0
- package/src/schema/mpcv2/index.ts +3 -0
- package/src/schema/mpcv2/keyGen/index.ts +2 -0
- package/src/schema/mpcv2/keyGen/keygenRound.ts +71 -0
- package/src/schema/mpcv2/keyGen/mpcv2KeyGenState.ts +12 -0
- package/src/schema/mpcv2/signing/index.ts +2 -0
- package/src/schema/mpcv2/signing/mpcv2SigningState.ts +11 -0
- package/src/schema/mpcv2/signing/signingRound.ts +113 -0
- package/src/schema/transactionRequest/index.ts +2 -0
- package/src/schema/transactionRequest/transactionRequestState.ts +21 -0
- package/src/schema/transactionRequest/transactionState.ts +22 -0
- package/src/schema/transactions/coinSpecific.ts +59 -0
- package/src/schema/transactions/index.ts +1 -0
- package/src/schema/transactions/sendTransactions.ts +245 -0
- package/src/schema/wallet/index.ts +1 -0
- package/src/schema/wallet/wallet.ts +8 -0
- package/src/schema/webhook/addWalletWebhookRequest.ts +24 -0
- package/src/schema/webhook/enterpriseWebhooks.ts +44 -0
- package/src/schema/webhook/index.ts +7 -0
- package/src/schema/webhook/webhook.ts +35 -0
- package/src/schema/webhook/webhookNotification.ts +33 -0
- package/src/schema/webhook/webhookScope.ts +10 -0
- package/src/schema/webhook/webhookState.ts +9 -0
- package/src/schema/webhook/webhookType.ts +56 -0
- package/src/utils/arrayFromSingle.ts +19 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/minMaxArray.ts +27 -0
- package/src/utils/optional.ts +5 -0
- package/src/utils/primitives.ts +11 -0
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/schema/index.d.ts.map +0 -1
- package/dist/src/schema/keyGen/index.d.ts.map +0 -1
- package/dist/src/schema/keyGen/keyGenState.d.ts.map +0 -1
- package/dist/src/schema/keyGen/keyGenType.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2BroadcastMessage.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2P2PMessage.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/common/mpcv2PartyFromStringOrNumber.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/keygenRound.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/keyGen/mpcv2KeyGenState.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/index.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/mpcv2SigningState.d.ts.map +0 -1
- package/dist/src/schema/mpcv2/signing/signingRound.d.ts.map +0 -1
- package/dist/src/schema/transactionRequest/index.d.ts.map +0 -1
- package/dist/src/schema/transactionRequest/transactionRequestState.d.ts.map +0 -1
- package/dist/src/schema/transactionRequest/transactionState.d.ts.map +0 -1
- package/dist/src/schema/transactions/coinSpecific.d.ts.map +0 -1
- package/dist/src/schema/transactions/index.d.ts.map +0 -1
- package/dist/src/schema/transactions/sendTransactions.d.ts.map +0 -1
- package/dist/src/schema/wallet/index.d.ts.map +0 -1
- package/dist/src/schema/wallet/wallet.d.ts.map +0 -1
- package/dist/src/schema/webhook/addWalletWebhookRequest.d.ts.map +0 -1
- package/dist/src/schema/webhook/enterpriseWebhooks.d.ts.map +0 -1
- package/dist/src/schema/webhook/index.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhook.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookNotification.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookScope.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookState.d.ts.map +0 -1
- package/dist/src/schema/webhook/webhookType.d.ts.map +0 -1
- package/dist/src/utils/arrayFromSingle.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/minMaxArray.d.ts.map +0 -1
- package/dist/src/utils/optional.d.ts.map +0 -1
- package/dist/src/utils/primitives.d.ts.map +0 -1
package/dist/src/index.d.ts
CHANGED
@@ -13,4 +13,3 @@ export declare const MPCv2BroadcastMessageWithSignatureR: t.IntersectionC<[t.Typ
|
|
13
13
|
signatureR: t.StringC;
|
14
14
|
}>]>;
|
15
15
|
export type MPCv2BroadcastMessageWithSignatureR = t.TypeOf<typeof MPCv2BroadcastMessageWithSignatureR>;
|
16
|
-
//# sourceMappingURL=mpcv2BroadcastMessage.d.ts.map
|
@@ -1,4 +1,3 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
2
|
export declare const MPCv2PartyFromStringOrNumber: t.UnionC<[t.UnionC<[t.LiteralC<0>, t.LiteralC<1>, t.LiteralC<2>]>, t.Type<0 | 2 | 1, string, unknown>]>;
|
3
3
|
export type MPCv2PartyFromStringOrNumber = t.TypeOf<typeof MPCv2PartyFromStringOrNumber>;
|
4
|
-
//# sourceMappingURL=mpcv2PartyFromStringOrNumber.d.ts.map
|
@@ -15,6 +15,7 @@ export declare const MPCv2KeyGenRound1Request: t.TypeC<{
|
|
15
15
|
}>;
|
16
16
|
export type MPCv2KeyGenRound1Request = t.TypeOf<typeof MPCv2KeyGenRound1Request>;
|
17
17
|
export declare const MPCv2KeyGenRound1Response: t.TypeC<{
|
18
|
+
walletGpgPubKeySigs: import("io-ts-types").NonEmptyStringC;
|
18
19
|
sessionId: import("io-ts-types").NonEmptyStringC;
|
19
20
|
bitgoMsg1: t.TypeC<{
|
20
21
|
from: t.UnionC<[t.UnionC<[t.LiteralC<0>, t.LiteralC<1>, t.LiteralC<2>]>, t.Type<0 | 2 | 1, string, unknown>]>;
|
@@ -106,4 +107,3 @@ export declare const MPCv2KeyGenRound3Response: t.TypeC<{
|
|
106
107
|
}>;
|
107
108
|
}>;
|
108
109
|
export type MPCv2KeyGenRound3Response = t.TypeOf<typeof MPCv2KeyGenRound3Response>;
|
109
|
-
//# sourceMappingURL=keygenRound.d.ts.map
|
@@ -34,6 +34,7 @@ exports.MPCv2KeyGenRound1Request = t.type({
|
|
34
34
|
backupMsg1: common_1.MPCv2BroadcastMessage,
|
35
35
|
});
|
36
36
|
exports.MPCv2KeyGenRound1Response = t.type({
|
37
|
+
walletGpgPubKeySigs: io_ts_types_1.NonEmptyString,
|
37
38
|
sessionId: io_ts_types_1.NonEmptyString,
|
38
39
|
bitgoMsg1: common_1.MPCv2BroadcastMessage,
|
39
40
|
bitgoToUserMsg2: common_1.MPCv2P2PMessage,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keygenRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/keyGen/keygenRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAA6C;AAC7C,sCAAmE;AAEtD,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,gBAAgB,EAAE,4BAAc;IAChC,kBAAkB,EAAE,4BAAc;IAClC,QAAQ,EAAE,8BAAqB;IAC/B,UAAU,EAAE,8BAAqB;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,SAAS,EAAE,8BAAqB;IAChC,eAAe,EAAE,wBAAe;IAChC,iBAAiB,EAAE,wBAAe;CACnC,CAAC,CAAC;AAMU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,wBAAe;IACzB,eAAe,EAAE,4BAAc;IAC/B,UAAU,EAAE,wBAAe;IAC3B,iBAAiB,EAAE,4BAAc;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,gBAAgB,EAAE,4BAAc;IAChC,eAAe,EAAE,wBAAe;IAChC,iBAAiB,EAAE,wBAAe;CACnC,CAAC,CAAC;AAMU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,wBAAe;IACzB,UAAU,EAAE,wBAAe;IAC3B,QAAQ,EAAE,8BAAqB;IAC/B,UAAU,EAAE,8BAAqB;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,cAAc,EAAE,4BAAc;IAC9B,SAAS,EAAE,8BAAqB;CACjC,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"keygenRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/keyGen/keygenRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAA6C;AAC7C,sCAAmE;AAEtD,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,gBAAgB,EAAE,4BAAc;IAChC,kBAAkB,EAAE,4BAAc;IAClC,QAAQ,EAAE,8BAAqB;IAC/B,UAAU,EAAE,8BAAqB;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,mBAAmB,EAAE,4BAAc;IACnC,SAAS,EAAE,4BAAc;IACzB,SAAS,EAAE,8BAAqB;IAChC,eAAe,EAAE,wBAAe;IAChC,iBAAiB,EAAE,wBAAe;CACnC,CAAC,CAAC;AAMU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,wBAAe;IACzB,eAAe,EAAE,4BAAc;IAC/B,UAAU,EAAE,wBAAe;IAC3B,iBAAiB,EAAE,4BAAc;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,gBAAgB,EAAE,4BAAc;IAChC,eAAe,EAAE,wBAAe;IAChC,iBAAiB,EAAE,wBAAe;CACnC,CAAC,CAAC;AAMU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,wBAAe;IACzB,UAAU,EAAE,wBAAe;IAC3B,QAAQ,EAAE,8BAAqB;IAC/B,UAAU,EAAE,8BAAqB;CAClC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,cAAc,EAAE,4BAAc;IAC9B,SAAS,EAAE,8BAAqB;CACjC,CAAC,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
1
|
import * as t from "io-ts";
|
2
2
|
export declare const MPCv2SigningState: t.UnionC<[t.LiteralC<"round1Input">, t.LiteralC<"round1Output">, t.LiteralC<"round2Input">, t.LiteralC<"round2Output">, t.LiteralC<"round3Input">]>;
|
3
3
|
export type MPCv2SigningState = t.TypeOf<typeof MPCv2SigningState>;
|
4
|
-
//# sourceMappingURL=mpcv2SigningState.d.ts.map
|
@@ -20,4 +20,3 @@ export declare const AddWalletWebhookRequestBodyC: t.TypeC<{
|
|
20
20
|
txRequestTransactionStates: t.UnionC<[t.Type<("initialized" | "pendingSignature" | "eddsaPendingCommitment" | "eddsaPendingRShare" | "eddsaPendingGShare" | "ecdsaMPCv2Round1" | "ecdsaMPCv2Round2" | "ecdsaMPCv2Round3" | "readyToCombineShares" | "signed" | "held" | "delivered" | "invalidSignature" | "rejected")[], ("initialized" | "pendingSignature" | "eddsaPendingCommitment" | "eddsaPendingRShare" | "eddsaPendingGShare" | "ecdsaMPCv2Round1" | "ecdsaMPCv2Round2" | "ecdsaMPCv2Round3" | "readyToCombineShares" | "signed" | "held" | "delivered" | "invalidSignature" | "rejected")[], unknown>, t.UndefinedC]>;
|
21
21
|
}>;
|
22
22
|
export type AddWalletWebhookRequestBody = t.TypeOf<typeof AddWalletWebhookRequestBodyC>;
|
23
|
-
//# sourceMappingURL=addWalletWebhookRequest.d.ts.map
|
@@ -79,4 +79,3 @@ export declare const ListEnterpriseWebhooksResponse: t.IntersectionC<[t.TypeC<{
|
|
79
79
|
nextBatchPrevId: t.UnionC<[t.Type<string | undefined, string | undefined, unknown>, t.UndefinedC]>;
|
80
80
|
}>]>;
|
81
81
|
export type ListEnterpriseWebhooksResponse = t.TypeOf<typeof ListEnterpriseWebhooksResponse>;
|
82
|
-
//# sourceMappingURL=enterpriseWebhooks.d.ts.map
|
@@ -5,4 +5,3 @@ export declare const optionalBoolean: t.UnionC<[t.Type<boolean, boolean, unknown
|
|
5
5
|
export declare const optionalNumber: t.UnionC<[t.Type<number, number, unknown>, t.UndefinedC]>;
|
6
6
|
export declare const optionalStringOrNumber: t.UnionC<[t.Type<string | number, string | number, unknown>, t.UndefinedC]>;
|
7
7
|
export declare const optionalUnknown: t.UnionC<[t.Type<{}, {}, unknown>, t.UndefinedC]>;
|
8
|
-
//# sourceMappingURL=primitives.d.ts.map
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bitgo/public-types",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.22.0",
|
4
4
|
"description": "Collection of types exposed externally as part of the BitGo public API",
|
5
5
|
"license": "UNLICENSED",
|
6
6
|
"author": "",
|
@@ -9,9 +9,10 @@
|
|
9
9
|
"url": "git+https://github.com/BitGo/public-types.git"
|
10
10
|
},
|
11
11
|
"main": "dist/src/index.js",
|
12
|
-
"types": "
|
12
|
+
"types": "src/index.ts",
|
13
13
|
"files": [
|
14
|
-
"dist/src/"
|
14
|
+
"dist/src/",
|
15
|
+
"src"
|
15
16
|
],
|
16
17
|
"scripts": {
|
17
18
|
"build": "tsc --build --incremental --verbose .",
|
package/src/index.ts
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { MPCv2KeyGenStateEnum } from "../mpcv2/keyGen/mpcv2KeyGenState";
|
3
|
+
|
4
|
+
export const KeyGenStateEnum = {
|
5
|
+
...MPCv2KeyGenStateEnum,
|
6
|
+
};
|
7
|
+
export const KeyGenState = t.keyof(KeyGenStateEnum);
|
8
|
+
export type KeyGenState = t.TypeOf<typeof KeyGenState>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { MPCv2PartyFromStringOrNumber } from "./mpcv2PartyFromStringOrNumber";
|
3
|
+
|
4
|
+
export const MPCv2BroadcastMessage = t.type(
|
5
|
+
{
|
6
|
+
from: MPCv2PartyFromStringOrNumber,
|
7
|
+
message: t.string,
|
8
|
+
signature: t.string,
|
9
|
+
},
|
10
|
+
"MPCv2BroadcastMessage",
|
11
|
+
);
|
12
|
+
|
13
|
+
export type MPCv2BroadcastMessage = t.TypeOf<typeof MPCv2BroadcastMessage>;
|
14
|
+
|
15
|
+
export const MPCv2BroadcastMessageWithSignatureR = t.intersection([
|
16
|
+
MPCv2BroadcastMessage,
|
17
|
+
t.type({
|
18
|
+
signatureR: t.string,
|
19
|
+
}),
|
20
|
+
]);
|
21
|
+
|
22
|
+
export type MPCv2BroadcastMessageWithSignatureR = t.TypeOf<
|
23
|
+
typeof MPCv2BroadcastMessageWithSignatureR
|
24
|
+
>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { MPCv2PartyFromStringOrNumber } from "./mpcv2PartyFromStringOrNumber";
|
3
|
+
|
4
|
+
export const MPCv2P2PMessage = t.type(
|
5
|
+
{
|
6
|
+
from: MPCv2PartyFromStringOrNumber,
|
7
|
+
to: MPCv2PartyFromStringOrNumber,
|
8
|
+
encryptedMessage: t.string,
|
9
|
+
signature: t.string,
|
10
|
+
},
|
11
|
+
"P2PMessage",
|
12
|
+
);
|
13
|
+
|
14
|
+
export type MPCv2P2PMessage = t.TypeOf<typeof MPCv2P2PMessage>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { NumberFromString, withMessage } from "io-ts-types";
|
3
|
+
|
4
|
+
const validPartyIndexes = t.union([t.literal(0), t.literal(1), t.literal(2)]);
|
5
|
+
|
6
|
+
export const MPCv2PartyFromStringOrNumber = withMessage(
|
7
|
+
t.union([validPartyIndexes, NumberFromString.pipe(validPartyIndexes)]),
|
8
|
+
(input) => `value is ${input} but expected one of [0, 1, 2, "0", "1", "2"]`,
|
9
|
+
);
|
10
|
+
|
11
|
+
export type MPCv2PartyFromStringOrNumber = t.TypeOf<
|
12
|
+
typeof MPCv2PartyFromStringOrNumber
|
13
|
+
>;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import { NonEmptyString } from "io-ts-types";
|
3
|
+
import { MPCv2BroadcastMessage, MPCv2P2PMessage } from "../common";
|
4
|
+
|
5
|
+
export const MPCv2KeyGenRound1Request = t.type({
|
6
|
+
userGpgPublicKey: NonEmptyString,
|
7
|
+
backupGpgPublicKey: NonEmptyString,
|
8
|
+
userMsg1: MPCv2BroadcastMessage,
|
9
|
+
backupMsg1: MPCv2BroadcastMessage,
|
10
|
+
});
|
11
|
+
|
12
|
+
export type MPCv2KeyGenRound1Request = t.TypeOf<
|
13
|
+
typeof MPCv2KeyGenRound1Request
|
14
|
+
>;
|
15
|
+
|
16
|
+
export const MPCv2KeyGenRound1Response = t.type({
|
17
|
+
walletGpgPubKeySigs: NonEmptyString,
|
18
|
+
sessionId: NonEmptyString,
|
19
|
+
bitgoMsg1: MPCv2BroadcastMessage,
|
20
|
+
bitgoToUserMsg2: MPCv2P2PMessage,
|
21
|
+
bitgoToBackupMsg2: MPCv2P2PMessage,
|
22
|
+
});
|
23
|
+
|
24
|
+
export type MPCv2KeyGenRound1Response = t.TypeOf<
|
25
|
+
typeof MPCv2KeyGenRound1Response
|
26
|
+
>;
|
27
|
+
|
28
|
+
export const MPCv2KeyGenRound2Request = t.type({
|
29
|
+
sessionId: NonEmptyString,
|
30
|
+
userMsg2: MPCv2P2PMessage,
|
31
|
+
userCommitment2: NonEmptyString,
|
32
|
+
backupMsg2: MPCv2P2PMessage,
|
33
|
+
backupCommitment2: NonEmptyString,
|
34
|
+
});
|
35
|
+
|
36
|
+
export type MPCv2KeyGenRound2Request = t.TypeOf<
|
37
|
+
typeof MPCv2KeyGenRound2Request
|
38
|
+
>;
|
39
|
+
|
40
|
+
export const MPCv2KeyGenRound2Response = t.type({
|
41
|
+
sessionId: NonEmptyString,
|
42
|
+
bitgoCommitment2: NonEmptyString,
|
43
|
+
bitgoToUserMsg3: MPCv2P2PMessage,
|
44
|
+
bitgoToBackupMsg3: MPCv2P2PMessage,
|
45
|
+
});
|
46
|
+
|
47
|
+
export type MPCv2KeyGenRound2Response = t.TypeOf<
|
48
|
+
typeof MPCv2KeyGenRound2Response
|
49
|
+
>;
|
50
|
+
|
51
|
+
export const MPCv2KeyGenRound3Request = t.type({
|
52
|
+
sessionId: NonEmptyString,
|
53
|
+
userMsg3: MPCv2P2PMessage,
|
54
|
+
backupMsg3: MPCv2P2PMessage,
|
55
|
+
userMsg4: MPCv2BroadcastMessage,
|
56
|
+
backupMsg4: MPCv2BroadcastMessage,
|
57
|
+
});
|
58
|
+
|
59
|
+
export type MPCv2KeyGenRound3Request = t.TypeOf<
|
60
|
+
typeof MPCv2KeyGenRound3Request
|
61
|
+
>;
|
62
|
+
|
63
|
+
export const MPCv2KeyGenRound3Response = t.type({
|
64
|
+
sessionId: NonEmptyString,
|
65
|
+
commonKeychain: NonEmptyString,
|
66
|
+
bitgoMsg4: MPCv2BroadcastMessage,
|
67
|
+
});
|
68
|
+
|
69
|
+
export type MPCv2KeyGenRound3Response = t.TypeOf<
|
70
|
+
typeof MPCv2KeyGenRound3Response
|
71
|
+
>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export enum MPCv2KeyGenStateEnum {
|
4
|
+
"MPCv2-R1" = "MPCv2-R1",
|
5
|
+
"MPCv2-R2" = "MPCv2-R2",
|
6
|
+
"MPCv2-R3" = "MPCv2-R3",
|
7
|
+
}
|
8
|
+
export const MPCv2KeyGenState = t.keyof(
|
9
|
+
MPCv2KeyGenStateEnum,
|
10
|
+
"MPCv2KeyGenState",
|
11
|
+
);
|
12
|
+
export type MPCv2KeyGenState = t.TypeOf<typeof MPCv2KeyGenState>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export const MPCv2SigningState = t.union([
|
4
|
+
t.literal("round1Input"),
|
5
|
+
t.literal("round1Output"),
|
6
|
+
t.literal("round2Input"),
|
7
|
+
t.literal("round2Output"),
|
8
|
+
t.literal("round3Input"),
|
9
|
+
]);
|
10
|
+
|
11
|
+
export type MPCv2SigningState = t.TypeOf<typeof MPCv2SigningState>;
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
import {
|
3
|
+
MPCv2P2PMessage,
|
4
|
+
MPCv2BroadcastMessage,
|
5
|
+
MPCv2BroadcastMessageWithSignatureR,
|
6
|
+
} from "../common";
|
7
|
+
import { MPCv2SigningState } from "./mpcv2SigningState";
|
8
|
+
|
9
|
+
export const MPCv2SignatureShareBase = t.type({
|
10
|
+
type: MPCv2SigningState,
|
11
|
+
});
|
12
|
+
|
13
|
+
/**
|
14
|
+
* User to BitGo round 1
|
15
|
+
*/
|
16
|
+
export const MPCv2SignatureShareRound1Input = t.intersection([
|
17
|
+
MPCv2SignatureShareBase,
|
18
|
+
t.type(
|
19
|
+
{
|
20
|
+
type: t.literal("round1Input"),
|
21
|
+
data: t.type({
|
22
|
+
msg1: MPCv2BroadcastMessage,
|
23
|
+
}),
|
24
|
+
},
|
25
|
+
"MPCv2SignatureShareRound1",
|
26
|
+
),
|
27
|
+
]);
|
28
|
+
|
29
|
+
export type MPCv2SignatureShareRound1Input = t.TypeOf<
|
30
|
+
typeof MPCv2SignatureShareRound1Input
|
31
|
+
>;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* BitGo to User round 1
|
35
|
+
*/
|
36
|
+
export const MPCv2SignatureShareRound1Output = t.intersection([
|
37
|
+
MPCv2SignatureShareBase,
|
38
|
+
t.type(
|
39
|
+
{
|
40
|
+
type: t.literal("round1Output"),
|
41
|
+
data: t.type({
|
42
|
+
msg1: MPCv2BroadcastMessage,
|
43
|
+
msg2: MPCv2P2PMessage,
|
44
|
+
}),
|
45
|
+
},
|
46
|
+
"MPCv2SignatureShareRound1Output",
|
47
|
+
),
|
48
|
+
]);
|
49
|
+
|
50
|
+
export type MPCv2SignatureShareRound1Output = t.TypeOf<
|
51
|
+
typeof MPCv2SignatureShareRound1Output
|
52
|
+
>;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* User to BitGo round 2
|
56
|
+
*/
|
57
|
+
export const MPCv2SignatureShareRound2Input = t.intersection([
|
58
|
+
MPCv2SignatureShareBase,
|
59
|
+
t.type(
|
60
|
+
{
|
61
|
+
type: t.literal("round2Input"),
|
62
|
+
data: t.type({
|
63
|
+
msg2: MPCv2P2PMessage,
|
64
|
+
msg3: MPCv2P2PMessage,
|
65
|
+
}),
|
66
|
+
},
|
67
|
+
"MPCv2SignatureShareRound2Input",
|
68
|
+
),
|
69
|
+
]);
|
70
|
+
|
71
|
+
export type MPCv2SignatureShareRound2Input = t.TypeOf<
|
72
|
+
typeof MPCv2SignatureShareRound2Input
|
73
|
+
>;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* BitGo to User round 2
|
77
|
+
*/
|
78
|
+
export const MPCv2SignatureShareRound2Output = t.intersection([
|
79
|
+
MPCv2SignatureShareBase,
|
80
|
+
t.type(
|
81
|
+
{
|
82
|
+
type: t.literal("round2Output"),
|
83
|
+
data: t.type({
|
84
|
+
msg3: MPCv2P2PMessage,
|
85
|
+
}),
|
86
|
+
},
|
87
|
+
"MPCv2SignatureShareRound2Output",
|
88
|
+
),
|
89
|
+
]);
|
90
|
+
|
91
|
+
export type MPCv2SignatureShareRound2Output = t.TypeOf<
|
92
|
+
typeof MPCv2SignatureShareRound2Output
|
93
|
+
>;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* User to BitGo round 3
|
97
|
+
*/
|
98
|
+
export const MPCv2SignatureShareRound3Input = t.intersection([
|
99
|
+
MPCv2SignatureShareBase,
|
100
|
+
t.type(
|
101
|
+
{
|
102
|
+
type: t.literal("round3Input"),
|
103
|
+
data: t.type({
|
104
|
+
msg4: MPCv2BroadcastMessageWithSignatureR,
|
105
|
+
}),
|
106
|
+
},
|
107
|
+
"MPCv2SignatureShareRound3Input",
|
108
|
+
),
|
109
|
+
]);
|
110
|
+
|
111
|
+
export type MPCv2SignatureShareRound3Input = t.TypeOf<
|
112
|
+
typeof MPCv2SignatureShareRound3Input
|
113
|
+
>;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export const TransactionRequestState = t.keyof(
|
4
|
+
{
|
5
|
+
pendingApproval: 1,
|
6
|
+
canceled: 1,
|
7
|
+
rejected: 1,
|
8
|
+
initialized: 1,
|
9
|
+
pendingDelivery: 1,
|
10
|
+
delivered: 1,
|
11
|
+
pendingUserSignature: 1,
|
12
|
+
pendingUserCommitment: 1,
|
13
|
+
pendingUserRShare: 1,
|
14
|
+
pendingUserGShare: 1,
|
15
|
+
readyToSend: 1,
|
16
|
+
signed: 1,
|
17
|
+
failed: 1,
|
18
|
+
},
|
19
|
+
"TransactionRequestState",
|
20
|
+
);
|
21
|
+
export type TransactionRequestState = t.TypeOf<typeof TransactionRequestState>;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import * as t from "io-ts";
|
2
|
+
|
3
|
+
export const TransactionState = t.keyof(
|
4
|
+
{
|
5
|
+
initialized: 1,
|
6
|
+
pendingSignature: 1,
|
7
|
+
eddsaPendingCommitment: 1,
|
8
|
+
eddsaPendingRShare: 1,
|
9
|
+
eddsaPendingGShare: 1,
|
10
|
+
ecdsaMPCv2Round1: 1,
|
11
|
+
ecdsaMPCv2Round2: 1,
|
12
|
+
ecdsaMPCv2Round3: 1,
|
13
|
+
readyToCombineShares: 1,
|
14
|
+
signed: 1,
|
15
|
+
held: 1,
|
16
|
+
delivered: 1,
|
17
|
+
invalidSignature: 1,
|
18
|
+
rejected: 1,
|
19
|
+
},
|
20
|
+
"TransactionState",
|
21
|
+
);
|
22
|
+
export type TransactionState = t.TypeOf<typeof TransactionState>;
|