Skip to content

Commit

Permalink
release v1.0.0 (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
kucera-lukas authored Apr 13, 2022
1 parent b8d222c commit 092f785
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ Server is using Go, Postgres, GraphQL and Redis.

Server endpoint: https://stegoer-server.herokuapp.com/

Development documentation: https://github.com/stegoer/server/blob/main/README.md

Reference documentation: https://stegoer.github.io/client

Source code: https://github.com/stegoer/server

---

## Installation

### Install dependencies
### Install instructions

1. Install Go https://go.dev/doc/install
2. Install PostgreSQL https://www.postgresql.org/download/
3. Install Redis https://redis.io/docs/getting-started/
4. Clone this repository

```sh
git clone [email protected]:stegoer/server.git
```

5. Install dependencies

```sh
go get ./...
Expand Down
4 changes: 2 additions & 2 deletions pkg/infrastructure/graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

const (
lruQueryCacheSize = 1000
maxUploadSize = 50 * 1024 * 1024 // 50MB
maxMemory = 50 * 1024 * 1024 // 50MB
maxUploadSize = 30 * 1024 * 1024 // 30MB
maxMemory = 30 * 1024 * 1024 // 30MB
complexityLimit = 1000
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/infrastructure/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
maxBytes = 50 * 1024 * 1024 // 50MB
maxBytes = 30 * 1024 * 1024 // 30MB
timeOutDeadline = time.Second * 30
shutdownSignal = 1
)
Expand Down
26 changes: 25 additions & 1 deletion pkg/steganography/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,26 @@ func MetadataFromBinaryBuffer(binaryBuffer *bytes.Buffer) (*Metadata, error) {

if len(byteSlice) != metadataLength {
return nil, errors.New(
"buffer length does not match expected metadata length",
"metadata: buffer length does not match expected metadata length",
)
}

if !ValidateLSB(byteSlice[8]) {
return nil, fmt.Errorf(
"metadata: invalid number of least significant bits: %d",
byteSlice[8],
)
}

for _, idx := range getBoolIndices() {
if !zeroOrOne(byteSlice[idx]) {
return nil, fmt.Errorf(
"metadata: invalid boolean byte: %d",
byteSlice[idx],
)
}
}

return &Metadata{
length: util.BytesToUint64(byteSlice[0:8]),
lsbUsed: byteSlice[8],
Expand All @@ -160,3 +176,11 @@ func MetadataFromImageData(imageData util.ImageData) (*Metadata, error) {

return MetadataFromBinaryBuffer(binaryBuffer)
}

func getBoolIndices() []byte {
return []byte{9, 10, 11, 12}
}

func zeroOrOne(b byte) bool {
return b == 0 || b == 1
}

0 comments on commit 092f785

Please sign in to comment.