@opendatalabs/vana-sdk
Version:
A TypeScript library for interacting with Vana Network smart contracts.
26 lines • 596 B
JavaScript
function constantTimeEqual(a, b) {
if (a.length !== b.length) return false;
let result = 0;
for (let i = 0; i < a.length; i++) {
result |= a[i] ^ b[i];
}
return result === 0;
}
function bufferToBytes(buffer) {
if (buffer instanceof Uint8Array) {
return buffer;
}
return new Uint8Array(buffer);
}
function bytesToBuffer(bytes) {
if (typeof Buffer === "undefined") {
throw new Error("Buffer is not available in browser environment");
}
return Buffer.from(bytes);
}
export {
bufferToBytes,
bytesToBuffer,
constantTimeEqual
};
//# sourceMappingURL=utils.js.map