IABTechLab / iabgpp-java

Apache License 2.0
11 stars 13 forks source link

Does this support TCF v2.2? #43

Open un-smurf opened 9 months ago

un-smurf commented 9 months ago

Does this support TCF v2.2 as every TCF String i try comes back with "Undecodable Base64URL string" Im generating strings to test from here https://iabgpp.com/# using the default TCF string (CP3MC8AP3MC8APoABABGAfEAAAAAAAAAAAAAAAAAAAAA.QAAA.IAAA) which decodes fine on the website but not using the library. If i use a GPP string it works fine.

my test code is basically a copy of the example on the main page

package com.mycompany.app;

import com.iab.gpp.encoder.GppModel;
import com.iab.gpp.encoder.section.TcfEuV2;
import com.iab.gpp.encoder.section.UspV1;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import com.iab.gpp.encoder.error.DecodingException;
import com.iab.gpp.encoder.error.EncodingException;
import com.iab.gpp.encoder.error.InvalidFieldException;
import com.iab.gpp.encoder.error.LazyDecodingException;

public class App 
{
    public static void main(String[] args )
    {
        String gppString = "CP3MC8AP3MC8APoABAENDgCAAAAAAAAAAIwIAAAAAAAA.QAAA.IAAA";

        GppModel gppModelDecoded = new GppModel(); 

        try {
          gppModelDecoded = new GppModel(gppString); 
        } catch (Throwable e) {
          e.printStackTrace();
        }

        TcfEuV2 tcfEuV2Section = (TcfEuV2)gppModelDecoded.getSection(TcfEuV2.NAME);
        Integer tcfEuV2Version = tcfEuV2Section.getVersion();
        String tcfEuV2ConsentLanguage = tcfEuV2Section.getConsentLanguage();

        System.out.println( tcfEuV2ConsentLanguage );
    } 
}

and my pom.xml has

    <dependency>
        <groupId>com.iabgpp</groupId>
        <artifactId>iabgpp-encoder</artifactId>
        <version>3.1.1</version>
    </dependency>

Is it me doing something wrong or a bug?