| 93 | } |
| 94 | |
| 95 | func 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 | } |