@bitgo/public-types 6.89.0 → 6.91.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.
@@ -1,7 +1,9 @@
1
1
  import * as t from "io-ts";
2
- interface DerivationIndexBrand {
3
- readonly DerivationIndex: unique symbol;
2
+ interface SafeBip44PathBrand {
3
+ readonly SafeBip44Path: unique symbol;
4
4
  }
5
+ export declare const SafeBip44Path: t.BrandC<t.StringC, SafeBip44PathBrand>;
6
+ export type SafeBip44Path = t.TypeOf<typeof SafeBip44Path>;
5
7
  export declare const MPCv2DeriveRound1Request: t.TypeC<{
6
8
  userGpgPublicKey: import("io-ts-types").NonEmptyStringC;
7
9
  userMsg1: t.TypeC<{
@@ -10,7 +12,7 @@ export declare const MPCv2DeriveRound1Request: t.TypeC<{
10
12
  signature: t.StringC;
11
13
  }>;
12
14
  parentKeyId: import("io-ts-types").NonEmptyStringC;
13
- derivationIndex: t.BrandC<t.NumberC, DerivationIndexBrand>;
15
+ path: t.BrandC<t.StringC, SafeBip44PathBrand>;
14
16
  }>;
15
17
  export type MPCv2DeriveRound1Request = t.TypeOf<typeof MPCv2DeriveRound1Request>;
16
18
  export declare const MPCv2DeriveRound1Response: t.TypeC<{
@@ -56,7 +58,7 @@ export declare const EddsaMPCv2DeriveRound1Request: t.TypeC<{
56
58
  signature: t.StringC;
57
59
  }>;
58
60
  parentKeyId: import("io-ts-types").NonEmptyStringC;
59
- derivationIndex: t.BrandC<t.NumberC, DerivationIndexBrand>;
61
+ path: t.BrandC<t.StringC, SafeBip44PathBrand>;
60
62
  }>;
61
63
  export type EddsaMPCv2DeriveRound1Request = t.TypeOf<typeof EddsaMPCv2DeriveRound1Request>;
62
64
  export declare const EddsaMPCv2DeriveRound1Response: t.TypeC<{
@@ -23,16 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.EddsaMPCv2DeriveRound2Response = exports.EddsaMPCv2DeriveRound2Request = exports.EddsaMPCv2DeriveRound1Response = exports.EddsaMPCv2DeriveRound1Request = exports.MPCv2DeriveRound3Response = exports.MPCv2DeriveRound3Request = exports.MPCv2DeriveRound2Response = exports.MPCv2DeriveRound2Request = exports.MPCv2DeriveRound1Response = exports.MPCv2DeriveRound1Request = void 0;
26
+ exports.EddsaMPCv2DeriveRound2Response = exports.EddsaMPCv2DeriveRound2Request = exports.EddsaMPCv2DeriveRound1Response = exports.EddsaMPCv2DeriveRound1Request = exports.MPCv2DeriveRound3Response = exports.MPCv2DeriveRound3Request = exports.MPCv2DeriveRound2Response = exports.MPCv2DeriveRound2Request = exports.MPCv2DeriveRound1Response = exports.MPCv2DeriveRound1Request = exports.SafeBip44Path = void 0;
27
27
  const t = __importStar(require("io-ts"));
28
28
  const io_ts_types_1 = require("io-ts-types");
29
29
  const common_1 = require("../common");
30
- const DerivationIndex = t.brand(t.number, (index) => Number.isSafeInteger(index) && index >= 0, "DerivationIndex");
30
+ const BIP32_HARDENED_OFFSET = 0x80000000;
31
+ const SAFE_BIP44_PATH = /^m\/44'\/(0|[1-9][0-9]*)'\/(0|[1-9][0-9]*)'\/(0|[1-9][0-9]*)'$/;
32
+ exports.SafeBip44Path = t.brand(t.string, (path) => {
33
+ const match = SAFE_BIP44_PATH.exec(path);
34
+ return (match !== null &&
35
+ match.slice(1).every((segment) => Number(segment) < BIP32_HARDENED_OFFSET));
36
+ }, "SafeBip44Path");
31
37
  exports.MPCv2DeriveRound1Request = t.type({
32
38
  userGpgPublicKey: io_ts_types_1.NonEmptyString,
33
39
  userMsg1: common_1.MPCv2BroadcastMessage,
34
40
  parentKeyId: io_ts_types_1.NonEmptyString,
35
- derivationIndex: DerivationIndex,
41
+ path: exports.SafeBip44Path,
36
42
  }, "MPCv2DeriveRound1Request");
37
43
  exports.MPCv2DeriveRound1Response = t.type({
38
44
  sessionId: io_ts_types_1.NonEmptyString,
@@ -57,7 +63,7 @@ exports.EddsaMPCv2DeriveRound1Request = t.type({
57
63
  userGpgPublicKey: io_ts_types_1.NonEmptyString,
58
64
  userMsg1: common_1.EddsaMPCv2SignedMessage,
59
65
  parentKeyId: io_ts_types_1.NonEmptyString,
60
- derivationIndex: DerivationIndex,
66
+ path: exports.SafeBip44Path,
61
67
  }, "EddsaMPCv2DeriveRound1Request");
62
68
  exports.EddsaMPCv2DeriveRound1Response = t.type({
63
69
  sessionId: io_ts_types_1.NonEmptyString,
@@ -1 +1 @@
1
- {"version":3,"file":"deriveRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/derive/deriveRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,6CAA6C;AAC7C,sCAA2E;AAM3E,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAC7B,CAAC,CAAC,MAAM,EACR,CAAC,KAAa,EAAoD,EAAE,CAClE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAC3C,iBAAiB,CAClB,CAAC;AAEW,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAC5C;IACE,gBAAgB,EAAE,4BAAc;IAChC,QAAQ,EAAE,8BAAqB;IAC/B,WAAW,EAAE,4BAAc;IAC3B,eAAe,EAAE,eAAe;CACjC,EACD,0BAA0B,CAC3B,CAAC;AAMW,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,SAAS,EAAE,8BAAqB;CACjC,CAAC,CAAC;AAMU,QAAA,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,8BAAqB;CAChC,CAAC,CAAC;AAMU,QAAA,yBAAyB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9C,SAAS,EAAE,4BAAc;IACzB,SAAS,EAAE,8BAAqB;CACjC,CAAC,CAAC;AAMU,QAAA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AE,gCAAuB;CACnC,CAAC,CAAC;AAMU,QAAA,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAClD,SAAS,EAAE,4BAAc;IACzB,QAAQ,EAAE,gCAAuB;CAClC,CAAC,CAAC;AAMU,QAAA,8BAA8B,GAAG,CAAC,CAAC,IAAI,CAAC;IACnD,SAAS,EAAE,4BAAc;IACzB,oBAAoB,EAAE,4BAAc;IACpC,SAAS,EAAE,gCAAuB;CACnC,CAAC,CAAC"}
@@ -4,10 +4,10 @@ export declare const RedpallasMPCv2RerandShareRound1Input: t.IntersectionC<[t.Ty
4
4
  }>, t.TypeC<{
5
5
  type: t.LiteralC<"round1Input">;
6
6
  data: t.TypeC<{
7
- msg1: t.TypeC<{
7
+ msg1: t.ArrayC<t.TypeC<{
8
8
  message: t.StringC;
9
9
  signature: t.StringC;
10
- }>;
10
+ }>>;
11
11
  }>;
12
12
  }>]>;
13
13
  export type RedpallasMPCv2RerandShareRound1Input = t.TypeOf<typeof RedpallasMPCv2RerandShareRound1Input>;
@@ -16,10 +16,10 @@ export declare const RedpallasMPCv2RerandShareRound1Output: t.IntersectionC<[t.T
16
16
  }>, t.TypeC<{
17
17
  type: t.LiteralC<"round1Output">;
18
18
  data: t.TypeC<{
19
- msg1: t.TypeC<{
19
+ msg1: t.ArrayC<t.TypeC<{
20
20
  message: t.StringC;
21
21
  signature: t.StringC;
22
- }>;
22
+ }>>;
23
23
  }>;
24
24
  }>]>;
25
25
  export type RedpallasMPCv2RerandShareRound1Output = t.TypeOf<typeof RedpallasMPCv2RerandShareRound1Output>;
@@ -28,10 +28,10 @@ export declare const RedpallasMPCv2RerandShareRound2Input: t.IntersectionC<[t.Ty
28
28
  }>, t.TypeC<{
29
29
  type: t.LiteralC<"round2Input">;
30
30
  data: t.TypeC<{
31
- msg2: t.TypeC<{
31
+ msg2: t.ArrayC<t.TypeC<{
32
32
  message: t.StringC;
33
33
  signature: t.StringC;
34
- }>;
34
+ }>>;
35
35
  }>;
36
36
  }>]>;
37
37
  export type RedpallasMPCv2RerandShareRound2Input = t.TypeOf<typeof RedpallasMPCv2RerandShareRound2Input>;
@@ -40,10 +40,10 @@ export declare const RedpallasMPCv2RerandShareRound2Output: t.IntersectionC<[t.T
40
40
  }>, t.TypeC<{
41
41
  type: t.LiteralC<"round2Output">;
42
42
  data: t.TypeC<{
43
- msg2: t.TypeC<{
43
+ msg2: t.ArrayC<t.TypeC<{
44
44
  message: t.StringC;
45
45
  signature: t.StringC;
46
- }>;
46
+ }>>;
47
47
  }>;
48
48
  }>]>;
49
49
  export type RedpallasMPCv2RerandShareRound2Output = t.TypeOf<typeof RedpallasMPCv2RerandShareRound2Output>;
@@ -31,36 +31,28 @@ exports.RedpallasMPCv2RerandShareRound1Input = t.intersection([
31
31
  signingRound_1.MPCv2SignatureShareBase,
32
32
  t.type({
33
33
  type: t.literal("round1Input"),
34
- data: t.type({
35
- msg1: common_1.EddsaMPCv2SignedMessage,
36
- }),
34
+ data: t.type({ msg1: t.array(common_1.EddsaMPCv2SignedMessage) }),
37
35
  }, "RedpallasMPCv2RerandShareRound1Input"),
38
36
  ]);
39
37
  exports.RedpallasMPCv2RerandShareRound1Output = t.intersection([
40
38
  signingRound_1.MPCv2SignatureShareBase,
41
39
  t.type({
42
40
  type: t.literal("round1Output"),
43
- data: t.type({
44
- msg1: common_1.EddsaMPCv2SignedMessage,
45
- }),
41
+ data: t.type({ msg1: t.array(common_1.EddsaMPCv2SignedMessage) }),
46
42
  }, "RedpallasMPCv2RerandShareRound1Output"),
47
43
  ]);
48
44
  exports.RedpallasMPCv2RerandShareRound2Input = t.intersection([
49
45
  signingRound_1.MPCv2SignatureShareBase,
50
46
  t.type({
51
47
  type: t.literal("round2Input"),
52
- data: t.type({
53
- msg2: common_1.EddsaMPCv2SignedMessage,
54
- }),
48
+ data: t.type({ msg2: t.array(common_1.EddsaMPCv2SignedMessage) }),
55
49
  }, "RedpallasMPCv2RerandShareRound2Input"),
56
50
  ]);
57
51
  exports.RedpallasMPCv2RerandShareRound2Output = t.intersection([
58
52
  signingRound_1.MPCv2SignatureShareBase,
59
53
  t.type({
60
54
  type: t.literal("round2Output"),
61
- data: t.type({
62
- msg2: common_1.EddsaMPCv2SignedMessage,
63
- }),
55
+ data: t.type({ msg2: t.array(common_1.EddsaMPCv2SignedMessage) }),
64
56
  }, "RedpallasMPCv2RerandShareRound2Output"),
65
57
  ]);
66
58
  //# sourceMappingURL=redpallasRerandRound.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redpallasRerandRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/signing/redpallasRerandRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,sCAAoD;AACpD,iDAAyD;AAgB5C,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,sCAAsC,CACvC;CACF,CAAC,CAAC;AAWU,QAAA,qCAAqC,GAAG,CAAC,CAAC,YAAY,CAAC;IAClE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,uCAAuC,CACxC;CACF,CAAC,CAAC;AAWU,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,sCAAsC,CACvC;CACF,CAAC,CAAC;AAWU,QAAA,qCAAqC,GAAG,CAAC,CAAC,YAAY,CAAC;IAClE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,uCAAuC,CACxC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"redpallasRerandRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/signing/redpallasRerandRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,sCAAoD;AACpD,iDAAyD;AAkB5C,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,sCAAsC,CACvC;CACF,CAAC,CAAC;AAWU,QAAA,qCAAqC,GAAG,CAAC,CAAC,YAAY,CAAC;IAClE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,uCAAuC,CACxC;CACF,CAAC,CAAC;AAWU,QAAA,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAAC;IACjE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,sCAAsC,CACvC;CACF,CAAC,CAAC;AAWU,QAAA,qCAAqC,GAAG,CAAC,CAAC,YAAY,CAAC;IAClE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,uCAAuC,CACxC;CACF,CAAC,CAAC"}
@@ -4,10 +4,10 @@ export declare const RedpallasMPCv2SignatureShareRound1Input: t.IntersectionC<[t
4
4
  }>, t.TypeC<{
5
5
  type: t.LiteralC<"round1Input">;
6
6
  data: t.TypeC<{
7
- msg1: t.TypeC<{
7
+ msg1: t.ArrayC<t.TypeC<{
8
8
  message: t.StringC;
9
9
  signature: t.StringC;
10
- }>;
10
+ }>>;
11
11
  }>;
12
12
  }>]>;
13
13
  export type RedpallasMPCv2SignatureShareRound1Input = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound1Input>;
@@ -16,10 +16,10 @@ export declare const RedpallasMPCv2SignatureShareRound1Output: t.IntersectionC<[
16
16
  }>, t.TypeC<{
17
17
  type: t.LiteralC<"round1Output">;
18
18
  data: t.TypeC<{
19
- msg1: t.TypeC<{
19
+ msg1: t.ArrayC<t.TypeC<{
20
20
  message: t.StringC;
21
21
  signature: t.StringC;
22
- }>;
22
+ }>>;
23
23
  }>;
24
24
  }>]>;
25
25
  export type RedpallasMPCv2SignatureShareRound1Output = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound1Output>;
@@ -28,10 +28,10 @@ export declare const RedpallasMPCv2SignatureShareRound2Input: t.IntersectionC<[t
28
28
  }>, t.TypeC<{
29
29
  type: t.LiteralC<"round2Input">;
30
30
  data: t.TypeC<{
31
- msg2: t.TypeC<{
31
+ msg2: t.ArrayC<t.TypeC<{
32
32
  message: t.StringC;
33
33
  signature: t.StringC;
34
- }>;
34
+ }>>;
35
35
  }>;
36
36
  }>]>;
