Переведены ключи UI в base58 и обновлены deploy defaults
This commit is contained in:
parent
a06b76b800
commit
68ed93dd24
@ -19,10 +19,10 @@ import java.util.jar.JarFile;
|
|||||||
*/
|
*/
|
||||||
public class IT_DeployBackupCleanAndRunRemoteMain {
|
public class IT_DeployBackupCleanAndRunRemoteMain {
|
||||||
|
|
||||||
private static final String REMOTE_HOST = System.getProperty("it.remoteHost", "194.87.0.247");
|
private static final String REMOTE_HOST = System.getProperty("it.remoteHost", "shineup.me");
|
||||||
private static final String REMOTE_USER = System.getProperty("it.remoteUser", "user");
|
private static final String REMOTE_USER = System.getProperty("it.remoteUser", "player");
|
||||||
|
|
||||||
private static final String REMOTE_DIR = System.getProperty("it.remoteDir", "/home/user/docker/shine-server");
|
private static final String REMOTE_DIR = System.getProperty("it.remoteDir", "/home/player/SHiNE/shine-server");
|
||||||
private static final String REMOTE_JAR = REMOTE_DIR + "/shine-server.jar";
|
private static final String REMOTE_JAR = REMOTE_DIR + "/shine-server.jar";
|
||||||
private static final String REMOTE_DATA = System.getProperty("it.remoteDataDir", REMOTE_DIR + "/data");
|
private static final String REMOTE_DATA = System.getProperty("it.remoteDataDir", REMOTE_DIR + "/data");
|
||||||
private static final String REMOTE_BACKUP_DIR = System.getProperty("it.remoteBackupDir", REMOTE_DIR + "/backup");
|
private static final String REMOTE_BACKUP_DIR = System.getProperty("it.remoteBackupDir", REMOTE_DIR + "/backup");
|
||||||
|
|||||||
@ -11,10 +11,10 @@ import java.util.Objects;
|
|||||||
public class IT_DeployRestartAndRunRemoteMain {
|
public class IT_DeployRestartAndRunRemoteMain {
|
||||||
|
|
||||||
// ====== НАСТРОЙКИ (можно переопределять systemProperty) ======
|
// ====== НАСТРОЙКИ (можно переопределять systemProperty) ======
|
||||||
private static final String REMOTE_HOST = System.getProperty("it.remoteHost", "194.87.0.247");
|
private static final String REMOTE_HOST = System.getProperty("it.remoteHost", "shineup.me");
|
||||||
private static final String REMOTE_USER = System.getProperty("it.remoteUser", "user");
|
private static final String REMOTE_USER = System.getProperty("it.remoteUser", "player");
|
||||||
|
|
||||||
private static final String REMOTE_DIR = System.getProperty("it.remoteDir", "/home/user/docker/shine-server");
|
private static final String REMOTE_DIR = System.getProperty("it.remoteDir", "/home/player/SHiNE/shine-server");
|
||||||
private static final String REMOTE_JAR = REMOTE_DIR + "/shine-server.jar";
|
private static final String REMOTE_JAR = REMOTE_DIR + "/shine-server.jar";
|
||||||
private static final String REMOTE_DATA = System.getProperty("it.remoteDataDir", REMOTE_DIR + "/data");
|
private static final String REMOTE_DATA = System.getProperty("it.remoteDataDir", REMOTE_DIR + "/data");
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
client.version=1.2.111
|
client.version=1.2.112
|
||||||
server.version=1.2.103
|
server.version=1.2.104
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { renderHeader } from '../components/header.js';
|
import { renderHeader } from '../components/header.js';
|
||||||
import { state } from '../state.js';
|
import { state } from '../state.js';
|
||||||
import { bytesToBase64 } from '../services/crypto-utils.js';
|
import { base64ToBytes, bytesToBase58 } from '../services/crypto-utils.js';
|
||||||
import { extractSeed32FromPkcs8B64 } from '../services/device-key-utils.js';
|
import { extractSeed32FromPkcs8B64 } from '../services/device-key-utils.js';
|
||||||
|
|
||||||
export const pageMeta = { id: 'registration-draft-keys-view', title: 'Сгенерированные ключи', showAppChrome: false };
|
export const pageMeta = { id: 'registration-draft-keys-view', title: 'Сгенерированные ключи', showAppChrome: false };
|
||||||
@ -17,7 +17,7 @@ function makeSecretField({ label, value }) {
|
|||||||
row.className = 'inline-input-row';
|
row.className = 'inline-input-row';
|
||||||
|
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.className = 'input';
|
input.className = 'input key-input';
|
||||||
input.type = 'password';
|
input.type = 'password';
|
||||||
input.readOnly = true;
|
input.readOnly = true;
|
||||||
input.value = value;
|
input.value = value;
|
||||||
@ -50,7 +50,7 @@ function makePublicField({ label, value }) {
|
|||||||
labelEl.textContent = label;
|
labelEl.textContent = label;
|
||||||
|
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.className = 'input';
|
input.className = 'input key-input';
|
||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
input.readOnly = true;
|
input.readOnly = true;
|
||||||
input.value = value;
|
input.value = value;
|
||||||
@ -82,38 +82,56 @@ export function render({ navigate }) {
|
|||||||
card.append(warning);
|
card.append(warning);
|
||||||
|
|
||||||
// Секрет (root key seed)
|
// Секрет (root key seed)
|
||||||
let secretB64 = '';
|
let secretB58 = '';
|
||||||
try {
|
try {
|
||||||
const rootSeed32 = extractSeed32FromPkcs8B64(keyBundle.rootPair.privatePkcs8B64);
|
const rootSeed32 = extractSeed32FromPkcs8B64(keyBundle.rootPair.privatePkcs8B64);
|
||||||
secretB64 = bytesToBase64(rootSeed32);
|
secretB58 = bytesToBase58(rootSeed32);
|
||||||
} catch {
|
} catch {
|
||||||
secretB64 = '(не удалось извлечь)';
|
secretB58 = '(не удалось извлечь)';
|
||||||
}
|
}
|
||||||
card.append(makeSecretField({ label: 'Секрет (root seed, 32 байта)', value: secretB64 }));
|
card.append(makeSecretField({ label: 'Секрет (root seed, base58, 32 байта)', value: secretB58 }));
|
||||||
|
|
||||||
// Root key
|
// Root key
|
||||||
const rootSep = document.createElement('p');
|
const rootSep = document.createElement('p');
|
||||||
rootSep.className = 'field-label';
|
rootSep.className = 'field-label';
|
||||||
rootSep.textContent = 'Root key';
|
rootSep.textContent = 'Root key';
|
||||||
card.append(rootSep);
|
card.append(rootSep);
|
||||||
card.append(makePublicField({ label: 'Root — публичный', value: keyBundle.rootPair.publicKeyB64 }));
|
card.append(makePublicField({
|
||||||
card.append(makeSecretField({ label: 'Root — приватный (PKCS8)', value: keyBundle.rootPair.privatePkcs8B64 }));
|
label: 'Root — публичный (base58)',
|
||||||
|
value: bytesToBase58(base64ToBytes(keyBundle.rootPair.publicKeyB64)),
|
||||||
|
}));
|
||||||
|
card.append(makeSecretField({
|
||||||
|
label: 'Root — приватный (seed base58, 32 байта)',
|
||||||
|
value: bytesToBase58(extractSeed32FromPkcs8B64(keyBundle.rootPair.privatePkcs8B64)),
|
||||||
|
}));
|
||||||
|
|
||||||
// Blockchain key
|
// Blockchain key
|
||||||
const bchSep = document.createElement('p');
|
const bchSep = document.createElement('p');
|
||||||
bchSep.className = 'field-label';
|
bchSep.className = 'field-label';
|
||||||
bchSep.textContent = 'Blockchain key';
|
bchSep.textContent = 'Blockchain key';
|
||||||
card.append(bchSep);
|
card.append(bchSep);
|
||||||
card.append(makePublicField({ label: 'Blockchain — публичный', value: keyBundle.blockchainPair.publicKeyB64 }));
|
card.append(makePublicField({
|
||||||
card.append(makeSecretField({ label: 'Blockchain — приватный (PKCS8)', value: keyBundle.blockchainPair.privatePkcs8B64 }));
|
label: 'Blockchain — публичный (base58)',
|
||||||
|
value: bytesToBase58(base64ToBytes(keyBundle.blockchainPair.publicKeyB64)),
|
||||||
|
}));
|
||||||
|
card.append(makeSecretField({
|
||||||
|
label: 'Blockchain — приватный (seed base58, 32 байта)',
|
||||||
|
value: bytesToBase58(extractSeed32FromPkcs8B64(keyBundle.blockchainPair.privatePkcs8B64)),
|
||||||
|
}));
|
||||||
|
|
||||||
// Device key
|
// Device key
|
||||||
const devSep = document.createElement('p');
|
const devSep = document.createElement('p');
|
||||||
devSep.className = 'field-label';
|
devSep.className = 'field-label';
|
||||||
devSep.textContent = 'Device key (= Solana wallet)';
|
devSep.textContent = 'Device key (= Solana wallet)';
|
||||||
card.append(devSep);
|
card.append(devSep);
|
||||||
card.append(makePublicField({ label: 'Device — публичный', value: keyBundle.devicePair.publicKeyB64 }));
|
card.append(makePublicField({
|
||||||
card.append(makeSecretField({ label: 'Device — приватный (PKCS8)', value: keyBundle.devicePair.privatePkcs8B64 }));
|
label: 'Device — публичный (base58)',
|
||||||
|
value: bytesToBase58(base64ToBytes(keyBundle.devicePair.publicKeyB64)),
|
||||||
|
}));
|
||||||
|
card.append(makeSecretField({
|
||||||
|
label: 'Device — приватный (seed base58, 32 байта)',
|
||||||
|
value: bytesToBase58(extractSeed32FromPkcs8B64(keyBundle.devicePair.privatePkcs8B64)),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions = document.createElement('div');
|
const actions = document.createElement('div');
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import { renderHeader } from '../components/header.js';
|
import { renderHeader } from '../components/header.js';
|
||||||
import { state } from '../state.js';
|
import { state } from '../state.js';
|
||||||
|
import { bytesToBase58 } from '../services/crypto-utils.js';
|
||||||
|
import { extractSeed32FromPkcs8B64 } from '../services/device-key-utils.js';
|
||||||
import { loadEncryptedUserSecrets } from '../services/key-vault.js';
|
import { loadEncryptedUserSecrets } from '../services/key-vault.js';
|
||||||
|
|
||||||
export const pageMeta = { id: 'show-keys-view', title: 'Показать ключи' };
|
export const pageMeta = { id: 'show-keys-view', title: 'Показать ключи' };
|
||||||
@ -43,15 +45,15 @@ export function render({ navigate }) {
|
|||||||
<span class="field-label">${label}</span>
|
<span class="field-label">${label}</span>
|
||||||
<button class="icon-btn small-btn" type="button" data-toggle="${id}">Показать</button>
|
<button class="icon-btn small-btn" type="button" data-toggle="${id}">Показать</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="key-value" data-value="${id}">*****</div>
|
<div class="key-value key-value--compact" data-value="${id}">*****</div>
|
||||||
`;
|
`;
|
||||||
return row;
|
return row;
|
||||||
};
|
};
|
||||||
|
|
||||||
card.append(
|
card.append(
|
||||||
renderField('root', 'root key'),
|
renderField('root', 'root key (base58)'),
|
||||||
renderField('blockchain', 'blockchain.key'),
|
renderField('blockchain', 'blockchain.key (base58)'),
|
||||||
renderField('device', 'device key'),
|
renderField('device', 'device key (base58)'),
|
||||||
);
|
);
|
||||||
|
|
||||||
const setMissingState = (id) => {
|
const setMissingState = (id) => {
|
||||||
@ -106,9 +108,13 @@ export function render({ navigate }) {
|
|||||||
state.session.storagePwdInMemory,
|
state.session.storagePwdInMemory,
|
||||||
);
|
);
|
||||||
|
|
||||||
keys.root = savedKeys.rootKey || '';
|
const rootSeed32 = savedKeys.rootKey ? extractSeed32FromPkcs8B64(savedKeys.rootKey) : null;
|
||||||
keys.blockchain = savedKeys.blockchainKey || '';
|
const blockchainSeed32 = savedKeys.blockchainKey ? extractSeed32FromPkcs8B64(savedKeys.blockchainKey) : null;
|
||||||
keys.device = savedKeys.deviceKey || '';
|
const deviceSeed32 = savedKeys.deviceKey ? extractSeed32FromPkcs8B64(savedKeys.deviceKey) : null;
|
||||||
|
|
||||||
|
keys.root = rootSeed32 ? bytesToBase58(rootSeed32) : '';
|
||||||
|
keys.blockchain = blockchainSeed32 ? bytesToBase58(blockchainSeed32) : '';
|
||||||
|
keys.device = deviceSeed32 ? bytesToBase58(deviceSeed32) : '';
|
||||||
|
|
||||||
if (keys.root || keys.blockchain || keys.device) {
|
if (keys.root || keys.blockchain || keys.device) {
|
||||||
status.textContent = 'Показаны только ключи, сохранённые на этом устройстве.';
|
status.textContent = 'Показаны только ключи, сохранённые на этом устройстве.';
|
||||||
|
|||||||
@ -25,6 +25,33 @@ function base64UrlToBase64(value) {
|
|||||||
return normalized + '='.repeat(padLen);
|
return normalized + '='.repeat(padLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||||
|
|
||||||
|
export function bytesToBase58(bytes) {
|
||||||
|
const input = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes || []);
|
||||||
|
if (input.length === 0) return '';
|
||||||
|
|
||||||
|
const digits = [];
|
||||||
|
for (let i = 0; i < input.length; i += 1) {
|
||||||
|
let carry = input[i];
|
||||||
|
for (let j = 0; j < digits.length; j += 1) {
|
||||||
|
const value = (digits[j] * 256) + carry;
|
||||||
|
digits[j] = value % 58;
|
||||||
|
carry = Math.floor(value / 58);
|
||||||
|
}
|
||||||
|
while (carry > 0) {
|
||||||
|
digits.push(carry % 58);
|
||||||
|
carry = Math.floor(carry / 58);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < input.length && input[i] === 0; i += 1) {
|
||||||
|
digits.push(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return digits.reverse().map((digit) => BASE58_ALPHABET[digit]).join('');
|
||||||
|
}
|
||||||
|
|
||||||
export function randomBase64(byteLen = 32) {
|
export function randomBase64(byteLen = 32) {
|
||||||
const bytes = getCryptoApi().getRandomValues(new Uint8Array(byteLen));
|
const bytes = getCryptoApi().getRandomValues(new Uint8Array(byteLen));
|
||||||
return bytesToBase64(bytes);
|
return bytesToBase64(bytes);
|
||||||
|
|||||||
@ -1270,6 +1270,17 @@ textarea.input {
|
|||||||
color: #dce7ff;
|
color: #dce7ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.key-value--compact {
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-input {
|
||||||
|
font-family: "IBM Plex Mono", "Fira Code", monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
letter-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.qr-demo {
|
.qr-demo {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user