0

I was attempting to implement this TOTP verification library created by Atlassian using java 1.8:

Atlassian 1time totp library

If I create a DefaultTOTPService, when I try to call any of its methods they are asking for a Continuation parameter. I understand this is a Kotlin continuation but I can't seem to get the syntax correct. I have a verification method which has the code:

    DefaultTOTPService serv = new DefaultTOTPService();
    serv.verify(totp, totpSecret, myContinutation);

Within the same class I have defined myContinuation as

Continuation<? super TOTPVerificationResult> myContinutation = new Continuation<TOTPVerificationResult>() {
    @Override
    public CoroutineContext getContext() {
        // TODO Auto-generated method stub
        return EmptyCoroutineContext.INSTANCE;
    }
    @Override
    public void resumeWith(Object arg0) {
        System.out.println("Result of getName is " + arg0);
        
    }

With this code I get the compilation error

The method verify(TOTP, TOTPSecret, Continuation<? super TOTPVerificationResult>) in the type DefaultTOTPService is not applicable for the arguments (OtpInfo, String, Continuation<capture#1-of ? super TOTPVerificationResult>)

Looking at this post I thought my code would work. Not sure what I am missing.

What do I need to fix to get my code to compile? Thank you.

Kachopsticks
  • 125
  • 1
  • 13

0 Answers0