(uri: string)
| 92 | }; |
| 93 | |
| 94 | const _readPsbtFileIntoBase64 = async function (uri: string): Promise<string> { |
| 95 | const base64 = await RNFS.readFile(uri, 'base64'); |
| 96 | const stringData = uint8ArrayToString(base64ToUint8Array(base64)); // decode from base64 |
| 97 | if (stringData.startsWith('psbt')) { |
| 98 | // file was binary, but outer code expects base64 psbt, so we return base64 we got from rn-fs; |
| 99 | // most likely produced by Electrum-desktop |
| 100 | return base64; |
| 101 | } else { |
| 102 | // file was a text file, having base64 psbt in there. so we basically have double base64encoded string |
| 103 | // thats why we are returning string that was decoded once; |
| 104 | // most likely produced by ColdCard |
| 105 | return stringData; |
| 106 | } |
| 107 | }; |
| 108 | |
| 109 | export const showImagePickerAndReadImage = async (): Promise<string | undefined> => { |
| 110 | try { |
no test coverage detected