From e484f595c7fd58654b95deccd2a6b09621cf9199 Mon Sep 17 00:00:00 2001 From: Kendall Weihe Date: Tue, 3 Sep 2024 16:18:27 -0400 Subject: [PATCH 1/3] Decouple from UniFFI code-gen'd Web5Exception --- bindings/web5_uniffi/src/web5.udl | 2 +- bindings/web5_uniffi_wrapper/src/errors.rs | 30 +-- .../src/main/kotlin/web5/sdk/Web5Exception.kt | 12 ++ .../kt/src/main/kotlin/web5/sdk/crypto/Dsa.kt | 16 ++ .../web5/sdk/crypto/Ed25519Generator.kt | 12 +- .../sdk/crypto/keys/InMemoryKeyManager.kt | 32 ++- .../main/kotlin/web5/sdk/crypto/keys/Jwk.kt | 16 +- .../web5/sdk/crypto/signers/Ed25519Signer.kt | 10 +- .../sdk/crypto/verifiers/Ed25519Verifier.kt | 11 +- .../main/kotlin/web5/sdk/dids/BearerDid.kt | 51 +++-- bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt | 14 +- .../src/main/kotlin/web5/sdk/dids/Document.kt | 18 +- .../main/kotlin/web5/sdk/dids/PortableDid.kt | 36 +++- .../kotlin/web5/sdk/dids/ResolutionResult.kt | 13 +- .../web5/sdk/dids/methods/dht/DidDht.kt | 50 +++-- .../web5/sdk/dids/methods/jwk/DidJwk.kt | 35 +++- .../web5/sdk/dids/methods/web/DidWeb.kt | 43 ++-- .../src/main/kotlin/web5/sdk/rust/UniFFI.kt | 7 +- .../web5/sdk/vc/VerifiableCredential.kt | 133 +++++++----- .../web5/sdk/vc/pex/PresentationDefinition.kt | 10 +- .../kotlin/web5/sdk/Web5TestVectorsTest.kt | 4 +- .../sdk/crypto/keys/InMemoryKeyManagerTest.kt | 14 +- .../kotlin/web5/sdk/crypto/keys/JwkTest.kt | 26 +-- .../sdk/crypto/signers/Ed25519SignerTest.kt | 10 +- .../crypto/verifiers/Ed25519VerifierTest.kt | 18 +- .../kotlin/web5/sdk/dids/BearerDidTest.kt | 10 +- .../src/test/kotlin/web5/sdk/dids/DidTest.kt | 42 ++-- .../kotlin/web5/sdk/dids/PortableDidTest.kt | 2 +- .../web5/sdk/dids/ResolutionResultTests.kt | 1 - .../web5/sdk/dids/methods/dht/DidDhtTests.kt | 6 +- .../web5/sdk/dids/methods/jwk/DidJwkTests.kt | 2 +- .../web5/sdk/dids/methods/web/DidWebTests.kt | 15 +- .../web5/sdk/vc/VerifiableCredentialTest.kt | 198 +++++++++--------- 33 files changed, 550 insertions(+), 349 deletions(-) create mode 100644 bound/kt/src/main/kotlin/web5/sdk/Web5Exception.kt diff --git a/bindings/web5_uniffi/src/web5.udl b/bindings/web5_uniffi/src/web5.udl index 40533579..4e99c248 100644 --- a/bindings/web5_uniffi/src/web5.udl +++ b/bindings/web5_uniffi/src/web5.udl @@ -18,7 +18,7 @@ namespace web5 { [Error] interface Web5Error { - Error(string type, string variant, string msg); + Error(string variant, string msg); }; dictionary JwkData { diff --git a/bindings/web5_uniffi_wrapper/src/errors.rs b/bindings/web5_uniffi_wrapper/src/errors.rs index b98cc736..0162cbbe 100644 --- a/bindings/web5_uniffi_wrapper/src/errors.rs +++ b/bindings/web5_uniffi_wrapper/src/errors.rs @@ -1,6 +1,5 @@ use serde_json::Error as SerdeJsonError; -use std::sync::PoisonError; -use std::{any::type_name, fmt::Debug}; +use std::fmt::Debug; use thiserror::Error; use web5::credentials::presentation_definition::PexError; use web5::credentials::CredentialError; @@ -9,41 +8,20 @@ use web5::errors::Web5Error as InnerWeb5Error; #[derive(Debug, Error)] pub enum Web5Error { #[error("{msg}")] - Error { - r#type: String, - variant: String, - msg: String, - }, + Error { variant: String, msg: String }, } impl Web5Error { - pub fn from_poison_error(error: PoisonError, error_type: &str) -> Self { - Web5Error::Error { - r#type: error_type.to_string(), - variant: "PoisonError".to_string(), - msg: error.to_string(), - } - } - fn new(error: T) -> Self where T: std::error::Error + 'static, { Self::Error { - r#type: type_of(&error).to_string(), variant: variant_name(&error), msg: error.to_string(), } } - pub fn r#type(&self) -> String { - match self { - Web5Error::Error { - r#type: error_type, .. - } => error_type.clone(), - } - } - pub fn variant(&self) -> String { match self { Web5Error::Error { @@ -60,10 +38,6 @@ impl Web5Error { } } -fn type_of(_: &T) -> &'static str { - type_name::() -} - fn variant_name(error: &T) -> String where T: Debug, diff --git a/bound/kt/src/main/kotlin/web5/sdk/Web5Exception.kt b/bound/kt/src/main/kotlin/web5/sdk/Web5Exception.kt new file mode 100644 index 00000000..8a710154 --- /dev/null +++ b/bound/kt/src/main/kotlin/web5/sdk/Web5Exception.kt @@ -0,0 +1,12 @@ +package web5.sdk + +class Web5Exception( + val variant: String, + override val message: String +) : Exception(message) { + companion object { + internal fun fromRustCore(e: web5.sdk.rust.Web5Exception.Exception): Web5Exception { + return Web5Exception(e.variant, e.msg) + } + } +} \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/Dsa.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/Dsa.kt index e1a90d8b..3e73d42f 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/Dsa.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/Dsa.kt @@ -1,6 +1,22 @@ package web5.sdk.crypto +import web5.sdk.rust.Dsa as RustCoreDsa + enum class Dsa { ED25519, SECP256K1; +} + +internal fun dsaFromRustCore(rustCore: RustCoreDsa): Dsa { + return when (rustCore) { + RustCoreDsa.ED25519 -> Dsa.ED25519 + RustCoreDsa.SECP256K1 -> Dsa.SECP256K1 + } +} + +internal fun dsaToRustCore(dsa: Dsa): RustCoreDsa { + return when(dsa) { + Dsa.ED25519 -> RustCoreDsa.ED25519 + Dsa.SECP256K1 -> RustCoreDsa.SECP256K1 + } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt index 63fae96c..bc6bdd23 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt @@ -1,7 +1,9 @@ package web5.sdk.crypto +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.Jwk import web5.sdk.rust.ed25519GeneratorGenerate +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Generates private key material for Ed25519. @@ -14,8 +16,14 @@ class Ed25519Generator { * @return Jwk the JWK with private key material included. */ fun generate(): Jwk { - val rustCoreJwkData = ed25519GeneratorGenerate() - return Jwk.fromRustCoreJwkData(rustCoreJwkData) + try { + val rustCoreJwkData = ed25519GeneratorGenerate() + return Jwk.fromRustCoreJwkData(rustCoreJwkData) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt index 4a6537d5..48f746d5 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt @@ -1,8 +1,10 @@ package web5.sdk.crypto.keys +import web5.sdk.Web5Exception import web5.sdk.crypto.signers.ToOuterSigner import web5.sdk.crypto.signers.Signer import web5.sdk.rust.InMemoryKeyManager as RustCoreInMemoryKeyManager +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * A class for managing cryptographic keys in-memory. @@ -25,8 +27,14 @@ class InMemoryKeyManager (privateJwks: List) : KeyManager, KeyExporter { * @return Jwk The public key represented as a JWK. */ override fun importPrivateJwk(privateJwk: Jwk): Jwk { - val rustCoreJwkData = this.rustCoreInMemoryKeyManager.importPrivateJwk(privateJwk.rustCoreJwkData) - return Jwk.fromRustCoreJwkData(rustCoreJwkData) + try { + val rustCoreJwkData = this.rustCoreInMemoryKeyManager.importPrivateJwk(privateJwk.rustCoreJwkData) + return Jwk.fromRustCoreJwkData(rustCoreJwkData) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } /** @@ -36,12 +44,24 @@ class InMemoryKeyManager (privateJwks: List) : KeyManager, KeyExporter { * @return Signer The signer for the given public key. */ override fun getSigner(publicJwk: Jwk): Signer { - val rustCoreSigner = this.rustCoreInMemoryKeyManager.getSigner(publicJwk.rustCoreJwkData) - return ToOuterSigner(rustCoreSigner) + try { + val rustCoreSigner = this.rustCoreInMemoryKeyManager.getSigner(publicJwk.rustCoreJwkData) + return ToOuterSigner(rustCoreSigner) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } override fun exportPrivateJwks(): List { - val rustCorePrivateJwksData = this.rustCoreInMemoryKeyManager.exportPrivateJwks() - return rustCorePrivateJwksData.map { Jwk.fromRustCoreJwkData(it) } + try { + val rustCorePrivateJwksData = this.rustCoreInMemoryKeyManager.exportPrivateJwks() + return rustCorePrivateJwksData.map { Jwk.fromRustCoreJwkData(it) } + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt index bb05d620..faf9dd5a 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt @@ -1,7 +1,9 @@ package web5.sdk.crypto.keys +import web5.sdk.Web5Exception import web5.sdk.rust.Jwk as RustCoreJwk import web5.sdk.rust.JwkData as RustCoreJwkData +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Partial representation of a [JSON Web Key as per RFC7517](https://tools.ietf.org/html/rfc7517). @@ -24,8 +26,8 @@ data class Jwk ( y ) - internal companion object { - fun fromRustCoreJwkData(rustCoreJwkData: RustCoreJwkData): Jwk { + companion object { + internal fun fromRustCoreJwkData(rustCoreJwkData: RustCoreJwkData): Jwk { return Jwk( rustCoreJwkData.alg, rustCoreJwkData.kty, @@ -38,7 +40,13 @@ data class Jwk ( } fun computeThumbprint(): String { - val rustCoreJwk = RustCoreJwk(rustCoreJwkData) - return rustCoreJwk.computeThumbprint() + try { + val rustCoreJwk = RustCoreJwk(rustCoreJwkData) + return rustCoreJwk.computeThumbprint() + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt index 7f6dd8a1..735fb465 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt @@ -1,7 +1,9 @@ package web5.sdk.crypto.signers +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.Jwk import web5.sdk.rust.Ed25519Signer as RustCoreEd25519Signer +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Implementation of Signer for Ed25519. @@ -16,6 +18,12 @@ class Ed25519Signer(privateJwk: Jwk) : Signer { * @return ByteArray the signature. */ override fun sign(payload: ByteArray): ByteArray { - return rustCoreSigner.sign(payload) + try { + return rustCoreSigner.sign(payload) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt index 63720001..142ba79d 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt @@ -1,8 +1,9 @@ package web5.sdk.crypto.verifiers +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.Jwk import web5.sdk.rust.Ed25519Verifier as RustCoreEd25519Verifier -import web5.sdk.rust.Web5Exception +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Implementation of Verifier for Ed25519. @@ -18,6 +19,12 @@ class Ed25519Verifier(publicJwk: Jwk) : Verifier { * @throws Web5Exception in the case of a failed verification */ override fun verify(message: ByteArray, signature: ByteArray) { - rustCoreVerifier.verify(message, signature) + try { + rustCoreVerifier.verify(message, signature) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt index 0b238ff8..497e6f35 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt @@ -1,5 +1,6 @@ package web5.sdk.dids +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.* import web5.sdk.crypto.keys.ToInnerKeyExporter import web5.sdk.crypto.keys.ToInnerKeyManager @@ -7,6 +8,7 @@ import web5.sdk.crypto.keys.ToOuterKeyManager import web5.sdk.crypto.signers.Signer import web5.sdk.crypto.signers.ToOuterSigner import web5.sdk.rust.BearerDid as RustCoreBearerDid +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Represents a Decentralized Identifier (DID) along with its DID document, key manager, metadata, @@ -26,11 +28,17 @@ data class BearerDid private constructor( did, document, keyManager, - RustCoreBearerDid( - did.toRustCoreDidData(), - document.toRustCore(), - ToInnerKeyManager(keyManager) - ) + try { + RustCoreBearerDid( + did.toRustCoreDidData(), + document.toRustCore(), + ToInnerKeyManager(keyManager) + ) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } ) companion object { @@ -40,8 +48,14 @@ data class BearerDid private constructor( * @param portableDid The PortableDid. */ fun fromPortableDid(portableDid: PortableDid): BearerDid { - val rustCoreBearerDid = RustCoreBearerDid.fromPortableDid(portableDid.rustCorePortableDid) - return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) + try { + val rustCoreBearerDid = RustCoreBearerDid.fromPortableDid(portableDid.rustCorePortableDid) + return fromRustCoreBearerDid(rustCoreBearerDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun fromRustCoreBearerDid(rustCoreBearerDid: RustCoreBearerDid): BearerDid { @@ -60,17 +74,28 @@ data class BearerDid private constructor( * @return Signer The signer for the DID. */ fun getSigner(verificationMethodId: String): Signer { - val rustCoreSigner = rustCoreBearerDid.getSigner(verificationMethodId) - - return ToOuterSigner(rustCoreSigner) + try { + val rustCoreSigner = rustCoreBearerDid.getSigner(verificationMethodId) + return ToOuterSigner(rustCoreSigner) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } /** * Returns the BearerDid represented as a PortableDid */ fun toPortableDid(keyExporter: KeyExporter): PortableDid { - val innerKeyExporter = ToInnerKeyExporter(keyExporter) - val rustCorePortableDid = rustCoreBearerDid.toPortableDid(innerKeyExporter) - return PortableDid.fromRustCorePortableDid(rustCorePortableDid) + try { + val innerKeyExporter = ToInnerKeyExporter(keyExporter) + val rustCorePortableDid = rustCoreBearerDid.toPortableDid(innerKeyExporter) + return PortableDid.fromRustCorePortableDid(rustCorePortableDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt index 4a23ea08..9ccab8fb 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt @@ -1,7 +1,9 @@ package web5.sdk.dids +import web5.sdk.Web5Exception import web5.sdk.rust.Did as RustCoreDid import web5.sdk.rust.DidData as RustCoreDidData +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Representation of a [DID Core Identifier](https://www.w3.org/TR/did-core/#identifiers). @@ -18,9 +20,15 @@ data class Did ( ) { companion object { fun parse(uri: String): Did { - val rustCoreDid = RustCoreDid(uri) - val data = rustCoreDid.getData() - return fromRustCoreDidData(data) + try { + val rustCoreDid = RustCoreDid(uri) + val data = rustCoreDid.getData() + return fromRustCoreDidData(data) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun fromRustCoreDidData(data: RustCoreDidData): Did { diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt index ee685bce..feb54667 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt @@ -1,6 +1,8 @@ package web5.sdk.dids +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.Jwk +import web5.sdk.rust.Web5Exception.Exception as RustCoreException /** * Representation of a [DID Document](https://github.com/TBD54566975/web5-spec/blob/main/spec/did.md). @@ -20,7 +22,13 @@ data class Document( ) { companion object { fun fromJsonString(json: String): Document { - return fromRustCore(web5.sdk.rust.Document.fromJsonString(json).getData()) + try { + return fromRustCore(web5.sdk.rust.Document.fromJsonString(json).getData()) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun fromRustCore(document: web5.sdk.rust.DocumentData): Document { @@ -41,7 +49,13 @@ data class Document( } fun toJsonString(): String { - return web5.sdk.rust.Document(toRustCore()).toJsonString() + try { + return web5.sdk.rust.Document(toRustCore()).toJsonString() + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun toRustCore(): web5.sdk.rust.DocumentData { diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt index 74de31b4..e6d3fdf2 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt @@ -1,7 +1,9 @@ package web5.sdk.dids +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.Jwk import web5.sdk.rust.PortableDid as RustCorePortableDid +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class PortableDid private constructor( val didUri: String, @@ -13,11 +15,17 @@ data class PortableDid private constructor( didUri, document, privateKeys, - RustCorePortableDid( - didUri, - document.toRustCore(), - privateKeys.map { it.rustCoreJwkData } - ) + try { + RustCorePortableDid( + didUri, + document.toRustCore(), + privateKeys.map { it.rustCoreJwkData } + ) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } ) companion object { @@ -27,8 +35,14 @@ data class PortableDid private constructor( * @param json The JSON string. */ fun fromJsonString(json: String): PortableDid { - val rustCorePortableDid = RustCorePortableDid.fromJsonString(json) - return PortableDid.fromRustCorePortableDid(rustCorePortableDid) + try { + val rustCorePortableDid = RustCorePortableDid.fromJsonString(json) + return fromRustCorePortableDid(rustCorePortableDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun fromRustCorePortableDid(rustCorePortableDid: RustCorePortableDid): PortableDid { @@ -46,6 +60,12 @@ data class PortableDid private constructor( * Serializes a PortableDid to a JSON string. */ fun toJsonString(): String { - return rustCorePortableDid.toJsonString() + try { + return rustCorePortableDid.toJsonString() + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt index 941a2a3b..4cfd1e29 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt @@ -1,5 +1,8 @@ package web5.sdk.dids +import web5.sdk.Web5Exception +import web5.sdk.rust.Web5Exception.Exception as RustCoreException + /** * Representation of the result of a DID (Decentralized Identifier) resolution. */ @@ -10,8 +13,14 @@ data class ResolutionResult( companion object { fun resolve(uri: String): ResolutionResult { - val rustCoreResolutionResult = web5.sdk.rust.ResolutionResult.resolve(uri) - return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + try { + val rustCoreResolutionResult = web5.sdk.rust.ResolutionResult.resolve(uri) + return fromRustCoreResolutionResult(rustCoreResolutionResult) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } internal fun fromRustCoreResolutionResult(rustCoreResolutionResult: web5.sdk.rust.ResolutionResult): ResolutionResult { diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt index 5435a9d9..55bb7386 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt @@ -1,5 +1,6 @@ package web5.sdk.dids.methods.dht +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.KeyManager import web5.sdk.crypto.keys.ToInnerKeyManager import web5.sdk.dids.BearerDid @@ -7,6 +8,7 @@ import web5.sdk.dids.ResolutionResult import web5.sdk.dids.Service import web5.sdk.dids.VerificationMethod import web5.sdk.rust.didDhtResolve as rustCoreDidDhtResolve +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class DidDhtCreateOptions( val publish: Boolean? = true, @@ -29,19 +31,25 @@ class DidDht { * @param options The set of options to configure creation. */ fun create(options: DidDhtCreateOptions? = null): BearerDid { - val rustCoreOptions = options?.let { opts -> - web5.sdk.rust.DidDhtCreateOptions( - opts.publish, - opts.gatewayUrl, - opts.keyManager?.let { ToInnerKeyManager(it) }, - opts.service?.map { it.toRustCore() }, - opts.controller, - opts.alsoKnownAs, - opts.verificationMethod?.map { it.toRustCore() } - ) + try { + val rustCoreOptions = options?.let { opts -> + web5.sdk.rust.DidDhtCreateOptions( + opts.publish, + opts.gatewayUrl, + opts.keyManager?.let { ToInnerKeyManager(it) }, + opts.service?.map { it.toRustCore() }, + opts.controller, + opts.alsoKnownAs, + opts.verificationMethod?.map { it.toRustCore() } + ) + } + val rustCoreBearerDid = web5.sdk.rust.didDhtCreate(rustCoreOptions) + return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e } - val rustCoreBearerDid = web5.sdk.rust.didDhtCreate(rustCoreOptions) - return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) } /** @@ -51,7 +59,13 @@ class DidDht { * @param gatewayUrl The optional gateway URL to publish to. */ fun publish(bearerDid: BearerDid, gatewayUrl: String? = null) { - web5.sdk.rust.didDhtPublish(bearerDid.rustCoreBearerDid, gatewayUrl) + try { + web5.sdk.rust.didDhtPublish(bearerDid.rustCoreBearerDid, gatewayUrl) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } /** @@ -62,8 +76,14 @@ class DidDht { */ @JvmStatic fun resolve(uri: String, gatewayUrl: String? = null): ResolutionResult { - val rustCoreResolutionResult = rustCoreDidDhtResolve(uri, gatewayUrl) - return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + try { + val rustCoreResolutionResult = rustCoreDidDhtResolve(uri, gatewayUrl) + return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt index 959172c4..85d80610 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt @@ -1,13 +1,16 @@ package web5.sdk.dids.methods.jwk +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.KeyManager import web5.sdk.crypto.keys.ToInnerKeyManager +import web5.sdk.crypto.Dsa +import web5.sdk.crypto.dsaToRustCore import web5.sdk.dids.BearerDid import web5.sdk.dids.ResolutionResult -import web5.sdk.rust.Dsa import web5.sdk.rust.didJwkCreate import web5.sdk.rust.DidJwkCreateOptions as RustCoreDidJwkCreateOptions import web5.sdk.rust.didJwkResolve as rustCoreDidJwkResolve +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class DidJwkCreateOptions( val keyManager: KeyManager? = null, @@ -25,13 +28,19 @@ class DidJwk { * @param options The set of options to configure creation. */ fun create(options: DidJwkCreateOptions? = null): BearerDid { - val rustCoreOptions = options?.let { opts -> - RustCoreDidJwkCreateOptions( - keyManager = opts.keyManager?.let { ToInnerKeyManager(it) }, - dsa = opts.dsa - ) } - val rustCoreBearerDid = didJwkCreate(rustCoreOptions) - return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) + try { + val rustCoreOptions = options?.let { opts -> + RustCoreDidJwkCreateOptions( + keyManager = opts.keyManager?.let { ToInnerKeyManager(it) }, + dsa = opts.dsa?.let { dsaToRustCore(it) } + ) } + val rustCoreBearerDid = didJwkCreate(rustCoreOptions) + return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } /** @@ -42,8 +51,14 @@ class DidJwk { */ @JvmStatic fun resolve(uri: String): ResolutionResult { - val rustCoreResolutionResult = rustCoreDidJwkResolve(uri) - return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + try { + val rustCoreResolutionResult = rustCoreDidJwkResolve(uri) + return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt index c9d96d57..f6c090e4 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt @@ -1,14 +1,17 @@ package web5.sdk.dids.methods.web +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.KeyManager import web5.sdk.crypto.keys.ToInnerKeyManager +import web5.sdk.crypto.Dsa +import web5.sdk.crypto.dsaToRustCore import web5.sdk.dids.BearerDid import web5.sdk.dids.ResolutionResult import web5.sdk.dids.Service import web5.sdk.dids.VerificationMethod -import web5.sdk.rust.Dsa import web5.sdk.rust.didWebCreate as rustCoreDidWebCreate import web5.sdk.rust.didWebResolve as rustCoreDidWebResolve +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class DidWebCreateOptions( val keyManager: KeyManager? = null, @@ -31,18 +34,24 @@ class DidWeb { * @param options The set of options to configure creation. */ fun create(domain: String, options: DidWebCreateOptions? = null): BearerDid { - val rustCoreOptions = options?.let { opts -> - web5.sdk.rust.DidWebCreateOptions( - keyManager = opts.keyManager?.let { ToInnerKeyManager(it) }, - dsa = opts.dsa, - service = opts.service?.map { it.toRustCore() }, - controller = opts.controller, - alsoKnownAs = opts.alsoKnownAs, - verificationMethod = opts.verificationMethod?.map { it.toRustCore() } - ) + try { + val rustCoreOptions = options?.let { opts -> + web5.sdk.rust.DidWebCreateOptions( + keyManager = opts.keyManager?.let { ToInnerKeyManager(it) }, + dsa = opts.dsa?.let { dsaToRustCore(it) }, + service = opts.service?.map { it.toRustCore() }, + controller = opts.controller, + alsoKnownAs = opts.alsoKnownAs, + verificationMethod = opts.verificationMethod?.map { it.toRustCore() } + ) + } + val rustCoreBearerDid = rustCoreDidWebCreate(domain, rustCoreOptions) + return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e } - val rustCoreBearerDid = rustCoreDidWebCreate(domain, rustCoreOptions) - return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) } /** @@ -53,8 +62,14 @@ class DidWeb { */ @JvmStatic fun resolve(uri: String): ResolutionResult { - val rustCoreResolutionResult = rustCoreDidWebResolve(uri) - return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + try { + val rustCoreResolutionResult = rustCoreDidWebResolve(uri) + return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt b/bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt index 4573c97a..ae5e53c1 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt @@ -6807,14 +6807,12 @@ sealed class Web5Exception: Exception() { class Exception( - val `type`: kotlin.String, - val `variant`: kotlin.String, val `msg`: kotlin.String ) : Web5Exception() { override val message - get() = "type=${ `type` }, variant=${ `variant` }, msg=${ `msg` }" + get() = "variant=${ `variant` }, msg=${ `msg` }" } @@ -6831,7 +6829,6 @@ public object FfiConverterTypeWeb5Error : FfiConverterRustBuffer return when(buf.getInt()) { 1 -> Web5Exception.Exception( - FfiConverterString.read(buf), FfiConverterString.read(buf), FfiConverterString.read(buf), ) @@ -6844,7 +6841,6 @@ public object FfiConverterTypeWeb5Error : FfiConverterRustBuffer is Web5Exception.Exception -> ( // Add the size for the Int that specifies the variant plus the size needed for all fields 4UL - + FfiConverterString.allocationSize(value.`type`) + FfiConverterString.allocationSize(value.`variant`) + FfiConverterString.allocationSize(value.`msg`) ) @@ -6855,7 +6851,6 @@ public object FfiConverterTypeWeb5Error : FfiConverterRustBuffer when(value) { is Web5Exception.Exception -> { buf.putInt(1) - FfiConverterString.write(value.`type`, buf) FfiConverterString.write(value.`variant`, buf) FfiConverterString.write(value.`msg`, buf) Unit diff --git a/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt b/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt index db41afd7..02f57b44 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt @@ -10,13 +10,15 @@ import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.module.kotlin.readValue -import web5.sdk.Json -import web5.sdk.dids.BearerDid import java.util.Date import web5.sdk.rust.CredentialStatusData as RustCoreCredentialStatus +import web5.sdk.Json +import web5.sdk.Web5Exception +import web5.sdk.dids.BearerDid import web5.sdk.rust.VerifiableCredential as RustCoreVerifiableCredential import web5.sdk.rust.VerifiableCredentialCreateOptionsData as RustCoreVerifiableCredentialCreateOptions import web5.sdk.rust.CredentialSchemaData as RustCoreCredentialSchema +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class CredentialStatus( var id: String, @@ -77,70 +79,87 @@ data class VerifiableCredential private constructor( issuer: Issuer, credentialSubject: CredentialSubject, options: VerifiableCredentialCreateOptions? = null): VerifiableCredential { - - val jsonSerializedIssuer = Json.stringify(issuer) - val jsonSerializedCredentialSubject = Json.stringify(credentialSubject) - val jsonSerializedEvidence = options?.evidence?.let { Json.stringify(it) } - - val rustCoreVerifiableCredential = RustCoreVerifiableCredential.create( - jsonSerializedIssuer, - jsonSerializedCredentialSubject, - RustCoreVerifiableCredentialCreateOptions( - options?.id, - options?.context, - options?.type, - options?.issuanceDate?.toInstant(), - options?.expirationDate?.toInstant(), - options?.credentialStatus?.let { RustCoreCredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, - options?.credentialSchema?.let { RustCoreCredentialSchema(it.id, it.type) }, - jsonSerializedEvidence + try { + val jsonSerializedIssuer = Json.stringify(issuer) + val jsonSerializedCredentialSubject = Json.stringify(credentialSubject) + val jsonSerializedEvidence = options?.evidence?.let { Json.stringify(it) } + + val rustCoreVerifiableCredential = RustCoreVerifiableCredential.create( + jsonSerializedIssuer, + jsonSerializedCredentialSubject, + RustCoreVerifiableCredentialCreateOptions( + options?.id, + options?.context, + options?.type, + options?.issuanceDate?.toInstant(), + options?.expirationDate?.toInstant(), + options?.credentialStatus?.let { RustCoreCredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, + options?.credentialSchema?.let { RustCoreCredentialSchema(it.id, it.type) }, + jsonSerializedEvidence + ) ) - ) - val data = rustCoreVerifiableCredential.getData() - val evidence = data.jsonSerializedEvidence?.let { Json.jsonMapper.readValue>>(it) } - - return VerifiableCredential( - data.context, - data.type, - data.id, - issuer, - credentialSubject, - Date.from(data.issuanceDate), - data.expirationDate?.let { Date.from(it) }, - data.credentialStatus?.let { CredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, - data.credentialSchema?.let { CredentialSchema(it.id, it.type) }, - evidence, - rustCoreVerifiableCredential - ) + val data = rustCoreVerifiableCredential.getData() + val evidence = data.jsonSerializedEvidence?.let { Json.jsonMapper.readValue>>(it) } + + return VerifiableCredential( + data.context, + data.type, + data.id, + issuer, + credentialSubject, + Date.from(data.issuanceDate), + data.expirationDate?.let { Date.from(it) }, + data.credentialStatus?.let { CredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, + data.credentialSchema?.let { CredentialSchema(it.id, it.type) }, + evidence, + rustCoreVerifiableCredential + ) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } fun fromVcJwt(vcJwt: String, verify: Boolean): VerifiableCredential { - val rustCoreVerifiableCredential = RustCoreVerifiableCredential.fromVcJwt(vcJwt, verify) - val data = rustCoreVerifiableCredential.getData() - - val issuer = Json.jsonMapper.readValue(data.jsonSerializedIssuer, Issuer::class.java) - val credentialSubject = Json.jsonMapper.readValue(data.jsonSerializedCredentialSubject, CredentialSubject::class.java) - val evidence = data.jsonSerializedEvidence?.let { Json.jsonMapper.readValue>>(it) } - - return VerifiableCredential( - data.context, - data.type, - data.id, - issuer, - credentialSubject, - Date.from(data.issuanceDate), - data.expirationDate?.let { Date.from(it) }, - data.credentialStatus?.let { CredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, - data.credentialSchema?.let { CredentialSchema(it.id, it.type) }, - evidence, - rustCoreVerifiableCredential - ) + try { + val rustCoreVerifiableCredential = RustCoreVerifiableCredential.fromVcJwt(vcJwt, verify) + val data = rustCoreVerifiableCredential.getData() + + val issuer = Json.jsonMapper.readValue(data.jsonSerializedIssuer, Issuer::class.java) + val credentialSubject = Json.jsonMapper.readValue(data.jsonSerializedCredentialSubject, CredentialSubject::class.java) + val evidence = data.jsonSerializedEvidence?.let { Json.jsonMapper.readValue>>(it) } + + return VerifiableCredential( + data.context, + data.type, + data.id, + issuer, + credentialSubject, + Date.from(data.issuanceDate), + data.expirationDate?.let { Date.from(it) }, + data.credentialStatus?.let { CredentialStatus(it.id, it.type, it.statusPurpose, it.statusListIndex, it.statusListCredential) }, + data.credentialSchema?.let { CredentialSchema(it.id, it.type) }, + evidence, + rustCoreVerifiableCredential + ) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } fun sign(bearerDid: BearerDid, verificationMethodId: String? = null): String { - return rustCoreVerifiableCredential.sign(bearerDid.rustCoreBearerDid, verificationMethodId) + try { + return rustCoreVerifiableCredential.sign(bearerDid.rustCoreBearerDid, verificationMethodId) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt b/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt index 1236585b..b8649b4e 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt @@ -2,7 +2,9 @@ package web5.sdk.vc.pex import com.fasterxml.jackson.annotation.JsonProperty import web5.sdk.Json +import web5.sdk.Web5Exception import web5.sdk.rust.PresentationDefinition as RustCorePresentationDefinition +import web5.sdk.rust.Web5Exception.Exception as RustCoreException data class PresentationDefinition( val id: String, @@ -16,7 +18,13 @@ data class PresentationDefinition( ) fun selectCredentials(vcJwts: List): List { - return this.rustCorePresentationDefinition.selectCredentials(vcJwts) + try { + return this.rustCorePresentationDefinition.selectCredentials(vcJwts) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } catch (e: Exception) { + throw e + } } } diff --git a/bound/kt/src/test/kotlin/web5/sdk/Web5TestVectorsTest.kt b/bound/kt/src/test/kotlin/web5/sdk/Web5TestVectorsTest.kt index 5c4db7fb..306a683e 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/Web5TestVectorsTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/Web5TestVectorsTest.kt @@ -21,7 +21,7 @@ import web5.sdk.crypto.verifiers.Ed25519Verifier import web5.sdk.dids.Document import web5.sdk.rust.DocumentMetadataData import web5.sdk.rust.ResolutionMetadataData -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception class Web5TestVectorsTest { @@ -119,7 +119,7 @@ class Web5TestVectorsTest { val verifier = Ed25519Verifier(ed25519Jwk) if (vector.errors == true || vector.output == false) { - assertThrows(Web5Exception.Exception::class.java) { + assertThrows(Web5Exception::class.java) { verifier.verify(inputByteArray, signatureByteArray) } } else { diff --git a/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/InMemoryKeyManagerTest.kt b/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/InMemoryKeyManagerTest.kt index 5ae967d1..922bfcfa 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/InMemoryKeyManagerTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/InMemoryKeyManagerTest.kt @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite import web5.sdk.crypto.Ed25519Generator -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception class InMemoryKeyManagerTest { @Nested @@ -30,11 +30,11 @@ class InMemoryKeyManagerTest { val privateJwk = Ed25519Generator.generate() val publicJwk = privateJwk.copy(d = null) - val exception = assertThrows { + val exception = assertThrows { keyManager.importPrivateJwk(publicJwk) } - assertEquals("parameter error private_jwk must be a private key", exception.msg) + assertEquals("parameter error private_jwk must be a private key", exception.message) assertEquals("Parameter", exception.variant) } @@ -72,11 +72,11 @@ class InMemoryKeyManagerTest { val privateJwk = Ed25519Generator.generate() val keyManager = InMemoryKeyManager(listOf(privateJwk)) - val exception = assertThrows { + val exception = assertThrows { keyManager.getSigner(privateJwk) } - assertEquals("parameter error public_jwk must be a public key", exception.msg) + assertEquals("parameter error public_jwk must be a public key", exception.message) assertEquals("Parameter", exception.variant) } @@ -88,11 +88,11 @@ class InMemoryKeyManagerTest { val privateJwk = Ed25519Generator.generate() val publicJwk = privateJwk.copy(d = null) - val exception = assertThrows { + val exception = assertThrows { keyManager.getSigner(publicJwk) } - assertEquals("not found error signer not found for public_jwk with thumbprint ${publicJwk.computeThumbprint()}", exception.msg) + assertEquals("not found error signer not found for public_jwk with thumbprint ${publicJwk.computeThumbprint()}", exception.message) assertEquals("NotFound", exception.variant) } diff --git a/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/JwkTest.kt b/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/JwkTest.kt index 5656f5b9..936ffadc 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/JwkTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/crypto/keys/JwkTest.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception @TestInstance(TestInstance.Lifecycle.PER_CLASS) class JwkTest { @@ -57,11 +57,11 @@ class JwkTest { y = "y_value" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error kty not supported RSA", exception.msg) + assertEquals("data member error kty not supported RSA", exception.message) } @Test @@ -73,11 +73,11 @@ class JwkTest { x = "x_value" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error kty cannot be empty", exception.msg) + assertEquals("data member error kty cannot be empty", exception.message) } @Test @@ -89,11 +89,11 @@ class JwkTest { x = "" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error x cannot be empty", exception.msg) + assertEquals("data member error x cannot be empty", exception.message) } @Test @@ -106,11 +106,11 @@ class JwkTest { y = "y_value" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error crv cannot be empty", exception.msg) + assertEquals("data member error crv cannot be empty", exception.message) } @Test @@ -122,11 +122,11 @@ class JwkTest { x = "x_value" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error missing y", exception.msg) + assertEquals("data member error missing y", exception.message) } @Test @@ -139,10 +139,10 @@ class JwkTest { y = "" ) - val exception = assertThrows { + val exception = assertThrows { jwk.computeThumbprint() } - assertEquals("data member error y cannot be empty", exception.msg) + assertEquals("data member error y cannot be empty", exception.message) } } diff --git a/bound/kt/src/test/kotlin/web5/sdk/crypto/signers/Ed25519SignerTest.kt b/bound/kt/src/test/kotlin/web5/sdk/crypto/signers/Ed25519SignerTest.kt index 926327c6..67011082 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/crypto/signers/Ed25519SignerTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/crypto/signers/Ed25519SignerTest.kt @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite import web5.sdk.crypto.Ed25519Generator -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception @TestInstance(TestInstance.Lifecycle.PER_CLASS) class Ed25519SignerTest { @@ -45,11 +45,11 @@ class Ed25519SignerTest { val signer = Ed25519Signer(invalidJwk) val message = "Test message".toByteArray() - val exception = assertThrows { + val exception = assertThrows { signer.sign(message) } - assertEquals("cryptography error invalid private key length ${SECRET_KEY_LENGTH - 1} must be $SECRET_KEY_LENGTH", exception.msg) + assertEquals("cryptography error invalid private key length ${SECRET_KEY_LENGTH - 1} must be $SECRET_KEY_LENGTH", exception.message) assertEquals("Crypto", exception.variant) } @@ -62,11 +62,11 @@ class Ed25519SignerTest { val signer = Ed25519Signer(missingKeyJwk) val message = "Test message".toByteArray() - val exception = assertThrows { + val exception = assertThrows { signer.sign(message) } - assertEquals("cryptography error private key material must be set", exception.msg) + assertEquals("cryptography error private key material must be set", exception.message) assertEquals("Crypto", exception.variant) } diff --git a/bound/kt/src/test/kotlin/web5/sdk/crypto/verifiers/Ed25519VerifierTest.kt b/bound/kt/src/test/kotlin/web5/sdk/crypto/verifiers/Ed25519VerifierTest.kt index 835fc858..8e27702e 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/crypto/verifiers/Ed25519VerifierTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/crypto/verifiers/Ed25519VerifierTest.kt @@ -7,7 +7,7 @@ import web5.sdk.UnitTestSuite import web5.sdk.crypto.Ed25519Generator import web5.sdk.crypto.keys.Jwk import web5.sdk.crypto.signers.Ed25519Signer -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception @TestInstance(TestInstance.Lifecycle.PER_CLASS) class Ed25519VerifierTest { @@ -55,11 +55,11 @@ class Ed25519VerifierTest { val message = "Test message".toByteArray() val invalidSignature = ByteArray(SIGNATURE_LENGTH - 1) // invalid length - val exception = assertThrows { + val exception = assertThrows { verifier.verify(message, invalidSignature) } - assertEquals("cryptography error provided verification key cannot contain private key material", exception.msg) + assertEquals("cryptography error provided verification key cannot contain private key material", exception.message) assertEquals("Crypto", exception.variant) } @@ -73,11 +73,11 @@ class Ed25519VerifierTest { val message = "Test message".toByteArray() val invalidSignature = ByteArray(SIGNATURE_LENGTH) // an obviously invalid signature - val exception = assertThrows { + val exception = assertThrows { verifier.verify(message, invalidSignature) } - assertEquals("cryptography error cryptographic verification failure", exception.msg) + assertEquals("cryptography error cryptographic verification failure", exception.message) assertEquals("Crypto", exception.variant) } @@ -94,11 +94,11 @@ class Ed25519VerifierTest { val message = "Test message".toByteArray() val signature = signer.sign(message) - val exception = assertThrows { + val exception = assertThrows { verifier.verify(message, signature) } - assertEquals("cryptography error invalid public key length ${PUBLIC_KEY_LENGTH - 1} must be $PUBLIC_KEY_LENGTH", exception.msg) + assertEquals("cryptography error invalid public key length ${PUBLIC_KEY_LENGTH - 1} must be $PUBLIC_KEY_LENGTH", exception.message) assertEquals("Crypto", exception.variant) } @@ -112,11 +112,11 @@ class Ed25519VerifierTest { val message = "Test message".toByteArray() val invalidSignature = ByteArray(SIGNATURE_LENGTH - 1) // invalid length - val exception = assertThrows { + val exception = assertThrows { verifier.verify(message, invalidSignature) } - assertEquals("cryptography error invalid signature length ${SIGNATURE_LENGTH - 1} must be $SIGNATURE_LENGTH", exception.msg) + assertEquals("cryptography error invalid signature length ${SIGNATURE_LENGTH - 1} must be $SIGNATURE_LENGTH", exception.message) assertEquals("Crypto", exception.variant) } diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/BearerDidTest.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/BearerDidTest.kt index 0f58f3f1..bd5302ce 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/BearerDidTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/BearerDidTest.kt @@ -7,7 +7,7 @@ import web5.sdk.UnitTestSuite import web5.sdk.crypto.keys.InMemoryKeyManager import web5.sdk.dids.methods.jwk.DidJwk import web5.sdk.dids.methods.jwk.DidJwkCreateOptions -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception class BearerDidTest { @Nested @@ -58,11 +58,11 @@ class BearerDidTest { val bearerDid = DidJwk.create() - val exception = assertThrows { + val exception = assertThrows { bearerDid.getSigner("") } - assertEquals("parameter error verification_method_id cannot be empty", exception.msg) + assertEquals("parameter error verification_method_id cannot be empty", exception.message) assertEquals("Parameter", exception.variant) } @@ -72,11 +72,11 @@ class BearerDidTest { val bearerDid = DidJwk.create() - val exception = assertThrows { + val exception = assertThrows { bearerDid.getSigner("invalid_id") } - assertEquals("not found error verification method not found", exception.msg) + assertEquals("not found error verification method not found", exception.message) assertEquals("NotFound", exception.variant) } diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/DidTest.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/DidTest.kt index 0abad8f8..d2fc1e79 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/DidTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/DidTest.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception @TestInstance(TestInstance.Lifecycle.PER_CLASS) class DidTest { @@ -25,11 +25,11 @@ class DidTest { testSuite.include() val uri = "" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -37,11 +37,11 @@ class DidTest { testSuite.include() val uri = "did:" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -49,11 +49,11 @@ class DidTest { testSuite.include() val uri = "did:uport" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -61,11 +61,11 @@ class DidTest { testSuite.include() val uri = "did:uport:" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -73,11 +73,11 @@ class DidTest { testSuite.include() val uri = "did:uport:1234_12313***" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -85,11 +85,11 @@ class DidTest { testSuite.include() val uri = "2nQtiQG6Cgm1GYTBaaKAgr76uY7iSexUkqX" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -97,11 +97,11 @@ class DidTest { testSuite.include() val uri = "did:method:%12%1" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -109,11 +109,11 @@ class DidTest { testSuite.include() val uri = "did:method:%1233%Ay" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -121,11 +121,11 @@ class DidTest { testSuite.include() val uri = "did:CAP:id" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test @@ -133,11 +133,11 @@ class DidTest { testSuite.include() val uri = "did:method:id::anotherid%r9" - val exception = assertThrows { + val exception = assertThrows { Did.parse(uri) } - assertEquals("parameter error identifier regex match failure $uri", exception.msg) + assertEquals("parameter error identifier regex match failure $uri", exception.message) } @Test diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/PortableDidTest.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/PortableDidTest.kt index fdacf1cf..d39ebe2a 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/PortableDidTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/PortableDidTest.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.assertDoesNotThrow import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Assertions.assertEquals -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception class PortableDidTest { @Test diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/ResolutionResultTests.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/ResolutionResultTests.kt index a610e43a..566bad28 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/ResolutionResultTests.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/ResolutionResultTests.kt @@ -8,7 +8,6 @@ import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite import web5.sdk.dids.methods.jwk.DidJwk import web5.sdk.dids.methods.web.DidWeb -import web5.sdk.dids.ResolutionMetadataError class ResolutionResultTests { @Nested diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/dht/DidDhtTests.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/dht/DidDhtTests.kt index d422c575..d394aeba 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/dht/DidDhtTests.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/dht/DidDhtTests.kt @@ -8,12 +8,12 @@ import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite +import web5.sdk.Web5Exception import web5.sdk.crypto.keys.InMemoryKeyManager import web5.sdk.crypto.keys.Jwk import web5.sdk.dids.Service import web5.sdk.dids.VerificationMethod import web5.sdk.dids.ResolutionMetadataError -import web5.sdk.rust.* class DidDhtTests { @Nested @@ -230,14 +230,14 @@ class DidDhtTests { ) ) - val exception = assertThrows { + val exception = assertThrows { DidDht.publish( bearerDid, gatewayUrl.toString() ) } - assertEquals("network error failed to PUT DID to mainline", exception.msg) + assertEquals("network error failed to PUT DID to mainline", exception.message) assertEquals("Network", exception.variant) mockWebServer.shutdown() diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/jwk/DidJwkTests.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/jwk/DidJwkTests.kt index 9a035737..51f4591a 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/jwk/DidJwkTests.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/jwk/DidJwkTests.kt @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite import web5.sdk.crypto.keys.InMemoryKeyManager +import web5.sdk.crypto.Dsa import web5.sdk.dids.ResolutionMetadataError -import web5.sdk.rust.Dsa class DidJwkTests { @Nested diff --git a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/web/DidWebTests.kt b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/web/DidWebTests.kt index 4eb02774..30f36430 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/dids/methods/web/DidWebTests.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/dids/methods/web/DidWebTests.kt @@ -1,17 +1,18 @@ package web5.sdk.dids.methods.web +import web5.sdk.Web5Exception import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite +import web5.sdk.crypto.Dsa import web5.sdk.crypto.keys.InMemoryKeyManager import web5.sdk.crypto.keys.Jwk import web5.sdk.dids.Service import web5.sdk.dids.VerificationMethod import web5.sdk.dids.ResolutionMetadataError -import web5.sdk.rust.* class DidWebTests { @Nested @@ -69,11 +70,11 @@ class DidWebTests { fun test_invalid_domain() { testSuite.include() - val exception = assertThrows { + val exception = assertThrows { DidWeb.create("invalid domain") } - assertTrue(exception.msg.contains("url parse failure") ?: false) + assertTrue(exception.message.contains("url parse failure") ?: false) assertEquals("Parameter", exception.variant) } @@ -89,12 +90,12 @@ class DidWebTests { DidWeb.create("http://127.0.0.1") } - val exception = assertThrows { + val exception = assertThrows { DidWeb.create("http://example.com") } assertEquals( "parameter error only https is allowed except for localhost or 127.0.0.1 with http", - exception.msg + exception.message ) assertEquals("Parameter", exception.variant) } @@ -103,12 +104,12 @@ class DidWebTests { fun test_must_be_https() { testSuite.include() - val exception = assertThrows { + val exception = assertThrows { DidWeb.create("http://example.com") } assertEquals( "parameter error only https is allowed except for localhost or 127.0.0.1 with http", - exception.msg + exception.message ) assertEquals("Parameter", exception.variant) diff --git a/bound/kt/src/test/kotlin/web5/sdk/vc/VerifiableCredentialTest.kt b/bound/kt/src/test/kotlin/web5/sdk/vc/VerifiableCredentialTest.kt index 1191411a..6fa9fb87 100644 --- a/bound/kt/src/test/kotlin/web5/sdk/vc/VerifiableCredentialTest.kt +++ b/bound/kt/src/test/kotlin/web5/sdk/vc/VerifiableCredentialTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.fail import web5.sdk.UnitTestSuite import web5.sdk.dids.BearerDid import web5.sdk.dids.methods.jwk.DidJwk -import web5.sdk.rust.Web5Exception +import web5.sdk.Web5Exception import java.util.Date import java.util.regex.Pattern @@ -121,11 +121,11 @@ class VerifiableCredentialTest { testSuite.include() val emptyIssuer = Issuer.StringIssuer("") - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(emptyIssuer, CREDENTIAL_SUBJECT, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error issuer id must not be empty", exception.msg) + assertEquals("parameter error issuer id must not be empty", exception.message) } @Test @@ -139,11 +139,11 @@ class VerifiableCredentialTest { fun test_issuer_string_must_be_valid_did() { testSuite.include() - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(Issuer.StringIssuer("did:something-invalid"), CREDENTIAL_SUBJECT, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error issuer must be a valid DID URI", exception.msg) + assertEquals("parameter error issuer must be a valid DID URI", exception.message) } @Test @@ -151,22 +151,22 @@ class VerifiableCredentialTest { testSuite.include() val issuer = Issuer.ObjectIssuer("", "Example Name") - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(issuer, CREDENTIAL_SUBJECT, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error issuer id must not be empty", exception.msg) + assertEquals("parameter error issuer id must not be empty", exception.message) } @Test fun test_issuer_object_id_must_be_valid_did() { testSuite.include() - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(Issuer.ObjectIssuer("did:something-invalid", "some name"), CREDENTIAL_SUBJECT, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error issuer must be a valid DID URI", exception.msg) + assertEquals("parameter error issuer must be a valid DID URI", exception.message) } @Test @@ -174,11 +174,11 @@ class VerifiableCredentialTest { testSuite.include() val issuer = Issuer.ObjectIssuer(ISSUER_DID_URI, "") - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(issuer, CREDENTIAL_SUBJECT, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error named issuer name must not be empty", exception.msg) + assertEquals("parameter error named issuer name must not be empty", exception.message) } @Test @@ -215,11 +215,11 @@ class VerifiableCredentialTest { testSuite.include() val credentialSubject = CredentialSubject("") - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, credentialSubject, VerifiableCredentialCreateOptions()) } - assertEquals("parameter error subject id must not be empty", exception.msg) + assertEquals("parameter error subject id must not be empty", exception.message) } @Test @@ -303,11 +303,11 @@ class VerifiableCredentialTest { credentialSchema = invalidSchemaType ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertEquals("parameter error type must be JsonSchema", exception.msg) + assertEquals("parameter error type must be JsonSchema", exception.message) } @Test @@ -324,11 +324,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertTrue(exception.msg.contains("unable to resolve json schema")) + assertTrue(exception.message.contains("unable to resolve json schema")) } @Test @@ -355,11 +355,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertTrue(exception.msg.contains("non-200 response when resolving json schema")) + assertTrue(exception.message.contains("non-200 response when resolving json schema")) mockWebServer.shutdown() } @@ -389,11 +389,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertTrue(exception.msg.contains("unable to parse json schema from response body")) + assertTrue(exception.message.contains("unable to parse json schema from response body")) mockWebServer.shutdown() } @@ -432,11 +432,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertTrue(exception.msg.contains("unable to compile json schema")) + assertTrue(exception.message.contains("unable to compile json schema")) mockWebServer.shutdown() } @@ -475,11 +475,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertEquals("json schema error draft unsupported Draft4", exception.msg) + assertEquals("json schema error draft unsupported Draft4", exception.message) mockWebServer.shutdown() } @@ -519,11 +519,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, CREDENTIAL_SUBJECT, options) } - assertEquals("json schema error draft unsupported Draft6", exception.msg) + assertEquals("json schema error draft unsupported Draft6", exception.message) mockWebServer.shutdown() } @@ -580,11 +580,11 @@ class VerifiableCredentialTest { credentialSchema = schema ) - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.create(ISSUER, invalidCredentialSubject, options) } - assertTrue(exception.msg.contains("validation errors")) + assertTrue(exception.message.contains("validation errors")) mockWebServer.shutdown() } @@ -673,11 +673,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingKid = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmEzYzY3NGI5LTliNGUtNGE2OS1hYzUwLWM3N2JhYzY0OTg2MCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKclZ6YzNjbnA2VTNGUExYSkxUekpIY1hwd04zRk9TRGhEYWtORmJFMHpabmhMUmtWcVdFTmtaRWxWSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yN1QyMDo0NzoyNS4xMTk2MjQrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnJWemMzY25wNlUzRlBMWEpMVHpKSGNYcHdOM0ZPU0RoRGFrTkZiRTB6Wm5oTFJrVnFXRU5rWkVsVkluMCIsImp0aSI6InVybjp1dWlkOmEzYzY3NGI5LTliNGUtNGE2OS1hYzUwLWM3N2JhYzY0OTg2MCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDc5MTY0NSwiaWF0IjoxNzI0NzkxNjQ1fQ.ocOyYhqFwz4Jvkdwpa69oFDXCOr2n-_IXSHg5elFebOM0T_lx3Cs6DgQJ7YLLk--mAOvPqrH05bh92BSaLB_DQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingKid, true) } - assertEquals("missing kid jose header", exception.msg) + assertEquals("missing kid jose header", exception.message) } @Test @@ -686,11 +686,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptyKid = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6IiJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmE5MzcwYTZjLWFmNDAtNDU3Zi1iNDNiLWM0YmYzMzcwZTg1OSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKNE5XODFYM3BHTTE5a1QzaDBlbFZzTUVjNGREQnZkVlUyZFRsVFFVdEpiVkZXZFRaa1lsSlpiMUJqSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yN1QyMDozODo0Ni45MjcxMzYrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSjROVzgxWDNwR00xOWtUM2gwZWxWc01FYzRkREJ2ZFZVMmRUbFRRVXRKYlZGV2RUWmtZbEpaYjFCakluMCIsImp0aSI6InVybjp1dWlkOmE5MzcwYTZjLWFmNDAtNDU3Zi1iNDNiLWM0YmYzMzcwZTg1OSIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDc5MTEyNiwiaWF0IjoxNzI0NzkxMTI2fQ.0LzNrPzFY4CsEWRqYdo8pogGDonZqjRqfx9k30NEoWASw8pas6YC-mlDSAQ-4qQaE-otQ6p7zoMeopfw9M1CCQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptyKid, true) } - assertEquals("missing kid jose header", exception.msg) + assertEquals("missing kid jose header", exception.message) } @Test @@ -699,11 +699,11 @@ class VerifiableCredentialTest { val vcJwtWithInvalidDidUri = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImludmFsaWQgZGlkIHVyaSJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmFhYzFmN2M5LTIzOWQtNGE4OC05NDBiLTEwOTk3NmViNWYyNCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaW52YWxpZCBkaWQgdXJpIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMjozMDowOC41OTAxOTcrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImludmFsaWQgZGlkIHVyaSIsImp0aSI6InVybjp1dWlkOmFhYzFmN2M5LTIzOWQtNGE4OC05NDBiLTEwOTk3NmViNWYyNCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg0ODIwOCwiaWF0IjoxNzI0ODQ4MjA4fQ.YdmnfP0wIK5HDu8Lft52UFdZCzfdFO0rclAOF-mWt6Y1vqAgoyuOn7AnX1Lx782-iWaekKApCGqCTaXepzj4CQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithInvalidDidUri, true) } - assertEquals("parameter error identifier regex match failure invalid did uri", exception.msg) + assertEquals("parameter error identifier regex match failure invalid did uri", exception.message) } @Test @@ -712,11 +712,11 @@ class VerifiableCredentialTest { val vcJwtWithInvalidDidResolution = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpkaHQ6c29tZXRoaW5nLWludmFsaWQifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjhiNGM1NmI5LTM1ODgtNGM0Mi1iOTg3LWEwZTAxNDFmNzA2YSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmRodDpzb21ldGhpbmctaW52YWxpZCIsImlzc3VhbmNlRGF0ZSI6IjIwMjQtMDgtMjhUMTI6MzQ6NDguMzMzMjg5KzAwOjAwIiwiZXhwaXJhdGlvbkRhdGUiOm51bGwsImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5In19LCJpc3MiOiJkaWQ6ZGh0OnNvbWV0aGluZy1pbnZhbGlkIiwianRpIjoidXJuOnV1aWQ6OGI0YzU2YjktMzU4OC00YzQyLWI5ODctYTBlMDE0MWY3MDZhIiwic3ViIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5IiwibmJmIjoxNzI0ODQ4NDg4LCJpYXQiOjE3MjQ4NDg0ODh9.hXbWLVU8ef38O5SY-HshVhXPM1RadFEAGRj0ds5Yjw1_lweWxe1-CNJxLmo0D4BiRCo4T4hCWP_bkwRoteImBA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithInvalidDidResolution, true) } - assertEquals("The DID Document does not have a valid public key.", exception.msg) + assertEquals("The DID Document does not have a valid public key.", exception.message) } @Test @@ -725,11 +725,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingVerificationMethod = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSmZNblZ0WDJFM2EwMU1OM1p0TXpGdlRWbGhjVE5WWWpGTWRWbzBhazFUTjNaT2NsTndlbWxvVWpkWkluMCMwLWludmFsaWQifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmM5ZjUzN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(vcJwtWithMissingVerificationMethod, true) } - assertEquals("not found error verification method not found", exception.msg) + assertEquals("not found error verification method not found", exception.message) } @Test @@ -738,11 +738,11 @@ class VerifiableCredentialTest { val vcJwtWithInvalidSignature = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSkhWelpGVERsSVRUbHRkSGx5Y0dsWWRGRlVNR3B4Wms1MmFXTm5RVGxCVkRnME1IWTFZMDh5YjFSckluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjZmYTQ2MDVjLWFlZGItNGQ2NC05NzdiLTFmY2NmYTU1ZTM1ZiIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKSFZ6WkZURGxJVFRsdGRIbHljR2xZZEZGVU1HcHhaazUyYVdOblFUbEJWRGcwTUhZMVkwOHliMVJySW4wIzAiLCJpc3N1YW5jZURhdGUiOiIyMDI0LTA4LTI4VDEyOjQyOjI3Ljc3Mjg4OSswMDowMCIsImV4cGlyYXRpb25EYXRlIjpudWxsLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSJ9fSwiaXNzIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKSFZ6WkZURGxJVFRsdGRIbHljR2xZZEZGVU1HcHhaazUyYVdOblFUbEJWRGcwTUhZMVkwOHliMVJySW4wIzAiLCJqdGkiOiJ1cm46dXVpZDo2ZmE0NjA1Yy1hZWRiLTRkNjQtOTc3Yi0xZmNjZmE1NWUzNWYiLCJzdWIiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkiLCJuYmYiOjE3MjQ4NDg5NDcsImlhdCI6MTcyNDg0ODk0N30.-JwIGYZ9HlJASYxdRBWY5KlwP0iJUxWUOU6BsOR74VeC-zKgZb9WWZR08OVD-wv0X8KD5--0K5Dr9r5fL3B0Aw-invalid-signature" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithInvalidSignature, true) } - assertTrue(exception.msg.contains("cryptography error vc-jwt failed cryptographic verification")) + assertTrue(exception.message.contains("cryptography error vc-jwt failed cryptographic verification")) } @Test @@ -859,11 +859,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingVcClaim = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSlNSbkZSVlVWS1RFOVhlbXh3T1ZaRk1rdEtSalp6UjBwT00yVnpaWHBsY0hSSE0ySTFlbTh4YjAwNEluMCMwIn0.eyJpc3MiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpESTFOVEU1SWl3aWEzUjVJam9pVDB0UUlpd2lZM0oySWpvaVJXUXlOVFV4T1NJc0luZ2lPaUpTUm5GUlZVVktURTlYZW14d09WWkZNa3RLUmpaelIwcE9NMlZ6WlhwbGNIUkhNMkkxZW04eGIwMDRJbjAiLCJqdGkiOiJ1cm46dXVpZDozNmU0ZjllNi0yYzdjLTQ0NGMtOTI4OS0zNDhmY2IxNDZlYjYiLCJzdWIiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkiLCJuYmYiOjE3MjQ4NTA1MjIsImlhdCI6MTcyNDg1MDUyMn0.SqwZC0q9RuHp9hAtFmE6sBYeJ1uHuuq1hyijF0NmW9nksSBqtDpfNroNlitK_Tl-CLWtwbTpK3b3JduTfzGEAw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingVcClaim, true) } - assertEquals("missing claim: vc", exception.msg) + assertEquals("missing claim: vc", exception.message) } @Test @@ -872,11 +872,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingJtiClaim = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSm5jMjlTZGsxUFlXMHliMlJQTlY4NWVqbExlV2xzV1VzM1Yzb3RZa1owWW5wdlVrWm1iVTlUTVRJNEluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjEwODM2MzgwLWI2MmMtNGVmZC04YmU0LTZhNzJiMDZjYWI4NyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKbmMyOVNkazFQWVcweWIyUlBOVjg1ZWpsTGVXbHNXVXMzVjNvdFlrWjBZbnB2VWtabWJVOVRNVEk0SW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzoxMDo1NS4yMDYwOTIrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSm5jMjlTZGsxUFlXMHliMlJQTlY4NWVqbExlV2xzV1VzM1Yzb3RZa1owWW5wdlVrWm1iVTlUTVRJNEluMCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MDY1NSwiaWF0IjoxNzI0ODUwNjU1fQ.1XDmdvB1GDsCHw9Qwp0HA5r8W-JnZB4lz9Yqo0C2V_EEe-uk88bQSl8P9HV8ViNyBC_YaYatLiPTD4jBZY77DA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingJtiClaim, true) } - assertEquals("missing claim: jti", exception.msg) + assertEquals("missing claim: jti", exception.message) } @Test @@ -885,11 +885,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingIssuerClaim = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnpjamREVWtVek1HbzNjVVU0Y2taVVJYQXdSbFJzYnpKVVVXVmlZa1ZHTVVvelJHaHRTVWhaVTNFd0luMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjRjYzU0NWU0LWI5ZDgtNDdkNS04Zjk0LTA4MmM0ZGViNzAyZCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKemNqZERVa1V6TUdvM2NVVTRja1pVUlhBd1JsUnNiekpVVVdWaVlrVkdNVW96UkdodFNVaFpVM0V3SW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzoxMTo1Mi4zMjg4MTMrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImp0aSI6InVybjp1dWlkOjRjYzU0NWU0LWI5ZDgtNDdkNS04Zjk0LTA4MmM0ZGViNzAyZCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MDcxMiwiaWF0IjoxNzI0ODUwNzEyfQ.hwR6edt6ItlN0HHkDcxzhE3N5hLk-5-VYDLrqkalUoTKB41vsfaPvGnt_UQK3EAuekQgrTQ0SuCq-6ut0EdlBw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingIssuerClaim, true) } - assertEquals("missing claim: issuer", exception.msg) + assertEquals("missing claim: issuer", exception.message) } @Test @@ -898,11 +898,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingSubjectClaim = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGW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ODUwNzY1fQ.61IFQhdASbbcYKUzMfhO7WPmikBd8AoE468FTlqRysxXck7kNa3bAAow3jK2uhYrIWLyRu3kuBp7JyYhLavjBw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingSubjectClaim, true) } - assertEquals("missing claim: subject", exception.msg) + assertEquals("missing claim: subject", exception.message) } @Test @@ -911,11 +911,11 @@ class VerifiableCredentialTest { val vcJwtWithMissingNbfClaim = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSXdOR1ZzZGxGdlJWbDBZbEJIT0RsWlVtaGpTR2RJT1cwMlMzSjZiRVkyUWpGUldrZGxOR2RGUjJKakluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjk3OGZhZTIxLTVmMDYtNDBmNy1iZTJmLTM4MzRmZGMwZDY0NSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lJd05HVnNkbEZ2UlZsMFlsQkhPRGxaVW1oalNHZElPVzAyUzNKNmJFWTJRakZSV2tkbE5HZEZSMkpqSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzoxMzoyNi4zMzQzNjYrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSXdOR1ZzZGxGdlJWbDBZbEJIT0RsWlVtaGpTR2RJT1cwMlMzSjZiRVkyUWpGUldrZGxOR2RGUjJKakluMCIsImp0aSI6InVybjp1dWlkOjk3OGZhZTIxLTVmMDYtNDBmNy1iZTJmLTM4MzRmZGMwZDY0NSIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsImlhdCI6MTcyNDg1MDgwNn0.ZXfuZmvddH1nvmub8WDpQ2UEOhuiLaN6WL2q3XDhn0eouM_bNVa7vmCUCUZc3sfJ1YCtnAGCJOlJxSGnD3tOCw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMissingNbfClaim, true) } - assertEquals("missing claim: not_before", exception.msg) + assertEquals("missing claim: not_before", exception.message) } @Test @@ -924,11 +924,11 @@ class VerifiableCredentialTest { val vcJwtWithMismatchId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnZTWHBSUjJkTmNGTlNPSEpRWTNkd1IxZEJTRnBaV0hwUFdYRlRiMFkyTWtoM09HTlJRamRJUzIxM0luMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InNvbWV0aGluZyBpbnZhbGlkIiwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJpc3N1ZXIiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpESTFOVEU1SWl3aWEzUjVJam9pVDB0UUlpd2lZM0oySWpvaVJXUXlOVFV4T1NJc0luZ2lPaUp2U1hwUlIyZE5jRk5TT0hKUVkzZHdSMWRCU0ZwWldIcFBXWEZUYjBZMk1raDNPR05SUWpkSVMyMTNJbjAiLCJpc3N1YW5jZURhdGUiOiIyMDI0LTA4LTI4VDEzOjE2OjAwLjcyMjgxOSswMDowMCIsImV4cGlyYXRpb25EYXRlIjpudWxsLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSJ9fSwiaXNzIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKdlNYcFJSMmROY0ZOU09ISlFZM2R3UjFkQlNGcFpXSHBQV1hGVGIwWTJNa2gzT0dOUlFqZElTMjEzSW4wIiwianRpIjoidXJuOnV1aWQ6ZGFkM2Y2MjktMzFiMS00NDcxLWFhYTMtMWE4MGZjN2I1YmU2Iiwic3ViIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5IiwibmJmIjoxNzI0ODUwOTYwLCJpYXQiOjE3MjQ4NTA5NjB9.P8-Z3KsMxIk7-Dz9a5odVhbGJZtWsWp4mDVYLlVxuZTNJl-Km-j2S1KusTjRTDkg1DqQoiVvp2Is0kr5WoAFBA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMismatchId, true) } - assertEquals("claim mismatch: id", exception.msg) + assertEquals("claim mismatch: id", exception.message) } @Test @@ -937,11 +937,11 @@ class VerifiableCredentialTest { val vcJwtWithMismatchIssuer = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSI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btjZfMf8DVhdgBoj9M0JOgJqCDFCzwcS5weVCpNAv3gN72Qo32RH9Tx0eYyoDA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMismatchIssuer, true) } - assertEquals("claim mismatch: issuer", exception.msg) + assertEquals("claim mismatch: issuer", exception.message) } @Test @@ -950,11 +950,11 @@ class VerifiableCredentialTest { val vcJwtWithMismatchSubject = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSXdVRmh0UkVNMlNIWnVia1E0Vmw5QkxWbDVSelZ1TWtSa2IxQkdTVFkxY2tkb2MwVTVZWFZsWW5CckluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjAwNDJiYTQ4LWU0ZGYtNGVhMS04ZmJjLWJjYmI4ODY3ZjFhMCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lJd1VGaHRSRU0yU0hadWJrUTRWbDlCTFZsNVJ6VnVNa1JrYjFCR1NUWTFja2RvYzBVNVlYVmxZbkJySW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzoxOToxMC4xNjM0ODkrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJzb21ldGhpbmcgaW52YWxpZCJ9fSwiaXNzIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lJd1VGaHRSRU0yU0hadWJrUTRWbDlCTFZsNVJ6VnVNa1JrYjFCR1NUWTFja2RvYzBVNVlYVmxZbkJySW4wIiwianRpIjoidXJuOnV1aWQ6MDA0MmJhNDgtZTRkZi00ZWExLThmYmMtYmNiYjg4NjdmMWEwIiwic3ViIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5IiwibmJmIjoxNzI0ODUxMTUwLCJpYXQiOjE3MjQ4NTExNTB9.bAm9kKJX2-Rcw679VS7cUPbqg9awuq5Lwu9wiZoGcE0TCSc59rQTIP4nvxlP22o3V-VVs_DbfpJU-qB4duDSCA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMismatchSubject, true) } - assertEquals("claim mismatch: subject", exception.msg) + assertEquals("claim mismatch: subject", exception.message) } @Test @@ -963,11 +963,11 @@ class VerifiableCredentialTest { val vcJwtWithMisconfiguredExp = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnJkWFI2V21WM01EVTBMVlUwUVRBM2FsYzJZbkkxUlV4NU1UQlpOSGxPVTFCaVkyOTNXakJ3TjJWakluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjYxZjgwM2I4LWUxMDQtNDdhOC04YWE1LTk4YzQ1ZTFiOGUzMSIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKcmRYUjZXbVYzTURVMExWVTBRVEEzYWxjMlluSTFSVXg1TVRCWk5IbE9VMUJpWTI5M1dqQndOMlZqSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzoyMzo0My45NDg4MzQrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjktMDgtMjJUMTM6MjM6NDMuOTQ4NzYwKzAwOjAwIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnJkWFI2V21WM01EVTBMVlUwUVRBM2FsYzJZbkkxUlV4NU1UQlpOSGxPVTFCaVkyOTNXakJ3TjJWakluMCIsImp0aSI6InVybjp1dWlkOjYxZjgwM2I4LWUxMDQtNDdhOC04YWE1LTk4YzQ1ZTFiOGUzMSIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MTQyMywiaWF0IjoxNzI0ODUxNDIzfQ.AWYyvLRISXwLH5gAXb5CcwBXNwaRKwacGqstXjnk-xIHx9gmm5xj8zGONvcKE2Xx0t9j3pNHicrhkp5wcOkABQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMisconfiguredExp, true) } - assertEquals("misconfigured expiration date: VC has expiration date but no exp in registered claims", exception.msg) + assertEquals("misconfigured expiration date: VC has expiration date but no exp in registered claims", exception.message) } @Test @@ -976,11 +976,11 @@ class VerifiableCred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VMk1Hc3pZMGgzVTJ0ckluMCIsImp0aSI6InVybjp1dWlkOjRhMjA2YmMzLWZmOTYtNDMwNS1iMzM4LTJiZGQ1ODRiYzkyOSIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MTY1MywiaWF0IjoxNzI0ODUxNjUzLCJleHAiOjE4ODUxMjM2NTN9.lAaTG8RhL2D92iNI6psZrv1uhtHYAO0m0AacGIQrW0XIThg-Livef36_CN9t4Lz2Ta5US2Be2VP6D3lCA-z1DQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithMismatchExp, true) } - assertEquals("claim mismatch: expiration_date", exception.msg) + assertEquals("claim mismatch: expiration_date", exception.message) } @Test @@ -989,11 +989,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptyId = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSmxja0pYTmpoTVpXWlVZbGhEU0Zwck5VeG5OVVl5U3pSalJrVmlNVmhNYlVWa1VVNWxTbVJKV2pkTkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6IiIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKbGNrSlhOamhNWldaVVlsaERTRnByTlV4bk5VWXlTelJqUmtWaU1WaE1iVVZrVVU1bFNtUkpXamROSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzozMDo1My44NDQ2ODMrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjktMDgtMjJUMTM6MzA6NTMuODQ0NjMwKzAwOjAwIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSmxja0pYTmpoTVpXWlVZbGhEU0Zwck5VeG5OVVl5U3pSalJrVmlNVmhNYlVWa1VVNWxTbVJKV2pkTkluMCIsImp0aSI6IiIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MTg1MywiaWF0IjoxNzI0ODUxODUzLCJleHAiOjE4ODIwOTk4NTN9.X_jkleLbhdAo0vm7KtN0qr6nR6hvWrXxk08UslfZAhZCkDN2kqLvWhoHps3GNznmGAuhJxwhZ0SN60OV7pp1DQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptyId, true) } - assertEquals("data model validation error: missing id", exception.msg) + assertEquals("data model validation error: missing id", exception.message) } @Test @@ -1002,11 +1002,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptyContext = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSjFSbXRGTVdkblNGcENaME4yY1doa1VqRkJZelZqUkd0Q2IybDFRMnhOYm5CTVVFNDRYM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zAw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptyContext, true) } - assertEquals("data model validation error: missing context", exception.msg) + assertEquals("data model validation error: missing context", exception.message) } @Test @@ -1015,11 +1015,11 @@ class VerifiableCredentialTest { val vcJwtWithoutBaseContext = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnFSVWRmU1V4TlZDMVVUMGgyTjIxeFJ6UlJWVmRMTWs1dU9FcGlUVU5OWldKQ1pXVjRkVGxIYlhWWkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJhIGNvbnRleHQiXSwiaWQiOiJ1cm46dXVpZDo4N2VmMDI1MC0yYWE2LTQyNTctYjIxMi0xYzAyMWFhZDY2Y2YiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImlzc3VlciI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnFSVWRmU1V4TlZDMVVUMGgyTjIxeFJ6UlJWVmRMTWs1dU9FcGlUVU5OWldKQ1pXVjRkVGxIYlhWWkluMCIsImlzc3VhbmNlRGF0ZSI6IjIwMjQtMDgtMjhUMTM6MzQ6MjcuODk4MDkwKzAwOjAwIiwiZXhwaXJhdGlvbkRhdGUiOm51bGwsImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5In19LCJpc3MiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpESTFOVEU1SWl3aWEzUjVJam9pVDB0UUlpd2lZM0oySWpvaVJXUXlOVFV4T1NJc0luZ2lPaUpxUlVkZlNVeE5WQzFVVDBoMk4yMXhSelJSVlZkTE1rNXVPRXBpVFVOTlpXSkNaV1Y0ZFRsSGJYVlpJbjAiLCJqdGkiOiJ1cm46dXVpZDo4N2VmMDI1MC0yYWE2LTQyNTctYjIxMi0xYzAyMWFhZDY2Y2YiLCJzdWIiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkiLCJuYmYiOjE3MjQ4NTIwNjcsImlhdCI6MTcyNDg1MjA2N30.cgkGQF5CXqHw_C1KNaKLFeIzPzmBuWRzRk-7KgvEYc1jJzwoXoOWB6cn-8I3MjWAgd_NeM1Yt656lJ60gy0RAQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithoutBaseContext, true) } - assertEquals("data model validation error: missing context", exception.msg) + assertEquals("data model validation error: missing context", exception.message) } @Test @@ -1028,11 +1028,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptyType = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSTJSV2Q2T0RZeGExRjNVMTh3U25SWVVqQlJha3BtWldOemQyVkJiRWN3UzBadGMwZGxUa0ZoZVdwQkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmNmNjQ1MTNiLTIwODQtNDliNC1iNWMzLTgxZTk1ODNjOTcyOCIsInR5cGUiOltdLCJpc3N1ZXIiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpESTFOVEU1SWl3aWEzUjVJam9pVDB0UUlpd2lZM0oySWpvaVJXUXlOVFV4T1NJc0luZ2lPaUkyUldkNk9EWXhhMUYzVTE4d1NuUllVakJSYWtwbVpXTnpkMlZCYkVjd1MwWnRjMGRsVGtGaGVXcEJJbjAiLCJpc3N1YW5jZURhdGUiOiIyMDI0LTA4LTI4VDEzOjM1OjM2LjkxMzQyNyswMDowMCIsImV4cGlyYXRpb25EYXRlIjpudWxsLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSJ9fSwiaXNzIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lJMlJXZDZPRFl4YTFGM1UxOHdTblJZVWpCUmFrcG1aV056ZDJWQmJFY3dTMFp0YzBkbFRrRmhlV3BCSW4wIiwianRpIjoidXJuOnV1aWQ6Y2Y2NDUxM2ItMjA4NC00OWI0LWI1YzMtODFlOTU4M2M5NzI4Iiwic3ViIjoiZGlkOmRodDpxZ21tcHlqdzVod25xZmd6bjd3bXJtMzNhZHk4Z2I4ejlpZGVpYjZtOWdqNHlzNndueTh5IiwibmJmIjoxNzI0ODUyMTM2LCJpYXQiOjE3MjQ4NTIxMzZ9.EY1q2nZHnPk-hnzdScvf6QYA0ko_sshHWOnPxU9tkU-RhxdklRoO9JQgmoHZC1FdDgEfgs4nDFNUKyX-FlJPBw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptyType, true) } - assertEquals("data model validation error: missing type", exception.msg) + assertEquals("data model validation error: missing type", exception.message) } @Test @@ -1041,11 +1041,11 @@ class VerifiableCredentialTest { val vcJwtWithoutBaseType = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aV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mYiOjE3MjQ4NTIxOTUsImlhdCI6MTcyNDg1MjE5NX0.S3vchUrNfdgXTQFeu7HcI5F0ZdkQdYkd4IqAXF8_uhcOe_sX9joDWspBSxwP3BY6ESCPIpJoms_dPIp01RWABA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithoutBaseType, true) } - assertEquals("data model validation error: missing type", exception.msg) + assertEquals("data model validation error: missing type", exception.message) } @Test @@ -1054,11 +1054,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptyIssuer = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnRPSEZRTVhoR1p6RndZMlpqZUY5UWVrUnJOMjFPYVhoak9YQTFWamN4WlVZelYwRTViSGwzTWpsckluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmFhMmNjNWNkLTg4N2QtNDFkMi1iZTM3LTIzMjMxMGVkODdjMiIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzozOToxNS42MjMzOTMrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6IiIsImp0aSI6InVybjp1dWlkOmFhMmNjNWNkLTg4N2QtNDFkMi1iZTM3LTIzMjMxMGVkODdjMiIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MjM1NSwiaWF0IjoxNzI0ODUyMzU1fQ.mRYZKF3qNz_Vyg8xpemuBOipGLOliYy9xJ6b9ZqcMNjZbb8GtEyiaBv8rgF2jqmHreRT71wHaT3P6mV9GsQOCA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptyIssuer, true) } - assertEquals("data model validation error: missing issuer", exception.msg) + assertEquals("data model validation error: missing issuer", exception.message) } @Test @@ -1067,11 +1067,11 @@ class VerifiableCredentialTest { val vcJwtWithEmptySubject = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnpOakV6U1hobGFWWk9WMW81YzBaM1NrdE1OSEI2WkdaRlRsWXRWVEZxYkMweVNIcFpXV2hCUWxWM0luMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjNkNGMzMjQxLWU0NDUtNGE2Ny1hYmE0LTIxYjBmM2NkMmMxYyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKek5qRXpTWGhsYVZaT1YxbzVjMFozU2t0TU5IQjZaR1pGVGxZdFZURnFiQzB5U0hwWldXaEJRbFYzSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0yOFQxMzo0MToxMC4xNzM2NzIrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiIifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSnpOakV6U1hobGFWWk9WMW81YzBaM1NrdE1OSEI2WkdaRlRsWXRWVEZxYkMweVNIcFpXV2hCUWxWM0luMCIsImp0aSI6InVybjp1dWlkOjNkNGMzMjQxLWU0NDUtNGE2Ny1hYmE0LTIxYjBmM2NkMmMxYyIsInN1YiI6IiIsIm5iZiI6MTcyNDg1MjQ3MCwiaWF0IjoxNzI0ODUyNDcwfQ.Ek9NMfHyb8BzJ7GnV0JRQPVl-UQyMOCMZ2_ABMx9Cvh8d8T81wMjrYUPp6v57-veqKntYFO_WZciL2FC_VZWAw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithEmptySubject, true) } - assertEquals("data model validation error: missing credential subject", exception.msg) + assertEquals("data model validation error: missing credential subject", exception.message) } @Test @@ -1080,11 +1080,11 @@ class VerifiableCredentialTest { val vcJwtWithIssuanceDateInFuture = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSmhhazFPTms1Zk1rOVRWbVl5TFdGd1VsOW1VbWRwVG1OMVNVMXphVWMzTVhaM2FYVnBVSGd4YTFOTkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjJiODhmMDhmLTVkOGItNDJiYS1iYmY0LTg4MjU1MjlmOGE2NyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKaGFrMU9OazVmTWs5VFZtWXlMV0Z3VWw5bVVtZHBUbU4xU1UxemFVYzNNWFozYVhWcFVIZ3hhMU5OSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyOS0wOC0yMlQxMzo0Mjo1Ni43OTA2OTcrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSmhhazFPTms1Zk1rOVRWbVl5TFdGd1VsOW1VbWRwVG1OMVNVMXphVWMzTVhaM2FYVnBVSGd4YTFOTkluMCIsImp0aSI6InVybjp1dWlkOjJiODhmMDhmLTVkOGItNDJiYS1iYmY0LTg4MjU1MjlmOGE2NyIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTg4MjEwMDU3NiwiaWF0IjoxNzI0ODUyNTc2fQ.QM4LHyJ8wW1_A0PcuhpsorI3FOA9NLX9-u7a6MkAMXrQoxwNFIfHZeHuwLGVBshmco2emUievVAfKWUQFpOvBQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithIssuanceDateInFuture, true) } - assertEquals("data model validation error: issuance date in future", exception.msg) + assertEquals("data model validation error: issuance date in future", exception.message) } @Test @@ -1093,11 +1093,11 @@ class VerifiableCredentialTest { val vcJwtWithExpired = "eyJ0eXAiOiJKV1Q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dWlkOmFkNzBmN2Y2LWExNTctNGYxZi1hZjI5LTdjYmJkNDRmODlmMCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNDg1MjY2NywiaWF0IjoxNzI0ODUyNjY3LCJleHAiOjE1Njc2MDQ2Njd9.pP_8QVzTqxuhUlIWpXDWQ3Py_VlDA4uX82xdD9GOdmRT2UK-K5Gn7A5qdUxBPhXifiRVnH_Q8NbWZCUQ8jZUBg" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithExpired, true) } - assertEquals("data model validation error: credential expired", exception.msg) + assertEquals("data model validation error: credential expired", exception.message) } @Test @@ -1106,11 +1106,11 @@ class VerifiableCredentialTest { val vcJwtWithWrongSchemaType = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSXhlbTlYY0VWTWN6TnhiV0p5VW5GblRFbzBjbDlCZUhCYVNFSmpjMUZJVGtSaVRGYzBOM1JmVGpkSkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjQ1NGY1NWJmLWYzMjAtNDQyOS1iNmViLTRkMzdlNTMzNDkwYyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lJeGVtOVhjRVZNY3pOeGJXSnlVbkZuVEVvMGNsOUJlSEJhU0VKamMxRklUa1JpVEZjME4zUmZUamRKSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOC0zMFQxNTowMjo1NC4zNjg1NjMrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJ0eXBlIjoic29tZXRoaW5nIGludmFsaWFkIn19LCJpc3MiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpESTFOVEU1SWl3aWEzUjVJam9pVDB0UUlpd2lZM0oySWpvaVJXUXlOVFV4T1NJc0luZ2lPaUl4ZW05WGNFVk1jek54YldKeVVuRm5URW8wY2w5QmVIQmFTRUpqYzFGSVRrUmlURmMwTjNSZlRqZEpJbjAiLCJqdGkiOiJ1cm46dXVpZDo0NTRmNTViZi1mMzIwLTQ0MjktYjZlYi00ZDM3ZTUzMzQ5MGMiLCJzdWIiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkiLCJuYmYiOjE3MjUwMzAxNzQsImlhdCI6MTcyNTAzMDE3NH0.8gxVx3_Qd1Lvao-y5PZ56XS3lMQvrFtBVMgfNDIdW9eoQkBQMNv79YKIxFCig0LHanzg_vyzX7tBviW6xJUuDw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithWrongSchemaType, true) } - assertEquals("parameter error type must be JsonSchema", exception.msg) + assertEquals("parameter error type must be JsonSchema", exception.message) } @Test @@ -1119,11 +1119,11 @@ class VerifiableCredentialTest { val vcJwtWithInvalidUrl = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaG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2YxLTMzM2ItNDg4OC1hMDc5LTdkMGU1N2JiZmFlZiIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTAzMDMyMCwiaWF0IjoxNzI1MDMwMzIwfQ.3sH7qzI7QrQMdkWIvqf7k8Mr2dMGjWBLrv4QB8gEz0t83RSFMtG-fWT-YVkUlo1qMvC4gNjT2Jc0eObCAA7VDQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtWithInvalidUrl, true) } - assertTrue(exception.msg.contains("unable to resolve json schema")) + assertTrue(exception.message.contains("unable to resolve json schema")) } @Test @@ -1140,11 +1140,11 @@ class VerifiableCredentialTest { val vcJwtAtPort = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSm9jMmhVZEU4M2F5MVNjVE5oVWtWR1lUVTRhUzFoWlZVdGRWaHNUVXB4UkdkallteEhhMTlpTW5OM0luMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOmE5Nzk1YTdmLTRmNzktNDU3OC1hYTkxLTcwYmYxM2YxZWVkNiIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKb2MyaFVkRTgzYXkxU2NUTmhVa1ZHWVRVNGFTMWhaVlV0ZFZoc1RVcHhSR2RqWW14SGExOWlNbk4zSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOS0wM1QxNTo0MDowMS4wNDg1MzIrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMDEvc2NoZW1hcy9lbWFpbC5qc29uIiwidHlwZSI6Ikpzb25TY2hlbWEifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSm9jMmhVZEU4M2F5MVNjVE5oVWtWR1lUVTRhUzFoWlZVdGRWaHNUVXB4UkdkallteEhhMTlpTW5OM0luMCIsImp0aSI6InVybjp1dWlkOmE5Nzk1YTdmLTRmNzktNDU3OC1hYTkxLTcwYmYxM2YxZWVkNiIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODAwMSwiaWF0IjoxNzI1Mzc4MDAxfQ.9739UnhTfGXr2tsbsjun7FQfFuXNtqmzfxhP_okbywVDoh6nsBGk8smLUU_D0VYwtiMBTo1ujDs1QtKPbCZDDA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertTrue(exception.msg.contains("non-200 response when resolving json schema")) + assertTrue(exception.message.contains("non-200 response when resolving json schema")) mockWebServer.shutdown() } @@ -1164,11 +1164,11 @@ class VerifiableCredentialTest { val vcJwtAtPort = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPa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blJXUTA1QkluMCIsImp0aSI6InVybjp1dWlkOmQ1NmYxMzRjLThjN2QtNDkyOC04OWYwLWQ5NWEzYjllZmU3YiIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODIzOCwiaWF0IjoxNzI1Mzc4MjM4fQ.vYZ5YeXa4ZXaomhVp2obgJwlgjwScFctNAJBqTf2hJOUr1v-jN1C5huK4JL_e16_dRCJd_ysmiOpgFOJD2MOCQ" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertTrue(exception.msg.contains("unable to parse json schema from response body")) + assertTrue(exception.message.contains("unable to parse json schema from response body")) mockWebServer.shutdown() } @@ -1208,11 +1208,11 @@ class VerifiableCredentialTest { val vcJwtAtPort = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSlRNemRDWVdaR01FTnRla2xmVTJ4WlEyTXlNSHBKZGt4eVprTnFjM1ptTUVWUWFtbDVkV2N5Wmt0WkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjJjZWFmODUxLTBiYzktNDFkYy04NzNmLThhMGMyN2Y0ZDZkOCIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKVE16ZENZV1pHTUVOdGVrbGZVMnhaUTJNeU1IcEpka3h5WmtOcWMzWm1NRVZRYW1sNWRXY3laa3RaSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOS0wM1QxNTo0NTozMC4zMDY4MDYrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMDMvc2NoZW1hcy9lbWFpbC5qc29uIiwidHlwZSI6Ikpzb25TY2hlbWEifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSlRNemRDWVdaR01FTnRla2xmVTJ4WlEyTXlNSHBKZGt4eVprTnFjM1ptTUVWUWFtbDVkV2N5Wmt0WkluMCIsImp0aSI6InVybjp1dWlkOjJjZWFmODUxLTBiYzktNDFkYy04NzNmLThhMGMyN2Y0ZDZkOCIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODMzMCwiaWF0IjoxNzI1Mzc4MzMwfQ.Drh8iEOdWWeL6l9KdmKMv9qfbBxWln-TW0KNwOJN3lZatyaSkwlBO_1o2FIWj0WIDiD_TP2EestMFazf4XFQDA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertTrue(exception.msg.contains("unable to compile json schema")) + assertTrue(exception.message.contains("unable to compile json schema")) mockWebServer.shutdown() } @@ -1252,11 +1252,11 @@ class VerifiableCredentialTest { val vcJwtAtPort = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsIm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iVWhhVXpNNVpEZEtlalUxUm0xU2R6WkVjbmswVkRjd0luMCIsImp0aSI6InVybjp1dWlkOmYzNDc3ZDdkLWJiOWUtNGI5Ny1iYjhkLTk4NDMwNjgzN2RmMyIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODQ2MSwiaWF0IjoxNzI1Mzc4NDYxfQ.X7pZBMqPeBO0oTq1QNtMcSrYcIpDxCavPEoPDiB1A9GOqCohx7KCgOerXaJGSyklAkmNJod7ssmL4DMM-l3uDA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertEquals("json schema error draft unsupported Draft4", exception.msg) + assertEquals("json schema error draft unsupported Draft4", exception.message) mockWebServer.shutdown() } @@ -1296,11 +1296,11 @@ class VerifiableCredentialTest { val vcJwtAtPort = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSkhSemxDUVU1QlpXUkplR2RpYzJkVlprOWZRWFpPWVZsWmFHMWxZbmhXYWpOZlVuQnBWREp4ZG5WVkluMCMwIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJpZCI6InVybjp1dWlkOjQ4MGM0ZjQ5LTAyMmEtNDIwMi1hYjFiLTc1ZThjZjQ1NDEyMyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaREkxTlRFNUlpd2lhM1I1SWpvaVQwdFFJaXdpWTNKMklqb2lSV1F5TlRVeE9TSXNJbmdpT2lKSFJ6bENRVTVCWldSSmVHZGljMmRWWms5ZlFYWk9ZVmxaYUcxbFluaFdhak5mVW5CcFZESnhkblZWSW4wIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOS0wM1QxNTo0ODo1MC4wNjM4NjIrMDA6MDAiLCJleHBpcmF0aW9uRGF0ZSI6bnVsbCwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZGh0OnFnbW1weWp3NWh3bnFmZ3puN3dtcm0zM2FkeThnYjh6OWlkZWliNm05Z2o0eXM2d255OHkifSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMDUvc2NoZW1hcy9lbWFpbC5qc29uIiwidHlwZSI6Ikpzb25TY2hlbWEifX0sImlzcyI6ImRpZDpqd2s6ZXlKaGJHY2lPaUpGWkRJMU5URTVJaXdpYTNSNUlqb2lUMHRRSWl3aVkzSjJJam9pUldReU5UVXhPU0lzSW5naU9pSkhSemxDUVU1QlpXUkplR2RpYzJkVlprOWZRWFpPWVZsWmFHMWxZbmhXYWpOZlVuQnBWREp4ZG5WVkluMCIsImp0aSI6InVybjp1dWlkOjQ4MGM0ZjQ5LTAyMmEtNDIwMi1hYjFiLTc1ZThjZjQ1NDEyMyIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODUzMCwiaWF0IjoxNzI1Mzc4NTMwfQ.Id6rsvMkqjocv6x5g_s8fnfR74HdXIpIdL3bMR33f1FYPFQ9CZRArMc1ZTh3xL3QfUggY8AUkRraQSAJh_onBA" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertEquals("json schema error draft unsupported Draft6", exception.msg) + assertEquals("json schema error draft unsupported Draft6", exception.message) mockWebServer.shutdown() } @@ -1340,11 +1340,11 @@ class VerifiableCredentialTest { val vc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0lzSW5naU9pSnBlRkpyUVhodk5GTmtVMXAwTW1VMGFWQm5WRTV0T1dnelFYWnJYMU42Wm1WUlNVeFNkbFJHU0RSSkluMCIsImp0aSI6InVybjp1dWlkOmY4NThhZGM2LTZhMDQtNDY5ZC04MGJiLWM2MmI1N2MyNWI5NSIsInN1YiI6ImRpZDpkaHQ6cWdtbXB5anc1aHducWZnem43d21ybTMzYWR5OGdiOHo5aWRlaWI2bTlnajR5czZ3bnk4eSIsIm5iZiI6MTcyNTM3ODYzOSwiaWF0IjoxNzI1Mzc4NjM5fQ.zxz0OZO1umdlxgRyrwyMJis4t4esE_7Zo6nma4Q8T4josAkw6vnQJFI_cPoZV4usQ1vve5bB5OOiMcf_tca6Cw" - val exception = assertThrows { + val exception = assertThrows { VerifiableCredential.fromVcJwt(vcJwtAtPort, true) } - assertTrue(exception.msg.contains("validation errors")) + assertTrue(exception.message.contains("validation errors")) mockWebServer.shutdown() } @@ -1435,13 +1435,13 @@ class VerifiableCredentialTest { ) val differentBearerDid = DidJwk.create() - val exception = assertThrows { + val exception = assertThrows { vc.sign(differentBearerDid, null) } assertEquals( "parameter error Bearer DID URI ${differentBearerDid.did.uri} does not match issuer ${bearerDid.did.uri}", - exception.msg + exception.message ) } @@ -1484,13 +1484,13 @@ class VerifiableCredentialTest { keyManager = bearerDid.keyManager ) - val exception = assertThrows { + val exception = assertThrows { vc.sign(modifiedBearerDid, vmId) } assertEquals( "parameter error verification_method_id $vmId is not an assertion_method", - exception.msg + exception.message ) } } From 350bf593c00db2d8cfaeafb77090aad3c49ff549 Mon Sep 17 00:00:00 2001 From: Kendall Weihe Date: Wed, 4 Sep 2024 09:19:55 -0400 Subject: [PATCH 2/3] Add missing skip_serialization --- crates/web5/src/credentials/jwt_payload_vc.rs | 2 +- crates/web5/src/credentials/verifiable_credential_1_1.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/web5/src/credentials/jwt_payload_vc.rs b/crates/web5/src/credentials/jwt_payload_vc.rs index a805b708..6afcdac4 100644 --- a/crates/web5/src/credentials/jwt_payload_vc.rs +++ b/crates/web5/src/credentials/jwt_payload_vc.rs @@ -31,7 +31,7 @@ pub struct JwtPayloadVerifiableCredential { deserialize_with = "deserialize_optional_system_time" )] pub expiration_date: Option, - #[serde(rename = "credentialStatus")] + #[serde(rename = "credentialStatus", skip_serializing_if = "Option::is_none")] pub credential_status: Option, #[serde(skip_serializing_if = "Option::is_none", rename = "credentialSubject")] pub credential_subject: Option, diff --git a/crates/web5/src/credentials/verifiable_credential_1_1.rs b/crates/web5/src/credentials/verifiable_credential_1_1.rs index dcd6e7b7..adc504ac 100644 --- a/crates/web5/src/credentials/verifiable_credential_1_1.rs +++ b/crates/web5/src/credentials/verifiable_credential_1_1.rs @@ -42,7 +42,7 @@ pub struct VerifiableCredential { deserialize_with = "deserialize_optional_system_time" )] pub expiration_date: Option, - #[serde(rename = "credentialStatus")] + #[serde(rename = "credentialStatus", skip_serializing_if = "Option::is_none")] pub credential_status: Option, #[serde(rename = "credentialSchema", skip_serializing_if = "Option::is_none")] pub credential_schema: Option, From bb5326d9559270fb57a4fc4434740b492d870988 Mon Sep 17 00:00:00 2001 From: Kendall Weihe Date: Wed, 4 Sep 2024 09:25:38 -0400 Subject: [PATCH 3/3] Remove redundant catch, add try/catch to status list creds --- .../web5/sdk/crypto/Ed25519Generator.kt | 2 -- .../sdk/crypto/keys/InMemoryKeyManager.kt | 6 ----- .../main/kotlin/web5/sdk/crypto/keys/Jwk.kt | 2 -- .../web5/sdk/crypto/signers/Ed25519Signer.kt | 2 -- .../sdk/crypto/verifiers/Ed25519Verifier.kt | 2 -- .../main/kotlin/web5/sdk/dids/BearerDid.kt | 8 ------- bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt | 2 -- .../src/main/kotlin/web5/sdk/dids/Document.kt | 4 ---- .../main/kotlin/web5/sdk/dids/PortableDid.kt | 6 ----- .../kotlin/web5/sdk/dids/ResolutionResult.kt | 2 -- .../web5/sdk/dids/methods/dht/DidDht.kt | 6 ----- .../web5/sdk/dids/methods/jwk/DidJwk.kt | 4 ---- .../web5/sdk/dids/methods/web/DidWeb.kt | 4 ---- .../web5/sdk/vc/StatusListCredential.kt | 22 ++++++++++++++----- .../web5/sdk/vc/VerifiableCredential.kt | 6 ----- .../web5/sdk/vc/pex/PresentationDefinition.kt | 2 -- 16 files changed, 16 insertions(+), 64 deletions(-) diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt index bc6bdd23..9390a29c 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/Ed25519Generator.kt @@ -21,8 +21,6 @@ class Ed25519Generator { return Jwk.fromRustCoreJwkData(rustCoreJwkData) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt index 48f746d5..5b25c7e4 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/InMemoryKeyManager.kt @@ -32,8 +32,6 @@ class InMemoryKeyManager (privateJwks: List) : KeyManager, KeyExporter { return Jwk.fromRustCoreJwkData(rustCoreJwkData) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -49,8 +47,6 @@ class InMemoryKeyManager (privateJwks: List) : KeyManager, KeyExporter { return ToOuterSigner(rustCoreSigner) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -60,8 +56,6 @@ class InMemoryKeyManager (privateJwks: List) : KeyManager, KeyExporter { return rustCorePrivateJwksData.map { Jwk.fromRustCoreJwkData(it) } } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt index faf9dd5a..28c31bc4 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/keys/Jwk.kt @@ -45,8 +45,6 @@ data class Jwk ( return rustCoreJwk.computeThumbprint() } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt index 735fb465..0438e978 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/signers/Ed25519Signer.kt @@ -22,8 +22,6 @@ class Ed25519Signer(privateJwk: Jwk) : Signer { return rustCoreSigner.sign(payload) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt b/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt index 142ba79d..f19da16b 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/crypto/verifiers/Ed25519Verifier.kt @@ -23,8 +23,6 @@ class Ed25519Verifier(publicJwk: Jwk) : Verifier { rustCoreVerifier.verify(message, signature) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt index 497e6f35..2e9170af 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/BearerDid.kt @@ -36,8 +36,6 @@ data class BearerDid private constructor( ) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } ) @@ -53,8 +51,6 @@ data class BearerDid private constructor( return fromRustCoreBearerDid(rustCoreBearerDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -79,8 +75,6 @@ data class BearerDid private constructor( return ToOuterSigner(rustCoreSigner) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -94,8 +88,6 @@ data class BearerDid private constructor( return PortableDid.fromRustCorePortableDid(rustCorePortableDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt index 9ccab8fb..df76c894 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/Did.kt @@ -26,8 +26,6 @@ data class Did ( return fromRustCoreDidData(data) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt index feb54667..97fccc3f 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/Document.kt @@ -26,8 +26,6 @@ data class Document( return fromRustCore(web5.sdk.rust.Document.fromJsonString(json).getData()) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -53,8 +51,6 @@ data class Document( return web5.sdk.rust.Document(toRustCore()).toJsonString() } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt index e6d3fdf2..44afbdd7 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/PortableDid.kt @@ -23,8 +23,6 @@ data class PortableDid private constructor( ) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } ) @@ -40,8 +38,6 @@ data class PortableDid private constructor( return fromRustCorePortableDid(rustCorePortableDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -64,8 +60,6 @@ data class PortableDid private constructor( return rustCorePortableDid.toJsonString() } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt index 4cfd1e29..3064793a 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/ResolutionResult.kt @@ -18,8 +18,6 @@ data class ResolutionResult( return fromRustCoreResolutionResult(rustCoreResolutionResult) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt index 55bb7386..b20447fd 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/dht/DidDht.kt @@ -47,8 +47,6 @@ class DidDht { return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -63,8 +61,6 @@ class DidDht { web5.sdk.rust.didDhtPublish(bearerDid.rustCoreBearerDid, gatewayUrl) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -81,8 +77,6 @@ class DidDht { return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt index 85d80610..682c4c4c 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/jwk/DidJwk.kt @@ -38,8 +38,6 @@ class DidJwk { return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -56,8 +54,6 @@ class DidJwk { return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt index f6c090e4..bf7bcaf0 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/dids/methods/web/DidWeb.kt @@ -49,8 +49,6 @@ class DidWeb { return BearerDid.fromRustCoreBearerDid(rustCoreBearerDid) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -67,8 +65,6 @@ class DidWeb { return ResolutionResult.fromRustCoreResolutionResult(rustCoreResolutionResult) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/vc/StatusListCredential.kt b/bound/kt/src/main/kotlin/web5/sdk/vc/StatusListCredential.kt index f5792aca..d1ace6a3 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/vc/StatusListCredential.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/vc/StatusListCredential.kt @@ -1,6 +1,8 @@ package web5.sdk.vc import web5.sdk.Json +import web5.sdk.Web5Exception +import web5.sdk.rust.Web5Exception.Exception as RustCoreException import web5.sdk.rust.StatusListCredential as RustCoreStatusListCredential data class StatusListCredential( @@ -13,18 +15,26 @@ data class StatusListCredential( statusPurpose: String, credentialsToDisable: List? = null ): StatusListCredential { - val jsonSerializedIssuer = Json.stringify(issuer) - val rustCoreCredentials = credentialsToDisable?.map { it.rustCoreVerifiableCredential } + try { + val jsonSerializedIssuer = Json.stringify(issuer) + val rustCoreCredentials = credentialsToDisable?.map { it.rustCoreVerifiableCredential } - val rustCoreStatusListCredential = RustCoreStatusListCredential.create(jsonSerializedIssuer, statusPurpose, rustCoreCredentials) + val rustCoreStatusListCredential = RustCoreStatusListCredential.create(jsonSerializedIssuer, statusPurpose, rustCoreCredentials) - val baseVerifiableCredential = VerifiableCredential.fromRustCore(rustCoreStatusListCredential.getBase()) + val baseVerifiableCredential = VerifiableCredential.fromRustCore(rustCoreStatusListCredential.getBase()) - return StatusListCredential(baseVerifiableCredential, rustCoreStatusListCredential) + return StatusListCredential(baseVerifiableCredential, rustCoreStatusListCredential) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } } } fun isDisabled(credential: VerifiableCredential): Boolean { - return rustCoreStatusListCredential.isDisabled(credential.rustCoreVerifiableCredential) + try { + return rustCoreStatusListCredential.isDisabled(credential.rustCoreVerifiableCredential) + } catch (e: RustCoreException) { + throw Web5Exception.fromRustCore(e) + } } } \ No newline at end of file diff --git a/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt b/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt index 02f57b44..3a4b112b 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/vc/VerifiableCredential.kt @@ -117,8 +117,6 @@ data class VerifiableCredential private constructor( ) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } @@ -146,8 +144,6 @@ data class VerifiableCredential private constructor( ) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } @@ -157,8 +153,6 @@ data class VerifiableCredential private constructor( return rustCoreVerifiableCredential.sign(bearerDid.rustCoreBearerDid, verificationMethodId) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } } diff --git a/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt b/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt index b8649b4e..02ca3451 100644 --- a/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt +++ b/bound/kt/src/main/kotlin/web5/sdk/vc/pex/PresentationDefinition.kt @@ -22,8 +22,6 @@ data class PresentationDefinition( return this.rustCorePresentationDefinition.selectCredentials(vcJwts) } catch (e: RustCoreException) { throw Web5Exception.fromRustCore(e) - } catch (e: Exception) { - throw e } } }