Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielost committed Mar 24, 2024
1 parent 4356086 commit a0f8ea2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions internal/service/handlers/generate_merkle_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package handlers

import (
"bytes"
"encoding/hex"
"encoding/pem"
"net/http"

Expand Down Expand Up @@ -37,9 +36,7 @@ func GenerateMerkleTree(w http.ResponseWriter, r *http.Request) {

data := make([][]byte, 0)
for _, certificate := range certificates {
hash := poseidon.New()
println(hex.EncodeToString(hash.Hash(certificate.RawSubjectPublicKeyInfo[:HASH_DATA_LENGTH])))
data = append(data, hash.Hash(certificate.RawSubjectPublicKeyInfo[:HASH_DATA_LENGTH]))
data = append(data, poseidon.New().Hash(certificate.RawSubjectPublicKeyInfo[:HASH_DATA_LENGTH]))
}

tree, err := merkletree.NewTree(merkletree.WithData(data), merkletree.WithHashType(poseidon.New()))
Expand Down Expand Up @@ -78,7 +75,6 @@ func parsePemBlocks(rawPemBlocks []string) ([]*x509.Certificate, error) {
certificates := make([]*x509.Certificate, len(rawPemBlocks))

for i, rawPemBlock := range rawPemBlocks {

pemBlock, _ := pem.Decode([]byte(rawPemBlock))
if pemBlock == nil || pemBlock.Type != PEM_BLOCK_TYPE {
return nil, errors.From(errors.New("failed to decode a pem block"), logan.F{
Expand Down

0 comments on commit a0f8ea2

Please sign in to comment.