(rawValue)
| 742 | } |
| 743 | |
| 744 | function decodeNativeToolConfigRawPayload(rawValue) { |
| 745 | let value = String(rawValue || '').trim(); |
| 746 | let mode = 'hex'; |
| 747 | if (value.toLowerCase().startsWith('hex:')) { |
| 748 | value = value.slice(4).trim(); |
| 749 | } else if (value.toLowerCase().startsWith('base64:')) { |
| 750 | mode = 'base64'; |
| 751 | value = value.slice(7).trim(); |
| 752 | } |
| 753 | const buf = mode === 'base64' |
| 754 | ? Buffer.from(value, 'base64') |
| 755 | : Buffer.from(value.replace(/\s+/g, ''), 'hex'); |
| 756 | if (buf.length > 512) { |
| 757 | throw new Error('WINDSURFAPI_NATIVE_TOOL_BRIDGE_CONFIG_RAW entry exceeds 512 bytes'); |
| 758 | } |
| 759 | if (!buf.length && value) { |
| 760 | throw new Error('WINDSURFAPI_NATIVE_TOOL_BRIDGE_CONFIG_RAW entry did not decode to bytes'); |
| 761 | } |
| 762 | return buf; |
| 763 | } |
| 764 | |
| 765 | function nativeToolConfigSwitches(list) { |
| 766 | const names = new Set((Array.isArray(list) ? list : []) |
no outgoing calls
no test coverage detected