boltcard / boltcard-wallet

The Bolt Card Compatible Wallet for Android and iOS
https://boltcardwallet.com/
MIT License
14 stars 1 forks source link

Rewrite on Bolt card with bolt card wallet fails if firstly written by LNBits extension (2 c values) #28

Open psychoet opened 10 months ago

psychoet commented 10 months ago

Do you need support? Try asking on the telegram group

Already reported and discussed in Telegram. No solution was retrieved.

Are you reporting a bug?

Yes. Already made a comment on issue #27 , but this one is more inclusive report.

The cards used in the test were: - Coincorners - Lasereyes

The devices used in the test were:

The software used to reproduce this case were:

1. Lasereyes card Created a bolt card record from LNBits extension, and write it via 'create' QR code/link. Tested successful payments, and wiped it via 'Wipe' QR code/link on both machine (iPhone, Android POS). (also tried to 'erase tag' using NFC tools.) After that, tried to connect the card using Bolt card wallet app & Bolt card hub, but failed only at "Keys ready to change: no x" and "Test CMAC: decrypt with key failed x". Other writing procedures were successful. The payment did not work. After wipe the card using bolt card wallet app, I tried again with LNBits extension for card registration, and it worked well.

2. Coincorner card I realized that I have one new coincorner's bolt card, so tested on iPhone Bolt Card Wallet app with bolt card hub. Writing was successful without any issue, and payment worked well. I am not doing further test with this card since I do not want to lose the only way to utilize my bolt card hub for now.

PeterRounce commented 10 months ago

IMG_20231027_225607_974.jpg

I believe this shows the same issue. Looks like the NDEF file may not have been fully cleared down as the new NDEF file template is shown over the old template.

psychoet commented 10 months ago

Thanks for checking. Why do you think the NDEF file may not be fully cleared? And why does LNBits extension + Boltcard NFC Programmer allows to write on that? I guess this is due to the issue on writing process of iOS Bolt Card Wallet app. Please let me know your opinion, and let me know what type of information I need to provide to find a solution on this issue.

PeterRounce commented 10 months ago

Not sure. Any ideas @robertclarkson ?

robertclarkson commented 10 months ago

Looking at the screen shot seems to give a clue... There are 2 C parameters in the URL which is very strange there should only be one. And this would explain the weirdness.

How 2 C parameters got there... Not sure.

PeterRounce commented 10 months ago

Looks like a possible string handling issue with missing \0 termination character. Could be related to moving to ADPU write.

Ideally the wipe should remove all previous character data and replace with \0s. Also the new string should include a \0 terminator.

robertclarkson commented 10 months ago

Yes have just tested with android as well and can confirm this is a bug thanks for the feedback @psychoet

PeterRounce commented 10 months ago

to recreate the issue:

https://github.com/boltcard/bolt-nfc-android-app/blob/master/testing.md

psychoet commented 10 months ago

I feel sorry for not being helpful on finding the solution, but is there anything I can do to help?

PeterRounce commented 10 months ago

Thank you for offering. Perhaps you could help with pushing the geyser fund. This all goes towards development time.

https://geyser.fund/project/boltcard/

psychoet commented 10 months ago

Made some on geyser. I was a bit surprised by the amount raised - too small! You can close this issue once resolved. I will keep this opened just for a checkpoint.

PeterRounce commented 8 months ago

from the Telegram group for similar report

"And it is somehow also possible to pay with it some times but it crashes the hub and I get API errors on the working card/wallet until I restart"

this indicates separate but related issue in the hub and wallet

X-Hades-X commented 8 months ago

I am the guy from the telegram group. Seems to be the same problem here, but I was able to do one payment after a selfpayment.

The payment was only possible after first paying the same wallet with the card that is connected to.

  1. Export boltcardhub:// backup and use it in the PoS App. You need to replace boltcardhub with lndhub in the string (there is an if in the code which blocks it, maybe remove sometime but that's another issue)
  2. Make an invoice with the PoS and pay it with the card, it should go through and you see in the Boltcard Wallet the amount sent and recieved.
  3. You can do a payment with someone else, Wallet of Satoshi and another PoS accepted it (but only if Pin is disabled)
  4. The Hub seems to be broken now. When trying to refresh the transaction list of any wallet on the Hub it shows a generic dialog with API Error
  5. Restarting the Hub (on Umbrel with restart script in app folder) makes the working card work again. The buggy one will crash the hub again.

Maybe this helps. I'll try to figure out more stuff next saturday when I have time.

X-Hades-X commented 8 months ago

I got around testing it but didn't really figure out why it writes a second c param with only 0. I also was unable to let the hub crash this time. After connecting the card with the same error I tried paying, it failed, tried to pay the same invoice again, worked and the hub didn't crash. I was able to make many payments, so I guess it was some temporary problem. Sadly the first crash also wipped the logs, so I have no clue how it happened.

However, the CMAC Test probably fails because the first c param which would be correct is overwritten bei the second one with only zeroes. https://github.com/boltcard/boltcard-wallet/blob/4a14961bb0f28a5ade1b87993d3f3ef006cfd03a/screen/boltcard/create.js#L314

I have no idea how to build an APK or such thing. So I have to leave it here I guess.