0

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.

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.