UNPKG

@maverick0351/odin-protocol-js

Version:

JavaScript/TypeScript SDK for ODIN v1.0 state capsule protocol

65 lines 1.91 kB
/** * Calculate BLAKE3 hash of data (using SHA-256 as fallback) */ export declare function blake3Hash(data: Uint8Array): Uint8Array; /** * Simple CRC32 implementation */ export declare function crc32(data: Uint8Array): number; /** * Convert number to big-endian bytes */ export declare function numberToBytes(value: number, size: number): Uint8Array; /** * Convert big-endian bytes to number */ export declare function bytesToNumber(bytes: Uint8Array): number; /** * Convert string to UTF-8 bytes */ export declare function stringToBytes(str: string): Uint8Array; /** * Convert UTF-8 bytes to string */ export declare function bytesToString(bytes: Uint8Array): string; /** * Concatenate multiple Uint8Arrays */ export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array; /** * Compare two Uint8Arrays for equality */ export declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean; /** * Generate random bytes */ export declare function randomBytes(length: number): Uint8Array; /** * Get current timestamp in seconds since UNIX epoch */ export declare function getCurrentTimestamp(): number; /** * Validate timestamp (not too far in future) */ export declare function isValidTimestamp(timestamp: number, maxFutureDrift?: number): boolean; /** * Convert hex string to bytes */ export declare function hexToBytes(hex: string): Uint8Array; /** * Convert bytes to hex string */ export declare function bytesToHex(bytes: Uint8Array): string; /** * Validate creator ID format (32 bytes) */ export declare function isValidCreatorId(creatorId: Uint8Array): boolean; /** * Generate a creator ID from string */ export declare function generateCreatorId(identifier: string): Uint8Array; /** * Pad data to specific size */ export declare function padBytes(data: Uint8Array, targetSize: number, paddingByte?: number): Uint8Array; //# sourceMappingURL=utils.d.ts.map