Diferent types of signatures on witness

I’m trying to insert a signature with a different format and I get an error without much detail:

forc = “0.56.0”
fuel-core = “0.26.0”

my code

Subscription structure:
image

Error:

Structure sent by witnesses (signature):

how the signature is read:

I will look into and get back to you soon :slight_smile:

1 Like

Hey @guimroque, this actually looks like a TS error given it’s being thrown at arrayify.ts. Would you mind also letting me know what version of fuels you are running?

I’ll run your code once I’ve got that version, but I also expect it’s throwing invalid data because your B512 signature will expect a string. So we’d expect something like const b512 = "0x1234....", same for all your hex values.

I’d reccomend checking out typegen and it’ll help you create type-safe inputs and outputs for your contracts.

1 Like

fuels version: 0.88.1

I’m sure I’m inserting it as a string… I’m passing the variable value as ${WEBAUTHN.signature},

Okay I was basing it off this screenshot you posted:

As these are not strings. Bare with me I’ll load up your repo.

Sorry, I updated to the latest code… check again

code

  • clone this repo, select branch feat/devnet-upgrade
  • run cd packages/sway
  • change your configurables files - set your node url
  • run pnpm install
  • run pnpm prebuild
  • run pnpm test
1 Like

If you need information about how the signature is generated, check:

webauthn

Yeah it’s the string conversion. If I log out the value:

console.log('Check sig: ', `${WEBAUTHN.signature}`);
// Check sig:  Infinity

As we are storing signature as a number. So JS is attempting to convert a 512 bit number to a string, throwing and falling back to Infinity (:man_facepalming: ). Most JS can safely handle is 53 bit numbers or you have to use something like the BN wrapper. But in your case you want a signature, which we should store as a string. I got this working by editing your constants file and changing all your hex values to string rather than number.

export const WEBAUTHN = {
  tx_id: '0x96434c01712899770803277f193d2bb00bc8cff1799fe364ffe6b07404078fbe',
  address: '0x511f2e17ba75934fa428227a7e9d879d3be118a15a907122c530691c1203a40d',
  signature:
    '0x00000000000000004bbf640fccaa7173201362d15f52973a9a68f6772dfda099ee805c7d5d8be34fd1bdc6ea82927031cad031de63df823516c9a8534b10290a91adb6f52d2b68c2000000000000002400000000000000c400000000000000257b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22222c226f726967696e223a2268747470733a2f2f62736166652d75692d6769742d73746167696e672d696e66696e6974792d626173652e76657263656c2e617070222c2263726f73734f726967696e223a66616c73652c226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d766159c52a420165c2367df88c6aec599f50425345b97f1d4d1014572b9cbca51d00000000',
};
1 Like

Ok, tanks for this…but have a new problem:

do you can check branch again?

run git pull

Hey @guimroque, I can see all tests are now passing, all good?

3 Likes

yes, all things working

thank you :slight_smile:

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.