SHA256
Исправить подпись user PDA формата 1.0
This commit is contained in:
@@ -314,8 +314,8 @@ function writeVariableBlock(out, blockType, writer) {
|
||||
*/
|
||||
export function canonicalPdaSigningBytes(unsignedBytes) {
|
||||
const bytes = toUint8Array(unsignedBytes);
|
||||
if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== 1 || bytes[6] !== 3) {
|
||||
throw new Error('Ожидается unsigned PDA v1.3');
|
||||
if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== FORMAT_MAJOR || bytes[6] !== FORMAT_MINOR_CURRENT) {
|
||||
throw new Error('Ожидается unsigned PDA v1.0');
|
||||
}
|
||||
const rd16 = (i) => bytes[i] | (bytes[i + 1] << 8);
|
||||
if (rd16(7) !== bytes.length + 64) throw new Error('Неверный record_len');
|
||||
@@ -730,7 +730,7 @@ export async function updateShineUserPdaOnSolana({
|
||||
if ((rootChanged || clientChanged) && !fullKeyRotation) {
|
||||
throw new Error('Root/client keys меняются только как полная ротация: новый root + новый client + новый blockchain fork');
|
||||
}
|
||||
const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.3.
|
||||
const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.0.
|
||||
if (authorityMode != null && authorityMode !== 'root' && authorityMode !== 'blockchain' && authorityMode !== AUTH_MODE_ROOT && authorityMode !== AUTH_MODE_BLOCKCHAIN) {
|
||||
throw new Error('Неподдерживаемый режим authority');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user