37
37
  export type RedpallasMPCv2SignatureShareRound2Input = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound2Input>;
@@ -40,10 +40,10 @@ export declare const RedpallasMPCv2SignatureShareRound2Output: t.IntersectionC<[
40
40
  }>, t.TypeC<{
41
41
  type: t.LiteralC<"round2Output">;
42
42
  data: t.TypeC<{
43
- msg2: t.TypeC<{
43
+ msg2: t.ArrayC<t.TypeC<{
44
44
  message: t.StringC;
45
45
  signature: t.StringC;
46
- }>;
46
+ }>>;
47
47
  }>;
48
48
  }>]>;
49
49
  export type RedpallasMPCv2SignatureShareRound2Output = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound2Output>;
@@ -52,10 +52,10 @@ export declare const RedpallasMPCv2SignatureShareRound3Input: t.IntersectionC<[t
52
52
  }>, t.TypeC<{
53
53
  type: t.LiteralC<"round3Input">;
54
54
  data: t.TypeC<{
55
- msg3: t.TypeC<{
55
+ msg3: t.ArrayC<t.TypeC<{
56
56
  message: t.StringC;
57
57
  signature: t.StringC;
58
- }>;
58
+ }>>;
59
59
  }>;
60
60
  }>]>;
61
61
  export type RedpallasMPCv2SignatureShareRound3Input = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound3Input>;
