MCPcopy Create free account
hub / github.com/encodeous/nylon / writeRawBundle

Function writeRawBundle

e2e/distribution_test.go:320–340  ·  view source on GitHub ↗
(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey)

Source from the content-addressed store, hash-verified

318}
319
320func writeRawBundle(t *testing.T, runDir string, name string, cfg state.CentralCfg, key state.NyPrivateKey) string {
321 t.Helper()
322 cfgBytes, err := yaml.Marshal(cfg)
323 if err != nil {
324 t.Fatal(err)
325 }
326 bundle, err := state.SignBundle(cfgBytes, key)
327 if err != nil {
328 t.Fatal(err)
329 }
330 pub := key.Pubkey()
331 bundle, err = state.SealBundle(bundle, pub[:])
332 if err != nil {
333 t.Fatal(err)
334 }
335 path := filepath.Join(runDir, name)
336 if err := os.WriteFile(path, []byte(base64.StdEncoding.EncodeToString(bundle)), 0644); err != nil {
337 t.Fatal(err)
338 }
339 return path
340}
341
342func withTimestamp(cfg state.CentralCfg, timestamp int64) state.CentralCfg {
343 cfg.Timestamp = timestamp

Calls 3

SignBundleFunction · 0.92
SealBundleFunction · 0.92
PubkeyMethod · 0.80

Tested by

no test coverage detected