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.
MODIFY
common/keydb/postgres/keydb.go
common/keydb/postgres/keydb.go
@@ -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(

MODIFY
common/keydb/sqlite3/keydb.go
common/keydb/sqlite3/keydb.go
@@ -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(

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.