Files
aitbc/dev/env/node_modules/aes-js/lib.commonjs/mode-cfb.js
aitbc 816e258d4c refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup:
 BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location
- dev/test-nodes/brother_node/: Moved from root directory for better organization
- Contains development configuration, test logs, and test chain data
- No impact on production systems - purely development/testing artifact

 DEVELOPMENT ARTIFACTS IDENTIFIED:
- Chain ID: aitbc-brother-chain (test/development chain)
- Ports: 8010 (P2P) and 8011 (RPC) - different from production
- Environment: .env file with test configuration
- Logs: rpc.log and node.log from development testing session (March 15, 2026)

 ROOT DIRECTORY CLEANUP: Removed development clutter from production directory
- brother_node/ moved to dev/test-nodes/brother_node/
- Root directory now contains only production-ready components
- Development artifacts properly organized in dev/ subdirectory

DIRECTORY STRUCTURE IMPROVEMENT:
📁 dev/test-nodes/: Development and testing node configurations
🏗️ Root Directory: Clean production structure with only essential components
🧪 Development Isolation: Test environments separated from production

BENEFITS:
 Clean Production Directory: No development artifacts in root
 Better Organization: Development nodes grouped in dev/ subdirectory
 Clear Separation: Production vs development environments clearly distinguished
 Maintainability: Easier to identify and manage development components

RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
2026-03-30 17:09:06 +02:00

81 lines
4.2 KiB
JavaScript
Executable File

"use strict";
// Cipher Feedback
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _CFB_instances, _CFB_iv, _CFB_shiftRegister, _CFB_shift;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CFB = void 0;
const mode_js_1 = require("./mode.js");
class CFB extends mode_js_1.ModeOfOperation {
constructor(key, iv, segmentSize = 8) {
super("CFB", key, CFB);
_CFB_instances.add(this);
_CFB_iv.set(this, void 0);
_CFB_shiftRegister.set(this, void 0);
// This library currently only handles byte-aligned segmentSize
if (!Number.isInteger(segmentSize) || (segmentSize % 8)) {
throw new TypeError("invalid segmentSize");
}
Object.defineProperties(this, {
segmentSize: { enumerable: true, value: segmentSize }
});
if (iv) {
if (iv.length % 16) {
throw new TypeError("invalid iv size (must be 16 bytes)");
}
__classPrivateFieldSet(this, _CFB_iv, new Uint8Array(iv), "f");
}
else {
__classPrivateFieldSet(this, _CFB_iv, new Uint8Array(16), "f");
}
__classPrivateFieldSet(this, _CFB_shiftRegister, this.iv, "f");
}
get iv() { return new Uint8Array(__classPrivateFieldGet(this, _CFB_iv, "f")); }
encrypt(plaintext) {
if (8 * plaintext.length % this.segmentSize) {
throw new TypeError("invalid plaintext size (must be multiple of segmentSize bytes)");
}
const segmentSize = this.segmentSize / 8;
const ciphertext = new Uint8Array(plaintext);
for (let i = 0; i < ciphertext.length; i += segmentSize) {
const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f"));
for (let j = 0; j < segmentSize; j++) {
ciphertext[i + j] ^= xorSegment[j];
}
__classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i));
}
return ciphertext;
}
decrypt(ciphertext) {
if (8 * ciphertext.length % this.segmentSize) {
throw new TypeError("invalid ciphertext size (must be multiple of segmentSize bytes)");
}
const segmentSize = this.segmentSize / 8;
const plaintext = new Uint8Array(ciphertext);
for (let i = 0; i < plaintext.length; i += segmentSize) {
const xorSegment = this.aes.encrypt(__classPrivateFieldGet(this, _CFB_shiftRegister, "f"));
for (let j = 0; j < segmentSize; j++) {
plaintext[i + j] ^= xorSegment[j];
}
__classPrivateFieldGet(this, _CFB_instances, "m", _CFB_shift).call(this, ciphertext.subarray(i));
}
return plaintext;
}
}
exports.CFB = CFB;
_CFB_iv = new WeakMap(), _CFB_shiftRegister = new WeakMap(), _CFB_instances = new WeakSet(), _CFB_shift = function _CFB_shift(data) {
const segmentSize = this.segmentSize / 8;
// Shift the register
__classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(__classPrivateFieldGet(this, _CFB_shiftRegister, "f").subarray(segmentSize));
__classPrivateFieldGet(this, _CFB_shiftRegister, "f").set(data.subarray(0, segmentSize), 16 - segmentSize);
};
//# sourceMappingURL=mode-cfb.js.map