ngraveio / bc-ur

A JS implementation of the Uniform Resources (UR) specification from Blockchain Commons
MIT License
14 stars 13 forks source link

BCUR v1 (legacy) support? #12

Open mflaxman opened 2 years ago

mflaxman commented 2 years ago

I'm looking to use this library to generate a PSBT QR gif for airgap signing. When looking at what Specter-Desktop or Sparrow generate for PSBTs it's of the form (for legacy encoding):

ur:bytes/6of8/dyzuek4l5mdgatky6ff34dqq7h8llkdu792jsuw3tcrs7pct9fys0s27r7/ll0r7ssp0xmdfq209wzttv4gx8lzx92u9sk3yjcw39nehdf2ugsxqdtv69pt0w32td8yms5a3mtfr08j9jaawuzrjnmhzjcsm5eypwwq288qck2u2vqqqzqqzqqqsqqqqqyqqgqqpqqpqqqqqqqqqqqzypsralma4nlau06zq9umd4ypfu4cfddj4qclugc4tskz

Looking at the tests/examples, is this supported in your library? I do see this example, but it doesn't match the legacy ur:bytes... format:

Is it possible to use this library to produce/consume a QR that a HWW/Coordinator could understand for legacy encoding/decoding? A working example would be very helpful.

I'm hoping to be able to make it work with an older Cobo Vault (whose firmware can unfortunately never be updated).

(Sorry for the multiple edits, I bumped submit earlier while drafting this post and updated it. And I realized while writing this that I think this is a BCUR2 library and not a BCUR1 library which was causing some of my confusion).

xardass commented 2 years ago

We currently offer no backwards compatibility with v1, but I would expect this to become rather useful/necessary.

I'm glad that you proposed it, I will see if I can prioritize this.

KayBeSee commented 1 year ago

I think the consensus is to move away from UR1 in favor of UR2. See discussion here: https://github.com/BlockchainCommons/Gordian-Developer-Community/discussions/26

That said, for backward compatibility with Cobo Vault I have two files here that should be compatible:

Encode: https://github.com/Lily-Technologies/lily-wallet/blob/c7d2141ab4887fdf9f3849afab59db2b4f9a0535/apps/frontend/src/pages/Send/Onchain/AddSignatureFromQrCode/DecodePsbtQrCode.tsx#L1

Decode: https://github.com/Lily-Technologies/lily-wallet/blob/c7d2141ab4887fdf9f3849afab59db2b4f9a0535/apps/frontend/src/pages/Send/Onchain/AddSignatureFromQrCode/PsbtQrCode.tsx

I have these pinned to the commit since I am updating those files in favor of UR2.