import type { Cipher, KeyWrapper } from '@web5/crypto'; import type { KeyExporter, KeyImporter } from './types/key-io.js'; export function isCipher( obj: unknown ): obj is Cipher { return ( obj !== null && typeof obj === 'object' && 'encrypt' in obj && typeof obj.encrypt === 'function' && 'decrypt' in obj && typeof obj.decrypt === 'function' ); } export function isKeyExporter( obj: unknown ): obj is KeyExporter { return ( obj !== null && typeof obj === 'object' && 'exportKey' in obj && typeof obj.exportKey === 'function' ); } export function isKeyImporter( obj: unknown ): obj is KeyImporter { return ( obj !== null && typeof obj === 'object' && 'importKey' in obj && typeof obj.importKey === 'function' ); } export function isKeyWrapper( obj: unknown ): obj is KeyWrapper { return ( obj !== null && typeof obj === 'object' && 'wrapKey' in obj && typeof obj.wrapKey === 'function' && 'unwrapKey' in obj && typeof obj.unwrapKey === 'function' ); }