|
| 1 | +'use strict'; |
| 2 | +Object.defineProperty(exports, '__esModule', { value: true }); |
| 3 | +exports.fixtures = { |
| 4 | + encode: [ |
| 5 | + { |
| 6 | + data: { |
| 7 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 8 | + subtype: 0x00, |
| 9 | + keydata: { |
| 10 | + aggregatedKey: |
| 11 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 12 | + outputKey: |
| 13 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 14 | + }, |
| 15 | + }, |
| 16 | + expected: |
| 17 | + 'fc25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953006232333936306265' + |
| 18 | + '31636235366564306639303434646564373364373538663436363439336366396532613663653133396130346661633864363330' + |
| 19 | + '61363031616634353566343938396431323265393138356638633335316462616563643133616463613365656638613964333865' + |
| 20 | + '66386666656436383637653334326533', |
| 21 | + }, |
| 22 | + { |
| 23 | + data: { |
| 24 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 25 | + identifierEncoding: 'utf16le', |
| 26 | + subtype: 0x00, |
| 27 | + keydata: { |
| 28 | + aggregatedKey: |
| 29 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 30 | + outputKey: |
| 31 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 32 | + }, |
| 33 | + }, |
| 34 | + expected: |
| 35 | + 'fc4a50005300420054005f0049004e005f004d0055005300490047005f005000410052005400490043004900500041004e0054005' + |
| 36 | + 'f005000550042004c00490043005f004b004500590053000062323339363062653163623536656430663930343464656437336437' + |
| 37 | + '353866343636343933636639653261366365313339613034666163386436333061363031616634353566343938396431323265393' + |
| 38 | + '13835663863333531646261656364313361646361336565663861396433386566386666656436383637653334326533', |
| 39 | + }, |
| 40 | + { |
| 41 | + data: { |
| 42 | + identifier: '', |
| 43 | + subtype: 0x00, |
| 44 | + keydata: { |
| 45 | + aggregatedKey: |
| 46 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 47 | + outputKey: |
| 48 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 49 | + }, |
| 50 | + }, |
| 51 | + expected: |
| 52 | + 'fc0000623233393630626531636235366564306639303434646564373364373538663436363439336366396532613663' + |
| 53 | + '65313339613034666163386436333061363031616634353566343938396431323265393138356638633335316462616563643133' + |
| 54 | + '61646361336565663861396433386566386666656436383637653334326533', |
| 55 | + }, |
| 56 | + { |
| 57 | + data: { |
| 58 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 59 | + subtype: Number.MAX_SAFE_INTEGER, |
| 60 | + keydata: { |
| 61 | + aggregatedKey: |
| 62 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 63 | + outputKey: |
| 64 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 65 | + }, |
| 66 | + }, |
| 67 | + expected: |
| 68 | + 'fc25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953ffffffffffffff1f006' + |
| 69 | + '232333936306265316362353665643066393034346465643733643735386634363634393363663965326136636531333961303466' + |
| 70 | + '616338643633306136303161663435356634393839643132326539313835663863333531646261656364313361646361336565663' + |
| 71 | + '861396433386566386666656436383637653334326533', |
| 72 | + }, |
| 73 | + { |
| 74 | + data: { |
| 75 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 76 | + subtype: Number.MAX_SAFE_INTEGER * 2, |
| 77 | + keydata: { |
| 78 | + aggregatedKey: |
| 79 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 80 | + outputKey: |
| 81 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 82 | + }, |
| 83 | + }, |
| 84 | + exception: 'value out of range', |
| 85 | + }, |
| 86 | + { |
| 87 | + data: { |
| 88 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 89 | + identifierEncoding: 'dummy', |
| 90 | + subtype: 0x00, |
| 91 | + keydata: { |
| 92 | + aggregatedKey: |
| 93 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 94 | + outputKey: |
| 95 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 96 | + }, |
| 97 | + }, |
| 98 | + exception: 'Unknown encoding: dummy', |
| 99 | + }, |
| 100 | + ], |
| 101 | + decode: [ |
| 102 | + { |
| 103 | + data: { |
| 104 | + key: |
| 105 | + 'fc25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953006232333936306265' + |
| 106 | + '31636235366564306639303434646564373364373538663436363439336366396532613663653133396130346661633864363330' + |
| 107 | + '61363031616634353566343938396431323265393138356638633335316462616563643133616463613365656638613964333865' + |
| 108 | + '66386666656436383637653334326533', |
| 109 | + }, |
| 110 | + expected: { |
| 111 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 112 | + subtype: 0x00, |
| 113 | + keydata: { |
| 114 | + aggregatedKey: |
| 115 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 116 | + outputKey: |
| 117 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 118 | + }, |
| 119 | + }, |
| 120 | + }, |
| 121 | + { |
| 122 | + data: { |
| 123 | + key: |
| 124 | + 'fc4a50005300420054005f0049004e005f004d0055005300490047005f005000410052005400490043004900500041004e0054005' + |
| 125 | + 'f005000550042004c00490043005f004b004500590053000062323339363062653163623536656430663930343464656437336437' + |
| 126 | + '353866343636343933636639653261366365313339613034666163386436333061363031616634353566343938396431323265393' + |
| 127 | + '13835663863333531646261656364313361646361336565663861396433386566386666656436383637653334326533', |
| 128 | + identifierEncoding: 'utf16le', |
| 129 | + }, |
| 130 | + expected: { |
| 131 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 132 | + identifierEncoding: 'utf16le', |
| 133 | + subtype: 0x00, |
| 134 | + keydata: { |
| 135 | + aggregatedKey: |
| 136 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 137 | + outputKey: |
| 138 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 139 | + }, |
| 140 | + }, |
| 141 | + }, |
| 142 | + { |
| 143 | + data: { |
| 144 | + key: |
| 145 | + 'fc0000623233393630626531636235366564306639303434646564373364373538663436363439336366396532613663' + |
| 146 | + '65313339613034666163386436333061363031616634353566343938396431323265393138356638633335316462616563643133' + |
| 147 | + '61646361336565663861396433386566386666656436383637653334326533', |
| 148 | + }, |
| 149 | + expected: { |
| 150 | + identifier: '', |
| 151 | + subtype: 0x00, |
| 152 | + keydata: { |
| 153 | + aggregatedKey: |
| 154 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 155 | + outputKey: |
| 156 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 157 | + }, |
| 158 | + }, |
| 159 | + }, |
| 160 | + { |
| 161 | + data: { |
| 162 | + key: |
| 163 | + 'fc25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953ffffffffffffff1f006' + |
| 164 | + '232333936306265316362353665643066393034346465643733643735386634363634393363663965326136636531333961303466' + |
| 165 | + '616338643633306136303161663435356634393839643132326539313835663863333531646261656364313361646361336565663' + |
| 166 | + '861396433386566386666656436383637653334326533', |
| 167 | + }, |
| 168 | + expected: { |
| 169 | + identifier: 'PSBT_IN_MUSIG_PARTICIPANT_PUBLIC_KEYS', |
| 170 | + subtype: Number.MAX_SAFE_INTEGER, |
| 171 | + keydata: { |
| 172 | + aggregatedKey: |
| 173 | + 'af455f4989d122e9185f8c351dbaecd13adca3eef8a9d38ef8ffed6867e342e3', |
| 174 | + outputKey: |
| 175 | + 'b23960be1cb56ed0f9044ded73d758f466493cf9e2a6ce139a04fac8d630a601', |
| 176 | + }, |
| 177 | + }, |
| 178 | + }, |
| 179 | + { |
| 180 | + data: { |
| 181 | + key: |
| 182 | + 'fb25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953006232333936306265' + |
| 183 | + '31636235366564306639303434646564373364373538663436363439336366396532613663653133396130346661633864363330' + |
| 184 | + '61363031616634353566343938396431323265393138356638633335316462616563643133616463613365656638613964333865' + |
| 185 | + '66386666656436383637653334326533', |
| 186 | + }, |
| 187 | + exception: 'Invalid proprietary key format found while decoding', |
| 188 | + }, |
| 189 | + { |
| 190 | + data: { |
| 191 | + key: '', |
| 192 | + }, |
| 193 | + exception: 'Invalid proprietary key format found while decoding', |
| 194 | + }, |
| 195 | + { |
| 196 | + data: { |
| 197 | + key: |
| 198 | + 'fc25505342545f494e5f4d555349475f5041525449434950414e545f5055424c49435f4b455953006232333936306265' + |
| 199 | + '31636235366564306639303434646564373364373538663436363439336366396532613663653133396130346661633864363330' + |
| 200 | + '61363031616634353566343938396431323265393138356638633335316462616563643133616463613365656638613964333865' + |
| 201 | + '66386666656436383637653334326533', |
| 202 | + identifierEncoding: 'dummy', |
| 203 | + }, |
| 204 | + exception: 'Unknown encoding: dummy', |
| 205 | + }, |
| 206 | + ], |
| 207 | +}; |
0 commit comments