SHA256
Исправить регистрацию free-пользователей без учёта регистра
НЕ ПРОВЕРЕНО: учтены логины с большими и маленькими буквами. Добавлен временный devnet-смарт-контракт для очистки тестового аккаунта от старых логинов; после сброса его необходимо удалить и восстановить штатный контракт.
This commit is contained in:
@@ -14,7 +14,9 @@ const bh = x => Uint8Array.from(Buffer.from(x, 'hex'));
|
||||
|
||||
test('строгая нормализация полных логинов', () => {
|
||||
assert.equal(normalizeFullLogin('alice@shine'), 'alice@shine');
|
||||
for (const bad of ['alice','ALICE@shine','alice@Shine',' alice@shine','alice@@shine','alice.s@shine','a'.repeat(30)+'@a'])
|
||||
assert.equal(normalizeFullLogin('ALICE@shine'), 'ALICE@shine');
|
||||
assert.equal(normalizeFullLogin('AlIcE@shine'), 'AlIcE@shine');
|
||||
for (const bad of ['alice','alice@Shine',' alice@shine','alice@@shine','alice.s@shine','a'.repeat(30)+'@a'])
|
||||
assert.throws(() => normalizeFullLogin(bad));
|
||||
assert.notEqual(normalizeFullLogin('a_b@shine'), normalizeFullLogin('ab@shine'));
|
||||
});
|
||||
@@ -31,6 +33,8 @@ test('SHA256 PDA seeds stable and domain separated', async () => {
|
||||
assert.equal(hex(await userPdaSeed32('bob@free')), props.user_bob_free_seed);
|
||||
assert.equal(hex(await namespacePdaSeed32('free')), props.namespace_free_seed);
|
||||
assert.notEqual(hex(await userPdaSeed32('bob@free')), hex(await namespacePdaSeed32('free')));
|
||||
assert.equal(hex(await userPdaSeed32('BoB@free')), hex(await userPdaSeed32('bob@free')));
|
||||
assert.equal(hex(await userPdaSeed32('BOB@free')), hex(await userPdaSeed32('bob@free')));
|
||||
});
|
||||
test('inner message is byte-for-byte fixture', () => {
|
||||
const b = buildFreeCertificateInnerMessage('bob@free',
|
||||
@@ -38,6 +42,11 @@ test('inner message is byte-for-byte fixture', () => {
|
||||
bh('29acbae141bccaf0b22e1a94d34d0bc7361e526d0bfe12c89794bc9322966dd7'),
|
||||
bh('2543b92ff1095511476adc8369db6ddc933665a11978dda1404ee1066ca9559d'));
|
||||
assert.equal(hex(b), props.inner_message_hex);
|
||||
const mixed = buildFreeCertificateInnerMessage('BoB@free',
|
||||
bh('03a107bff3ce10be1d70dd18e74bc09967e4d6309ba50d5f1ddc8664125531b8'),
|
||||
bh('29acbae141bccaf0b22e1a94d34d0bc7361e526d0bfe12c89794bc9322966dd7'),
|
||||
bh('2543b92ff1095511476adc8369db6ddc933665a11978dda1404ee1066ca9559d'));
|
||||
assert.notEqual(hex(mixed), hex(b)); // Подпись сертификата включает оригинальный регистр.
|
||||
});
|
||||
test('create instruction suffix encodes registrar signature, never promo', () => {
|
||||
const common = {login:'bob@free', rootKey32: new Uint8Array(32), createdAtMs:1n,
|
||||
|
||||
Reference in New Issue
Block a user