MCPcopy Create free account
hub / github.com/WICG/webpackage / writeOutput

Function writeOutput

go/bundle/cmd/sign-bundle/integrityblock.go:17–29  ·  view source on GitHub ↗
(bundleFile io.ReadSeeker, integrityBlockBytes []byte, originalIntegrityBlockOffset int64, signedBundleFile *os.File)

Source from the content-addressed store, hash-verified

15)
16
17func writeOutput(bundleFile io.ReadSeeker, integrityBlockBytes []byte, originalIntegrityBlockOffset int64, signedBundleFile *os.File) error {
18 signedBundleFile.Write(integrityBlockBytes)
19
20 // Move the file pointer to the start of the web bundle bytes.
21 bundleFile.Seek(originalIntegrityBlockOffset, io.SeekStart)
22
23 // io.Copy() will do chunked read/write under the hood
24 _, err := io.Copy(signedBundleFile, bundleFile)
25 if err != nil {
26 return err
27 }
28 return nil
29}
30
31func readPublicEd25519KeyFromFile(path string) (ed25519.PublicKey, error) {
32 pubkeytext, err := ioutil.ReadFile(path)

Callers 1

SignWithIntegrityBlockFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected