< Summary

Information
Class: Syki.Back.Features.Cross.GetMfaKey.GetMfaKeyService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Cross/GetMfaKey/GetMfaKeyService.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 21
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Get()100%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Cross/GetMfaKey/GetMfaKeyService.cs

#LineLine coverage
 1using Syki.Back.Features.Cross.CreateUser;
 2
 3namespace Syki.Back.Features.Cross.GetMfaKey;
 4
 95public class GetMfaKeyService(UserManager<SykiUser> userManager) : ICrossService
 6{
 7    public async Task<GetMfaKeyOut> Get(Guid userId)
 8    {
 99        var user = await userManager.Users.FirstAsync(u => u.Id == userId);
 10
 911        var key = await userManager.GetAuthenticatorKeyAsync(user);
 12
 913        if (key == null)
 14        {
 715            await userManager.ResetAuthenticatorKeyAsync(user);
 716            key = await userManager.GetAuthenticatorKeyAsync(user);
 17        }
 18
 919        return new GetMfaKeyOut { Key = key! };
 920    }
 21}