mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
chore: bump version to 5.1.1 [skip ci]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* How TREK 5.1.0 registers with the TREK services.
|
||||
* How TREK 5.1.1 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,20 +8,49 @@
|
||||
*/
|
||||
import type { DialectSelfCheck, RegistrationDialect } from './registration-dialect.types';
|
||||
|
||||
import { createHash, createHmac, pbkdf2Sync } from 'node:crypto';
|
||||
import { crc32 } from 'node:zlib';
|
||||
import { createHash, pbkdf2Sync } from 'node:crypto';
|
||||
|
||||
const DIALECT = '_53EjggnrEZi';
|
||||
const PLATEAU_JUNIPER = Buffer.from('e0a200e6a45b6507328ae0f3a781e488ad16c4a56335d2243e6b61989149c23b', 'hex');
|
||||
const RIVER_CANAL = 'abcdefghijklmnopqrstuvwxyz234567';
|
||||
const DIALECT = 'uPqlvaOK1lTg';
|
||||
const REEF_FERN = Buffer.from('f8ae4b4d3888cd3120ee6bd281eba75f55647ea1a4523fcebfc586f9cb5391e9', 'hex');
|
||||
|
||||
function pier(input: Buffer, order: number[]): Buffer {
|
||||
function citadel(input: Buffer, width: number): Buffer {
|
||||
const out = Buffer.from(input);
|
||||
order.forEach((from, to) => out.writeUInt8(input.readUInt8(from), to));
|
||||
for (let i = 0; i + width <= out.length; i += width) out.subarray(i, i + width).reverse();
|
||||
return out;
|
||||
}
|
||||
|
||||
function kettle(value: number): Buffer {
|
||||
function lichen(input: Buffer, start: number): Buffer {
|
||||
const out = Buffer.from(input);
|
||||
for (let offset = 0; offset < out.length; offset += 32) {
|
||||
const counter = Buffer.alloc(2);
|
||||
counter.writeUInt16LE((start + offset / 32) & 0xffff);
|
||||
const block = createHash('sha256').update(REEF_FERN).update(counter).digest();
|
||||
for (let j = offset; j < Math.min(offset + 32, out.length); j++) {
|
||||
out.writeUInt8(out.readUInt8(j) ^ block.readUInt8(j - offset), j);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function dale(part: Buffer): Buffer {
|
||||
const head = Buffer.alloc(2);
|
||||
head.writeUInt16BE(part.length);
|
||||
return Buffer.concat([head, part]);
|
||||
}
|
||||
|
||||
function sleet(value: number): Buffer {
|
||||
const out = Buffer.alloc(8);
|
||||
out.writeBigUInt64LE(BigInt(value));
|
||||
return out;
|
||||
}
|
||||
|
||||
function grove(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 boulder(value: number): Buffer {
|
||||
const out: number[] = [];
|
||||
let rest = value;
|
||||
do {
|
||||
@@ -32,92 +61,48 @@ function kettle(value: number): Buffer {
|
||||
return Buffer.from(out);
|
||||
}
|
||||
|
||||
function sorrel(input: Buffer): string {
|
||||
const bits = [...input].map((byte) => byte.toString(2).padStart(8, '0')).join('');
|
||||
let out = '';
|
||||
for (let i = 0; i < bits.length; i += 5) {
|
||||
out += RIVER_CANAL.charAt(parseInt(bits.slice(i, i + 5).padEnd(5, '0'), 2));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function barrel(value: number): Buffer {
|
||||
const out = Buffer.alloc(4);
|
||||
out.writeUInt32BE(value >>> 0);
|
||||
return out;
|
||||
}
|
||||
|
||||
function slate7(alg: string, size: number, data: Buffer): Buffer {
|
||||
return createHash(alg, { outputLength: size }).update(data).digest();
|
||||
}
|
||||
|
||||
function lava(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 candle(input: Buffer, rotation: number, consts: Buffer): Buffer {
|
||||
const out = Buffer.from(input);
|
||||
let previous = 0;
|
||||
for (let i = 0; i + 4 <= out.length; i += 4) {
|
||||
const word = (out.readUInt32LE(i) + consts.readUInt32BE(i % consts.length)) >>> 0;
|
||||
previous = (((word << rotation) | (word >>> (32 - rotation))) ^ previous) >>> 0;
|
||||
out.writeUInt32LE(previous, i);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export const registrationDialect: RegistrationDialect = {
|
||||
id: DIALECT,
|
||||
releasedFor: '5.1.0',
|
||||
createdAt: '2026-10-31',
|
||||
releasedFor: '5.1.1',
|
||||
createdAt: '2026-11-08',
|
||||
challengePath: `/v1/register/${DIALECT}/challenge`,
|
||||
registerPath: `/v1/register/${DIALECT}`,
|
||||
begin({ challenge, version, random, nowSeconds }) {
|
||||
const zephyr = Buffer.from(challenge.c, 'utf8');
|
||||
const hollow = Buffer.from(version, 'utf8');
|
||||
const tide = createHash('sha256').update(zephyr).digest();
|
||||
const fossil = Buffer.from([0x63]);
|
||||
const delta = Buffer.concat([hollow, fossil, PLATEAU_JUNIPER, fossil, tide]);
|
||||
const cherry = createHmac('sha256', delta).update(hollow).digest();
|
||||
const barge = Buffer.from(cherry.subarray(6, 26));
|
||||
const gull = Buffer.from('b689ff5d4dbea8f47007ef8acb40fe08d6737d2627f5f206', 'hex');
|
||||
const wren = candle(candle(barge, 2, gull), 15, gull);
|
||||
begin({ challenge, version, random }) {
|
||||
const olive = Buffer.from(challenge.c, 'utf8');
|
||||
const cactus = Buffer.from(version, 'utf8');
|
||||
const cypress = createHash('sha256').update(olive).digest();
|
||||
const creek = Buffer.concat([olive, cactus].map(dale));
|
||||
const cairn = createHash('shake256', { outputLength: 0x15 }).update(creek).digest();
|
||||
return {
|
||||
work(nonce) {
|
||||
const canyon = Buffer.concat([random, zephyr, hollow, Buffer.from(`${nonce}`)]);
|
||||
const pollen = Buffer.from(canyon.map((byte) => (byte * 0x73 + 62) & 0xff));
|
||||
const otter = Buffer.from([
|
||||
4, 12, 1, 5, 0xe, 8, 7, 0xd, 9, 3, 0xb, 0xa, 0, 2, 6,
|
||||
].map((from) => pollen.readUInt8(from)));
|
||||
const river5 = Buffer.concat([otter, pollen.subarray(15)]);
|
||||
const prairie = lava(river5, 20);
|
||||
const boulder = createHmac('sha384', PLATEAU_JUNIPER).update(prairie).digest();
|
||||
const jetty = pier(boulder, [
|
||||
0x16, 0, 0xd, 0xb, 18, 20, 0x15, 23, 10, 19, 8, 0x11, 4, 0xe, 2, 7, 24, 9, 0xf, 6, 3, 1, 25, 0x10, 0xc, 5,
|
||||
const breeze = Buffer.from([0xe1]);
|
||||
const summit = Buffer.concat([
|
||||
cactus, breeze, random, breeze, olive, breeze, boulder(nonce), breeze, REEF_FERN,
|
||||
]);
|
||||
return { password: jetty, salt: wren };
|
||||
const stamp = Buffer.from([
|
||||
...summit.subarray(0xb % summit.length), ...summit.subarray(0, 0xb % summit.length),
|
||||
]);
|
||||
const ember = createHash('blake2b512').update(stamp).digest();
|
||||
const dove = lichen(ember, 254);
|
||||
const autumn = createHash('blake2b512').update(dove).digest();
|
||||
return { password: autumn, salt: cairn };
|
||||
},
|
||||
request(nonce) {
|
||||
const slate = Buffer.concat([
|
||||
barrel(nowSeconds), Buffer.from([104]), zephyr, Buffer.from([104]), random, Buffer.from([104]), tide,
|
||||
Buffer.from([104]), PLATEAU_JUNIPER.subarray(15, 0x1b), Buffer.from([104]), kettle(nonce), Buffer.from([104]),
|
||||
hollow,
|
||||
]);
|
||||
const dawn = pbkdf2Sync(slate, random, 0x1b, 0x1d, 'sha256');
|
||||
const crane = Buffer.concat([dawn, barrel(crc32(dawn))]);
|
||||
const shore = slate7('shake256', 51, crane);
|
||||
const barley = Buffer.concat([sleet(nonce), olive, cactus]);
|
||||
const wren = grove(barley, cypress);
|
||||
const chapel = citadel(wren, 4);
|
||||
const lava = pbkdf2Sync(chapel, olive, 19, 29, 'sha256');
|
||||
return {
|
||||
body: {
|
||||
'glade-wisteria': String(nonce),
|
||||
'stamp-drift': challenge.c,
|
||||
jade: random.toString('hex'),
|
||||
harrier: nowSeconds,
|
||||
'apple-marble': version,
|
||||
'dew-basin': 'timber-803',
|
||||
pilgrim: {
|
||||
harvest: version,
|
||||
lindenQuartz: challenge.c,
|
||||
plateauSorrel: nonce,
|
||||
apple: 'nest-421',
|
||||
harvestHollow: random.toString('hex'),
|
||||
},
|
||||
},
|
||||
headers: { 'X-TREK-Spruce-Otter': sorrel(shore) },
|
||||
headers: { 'X-TREK-Quill-Bramble': lava.toString('hex') },
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -126,13 +111,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._53EjggnrEZi', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
|
||||
version: '5.1.0',
|
||||
challenge: { c: 'v1.selfcheck.uPqlvaOK1lTg', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
|
||||
version: '5.1.1',
|
||||
random: '000102030405060708090a0b0c0d0e0f',
|
||||
nowSeconds: 1800000000,
|
||||
nonce: 41,
|
||||
inputSha256: '3492823dc72bc3566dd8a483fbb041db15235d8069387e6ecd5df4b67d776a63',
|
||||
saltSha256: '91104fa382a167ba804e06ac859aff52fe9107b420c0880a1ccd319f6699bfe2',
|
||||
scrypt: '0bf159d19acf7d51c23759e1d71b5ddb9d8b974811ca3478193eca280e0a0101',
|
||||
requestSha256: '21b99ccdccc6c9ad77109170d26cd9ab3b41d2243d3e9012fdb3dbc3e69d8d9c',
|
||||
inputSha256: '51bf94954bef8fb0bd92426ffbd3a4301cc26aacc2f1392e36a3589c3d368eed',
|
||||
saltSha256: 'f574427b733f5f3307704d8e967654cd8a2a1b7cf1ea37c79d682aed6253ab2d',
|
||||
scrypt: '9603a88e384e7b6a99e79883351d9786ab5294bfe83bb9b80979ddba279d8515',
|
||||
requestSha256: '30fb4cbca72c689c6b66ba741bd6432a112f0f424619b15ef621935c3dfddf6d',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user