@e280/quay
Version:
File-browser and outliner UI for the web
19 lines • 517 B
JavaScript
import { Hex } from "@e280/stz";
/** File with a hash label */
export class Cask {
hash;
bytes;
static async hash(bytes) {
const hashBuffer = await crypto.subtle.digest("SHA-256", bytes);
return Hex.fromBytes(new Uint8Array(hashBuffer));
}
static async make(bytes) {
const hash = await this.hash(bytes);
return new this(hash, bytes);
}
constructor(hash, bytes) {
this.hash = hash;
this.bytes = bytes;
}
}
//# sourceMappingURL=cask.js.map