Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
psychoet opened this issue Oct 27, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@psychoet
Copy link

psychoet commented Oct 27, 2023

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.

  • your phone model and OS version: iPhone 11 pro, iOS 16.6.1
  • BoltCardWallet app version (settings->about->scroll down): v0.3.4
  • self-test passes? Open settings->about->scroll down, tap "Run self-test": N/A on iOS app
  • unique ID for our crash reporting service (settings->about->scroll down, tap "copy"): 1E9357CD-B313-417D-9692-1CF5E9220D3E

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

The devices used in the test were:

  • iPhone 11 pro
  • Androis POS machine (OS: Android 11, Model: CS30)

The software used to reproduce this case were:

  • LNBits extension - umbrel docker edition
  • Bolt card hub - umbrel docker edition
  • Bolt card wallet (iOS, android)
  • Boltcard NFC Programmer
  • NFC tools (for 'erase tag')

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

Not sure. Any ideas @robertclarkson ?

@robertclarkson
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

@robertclarkson robertclarkson added the bug Something isn't working label Oct 29, 2023
@PeterRounce
Copy link
Member

to recreate the issue:

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

  • create the card (long URL)
  • then wipe
  • then create short URL card

@psychoet
Copy link
Author

psychoet commented Nov 6, 2023

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

@PeterRounce
Copy link
Member

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
Copy link
Author

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 PeterRounce changed the title Rewrite on Bolt card with bolt card wallet fails if firstly written by LNBits extension Rewrite on Bolt card with bolt card wallet fails if firstly written by LNBits extension (2 c values) Jan 14, 2024
@PeterRounce
Copy link
Member

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
Copy link

X-Hades-X commented Jan 14, 2024

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
Copy link

X-Hades-X commented Jan 17, 2024

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.

params[key] = value;

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants