SHA256
Регистрация V2: не проверено end-to-end
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/** Разделённые шаги V2: независимая проверка логина, затем email. */
|
||||
import { authService } from '../state.js';
|
||||
import { normalizeFullLogin } from './shine-namespace-service.js';
|
||||
|
||||
async function call(op, payload = {}) {
|
||||
const response = await authService.ws.request(op, payload, op==='ConfirmFreeRegistration'?150000:18000);
|
||||
if (response.status !== 200 || response.ok === false) {
|
||||
const error=new Error(response.message || response.error || `${op}: ошибка сервера`);
|
||||
error.code=response.error || 'REGISTRATION_REQUEST_FAILED';
|
||||
throw error;
|
||||
}
|
||||
return response.payload || {};
|
||||
}
|
||||
export const getRegistrationNamespaces = () => call('GetNamespaces');
|
||||
export const checkRegistrationLogin = (fullLogin) => call('CheckRegistrationLogin', { fullLogin: normalizeFullLogin(fullLogin) });
|
||||
export const checkRegistrationEmail = (email) => call('CheckRegistrationEmail', { email });
|
||||
export const startFreeRegistration = ({ fullLogin, keyBundle, email }) => call('StartFreeRegistration', {
|
||||
fullLogin: normalizeFullLogin(fullLogin), email,
|
||||
rootPublicKeyB64: keyBundle.rootPair.publicKeyB64,
|
||||
blockchainPublicKeyB64: keyBundle.blockchainPair.publicKeyB64,
|
||||
clientPublicKeyB64: keyBundle.clientPair.publicKeyB64,
|
||||
});
|
||||
export const confirmFreeRegistration = (challengeId, code) => call('ConfirmFreeRegistration',{challengeId,code});
|
||||
export const getRegistrationStatus = (fullLogin) => call('GetRegistrationStatus',{fullLogin: normalizeFullLogin(fullLogin)});
|
||||
Reference in New Issue
Block a user