HEADER v3, primary аккаунты и подтверждения

This commit is contained in:
AidarKC
2026-11-27 12:29:24 +03:00
parent f9e7c4ef94
commit ae430e84c7
89 changed files with 1201 additions and 1596 deletions
@@ -24,17 +24,18 @@ const context = {
};
const makeHeaderBodyBytes = vm.runInNewContext(`function makeHeaderBodyBytes(${makeBytesFunction}\nmakeHeaderBodyBytes`, context);
test('CORE/CONTENT HEADER v1 contains login and initial key without CC0', () => {
test('CORE/CONTENT HEADER v2 contains login, empty license and initial key', () => {
const key = Uint8Array.from({ length: 32 }, (_, n) => n + 1);
const result = makeHeaderBodyBytes({ login: 'Alice@shine', initialBlockchainKey32: key });
const login = new TextEncoder().encode('Alice@shine');
assert.equal(new TextDecoder().decode(result.slice(0,5)), 'SHiNE');
assert.equal(result[5], login.length);
assert.deepEqual(Array.from(result.slice(6, 6+login.length)), Array.from(login));
assert.deepEqual(Array.from(result.slice(6+login.length)), Array.from(key));
assert.equal(result.length, 5 + 1 + login.length + 32);
assert.deepEqual(Array.from(result.slice(7+login.length)), Array.from(key));
assert.equal(result[6+login.length], 0);
assert.equal(result.length, 5 + 1 + login.length + 1 + 32);
assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION/);
assert.match(auth, /export const HEADER_VERSION = 1/);
assert.match(auth, /export const HEADER_VERSION = 3/);
});
test('free and paid registration both require accepted documents before any registration operation', { skip: !hasRegistrationTerms }, () => {