import { describe, expect, it } from 'vitest' import { HKDF_INFO, HKDF_INFO_C2H, HKDF_INFO_H2C, NotImplementedInContractsError, REPLAY_KDF_INFO, buildClientHandshake, createE2ESession, deriveContentKey, openFrame, openReplayCiphertext, sealFrame, sealReplayFrame, } from '../src/index.js' /** * relay-contracts owns SHAPES only; the crypto implementations live in P4. Each frozen * signature must exist (importable / type-checked) and throw NotImplementedInContractsError. */ describe('ยง4.4 crypto signatures are frozen stubs (impl in P4)', () => { const key = {} as never const env = {} as never it.each([ ['sealFrame', () => sealFrame(key, 0n, new Uint8Array())], ['openFrame', () => openFrame(key, env, 0n)], ['createE2ESession', () => createE2ESession('client', {} as never)], ['buildClientHandshake', () => buildClientHandshake({} as never, 'h', ['aes-256-gcm'])], ['deriveContentKey', () => deriveContentKey({} as never)], ['sealReplayFrame', () => sealReplayFrame(key, 0n, new Uint8Array())], ['openReplayCiphertext', () => openReplayCiphertext(key, new Uint8Array())], ])('%s throws NotImplementedInContractsError', (_name, fn) => { expect(fn).toThrow(NotImplementedInContractsError) }) it('exposes the frozen HKDF label constants', () => { expect(HKDF_INFO).toBe('relay-e2e/v1') expect(HKDF_INFO_C2H).toBe('relay-e2e/v1/c2h') expect(HKDF_INFO_H2C).toBe('relay-e2e/v1/h2c') expect(REPLAY_KDF_INFO).toBe('relay-e2e/replay/v1') }) })