Skip to content

Commit

Permalink
Make AaSignature optional in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
J3imip committed Dec 10, 2024
1 parent 0d60b06 commit 0789f9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/assets/migrations/001_initial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ create table document_sod
signed_attributes varchar(512) not null, -- hex encoded
encapsulated_content varchar(4096) not null, -- hex encoded
signature varchar(4096) not null, -- hex encoded
aa_signature varchar(4096) not null, -- hex encoded
aa_signature varchar(4096), -- hex encoded
pem_file varchar(4096) not null,
error_kind smallint, -- 0 - signed attributes validation failed, 1 - PEM file parsing failed, 2 - PEM file validation failed, 3 - signature verification failed
error varchar(1024), -- error message
Expand Down
2 changes: 1 addition & 1 deletion internal/data/document_sod.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type DocumentSOD struct {
SignedAttributes string `db:"signed_attributes" structs:"signed_attributes"`
EncapsulatedContent string `db:"encapsulated_content" structs:"encapsulated_content"`
Signature string `db:"signature" structs:"signature"`
AaSignature string `db:"aa_signature" structs:"aa_signature"`
AaSignature *string `db:"aa_signature" structs:"aa_signature"`
PemFile string `db:"pem_file" structs:"pem_file"`
Hash string `db:"hash" structs:"hash"`
ErrorKind *types.DocumentSODErrorKind `db:"error_kind" structs:"error_kind"`
Expand Down
3 changes: 2 additions & 1 deletion internal/service/api/handlers/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func Register(w http.ResponseWriter, r *http.Request) {
}

if req.Data.Attributes.DocumentSod.AaSignature != nil {
documentSOD.AaSignature = truncateHexPrefix(*req.Data.Attributes.DocumentSod.AaSignature)
truncatedAaSignature := truncateHexPrefix(*req.Data.Attributes.DocumentSod.AaSignature)
documentSOD.AaSignature = &truncatedAaSignature
}

var response *resources.SignatureResponse
Expand Down

0 comments on commit 0789f9d

Please sign in to comment.