Skip to content

updated error messages #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ Refer to the `/register_identity` endpoint in the Swagger documentation for deta

> **Note**: When registering identities through our API, the API account address is used to compute the identity that will be returned. If you want to use your own address, you need to submit the registration directly to the registry contract. The contract's definition can be found here:
> [ShutterRegistry.sol](https://github.com/shutter-network/contracts/blob/main/src/shutter-service/ShutterRegistry.sol#L1C1-L86C2).
> We follow Gnosis Mainnet block timestamps for `decryptionTimestamp`. The identities will be release on the basis of Gnosis Timestamp only (~every 5 seconds).

#### Example Request
```bash
curl -X POST https://<API_BASE_URL>/register_identity \
-H "Content-Type: application/json" \
-d '{
"decryptionTimestamp": 1735044061,
"decryptionTimestamp": 1735044060,
"identityPrefix": "0x79bc8f6b4fcb02c651d6a702b7ad965c7fca19e94a9646d21ae90c8b54c030a0"
}'
```
Expand Down Expand Up @@ -286,6 +287,9 @@ The keyper set is designed to handle downtime gracefully. Any missed decryption
### How secure is the Shutter system?
The Shutter system uses threshold encryption and distributed cryptographic operations to ensure that no single entity can compromise the security of commitments.

### Why is my decryption key not released after timestamp has elaped?
This is probably because the decryption timestamp is not according to block timestamp of Gnosis chain. We strictly follow Gnosis chain block time to release decryption keys i.e. ~ every 5 seconds.

## Swagger Documentation

For detailed API specifications, including parameters, responses, and error codes, visit the Swagger Documentation:
Expand Down
10 changes: 9 additions & 1 deletion internal/usecase/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,19 @@ func (uc *CryptoUsecase) GetDecryptionKey(ctx context.Context, identity string)
})
if err != nil {
if err == pgx.ErrNoRows {
if registrationData.Timestamp%5 != 0 {
err := httpError.NewHttpError(
fmt.Sprintf("decryption will happen based on gnosis block time, please try again later after %d seconds", registrationData.Timestamp%5),
"",
http.StatusAccepted,
)
return nil, &err
}
// no data found try querying from other keyper via http
decKey, err := uc.getDecryptionKeyFromExternalKeyper(ctx, int64(registrationData.Eon), identity)
if err != nil {
err := httpError.NewHttpError(
err.Error(),
fmt.Sprintf("error while querying decryption key from external keyper: %s", err.Error()),
"",
http.StatusInternalServerError,
)
Expand Down