Переименовал везде loginKey в solanaKey
This commit is contained in:
AidarKC 2026-01-08 14:44:47 +03:00
parent a218f6586d
commit 1ea5390771
8 changed files with 23 additions and 23 deletions

View File

@ -269,7 +269,7 @@ op - "AddUser"
requestId
login
blockchainName
loginKey
solanaKey
deviceKey
bchLimit

View File

@ -35,7 +35,7 @@
1. Добавление пользователя (AddUser)
Назначение: создать локальную запись пользователя с двумя ключами — loginKey и deviceKey.
Назначение: создать локальную запись пользователя с двумя ключами — solanaKey и deviceKey.
📤 Запрос клиента
{
@ -45,7 +45,7 @@
"login": "anya4",
"loginId": 100212,
"bchId": 4222,
"loginKey": "BASE64_LOGIN_KEY",
"solanaKey": "BASE64_LOGIN_KEY",
"deviceKey": "BASE64_DEVICE_KEY",
"bchLimit": 1000000
}
@ -61,7 +61,7 @@ CREATE TABLE solana_users (
login TEXT NOT NULL,
loginId INTEGER PRIMARY KEY,
bchId INTEGER NOT NULL,
loginKey TEXT,
solanaKey TEXT,
deviceKey TEXT,
bchLimit INTEGER
);

View File

@ -197,18 +197,18 @@ public final class Net_AddBlock_Handler implements JsonMessageHandler {
// -------------------------------------------------------------------
// 5) Ключ подписи берём из blockchain_state.blockchainKey (Base64(32))
// -------------------------------------------------------------------
final byte[] loginKey32;
final byte[] solanaKey32;
try {
loginKey32 = st.getBlockchainKeyBytes();
solanaKey32 = st.getBlockchainKeyBytes();
} catch (Exception e) {
log.warn("AddBlock: bad_blockchain_key_in_state (login={}, blockchainName={}, globalNumber={})",
login, blockchainName, globalNumber, e);
return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "bad_blockchain_key_in_state", serverLastNum, serverLastHashHex);
}
if (loginKey32 == null || loginKey32.length != 32) {
if (solanaKey32 == null || solanaKey32.length != 32) {
log.warn("AddBlock: bad_blockchain_key_len (login={}, blockchainName={}, globalNumber={}, keyLen={})",
login, blockchainName, globalNumber, (loginKey32 == null ? -1 : loginKey32.length));
login, blockchainName, globalNumber, (solanaKey32 == null ? -1 : solanaKey32.length));
return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "bad_blockchain_key_len", serverLastNum, serverLastHashHex);
}
@ -278,7 +278,7 @@ public final class Net_AddBlock_Handler implements JsonMessageHandler {
prevLineHash32,
block.getRawBytes(),
block.getSignature64(),
loginKey32,
solanaKey32,
block.getHash32()
);

View File