@@ -64,10 +64,10 @@ export declare const RedpallasMPCv2SignatureShareRound3Output: t.IntersectionC<[
64
64
  }>, t.TypeC<{
65
65
  type: t.LiteralC<"round3Output">;
66
66
  data: t.TypeC<{
67
- msg3: t.TypeC<{
67
+ msg3: t.ArrayC<t.TypeC<{
68
68
  message: t.StringC;
69
69
  signature: t.StringC;
70
- }>;
70
+ }>>;
71
71
  }>;
72
72
  }>]>;
73
73
  export type RedpallasMPCv2SignatureShareRound3Output = t.TypeOf<typeof RedpallasMPCv2SignatureShareRound3Output>;
@@ -31,54 +31,42 @@ exports.RedpallasMPCv2SignatureShareRound1Input = t.intersection([
31
31
  signingRound_1.MPCv2SignatureShareBase,
32
32
  t.type({
33
33
  type: t.literal("round1Input"),
34
- data: t.type({
35
- msg1: common_1.EddsaMPCv2SignedMessage,
36
- }),
34
+ data: t.type({ msg1: t.array(common_1.EddsaMPCv2SignedMessage) }),
37
35
  }, "RedpallasMPCv2SignatureShareRound1Input"),
38
36
  ]);
39
37
  exports.RedpallasMPCv2SignatureShareRound1Output = t.intersection([
40
38
  signingRound_1.MPCv2SignatureShareBase,
41
39
  t.type({
42
40
  type: t.literal("round1Output"),
43
- data: t.type({
44
- msg1: common_1.EddsaMPCv2SignedMessage,
45
- }),
41
+ data: t.type({ msg1: t.array(common_1.EddsaMPCv2SignedMessage) }),
46
42
  }, "RedpallasMPCv2SignatureShareRound1Output"),
47
43
  ]);
