GithubHelp home page GithubHelp logo

Comments (3)

philpotisk avatar philpotisk commented on June 2, 2024

Hi @saujam as you see in the picture, I could reproduce the issue. Due to the "inline" Result class the suffix is produced, which can not be inherited from Java.
Screenshot_20240417_215723

To solve this issue, I could think of two options:
1.) Change the result type in the Key interface or
2.) Wrap the Result within a subclass for the JVM, as you see in the next screenshot, which at least works in my PoC:

image

I will discuss these options with the team an come back to you.

from waltid-identity.

kbrgmn avatar kbrgmn commented on June 2, 2024

Hi @saujam,

if you want to implement a Key in Java instead of Kotlin, you will have to extend from JavaKey instead of Key. There you will not have to handle suspend/coroutines or the kotlin.Result return type.

This is a stub you can utilize:

import id.walt.crypto.keys.JavaKey;
import id.walt.crypto.keys.Key;
import id.walt.crypto.keys.KeyMeta;
import id.walt.crypto.keys.KeyType;
import java.util.Map;
import kotlinx.serialization.json.JsonElement;
import kotlinx.serialization.json.JsonObject;
import org.jetbrains.annotations.NotNull;

public class MyKey extends JavaKey {

    private String _xyz;

    public MyKey(String xyz) {
        this._xyz = xyz;
    }

    @NotNull
    @Override
    public KeyMeta javaGetMeta() {
        return null;
    }

    @NotNull
    @Override
    public byte[] javaGetPublicKeyRepresentation() {
        return new byte[0];
    }

    @NotNull
    @Override
    public Key javaGetPublicKey() {
        return null;
    }

    @NotNull
    @Override
    public JsonElement javaVerifyJws() {
        return null;
    }

    @NotNull
    @Override
    public byte[] javaVerifyRaw() {
        return new byte[0];
    }

    @NotNull
    @Override
    public String javaSignJws(@NotNull byte[] plaintext, @NotNull Map<String, String> headers) {
        return "";
    }

    @NotNull
    @Override
    public Object javaSignRaw(@NotNull byte[] plaintext) {
        return null;
    }

    @NotNull
    @Override
    public String javaExportPEM() {
        return "";
    }

    @NotNull
    @Override
    public JsonObject javaExportJWKObject() {
        return null;
    }

    @NotNull
    @Override
    public String javaExportJWK() {
        return "";
    }

    @NotNull
    @Override
    public String javaGetThumbprint() {
        return "";
    }

    @NotNull
    @Override
    public String javaGetKeyId() {
        return "";
    }

    @Override
    public boolean javaHasPrivateKey() {
        return false;
    }

    @NotNull
    @Override
    public KeyType javaGetKeyType() {
        return null;
    }
}

from waltid-identity.

saujam avatar saujam commented on June 2, 2024

What is the release version for java key implementation.

from waltid-identity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.