SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -14,21 +14,20 @@ const encode = vm.runInNewContext(`function makeHeaderBodyBytes(${source}\nmakeH
|
||||
int8Byte: value => Uint8Array.of(value),
|
||||
concatBytes: (...parts) => Uint8Array.from(parts.flatMap(part => Array.from(part))),
|
||||
Uint8Array,
|
||||
HEADER_LICENSE_FIELD_CC0: 'license:CC0-1.0',
|
||||
});
|
||||
|
||||
test('client writes HEADER v2 as SHiNE → login → literal license → key', () => {
|
||||
test('client writes CORE HEADER v1 as SHiNE → login → key', () => {
|
||||
const key = Uint8Array.from({ length: 32 }, (_, i) => i + 1);
|
||||
const login = 'Alice@shine';
|
||||
const body = encode({ login, initialBlockchainKey32: key });
|
||||
const loginBytes = utf8(login);
|
||||
const expected = Uint8Array.from([
|
||||
...utf8('SHiNE'), loginBytes.length, ...loginBytes,
|
||||
...utf8('license:CC0-1.0'), ...key,
|
||||
...key,
|
||||
]);
|
||||
assert.deepEqual(Array.from(body), Array.from(expected));
|
||||
assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_VERSION_CC0/);
|
||||
assert.match(auth, /export const HEADER_VERSION_CC0 = 2/);
|
||||
assert.match(auth, /msgSubType: MSG_SUBTYPE_TECH_HEADER,\s*msgVersion: HEADER_CONTENT_VERSION/);
|
||||
assert.match(auth, /export const HEADER_CONTENT_VERSION = 1/);
|
||||
});
|
||||
|
||||
test('inspector decodes both v1 and v2 and rejects invalid v2 license/order', () => {
|
||||
|
||||
Reference in New Issue
Block a user