danubetech / verifiable-credentials-java Goto Github PK
View Code? Open in Web Editor NEWJava implementation of Verifiable Credentials
License: Apache License 2.0
Java implementation of Verifiable Credentials
License: Apache License 2.0
hi, it looks like this is should be JwtKeywords.JWT_CLAIM_VP at src/main/java/com/danubetech/verifiablecredentials/jwt/JwtVerifiablePresentation.java, line 29
public static JwtVerifiablePresentation fromCompactSerialization(String compactSerialization) throws ParseException {
SignedJWT signedJWT = SignedJWT.parse(compactSerialization);
JWTClaimsSet jwtPayload = signedJWT.getJWTClaimsSet();
Map<String, Object> jsonObject = (Map<String, Object>) jwtPayload.getClaims().get(**JwtKeywords.JWT_CLAIM_VP**);
VerifiablePresentation payloadVerifiablePresentation = VerifiablePresentation.fromJsonObject(new LinkedHashMap<>(jsonObject));
return new JwtVerifiablePresentation(jwtPayload, payloadVerifiablePresentation, signedJWT, compactSerialization);
}
Hi @peacekeeper
While verifying this VC i am getting this error from the site https://certs.dock.io/credentials/verify
" verification method should have type Ed25519VerificationKey2018 and have the base58 public key"
this is the VC which i have generated
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1"
],
"type": [
"UniversityDegreeCredential",
"VerifiableCredential",
"Ed25519VerificationKey2018"
],
"issuer": "did:web:did-web.uniregistrar.io:72206333-435f-4960-97d7-35a496fbae10",
"issuanceDate": "2019-06-16T18:56:59Z",
"expirationDate": "2023-06-17T18:56:59Z",
"credentialSubject": {
"degree": {
"name": "Bachelor of Science and Arts",
"type": "BachelorDegree"
}
},
"proof": {
"type": "Ed25519Signature2018",
"created": "2022-09-26T06:38:38Z",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:web:did-web.uniregistrar.io:72206333-435f-4960-97d7-35a496fbae10",
"jws": "eyJiNjQiOmZhbHNlLCJjcml0IjpbImI2NCJdLCJhbGciOiJFZERTQSJ9..oIEKh6LJhhe_SY12OhluKDBp3p-3YbnhzCYbgM3k9IW2wmDa3sjad3yZo_09w1uJ29BJ943PZeyRwPvYj68iBg"
}
}
this is my diddocument
{
"state": "finished",
"secret": null,
"didDocument": {
"@context": "https://www.w3.org/ns/did/v1",
"service": [
{
"type": "ServiceEndpointProxyService",
"serviceEndpoint": "https://sysveda.co.in"
}
],
"verificationMethod": [
{
"type": "Ed25519VerificationKey2018",
"publicKeyBase64": "de8777a28f8da1a74e7a13090ed974d879bf692d001cddee16e4cc9f84b60580"
}
],
"id": "did:web:did-web.uniregistrar.io:72206333-435f-4960-97d7-35a496fbae10"
},
"did": "did:web:did-web.uniregistrar.io:72206333-435f-4960-97d7-35a496fbae10"
}
Currently, validation assumes that credentials/presentations have to be in JSON-LD format
this library support verifiable data registry ??
generated VC can be verifier in other system??
base58btc multibase encoding is supported
When validating an VC's ID I don't think it necessarily has to be 'absolute' ie a fully resolvable url.
It can just be a UUID to preserve privacy.
Any way to make this optional or add validation options to bypass this check?
Hi @peacekeeper the signing format in the proof is now base64 format for ed25119
but i need base58btc format whether is possible to do that ?
Hi @peacekeeper i need to add new context like below.
This library support that ?
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
{
"dk": "https://ld.dock.io/credentials#",
"BasicCredential": "dk:BasicCredential",
"name": "dk:name",
"title": "dk:title",
"description": "dk:description",
"logo": "dk:logo"
}
],
the algorithm Ed25519Signature2018LdSigner support base58 multibase encoding
This issue strongly relates to this issue
The current implementation assumes to have one Verifiable Credential
inside a Verifiable Presentation
. The Builder
component inside the VerifiablePresentation
class has an attribute verifiableCredential
instead of a List.
Moreover the getVerifiableCredential() method will fail if the presentation has more than one `` Verifiable Credential
:
public VerifiableCredential getVerifiableCredential() {
Object verifiableCredentialObject = this.getJsonObject().get(VerifiableCredentialKeywords.JSONLD_TERM_VERIFIABLECREDENTIAL);
if ((verifiableCredentialObject instanceof List<?> && ! ((List<?>) verifiableCredentialObject).isEmpty() && ((List<?>) verifiableCredentialObject).get(0) instanceof Map)) {
return VerifiableCredential.getFromJsonLDObject(this);
} else if (verifiableCredentialObject instanceof Map) {
return VerifiableCredential.getFromJsonLDObject(this);
}
return null;
}
The code produces an error when we are in the case of the verifiableCredentialObject instanceof List
The class VerifiableCredential
should have another method like this to be called in the List
case:
public static Set<VerifiableCredential> getFromJsonLDObject(JsonLDObject jsonLdObject)
which iterates over the List
.
Are you planning to merge the PR mentioned in the other issue?
Are you planning to support multiple VCs in a VP?
signer.setVerificationMethod(URI.create("https://example.com/jdoe/keys/1"));
signer.setDomain("example.com");
signer.setNonce("343s$FSFDa-");
what is domain and verification method in proof?
Project can't be built because Gradle can't find com.github.multiformats:java-multibase:v1.1.0
dependency. And I can't find it manually as well. It miss both in maven central and in repo.danubetech.com.
FYI: it is possible to overcome this issue as sources of the java-multibase
are available on GitHub here.
Hi @peacekeeper
What is the ID attribute in the Verifiable credential ?
How to create the id url?
Hi! Thanks for creating this library. We are currently using it in our repository as a dependency.
We are currently getting a 500 Server Error when trying to download verifiable-credentials-java:1.6.0
via mvn install
We are also currently unable to render the repo website by browser - same 500 Server Error appears.
Because of this, we can't build our repo, which blocks our team.
Build error message, if you're interested:
Failed to execute goal on project kotlin-testsuite: Could not resolve dependencies for
project website.tbd.developer.site:kotlin-testsuite:jar:0.1.0-SNAPSHOT:
Failed to collect dependencies at xyz.block:tbdex:jar:0.10.0-beta ->
xyz.block:tbdex-protocol:jar:0.10.0-beta ->
xyz.block:web5:jar:0.0.11 ->
xyz.block:web5-credentials:jar:0.0.11 ->
com.danubetech:verifiable-credentials-java:jar:1.6.0:
Failed to read artifact descriptor for com.danubetech:verifiable-credentials-java:jar:1.6.0:
The following artifacts could not be resolved:
com.danubetech:verifiable-credentials-java:pom:1.6.0 (absent):
Could not transfer artifact com.danubetech:verifiable-credentials-java:pom:1.6.0
from/to danubetech (https://repo.danubetech.com/repository/maven-public/):
status code: 500, reason phrase: Server Error (500) -> [Help 1]
To improve conformance with the Verifiable Credential data model v1.1, add support for multiple subjects in a Verifiable Credential.
From the following excerpt at https://www.w3.org/TR/vc-data-model/#credential-subject, this entails supporting an array of subjects in the credentialSubject
field in addition to an object.
It is possible to express information related to multiple subjects in a verifiable credential. The example below specifies two subjects who are spouses. Note the use of array notation to associate multiple subjects with the credentialSubject property.
EXAMPLE 7: Specifying multiple subjects in a verifiable credential
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1"
],
"id": "http://example.edu/credentials/3732",
"type": ["VerifiableCredential", "RelationshipCredential"],
"issuer": "https://example.com/issuer/123",
"issuanceDate": "2010-01-01T00:00:00Z",
"credentialSubject": [{
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"name": "Jayden Doe",
"spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1"
}, {
"id": "did:example:c276e12ec21ebfeb1f712ebc6f1",
"name": "Morgan Doe",
"spouse": "did:example:ebfeb1f712ebc6f1c276e12ec21"
}]
}
I will propose a pull request with an implementation.
We have to generate DID for each VC that provide?
How to create new DID for for issuer and credential subject ?
this is about verifiable-credentials-java library,
when i create a new context,
i cannot generate proof i am getting exception like this
JsonLdError[code=There was a problem encountered loading a remote context [code=LOADING_REMOTE_CONTEXT_FAILED]., message=There was a problem encountered loading a remote context [code=LOADING_REMOTE_CONTEXT_FAILED].]
"2022-09-08T07:36:46Z"
How to change this format according to indian standard time(ist)
1.how can i create a new context because i have to add new attributes in the credential subject
2.the id above the issuer is optional or mandatory what is the propose of that ??
This started happening earlier today.
Repro steps:
implementation 'com.danubetech:verifiable-credentials-java:1.9.0'
rm -rf <user-home>/.gradle/caches
--info
: gradle dependencies --info
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/com/danubetech/verifiable-credentials-java/1.9.0/verifiable-credentials-java-1.9.0.pom]
Resource missing. [HTTP GET: https://jitpack.io/com/danubetech/verifiable-credentials-java/1.9.0/verifiable-credentials-java-1.9.0.pom]
Getting this error while generating proof using Ed25519_EdDSA
Hi @peacekeeper need to clear some point correct me if wrong
1.Using this library I have create a VC
2.I need to verify that VC in dock wallet but for that I need DID so I have planned to use WEB method.
3.For creating did document i have to mentioned the public used in this library verification?
4.I am going to use did:web method for that I have to anchor the did in block chain?
5.In w3c they have not mentioned the did document structure for ed22519signer
6.In VC the I'd inside the credentials subject and I'd above the issuer is mandatory or optional?
We have a number of locally cached JSON-LD contexts here:
We should probably also include https://w3id.org/vc-revocation-list-2020/v1 which is used by https://w3c-ccg.github.io/vc-status-rl-2020/.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.