48
44
  exports.RedpallasMPCv2SignatureShareRound2Input = t.intersection([
49
45
  signingRound_1.MPCv2SignatureShareBase,
50
46
  t.type({
51
47
  type: t.literal("round2Input"),
52
- data: t.type({
53
- msg2: common_1.EddsaMPCv2SignedMessage,
54
- }),
48
+ data: t.type({ msg2: t.array(common_1.EddsaMPCv2SignedMessage) }),
55
49
  }, "RedpallasMPCv2SignatureShareRound2Input"),
56
50
  ]);
57
51
  exports.RedpallasMPCv2SignatureShareRound2Output = t.intersection([
58
52
  signingRound_1.MPCv2SignatureShareBase,
59
53
  t.type({
60
54
  type: t.literal("round2Output"),
61
- data: t.type({
62
- msg2: common_1.EddsaMPCv2SignedMessage,
63
- }),
55
+ data: t.type({ msg2: t.array(common_1.EddsaMPCv2SignedMessage) }),
64
56
  }, "RedpallasMPCv2SignatureShareRound2Output"),
65
57
  ]);
66
58
  exports.RedpallasMPCv2SignatureShareRound3Input = t.intersection([
67
59
  signingRound_1.MPCv2SignatureShareBase,
68
60
  t.type({
69
61
  type: t.literal("round3Input"),
70
- data: t.type({
71
- msg3: common_1.EddsaMPCv2SignedMessage,
72
- }),
62
+ data: t.type({ msg3: t.array(common_1.EddsaMPCv2SignedMessage) }),
73
63
  }, "RedpallasMPCv2SignatureShareRound3Input"),
74
64
  ]);
