loadStoredACMECertificateMetadata loads the stored ACME certificate data from the cert's sidecar JSON file.
(ctx context.Context, cert Certificate)
| 430 | // loadStoredACMECertificateMetadata loads the stored ACME certificate data |
| 431 | // from the cert's sidecar JSON file. |
| 432 | func (cfg *Config) loadStoredACMECertificateMetadata(ctx context.Context, cert Certificate) (acme.Certificate, error) { |
| 433 | metaBytes, err := cfg.Storage.Load(ctx, StorageKeys.SiteMeta(cert.issuerKey, cert.Names[0])) |
| 434 | if err != nil { |
| 435 | return acme.Certificate{}, fmt.Errorf("loading cert metadata: %w", err) |
| 436 | } |
| 437 | |
| 438 | var certRes CertificateResource |
| 439 | if err = json.Unmarshal(metaBytes, &certRes); err != nil { |
| 440 | return acme.Certificate{}, fmt.Errorf("unmarshaling cert metadata: %w", err) |
| 441 | } |
| 442 | |
| 443 | var acmeCert acme.Certificate |
| 444 | if err = json.Unmarshal(certRes.IssuerData, &acmeCert); err != nil { |
| 445 | return acme.Certificate{}, fmt.Errorf("unmarshaling potential ACME issuer metadata: %v", err) |
| 446 | } |
| 447 | |
| 448 | return acmeCert, nil |
| 449 | } |
| 450 | |
| 451 | // updateARI updates the cert's ACME renewal info, first by checking storage for a newer |
| 452 | // one, or getting it from the CA if needed. The updated info is stored in storage and |
no test coverage detected