diff --git a/README.md b/README.md index 374d634..1d3d77e 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 released 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 the given timestamp has elapsed? +This is probably because the decryption timestamp is not aligned to a Gnosis Chain block timestamp. We strictly follow Gnosis Chain block timestamps to release decryption keys i.e. every 5 seconds. In this case simply try again a few seconds later. + ## 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..0e4c8d1 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("Timestamp not aligned with block time, decryption is processed based on Gnosis block time, please retry 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, )