aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_create.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-03-14 18:39:04 +0100
committerMichael Muré <batolettre@gmail.com>2021-03-14 18:40:50 +0100
commitf1d4a19af81fcc05ae9d90e018ff141f6521335a (patch)
tree9d82815e93a2d3a0856962249798f8adac81a1a6 /bug/op_create.go
parentbd09541752ef4db008500d238762ebe7f2f7be39 (diff)
downloadgit-bug-f1d4a19af81fcc05ae9d90e018ff141f6521335a.tar.gz
bug: nonce on all operation to prevent id collision
Diffstat (limited to 'bug/op_create.go')
-rw-r--r--bug/op_create.go15
1 files changed, 0 insertions, 15 deletions
diff --git a/bug/op_create.go b/bug/op_create.go
index e3e38ade..37e1ddc5 100644
--- a/bug/op_create.go
+++ b/bug/op_create.go
@@ -1,7 +1,6 @@
package bug
import (
- "crypto/rand"
"encoding/json"
"fmt"
"strings"
@@ -18,10 +17,6 @@ var _ Operation = &CreateOperation{}
// CreateOperation define the initial creation of a bug
type CreateOperation struct {
OpBase
- // mandatory random bytes to ensure a better randomness of the data of the first
- // operation of a bug, used to later generate the ID
- // len(Nonce) should be > 20 and < 64 bytes
- Nonce []byte `json:"nonce"`
Title string `json:"title"`
Message string `json:"message"`
Files []repository.Hash `json:"files"`
@@ -147,19 +142,9 @@ func (op *CreateOperation) UnmarshalJSON(data []byte) error {
// Sign post method for gqlgen
func (op *CreateOperation) IsAuthored() {}
-func makeNonce(len int) []byte {
- result := make([]byte, len)
- _, err := rand.Read(result)
- if err != nil {
- panic(err)
- }
- return result
-}
-
func NewCreateOp(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) *CreateOperation {
return &CreateOperation{
OpBase: newOpBase(CreateOp, author, unixTime),
- Nonce: makeNonce(20),
Title: title,
Message: message,
Files: files,