@ -33,14 +33,14 @@ public class Net_AddUser_Handler implements JsonMessageHandler {
if (req.getLogin() == null || req.getLogin().isBlank()
|| req.getBlockchainName() == null || req.getBlockchainName().isBlank()
|| req.getLoginKey() == null || req.getLoginKey().isBlank()
|| req.getSolanaKey() == null || req.getSolanaKey().isBlank()
|| req.getDeviceKey() == null || req.getDeviceKey().isBlank()) {
return NetExceptionResponseFactory.error(
req,
WireCodes.Status.BAD_REQUEST,
"BAD_FIELDS",
"Некорректные поля: login/blockchainName/loginKey/deviceKey"
"Некорректные поля: login/blockchainName/solanaKey/deviceKey"
);
}
@ -49,13 +49,13 @@ public class Net_AddUser_Handler implements JsonMessageHandler {
: req.getBchLimit();
try {
byte[] blockchainKey32 = Base64.getDecoder().decode(req.getLoginKey());
byte[] blockchainKey32 = Base64.getDecoder().decode(req.getSolanaKey());
if (blockchainKey32.length != 32) {
return NetExceptionResponseFactory.error(
req,
WireCodes.Status.BAD_REQUEST,
"BAD_BLOCKCHAIN_KEY",
"loginKey должен быть Base64(32 bytes)"
"solanaKey должен быть Base64(32 bytes)"
);
}
@ -100,7 +100,7 @@ public class Net_AddUser_Handler implements JsonMessageHandler {
BlockchainStateEntry st = new BlockchainStateEntry();
st.setBlockchainName(req.getBlockchainName());
st.setLogin(req.getLogin());
st.setBlockchainKey(req.getLoginKey()); // Base64(32)
st.setBlockchainKey(req.getSolanaKey()); // Base64(32)
st.setLastGlobalNumber(-1);
st.setLastGlobalHash(new byte[32]);
st.setFileSizeBytes(0);

View File

@ -13,7 +13,7 @@ import server.logic.ws_protocol.JSON.entyties.Net_Request;
* "payload": {
* "login": "anya",
* "blockchainName": "anya0001",
* "loginKey": "base64-ed25519-public-key-login",
* "solanaKey": "base64-ed25519-public-key-login",
* "deviceKey": "base64-ed25519-public-key-device",
* "bchLimit": 1000000
* }
@ -25,7 +25,7 @@ public class Net_AddUser_Request extends Net_Request {
private String login;
private String blockchainName;
private String loginKey;
private String solanaKey;
private String deviceKey;
private Integer bchLimit;
@ -35,8 +35,8 @@ public class Net_AddUser_Request extends Net_Request {
public String getBlockchainName() { return blockchainName; }
public void setBlockchainName(String blockchainName) { this.blockchainName = blockchainName; }
public String getLoginKey() { return loginKey; }
public void setLoginKey(String loginKey) { this.loginKey = loginKey; }
public String getSolanaKey() { return solanaKey; }
public void setSolanaKey(String solanaKey) { this.solanaKey = solanaKey; }
public String getDeviceKey() { return deviceKey; }
public void setDeviceKey(String deviceKey) { this.deviceKey = deviceKey; }

View File

@ -269,7 +269,7 @@ op - "AddUser"
requestId
login
blockchainName
loginKey
solanaKey
deviceKey
bchLimit

View File

@ -99,7 +99,7 @@ public final class TestConfig {
public static String BCH_NAME2() { return getBlockchainName(LOGIN2()); }
public static String BCH_NAME3() { return getBlockchainName(LOGIN3()); }
/** loginKey для AddUser: по твоему решению = blockchain pubkey. */
/** solanaKey для AddUser: по твоему решению = blockchain pubkey. */
public static String LOGIN_PUBKEY_B64() { return blockchainPublicKeyB64(LOGIN()); }
public static String LOGIN2_PUBKEY_B64() { return blockchainPublicKeyB64(LOGIN2()); }
public static String LOGIN3_PUBKEY_B64() { return blockchainPublicKeyB64(LOGIN3()); }

View File

@ -16,7 +16,7 @@ public final class JsonBuilders {
public static String addUser(String login) {
String requestId = TestIds.next("adduser");
String blockchainName = TestConfig.getBlockchainName(login);
String loginKeyB64 = TestConfig.blockchainPublicKeyB64(login); // loginKey = blockchain pub
String solanaKeyB64 = TestConfig.blockchainPublicKeyB64(login); // solanaKey = blockchain pub
String deviceKeyB64 = TestConfig.devicePublicKeyB64(login);
return """
{
@ -25,12 +25,12 @@ public final class JsonBuilders {
"payload": {
"login": "%s",
"blockchainName": "%s",
"loginKey": "%s",
"solanaKey": "%s",
"deviceKey": "%s",
"bchLimit": %d
}
}
""".formatted(requestId, login, blockchainName, loginKeyB64, deviceKeyB64, TestConfig.TEST_BCH_LIMIT);
""".formatted(requestId, login, blockchainName, solanaKeyB64, deviceKeyB64, TestConfig.TEST_BCH_LIMIT);
}
// ---------------- AuthChallenge ----------------