Only keep keys valid for 100 years rather than the heat death of the universe

WASM builds really dislike thinking that far into the future, causing
WASM to trap with "float unrepresentable in integer range", which corrupts
the Go stack in wasm_exec which then leads to a segfault and the program
exiting.
This commit is contained in:
Kegan Dougal 2020-05-15 17:39:20 +01:00
parent 8db60c90bb
commit bfb954519b
2 changed files with 4 additions and 4 deletions

View file

@ -17,7 +17,7 @@ package postgres
import (
"context"
"math"
"time"
"golang.org/x/crypto/ed25519"
@ -62,7 +62,7 @@ func NewDatabase(
VerifyKey: gomatrixserverlib.VerifyKey{
Key: gomatrixserverlib.Base64String(serverKey),
},
ValidUntilTS: math.MaxUint64 >> 1,
ValidUntilTS: gomatrixserverlib.AsTimestamp(time.Now().Add(100 * 365 * 24 * time.Hour)),
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
}
err = d.StoreKeys(

View file

@ -17,7 +17,7 @@ package sqlite3
import (
"context"
"math"
"time"
"golang.org/x/crypto/ed25519"
@ -63,7 +63,7 @@ func NewDatabase(
VerifyKey: gomatrixserverlib.VerifyKey{
Key: gomatrixserverlib.Base64String(serverKey),
},
ValidUntilTS: math.MaxUint64 >> 1,
ValidUntilTS: gomatrixserverlib.AsTimestamp(time.Now().Add(100 * 365 * 24 * time.Hour)),
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
}
err = d.StoreKeys(