You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #34 from datachainlab/fix-key-expiration-calculation
Fix to use `output.validity.not_after + 1` as key's `expiredAt` if the client state's key expiration is zero
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
Copy file name to clipboardExpand all lines: contracts/LCPClientZKDCAPBase.sol
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -191,15 +191,16 @@ abstract contract LCPClientZKDCAPBase is LCPClientBase {
191
191
}
192
192
193
193
// calculate the expiration time of the enclave key
194
+
uint64 maxExpiredAt = output.validityNotAfter +1;
194
195
uint64 expiredAt;
195
196
if (clientState.key_expiration ==0) {
196
-
// If the value is 0, the validity period of the EK is `qv_output.validity.not_after`.
197
-
expiredAt =output.validityNotAfter;
197
+
// If the value is 0, the validity period of the EK is `output.validity.not_after` + 1.
198
+
expiredAt =maxExpiredAt;
198
199
} else {
199
-
// If the value is greater than 0, the validity period of the EK is min(`output.validty.not_before + key_expiration`, `output.validity.not_after`).
200
+
// If the value is greater than 0, the validity period of the EK is min(`output.validity.not_before + key_expiration`, `output.validity.not_after` + 1).
0 commit comments