75
65
  exports.RedpallasMPCv2SignatureShareRound3Output = t.intersection([
76
66
  signingRound_1.MPCv2SignatureShareBase,
77
67
  t.type({
78
68
  type: t.literal("round3Output"),
79
- data: t.type({
80
- msg3: common_1.EddsaMPCv2SignedMessage,
81
- }),
69
+ data: t.type({ msg3: t.array(common_1.EddsaMPCv2SignedMessage) }),
82
70
  }, "RedpallasMPCv2SignatureShareRound3Output"),
83
71
  ]);
84
72
  //# sourceMappingURL=redpallasSigningRound.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redpallasSigningRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/signing/redpallasSigningRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,sCAAoD;AACpD,iDAAyD;AAS5C,QAAA,uCAAuC,GAAG,CAAC,CAAC,YAAY,CAAC;IACpE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,yCAAyC,CAC1C;CACF,CAAC,CAAC;AAWU,QAAA,wCAAwC,GAAG,CAAC,CAAC,YAAY,CAAC;IACrE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,0CAA0C,CAC3C;CACF,CAAC,CAAC;AAWU,QAAA,uCAAuC,GAAG,CAAC,CAAC,YAAY,CAAC;IACpE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,yCAAyC,CAC1C;CACF,CAAC,CAAC;AAWU,QAAA,wCAAwC,GAAG,CAAC,CAAC,YAAY,CAAC;IACrE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,0CAA0C,CAC3C;CACF,CAAC,CAAC;AAWU,QAAA,uCAAuC,GAAG,CAAC,CAAC,YAAY,CAAC;IACpE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,yCAAyC,CAC1C;CACF,CAAC,CAAC;AAWU,QAAA,wCAAwC,GAAG,CAAC,CAAC,YAAY,CAAC;IACrE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gCAAuB;SAC9B,CAAC;KACH,EACD,0CAA0C,CAC3C;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"redpallasSigningRound.js","sourceRoot":"","sources":["../../../../../src/schema/mpcv2/signing/redpallasSigningRound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAC3B,sCAAoD;AACpD,iDAAyD;AAW5C,QAAA,uCAAuC,GAA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,CAAC;IACpE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,yCAAyC,CAC1C;CACF,CAAC,CAAC;AAWU,QAAA,wCAAwC,GAAG,CAAC,CAAC,YAAY,CAAC;IACrE,sCAAuB;IACvB,CAAC,CAAC,IAAI,CACJ;QACE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAuB,CAAC,EAAE,CAAC;KACzD,EACD,0CAA0C,CAC3C;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo/public-types",
