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

Function UnbundleConfig

state/distribution.go:95–119  ·  view source on GitHub ↗
(bundleStr string, pubKey NyPublicKey)

Source from the content-addressed store, hash-verified

93}
94
95func UnbundleConfig(bundleStr string, pubKey NyPublicKey) (*CentralCfg, error) {
96 bundle, err := base64.StdEncoding.DecodeString(bundleStr)
97 if err != nil {
98 return nil, err
99 }
100 bundle, err = OpenBundle(bundle, pubKey[:])
101 if err != nil {
102 return nil, err
103 }
104 bundle, err = VerifyBundle(bundle, pubKey)
105 if err != nil {
106 return nil, err
107 }
108
109 cfg := &CentralCfg{}
110 err = yaml.Unmarshal(bundle, cfg)
111 if err != nil {
112 return nil, err
113 }
114 err = CentralConfigValidator(cfg)
115 if err != nil {
116 return nil, err
117 }
118 return cfg, nil
119}

Callers 9

FetchConfigFunction · 0.92
bundle.goFile · 0.92
TestDistributionFunction · 0.92
writeBundleFunction · 0.92
TestBundleUnbundleFunction · 0.85
TestBundleTamperFunction · 0.85
TestBundleInvalidSignFunction · 0.85
TestBundleInvalidData1Function · 0.85
TestBundleInvalidData2Function · 0.85

Calls 3

OpenBundleFunction · 0.85
VerifyBundleFunction · 0.85
CentralConfigValidatorFunction · 0.85

Tested by 7

TestDistributionFunction · 0.74
writeBundleFunction · 0.74
TestBundleUnbundleFunction · 0.68
TestBundleTamperFunction · 0.68
TestBundleInvalidSignFunction · 0.68
TestBundleInvalidData1Function · 0.68
TestBundleInvalidData2Function · 0.68