From 1b2f9ea1d2436a37fa40924c5b043adf4a2a0a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 13 Oct 2024 00:07:02 +0800 Subject: [PATCH] fix: cert eab save --- internal/data/cert_account.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/data/cert_account.go b/internal/data/cert_account.go index e26cb7ea..7492f9f6 100644 --- a/internal/data/cert_account.go +++ b/internal/data/cert_account.go @@ -50,6 +50,8 @@ func (r certAccountRepo) Create(req *request.CertAccountCreate) (*biz.CertAccoun if eabErr != nil { return nil, eabErr } + account.Kid = eab.KeyID + account.HmacEncoded = eab.MACKey client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAGoogleCN, eab, acme.KeyType(account.KeyType)) case "google": client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAGoogle, &acme.EAB{KeyID: account.Kid, MACKey: account.HmacEncoded}, acme.KeyType(account.KeyType)) @@ -62,6 +64,8 @@ func (r certAccountRepo) Create(req *request.CertAccountCreate) (*biz.CertAccoun if eabErr != nil { return nil, eabErr } + account.Kid = eab.KeyID + account.HmacEncoded = eab.MACKey client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAZeroSSL, eab, acme.KeyType(account.KeyType)) case "sslcom": client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CASSLcom, &acme.EAB{KeyID: account.Kid, MACKey: account.HmacEncoded}, acme.KeyType(account.KeyType)) @@ -105,6 +109,8 @@ func (r certAccountRepo) Update(req *request.CertAccountUpdate) error { if eabErr != nil { return eabErr } + account.Kid = eab.KeyID + account.HmacEncoded = eab.MACKey client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAGoogleCN, eab, acme.KeyType(account.KeyType)) case "google": client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAGoogle, &acme.EAB{KeyID: account.Kid, MACKey: account.HmacEncoded}, acme.KeyType(account.KeyType)) @@ -117,6 +123,8 @@ func (r certAccountRepo) Update(req *request.CertAccountUpdate) error { if eabErr != nil { return eabErr } + account.Kid = eab.KeyID + account.HmacEncoded = eab.MACKey client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CAZeroSSL, eab, acme.KeyType(account.KeyType)) case "sslcom": client, err = acme.NewRegisterAccount(context.Background(), account.Email, acme.CASSLcom, &acme.EAB{KeyID: account.Kid, MACKey: account.HmacEncoded}, acme.KeyType(account.KeyType))