u2fContainer.tsx 697 B

123456789101112131415161718192021222324252627282930
  1. import {Authenticator} from 'sentry/types';
  2. import U2fSign from './u2fsign';
  3. type U2FSignProps = React.ComponentProps<typeof U2fSign>;
  4. type Props = {
  5. authenticators: Array<Authenticator>;
  6. onTap: U2FSignProps['onTap'];
  7. className?: string;
  8. displayMode?: U2FSignProps['displayMode'];
  9. };
  10. function U2fContainer({className, authenticators, ...props}: Props) {
  11. if (!authenticators.length) {
  12. return null;
  13. }
  14. return (
  15. <div className={className}>
  16. {authenticators.map(auth =>
  17. auth.id === 'u2f' && auth.challenge ? (
  18. <U2fSign key={auth.id} {...props} challengeData={auth.challenge} />
  19. ) : null
  20. )}
  21. </div>
  22. );
  23. }
  24. export default U2fContainer;