user993: The following (await window.cardano['<wallet>'].enable()).signData('<addr>', '<payload>')
Returns an object
{ key: <key>, signature: <sig> }
I'm successfully parsing the key to a CoseKey with ermugo/message-signing in node.js, but struggling to pull the header which contains the key. Reading CIP-0030 I believe it is contained within the headers as x. Could someone explain how I read this in code, please? Thanks for your time.
edit: if there is documentation that explains how to do this please show me the way.

user993: Since it's mentioned in CIP-0030 that the key for the header associated with the public key is -2, I spent some time in the debugger and managed to fetch it with this code.
const coseKey = MessageSigning.COSEKey.from_bytes(Buffer.from(key, 'hex'));

const keyHeaderBytes = coseKey.header(MessageSigning.Label.new_int(MessageSigning.Int.new_i32(-2))).as_bytes();

Not sure if this is the optimal solution but it seems to work. Open to feedback.

993: <p>The following <code>(await window.cardano['&lt;wallet&gt;'].enable()).signData('&lt;addr&gt;', '&lt;payload&gt;')</code></p>
<p>Returns an object
<code>{ key: &lt;key&gt;, signature: &lt;sig&gt; }</code></p>
<p>I'm successfully parsing the key to a CoseKey with <code>ermugo/message-signing</code> in node.js, but struggling to pull the header which contains the key. Reading <a href="https://github.com/cardano-foundation/CIPs/tree/master/CIP-0030#apisigndataaddr-address-payload-bytes-promisedatasignature" rel="nofollow noreferrer">CIP-0030</a> I believe it is contained within the headers as <code>x</code>. Could someone explain how I read this in code, please? Thanks for your time.</p>
<p>edit: if there is documentation that explains how to do this please show me the way.</p>
 993: <p>Since it's mentioned in CIP-0030 that the key for the header associated with the public key is <code>-2</code>, I spent some time in the debugger and managed to fetch it with this code.</p>
<pre><code>const coseKey = MessageSigning.COSEKey.from_bytes(Buffer.from(key, 'hex'));

const keyHeaderBytes = coseKey.header(MessageSigning.Label.new_int(MessageSigning.Int.new_i32(-2))).as_bytes();
</code></pre>
<p>Not sure if this is the optimal solution but it seems to work. Open to feedback.</p>
