import { crypto_sign } from './crypto_sign'
import { crypto_verify_decodepubkey, crypto_verify_relaxed, crypto_verify_strict } from './crypto_verify'
import { errors } from './errors'
+import './tests'
export const BLOCKHASH_BYTELENGTH: i32 = 32
export const KEY_BYTELENGTH: i32 = 32
--- /dev/null
+//! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
+//! SPDX-License-Identifier: GPL-3.0-or-later
+
+import { equalbytes } from './utils'
+
+/**
+ * Tests run on initialization to ensure build is correct.
+ */
+const testbytesA = new StaticArray<u8>(32).fill(0)
+const testbytesB = new StaticArray<u8>(32).fill(0)
+
+/** equalbytes */
+for (let i = 0; i < 32; i++) {
+ for (let j: u8 = 0; j < 8; j++) {
+ testbytesA[i] = 1 << j
+ if (equalbytes(testbytesA, testbytesB, 32)) {
+ throw new Error('equalbytes failed build test')
+ }
+ testbytesA[i] = 0
+ }
+}
d &= 255
return u8(((d - 1) >> 8) & 1)
}
-
-/** Unit tests on initialization */
-const testbytesA = new StaticArray<u8>(32).fill(0)
-const testbytesB = new StaticArray<u8>(32).fill(0)
-for (let i = 0; i < 32; i++) {
- for (let j: u8 = 0; j < 8; j++) {
- testbytesA[i] = 1 << j
- if (equalbytes(testbytesA, testbytesB, 32)) {
- throw new Error('equalbytes failed unit test')
- }
- testbytesA[i] = 0
- }
-}