forked from Blendman974/faceclaw
Porting onboarding/flashing flow io iOS
This commit is contained in:
1 parent
68b459751e
commit
64bf600ef9
46 files changed
+1419
-211
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { toData, fromData } from './kotlin-data'
|
||||
declare const FaceclawCrypto: any
|
||||
export function firmwareSha256(buffer: ArrayBuffer): string { return String(FaceclawCrypto.sha256(toData(new Uint8Array(buffer)))) }
|
||||
export function writeFirmwareFile(path: string, buffer: ArrayBuffer): void {
|
||||
if (!toData(new Uint8Array(buffer)).writeToFileAtomically(path, true)) throw new Error('Could not save the verified firmware image.')
|
||||
}
|
||||
export function readFirmwareFile(path: string): Uint8Array {
|
||||
const data = NSData.dataWithContentsOfFile(path)
|
||||
if (!data) throw new Error('Could not read the prepared firmware image.')
|
||||
return fromData(data)
|
||||
}
|
||||
Reference in new issue
Block a user