Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

344 B
Raw Blame
import {vi} from 'vitest'

// HTTP LAN origins expose getRandomValues, but not secure-context randomUUID.
export function mockHttpCrypto(uuid) {
  const seed = Uint8Array.from(uuid.replaceAll('-', '').match(/../g), byte => Number.parseInt(byte,16))
  vi.stubGlobal('crypto', {getRandomValues:vi.fn(bytes => {bytes.set(seed); return bytes})})
}