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.main
parent
8db60c90bb
commit
bfb954519b
|
@ -17,7 +17,7 @@ package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func NewDatabase(
|
||||||
VerifyKey: gomatrixserverlib.VerifyKey{
|
VerifyKey: gomatrixserverlib.VerifyKey{
|
||||||
Key: gomatrixserverlib.Base64String(serverKey),
|
Key: gomatrixserverlib.Base64String(serverKey),
|
||||||
},
|
},
|
||||||
ValidUntilTS: math.MaxUint64 >> 1,
|
ValidUntilTS: gomatrixserverlib.AsTimestamp(time.Now().Add(100 * 365 * 24 * time.Hour)),
|
||||||
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
|
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
|
||||||
}
|
}
|
||||||
err = d.StoreKeys(
|
err = d.StoreKeys(
|
||||||
|
|
|
@ -17,7 +17,7 @@ package sqlite3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func NewDatabase(
|
||||||
VerifyKey: gomatrixserverlib.VerifyKey{
|
VerifyKey: gomatrixserverlib.VerifyKey{
|
||||||
Key: gomatrixserverlib.Base64String(serverKey),
|
Key: gomatrixserverlib.Base64String(serverKey),
|
||||||
},
|
},
|
||||||
ValidUntilTS: math.MaxUint64 >> 1,
|
ValidUntilTS: gomatrixserverlib.AsTimestamp(time.Now().Add(100 * 365 * 24 * time.Hour)),
|
||||||
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
|
ExpiredTS: gomatrixserverlib.PublicKeyNotExpired,
|
||||||
}
|
}
|
||||||
err = d.StoreKeys(
|
err = d.StoreKeys(
|
||||||
|
|
Loading…
Reference in New Issue