3
- "version": "6.89.0",
3
+ "version": "6.91.0",
4
4
  "description": "Collection of types exposed externally as part of the BitGo public API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",
@@ -2,23 +2,39 @@ import * as t from "io-ts";
2
2
  import { NonEmptyString } from "io-ts-types";
3
3
  import { MPCv2BroadcastMessage, EddsaMPCv2SignedMessage } from "../common";
4
4
 
5
- interface DerivationIndexBrand {
6
- readonly DerivationIndex: unique symbol;
5
+ const BIP32_HARDENED_OFFSET = 0x80000000;
6
+ const SAFE_BIP44_PATH =
7
+ /^m\/44'\/(0|[1-9][0-9]*)'\/(0|[1-9][0-9]*)'\/(0|[1-9][0-9]*)'$/;
8
+
9
+ interface SafeBip44PathBrand {
10
+ readonly SafeBip44Path: unique symbol;
7
11
  }
8
12
 
9
- const DerivationIndex = t.brand(
10
- t.number,
11
- (index: number): index is t.Branded<number, DerivationIndexBrand> =>
12
- Number.isSafeInteger(index) && index >= 0,
13
- "DerivationIndex",
13
+ /**
14
+ * Full hardened Safe child derivation path `m/44'/<coinType>'/<slot>'/<account>'`: purpose `44'`,
15
+ * then three more hardened segments, each a canonical decimal BIP32 index in `0 .. 2^31-1`.
16
+ * Structural only; the service that receives it compares it with the path it expects for the
17
+ * (coin, slot, account) before use.
18
+ */
19
+ export const SafeBip44Path = t.brand(
20
+ t.string,
21
+ (path: string): path is t.Branded<string, SafeBip44PathBrand> => {
22
+ const match = SAFE_BIP44_PATH.exec(path);
23
+ return (
24
+ match !== null &&
25
+ match.slice(1).every((segment) => Number(segment) < BIP32_HARDENED_OFFSET)
26
+ );
27
+ },
28
+ "SafeBip44Path",
14
29
  );
30
+ export type SafeBip44Path = t.TypeOf<typeof SafeBip44Path>;
15
31
 
16
32
  export const MPCv2DeriveRound1Request = t.type(
17
33
  {
18
34
  userGpgPublicKey: NonEmptyString,
19
35
  userMsg1: MPCv2BroadcastMessage,
20
36
  parentKeyId: NonEmptyString,
21
- derivationIndex: DerivationIndex,
37
+ path: SafeBip44Path,
22
38
  },
23
39
  "MPCv2DeriveRound1Request",
24
40
  );
@@ -76,7 +92,7 @@ export const EddsaMPCv2DeriveRound1Request = t.type(
76
92
  userGpgPublicKey: NonEmptyString,
77
93
  userMsg1: EddsaMPCv2SignedMessage,
78
94
  parentKeyId: NonEmptyString,
79
- derivationIndex: DerivationIndex,
95
+ path: SafeBip44Path,
80
96
  },
81
97
  "EddsaMPCv2DeriveRound1Request",
82
98
  );
@@ -10,6 +10,8 @@ import { MPCv2SignatureShareBase } from "./signingRound";
10
10
  * `handleIncomingMessages` in `WaitMsg1` the round 2 payload, each
11
11
  * carrying WASM-serialized bytes with a rerand prefix. Round 0 is
12
12
  * computed locally and never crosses the wire; there is no round 3.
13
+ * Each round carries one signed message per Orchard spend: `msg1` and
14
+ * `msg2` are arrays ordered by spend index (N=1 is a one-element array).
13
15
  *
14
16
  * Wire literals reuse the shared signing-round states and the envelope
15
17
  * reuses `EddsaMPCv2SignedMessage` (shared with EdDSA despite the name),
@@ -21,9 +23,7 @@ export const RedpallasMPCv2RerandShareRound1Input = t.intersection([
21
23
  t.type(
22
24
  {
23
25
  type: t.literal("round1Input"),
24
- data: t.type({
25
- msg1: EddsaMPCv2SignedMessage,
26
- }),
26
+ data: t.type({ msg1: t.array(EddsaMPCv2SignedMessage) }),
27
27
  },
28
28
  "RedpallasMPCv2RerandShareRound1Input",
29
29
  ),
@@ -43,9 +43,7 @@ export const RedpallasMPCv2RerandShareRound1Output = t.intersection([
43
43
  t.type(
44
44
  {
45
45
  type: t.literal("round1Output"),
46
- data: t.type({
47
- msg1: EddsaMPCv2SignedMessage,
48
- }),
46
+ data: t.type({ msg1: t.array(EddsaMPCv2SignedMessage) }),
49
47
  },
50
48
  "RedpallasMPCv2RerandShareRound1Output",
51
49
  ),
@@ -65,9 +63,7 @@ export const RedpallasMPCv2RerandShareRound2Input = t.intersection([
65
63
  t.type(
66
64
  {
67
65
  type: t.literal("round2Input"),
68
- data: t.type({
69
- msg2: EddsaMPCv2SignedMessage,
70
- }),
66
+ data: t.type({ msg2: t.array(EddsaMPCv2SignedMessage) }),
71
67
  },
72
68
  "RedpallasMPCv2RerandShareRound2Input",
73
69
  ),
@@ -87,9 +83,7 @@ export const RedpallasMPCv2RerandShareRound2Output = t.intersection([
87
83
  t.type(
88
84
  {
89
85
  type: t.literal("round2Output"),
90
- data: t.type({
91
- msg2: EddsaMPCv2SignedMessage,
92
- }),
86
+ data: t.type({ msg2: t.array(EddsaMPCv2SignedMessage) }),
93
87
  },
94
88
  "RedpallasMPCv2RerandShareRound2Output",
95
89
  ),
@@ -5,18 +5,18 @@ import { MPCv2SignatureShareBase } from "./signingRound";
5
5
  /**
6
6
  * RedPallas MPCv2 — User to BitGo round 1
7
7
  *
8
- * RedPallas DSG signing follows the same 3-round shape as EdDSA MPCv2 —
9
- * one signed message per round — reusing the shared EdDSA MPCv2 GPG
10
- * material and message envelope (`EddsaMPCv2SignedMessage`).
8
+ * RedPallas DSG signing follows the same 3-round shape as EdDSA MPCv2,
9
+ * reusing the shared EdDSA MPCv2 GPG material and message envelope
10
+ * (`EddsaMPCv2SignedMessage`). Unlike EdDSA MPS, each round carries one
11
+ * signed message per Orchard spend: `msgN` is an array ordered by spend
12
+ * index (N=1 is a one-element array).
11
13
  */
12
14
  export const RedpallasMPCv2SignatureShareRound1Input = t.intersection([
13
15
  MPCv2SignatureShareBase,
14
16
  t.type(
15
17
  {
16
18
  type: t.literal("round1Input"),
17
- data: t.type({
18
- msg1: EddsaMPCv2SignedMessage,
19
- }),
19
+ data: t.type({ msg1: t.array(EddsaMPCv2SignedMessage) }),
20
20
  },
21
21
  "RedpallasMPCv2SignatureShareRound1Input",
22
22
  ),
@@ -36,9 +36,7 @@ export const RedpallasMPCv2SignatureShareRound1Output = t.intersection([
36
36
  t.type(
37
37
  {
38
38
  type: t.literal("round1Output"),
39
- data: t.type({
40
- msg1: EddsaMPCv2SignedMessage,
41
- }),
39
+ data: t.type({ msg1: t.array(EddsaMPCv2SignedMessage) }),
42
40
  },
43
41
  "RedpallasMPCv2SignatureShareRound1Output",
44
42
  ),
@@ -58,9 +56,7 @@ export const RedpallasMPCv2SignatureShareRound2Input = t.intersection([
58
56
  t.type(
59
57
  {
60
58
  type: t.literal("round2Input"),
61
- data: t.type({
62
- msg2: EddsaMPCv2SignedMessage,
63
- }),
59
+ data: t.type({ msg2: t.array(EddsaMPCv2SignedMessage) }),
64
60
  },
65
61
  "RedpallasMPCv2SignatureShareRound2Input",
66
62
  ),
@@ -80,9 +76,7 @@ export const RedpallasMPCv2SignatureShareRound2Output = t.intersection([
80
76
  t.type(
81
77
  {
82
78
  type: t.literal("round2Output"),
83
- data: t.type({
84
- msg2: EddsaMPCv2SignedMessage,
85
- }),
79
+ data: t.type({ msg2: t.array(EddsaMPCv2SignedMessage) }),
86
80
  },
87
81
  "RedpallasMPCv2SignatureShareRound2Output",
88
82
  ),
@@ -102,9 +96,7 @@ export const RedpallasMPCv2SignatureShareRound3Input = t.intersection([
102
96
  t.type(
103
97
  {
104
98
  type: t.literal("round3Input"),
105
- data: t.type({
106
- msg3: EddsaMPCv2SignedMessage,
107
- }),
99
+ data: t.type({ msg3: t.array(EddsaMPCv2SignedMessage) }),
108
100
  },
109
101
  "RedpallasMPCv2SignatureShareRound3Input",
110
102
  ),
@@ -124,9 +116,7 @@ export const RedpallasMPCv2SignatureShareRound3Output = t.intersection([
124
116
  t.type(
125
117
  {
126
118
  type: t.literal("round3Output"),
127
- data: t.type({
128
- msg3: EddsaMPCv2SignedMessage,
129
- }),
119
+ data: t.type({ msg3: t.array(EddsaMPCv2SignedMessage) }),
130
120
  },
131
121
  "RedpallasMPCv2SignatureShareRound3Output",
132
122
  ),