Skip to content

Commit

Permalink
#535 Enable providing serial number while revoking x509 certs
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois123@gmail.com>
  • Loading branch information
Abdulbois committed Feb 15, 2024
1 parent ca02c54 commit 19884b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions x/pki/keeper/approved_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ func (k Keeper) RemoveApprovedCertificates(
))
}

func (k Keeper) removeCertFromList(serialNumber string, certs *types.ApprovedCertificates) {
certIndex := -1

for i, cert := range certs.Certs {
if cert.SerialNumber == serialNumber {
certIndex = i

break
}
}
if certIndex == -1 {
return
}
if certIndex == len(certs.Certs)-1 {
certs.Certs = certs.Certs[:certIndex]
} else {
certs.Certs = append(certs.Certs[:certIndex], certs.Certs[certIndex+1:]...)
}
}

// GetAllApprovedCertificates returns all approvedCertificates.
func (k Keeper) GetAllApprovedCertificates(ctx sdk.Context) (list []types.ApprovedCertificates) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), pkitypes.KeyPrefix(types.ApprovedCertificatesKeyPrefix))
Expand Down

0 comments on commit 19884b1

Please sign in to comment.