package com.yubico.client.v2;

import com.yubico.client.v2.impl.YubicoClientImpl;

/* Copyright (c) 2011, Linus Widströmer.  All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
  
   * Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
  
   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following
     disclaimer in the documentation and/or other materials provided
     with the distribution.
 
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
   CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
   THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   SUCH DAMAGE.
 
   Written by Linus Widströmer <linus.widstromer@it.su.se>, January 2011.
*/

public abstract class YubicoClient {
    protected Integer clientId;

    public abstract YubicoResponse verify( String otp );

    public Integer getClientId() {
        return clientId;
    }

    public void setClientId(Integer clientId) {
        this.clientId = clientId;
    }

    public static YubicoClient getClient() {
        return new YubicoClientImpl();
    }


}


@@ -138,16 +138,72 @@
 eserved.
+%0A   Copyright (c) 2011, Yubico AB.  All rights reserved.
 %0A%0A   Red
@@ -348,18 +348,16 @@
 re met:%0A
-  
 %0A   * Re
@@ -484,18 +484,16 @@
 laimer.%0A
-  
 %0A   * Re
@@ -708,17 +708,16 @@
 bution.%0A
- 
 %0A   THIS
@@ -1503,17 +1503,16 @@
 DAMAGE.%0A
- 
 %0A   Writ
@@ -1961,8 +1961,551 @@
  %7D%0A%0A
+    /**%0A%09 * Extract the public ID of a Yubikey from an OTP it generated.%0A%09 *%0A%09 * @param otp%09The OTP to extract ID from, in modhex format.%0A%09 *%0A%09 * @return string%09Public ID of Yubikey that generated otp. Between 0 and 12 characters.%0A%09 */%0A%09public static String getPublicId(String otp) %7B%0A%09%09Integer len = otp.length();%0A%0A%09%09/* The OTP part is always the last 32 bytes of otp. Whatever is before that%0A%09%09 * (if anything) is the public ID of the Yubikey. The ID can be set to ''%0A%09%09 * through personalization.%0A%09%09 */%0A%09%09return otp.substring(0, len - 32);%0A%09%7D
 %0A%7D%0A
-%0A

Add getPublicId() from com.yubico.client.v1.