mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
chore: bump version to 5.1.3 [skip ci]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* How TREK 5.1.2 registers with the TREK services.
|
||||
* How TREK 5.1.3 registers with the TREK services.
|
||||
*
|
||||
* The issuer writes this file for each release and the release pipeline
|
||||
* commits it with the version bump. It is not edited by hand, and its layout
|
||||
@@ -8,103 +8,86 @@
|
||||
*/
|
||||
import type { DialectSelfCheck, RegistrationDialect } from './registration-dialect.types';
|
||||
|
||||
import { createHash, createHmac, hkdfSync } from 'node:crypto';
|
||||
import { createHash, pbkdf2Sync } from 'node:crypto';
|
||||
|
||||
const DIALECT = 'MFB4wDFbWlov';
|
||||
const ZINNIA_LANTERN = Buffer.from('0eb4b15eba99bcd9f2624fead1e5e041a4cffd6485ca8740c26b92cd9ab42910', 'hex');
|
||||
const DIALECT = 'qDlOapZrw47x';
|
||||
const POND_HILL = Buffer.from('53ee01dfb2711f0b4b7cb1b5d7cd644801289dabda654bf6f53ba0f4727d5d26', 'hex');
|
||||
|
||||
function plateau6(input: Buffer, size: number): Buffer {
|
||||
const out = Buffer.alloc(size);
|
||||
input.forEach((byte, i) => out.writeUInt8(out.readUInt8(i % size) ^ byte, i % size));
|
||||
return out;
|
||||
}
|
||||
|
||||
function cedar(alg: string, data: Buffer): Buffer {
|
||||
function saddle(alg: string, data: Buffer): Buffer {
|
||||
return createHash(alg).update(data).digest();
|
||||
}
|
||||
|
||||
function barrel(value: number): Buffer {
|
||||
const out = Buffer.alloc(8);
|
||||
out.writeBigUInt64LE(BigInt(value));
|
||||
return out;
|
||||
}
|
||||
|
||||
function vessel(part: Buffer): Buffer {
|
||||
const head = Buffer.alloc(4);
|
||||
head.writeUInt32BE(part.length);
|
||||
return Buffer.concat([head, part]);
|
||||
}
|
||||
|
||||
function crater(value: number): Buffer {
|
||||
function frost(value: number): Buffer {
|
||||
const out = Buffer.alloc(8);
|
||||
out.writeBigUInt64BE(BigInt(value));
|
||||
return out;
|
||||
}
|
||||
|
||||
function jade(alg: string, key: Buffer, data: Buffer): Buffer {
|
||||
return createHmac(alg, key).update(data).digest();
|
||||
function hollow(input: Buffer, size: number): Buffer {
|
||||
const out = Buffer.alloc(size);
|
||||
input.forEach((byte, i) => out.writeUInt8(out.readUInt8(i % size) ^ byte, i % size));
|
||||
return out;
|
||||
}
|
||||
|
||||
function nest(input: Buffer, width: number): Buffer {
|
||||
function zephyr(value: number): Buffer {
|
||||
const out: number[] = [];
|
||||
let rest = value;
|
||||
do {
|
||||
const low = rest % 128;
|
||||
rest = Math.floor(rest / 128);
|
||||
out.push(low | (Math.sign(rest) << 7));
|
||||
} while (rest > 0);
|
||||
return Buffer.from(out);
|
||||
}
|
||||
|
||||
function barrel(input: Buffer, width: number): Buffer {
|
||||
const out = Buffer.from(input);
|
||||
for (let i = 0; i + width <= out.length; i += width) out.subarray(i, i + width).reverse();
|
||||
return out;
|
||||
}
|
||||
|
||||
function ticket(a: Buffer, b: Buffer): Buffer {
|
||||
const parts: Buffer[] = [];
|
||||
for (let i = 0; i < Math.max(a.length, b.length); i++) parts.push(a.subarray(i, i + 1), b.subarray(i, i + 1));
|
||||
return Buffer.concat(parts);
|
||||
}
|
||||
|
||||
function island(alg: string, size: number, data: Buffer): Buffer {
|
||||
return createHash(alg, { outputLength: size }).update(data).digest();
|
||||
}
|
||||
|
||||
export const registrationDialect: RegistrationDialect = {
|
||||
id: DIALECT,
|
||||
releasedFor: '5.1.2',
|
||||
createdAt: '2026-11-09',
|
||||
releasedFor: '5.1.3',
|
||||
createdAt: '2026-11-10',
|
||||
challengePath: `/v1/register/${DIALECT}/challenge`,
|
||||
registerPath: `/v1/register/${DIALECT}`,
|
||||
begin({ challenge, version, random, nowSeconds }) {
|
||||
const fern = Buffer.from(challenge.c, 'utf8');
|
||||
const jetty = Buffer.from(version, 'utf8');
|
||||
const echo = createHash('sha256').update(fern).digest();
|
||||
const petal = Buffer.concat([ZINNIA_LANTERN.subarray(14, 32), fern, jetty, random.subarray(9, 13)]);
|
||||
const storm = Buffer.concat([petal.subarray(4 % petal.length), petal.subarray(0, 4 % petal.length)]);
|
||||
const plateau = Buffer.from(storm).reverse();
|
||||
const mill = Buffer.from(hkdfSync('sha384', plateau, echo, Buffer.from('3a79e850344e169208', 'hex'), 0x18));
|
||||
begin({ challenge, version, random }) {
|
||||
const garnet = Buffer.from(challenge.c, 'utf8');
|
||||
const glade = Buffer.from(version, 'utf8');
|
||||
const banner = createHash('sha256').update(garnet).digest();
|
||||
const kettle = Buffer.from([0x5a]);
|
||||
const river = Buffer.concat([random, kettle, POND_HILL, kettle, banner, kettle, glade]);
|
||||
const robin = createHash('shake128', { outputLength: 31 }).update(river).digest();
|
||||
const larch = barrel(robin, 8);
|
||||
const ocean = createHash('sha3-512').update(larch).digest();
|
||||
return {
|
||||
work(nonce) {
|
||||
const bamboo = Buffer.concat([
|
||||
vessel(fern), vessel(jetty), vessel(barrel(nonce)), vessel(ZINNIA_LANTERN.subarray(7, 27)),
|
||||
vessel(Buffer.from(String(nowSeconds), 'utf8')), vessel(random),
|
||||
]);
|
||||
const pasture = nest(bamboo, 4);
|
||||
const umber = island('shake128', 35, pasture);
|
||||
const reef = plateau6(umber, 32);
|
||||
const moss = nest(reef, 4);
|
||||
return { password: moss, salt: mill };
|
||||
const wren = Buffer.concat([banner.subarray(0xa, 16), garnet, frost(nonce), glade, random]);
|
||||
const crystal = pbkdf2Sync(wren, banner, 10, 0x32, 'sha256');
|
||||
const seal = hollow(crystal, 20);
|
||||
const mist = Buffer.from([...seal.subarray(0x1b % seal.length), ...seal.subarray(0, 0x1b % seal.length)]);
|
||||
const coast = barrel(mist, 4);
|
||||
const dawn = saddle('sha512', coast);
|
||||
const yarrow = barrel(dawn, 8);
|
||||
return { password: yarrow, salt: ocean };
|
||||
},
|
||||
request(nonce) {
|
||||
const zinnia5 = Buffer.from([0xa8]);
|
||||
const olive = Buffer.concat([
|
||||
fern, zinnia5, Buffer.from(`${nowSeconds}`), zinnia5, crater(nonce), zinnia5, ZINNIA_LANTERN.subarray(9, 16),
|
||||
zinnia5, random, zinnia5, jetty,
|
||||
const pilgrim = Buffer.concat([
|
||||
garnet, Buffer.from([7]), glade, Buffer.from([7]), banner, Buffer.from([7]), zephyr(nonce), Buffer.from([7]),
|
||||
random,
|
||||
]);
|
||||
const bale = ticket(olive, echo);
|
||||
const olive6 = jade('sha3-256', jetty, bale);
|
||||
const brook = cedar('sha3-256', olive6);
|
||||
const pepper = Buffer.from(Array.from(pilgrim, (byte) => (byte * 203 + 60) % 256));
|
||||
const mesa = createHash('blake2b512').update(pepper).digest();
|
||||
return {
|
||||
body: {
|
||||
'kelp-petal': version,
|
||||
canoe: challenge.c,
|
||||
pepper: random.toString('hex'),
|
||||
'glacier-ferry': nowSeconds.toString(),
|
||||
'linden-ridge': nonce.toString(),
|
||||
brookCactus: mesa.toString('base64'),
|
||||
tundra: random.toString('hex'),
|
||||
ivoryCape: version,
|
||||
mill: nonce,
|
||||
jadeBadge: challenge.c,
|
||||
},
|
||||
headers: { 'X-TREK-Mist-Acorn': brook.toString('hex') },
|
||||
headers: {},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -113,13 +96,13 @@ export const registrationDialect: RegistrationDialect = {
|
||||
|
||||
/** Fixed inputs and what this module must make of them; TREK's tests and release job run it. */
|
||||
export const SELF_CHECK: DialectSelfCheck = {
|
||||
challenge: { c: 'v1.selfcheck.MFB4wDFbWlov', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
|
||||
version: '5.1.2',
|
||||
challenge: { c: 'v1.selfcheck.qDlOapZrw47x', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
|
||||
version: '5.1.3',
|
||||
random: '000102030405060708090a0b0c0d0e0f',
|
||||
nowSeconds: 1800000000,
|
||||
nonce: 41,
|
||||
inputSha256: '2d1a46dce1ca69e981e1784ec1533e2b495eccfaeb399f20418c55c509460938',
|
||||
saltSha256: 'f8f01b58c5140199b3b259f2cba1a6eb19d2783c0b519afc39310d2f11c9787e',
|
||||
scrypt: '2a0a02e0a17365b24727aea936466a0561eb65bcd4fb21f33aea9b74a6326e68',
|
||||
requestSha256: 'd7663256c3593f171e27f899081ae52ff7c95619cd8cd22bd0e8113b724d83cf',
|
||||
inputSha256: 'd0459dd032ca32758d4960be87026844ca0e5f2ccc0cd087838c7cc9f1f054d6',
|
||||
saltSha256: 'e6beeb65b892a5f7e68977ceb33e0193bcf284904db6b55884823b5b2a948787',
|
||||
scrypt: 'cb5f7842c312c4442f9d750305c31d2ea2df36556dbf80e17b56df859d2bc1e9',
|
||||
requestSha256: '53bc1ae4f560b17631848e100dd2469040bbadc8ae61c881263a489bd14842ed',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user