This commit is contained in:
2026-11-01 16:43:28 -05:00
parent b427fa4217
commit b88dfb1e94
11 changed files with 121 additions and 23 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export const PROFILE = networkProfile(isNodeRuntime
export const IS_MAINNET = PROFILE === 'mainnet';
export const NETWORK = IS_MAINNET ? 'wikideck-randomx-mainnet-1' as const : 'wikideck-randomx-testnet-6' as const;
const TESTNET_GENESIS_TIME = 1_792_411_200;
const DEFAULT_MAINNET_GENESIS_TIME = 1_798_761_600; // 2027-01-01 UTC candidate; deployment must freeze one value.
const DEFAULT_MAINNET_GENESIS_TIME = 1_793_491_200; // 2026-11-01 00:00 UTC; fixed launch identity, never derived from the current clock.
function genesisTime(raw: string | undefined, profile: NetworkProfile): number {
const value = raw ?? String(profile === 'mainnet' ? DEFAULT_MAINNET_GENESIS_TIME : TESTNET_GENESIS_TIME);
if (!/^(0|[1-9]\d{8,10})$/.test(value)) throw new Error('WIKIDECK_GENESIS_TIME must be a canonical Unix-seconds integer');
+4 -2
View File
@@ -96,10 +96,12 @@ async function validateBackup(value: unknown): Promise<WalletBackup> {
decode(backup.ciphertext, 17, 4096);
if (encoder.encode(JSON.stringify(backup)).length > MAX_BYTES) throw new Error('Backup exceeds 32 KB.');
// Snapshot primitives so callers cannot change headers during awaits.
return { format: backup.format, version: backup.version, network: backup.network,
...(backup.version === 2 ? { chainId: backup.chainId } : {}),
const snapshot: WalletBackupBase = { format: backup.format, network: backup.network,
kdf: backup.kdf, iterations: backup.iterations, cipher: backup.cipher,
salt: backup.salt, iv: backup.iv, publicKey: backup.publicKey, ciphertext: backup.ciphertext };
return backup.version === 2
? { ...snapshot, version: 2, chainId: backup.chainId }
: { ...snapshot, version: 1 };
}
async function validatePair(privateKey: CryptoKey, publicKey: string): Promise<string> {