diff --git a/README.md b/README.md index 374d634..52f4647 100644 --- a/README.md +++ b/README.md @@ -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:///register_identity \ -H "Content-Type: application/json" \ -d '{ - "decryptionTimestamp": 1735044061, + "decryptionTimestamp": 1735044060, "identityPrefix": "0x79bc8f6b4fcb02c651d6a702b7ad965c7fca19e94a9646d21ae90c8b54c030a0" }' ``` @@ -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: diff --git a/internal/usecase/crypto.go b/internal/usecase/crypto.go index d0c3273..92cad2e 100644 --- a/internal/usecase/crypto.go +++ b/internal/usecase/crypto.go @@ -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, )