Skip to content

Commit

Permalink
chroe: typos, code refactor and class files removed
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-vavdiya committed Feb 26, 2024
1 parent 188196e commit 31bffc7
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ public class ResolveDIDDoc {
*
* @param didUrl the did url
* @return the did document
* @throws org.eclipse.tractusx.ssi.lib.did.resolver.DidResolverException
* @throws DidDocumentResolverNotRegisteredException the did document resolver not registered
* exception
* @throws DidResolverException the did resolve exception
* @throws DidParseException the did parse exception
*/
public static DidDocument ResovleDocument(String didUrl)
public static DidDocument resolveDidDocument(String didUrl)
throws DidParseException, DidResolverException {

// DID Resolver Constracture params
// DID Resolver Contracture params
DidWebParser didParser = new DidWebParser();
var httpClient = HttpClient.newHttpClient();
var enforceHttps = false;
Expand Down
31 changes: 15 additions & 16 deletions src/main/java/org/eclipse/tractusx/ssi/examples/VC.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class VC {
*/
public static VerifiableCredential createVCWithoutProof() {

// VC Bulider
// VC Builder
final VerifiableCredentialBuilder verifiableCredentialBuilder =
new VerifiableCredentialBuilder();

Expand All @@ -58,17 +58,14 @@ public static VerifiableCredential createVCWithoutProof() {
new VerifiableCredentialSubject(Map.of("test", "test"));

// Using Builder
final VerifiableCredential credentialWithoutProof =
verifiableCredentialBuilder
.id(URI.create("did:test:id"))
.type(List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL))
.issuer(URI.create("did:test:isser"))
.expirationDate(Instant.now().plusSeconds(3600))
.issuanceDate(Instant.now())
.credentialSubject(verifiableCredentialSubject)
.build();

return credentialWithoutProof;
return verifiableCredentialBuilder
.id(URI.create("did:test:id"))
.type(List.of(VerifiableCredentialType.VERIFIABLE_CREDENTIAL))
.issuer(URI.create("did:test:issuer"))
.expirationDate(Instant.now().plusSeconds(3600))
.issuanceDate(Instant.now())
.credentialSubject(verifiableCredentialSubject)
.build();
}

/**
Expand All @@ -79,8 +76,9 @@ public static VerifiableCredential createVCWithoutProof() {
* @param issuer the issuer
* @return the verifiable credential
* @throws UnsupportedSignatureTypeException the unsupported signature type exception
* @throws SsiException the ssi exception
* @throws InvalidePrivateKeyFormat the invalide private key format
* @throws SignatureGenerateFailedException the ssi exception
* @throws InvalidPrivateKeyFormatException the invalid private key format
* @throws TransformJsonLdException the json-ld transform error
*/
public static VerifiableCredential createVCWithED25519Proof(
VerifiableCredential credential, IPrivateKey privateKey, Did issuer)
Expand Down Expand Up @@ -119,8 +117,9 @@ public static VerifiableCredential createVCWithED25519Proof(
* @param issuer the issuer
* @return the verifiable credential
* @throws UnsupportedSignatureTypeException the unsupported signature type exception
* @throws SsiException the ssi exception
* @throws InvalidePrivateKeyFormat the invalide private key format
* @throws SignatureGenerateFailedException the signature generation failed
* @throws InvalidPrivateKeyFormatException the invalid private key format
* @throws TransformJsonLdException the json-ld transform error
*/
public static VerifiableCredential createVCWithJWSProof(
VerifiableCredential credential, IPrivateKey privateKey, Did issuer)
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/org/eclipse/tractusx/ssi/examples/VP.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ public static VerifiablePresentation createVP(
Did issuer, List<VerifiableCredential> credentials) {
final VerifiablePresentationBuilder verifiablePresentationBuilder =
new VerifiablePresentationBuilder();
final VerifiablePresentation verifiablePresentation =
verifiablePresentationBuilder
.id(issuer.toUri()) // NOTE: Provide unique ID number to each VP you create!!
.type(List.of(VerifiablePresentationType.VERIFIABLE_PRESENTATION))
.verifiableCredentials(credentials)
.build();
return verifiablePresentation;
return verifiablePresentationBuilder
.id(issuer.toUri()) // NOTE: Provide unique ID number to each VP you create!!
.type(List.of(VerifiablePresentationType.VERIFIABLE_PRESENTATION))
.verifiableCredentials(credentials)
.build();
}

/**
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/eclipse/tractusx/ssi/examples/Validation.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ public class Validation {
* Validate jwt date.
*
* @param signedJWT the signed jwt
* @param audience the audience
* @throws JwtAudienceCheckException the jwt audience check failed exception
* @throws SignatureParseException the jwt signature check failed exception
* @throws JwtExpiredException the jwt expired exception
*/
public static void validateJWTDate(SignedJWT signedJWT, String audience)
throws JwtAudienceCheckException, JwtExpiredException, SignatureParseException {
public static void validateJWTDate(SignedJWT signedJWT)
throws JwtExpiredException, SignatureParseException {
SignedJwtValidator jwtValidator = new SignedJwtValidator();
jwtValidator.validateDate(signedJWT);
}
Expand All @@ -49,10 +48,10 @@ public static void validateJWTDate(SignedJWT signedJWT, String audience)
* @param signedJWT the signed jwt
* @param audience the audience
* @throws JwtAudienceCheckException the jwt audience check failed exception
* @throws JwtExpiredException the jwt expired exception
* @throws SignatureParseException the jwt signature check failed exception
*/
public static void validateJWTAudiences(SignedJWT signedJWT, String audience)
throws JwtAudienceCheckException, JwtExpiredException, SignatureParseException {
throws JwtAudienceCheckException, SignatureParseException {
SignedJwtValidator jwtValidator = new SignedJwtValidator();
jwtValidator.validateAudiences(signedJWT, audience);
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class DidParseException extends SSIException {
/**
* Instantiates a new Did parse exception.
*
* @param message the message
* @param did the did
*/
public DidParseException(String did) {
super(String.format("Invalid DID URL: %s, not able to parse it", did));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package org.eclipse.tractusx.ssi.lib.exception.key;

/** The type Invalide private key format. */
/** The type Invalid private key format. */
public class InvalidPrivateKeyFormatException extends KeyGenerationException {
private static final long serialVersionUID = 1L;
/**
Expand All @@ -33,7 +33,7 @@ public class InvalidPrivateKeyFormatException extends KeyGenerationException {
public InvalidPrivateKeyFormatException(int correctLength, int providedLength) {
super(
String.format(
"Invalide Private Key Format, this key should have '%s' as lenght but we got %s",
"Invalid Private Key Format, this key should have '%s' as length but we got %s",
correctLength, providedLength));
}

Expand All @@ -50,7 +50,7 @@ public InvalidPrivateKeyFormatException(String message) {
* Instantiates a new Invalid private key format.
*
* @param message message
* @param cuase the cause
* @param cause the cause
*/
public InvalidPrivateKeyFormatException(String message, Throwable cause) {
super(message, cause);
Expand All @@ -59,7 +59,7 @@ public InvalidPrivateKeyFormatException(String message, Throwable cause) {
/**
* Instantiates a new Invalid private key format.
*
* @param cuase the cause
* @param cause the cause
*/
public InvalidPrivateKeyFormatException(Throwable cause) {
super(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class InvalidPublicKeyFormatException extends KeyGenerationException {
public InvalidPublicKeyFormatException(int correctLength, int providedLength) {
super(
String.format(
"Invalide Publice Key Format, this key should have '%s' as lenght but we got %s",
"Invalid Public Key Format, this key should have '%s' as length but we got %s",
correctLength, providedLength));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class KeyTransformationException extends SSIException {

private static final long serialVersionUID = 1L;
/**
* Instantiates a new key trnasformation exception.
* Instantiates a new key transformation exception.
*
* @param message the message
*/
Expand All @@ -36,7 +36,7 @@ public KeyTransformationException(String message) {
}

/**
* Instantiates a new key trnasformation exception.
* Instantiates a new key transformation exception.
*
* @param message the message
* @param cause the cause
Expand All @@ -46,7 +46,7 @@ public KeyTransformationException(String message, Throwable cause) {
}

/**
* Instantiates a new key trnasformation exception.
* Instantiates a new key transformation exception.
*
* @param cause the cause
*/
Expand All @@ -55,7 +55,7 @@ public KeyTransformationException(Throwable cause) {
}

/**
* Instantiates a new key trnasformation exception.
* Instantiates a new key transformation exception.
*
* @param message the message
* @param cause the cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package org.eclipse.tractusx.ssi.lib.exception.proof;

/** NoVerificationKeyFoundExcpetion */
/** NoVerificationKeyFoundException */
public class NoVerificationKeyFoundException extends SignatureVerificationException {
private static final long serialVersionUID = 1L;

Expand Down
Binary file not shown.

0 comments on commit 31bffc7

Please sign in to comment.