import PropTypes from 'prop-types';
import useDid from './use-did';

function WrapDid({ session, children }) {
  const state = useDid({ session });

  if (children instanceof Function) {
    return children(state);
  }
  return null;
}

WrapDid.propTypes = {
  session: PropTypes.object.isRequired,
  children: PropTypes.func.isRequired,
};

export default WrapDid;
