Object DidJwk

  • All Implemented Interfaces:

    
    public class DidJwk
    
                        

    Provides a specific implementation for creating and resolving "did:jwk" method Decentralized Identifiers (DIDs).

    A "did:jwk" DID is a special type of DID that is formulated directly from a single public key. It's utilized in scenarios where it's beneficial for verifiable credentials, capabilities, or other assertions about a subject to be self-verifiable by third parties. This eradicates the necessity for a separate blockchain or ledger. Further specifics and technical details are outlined in the DID Jwk Spec.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final BearerDid create(KeyManager keyManager, AlgorithmId algorithmId) Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.
      final BearerDid create(KeyManager keyManager) Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.
      final BearerDid create() Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.
      final BearerDid import(PortableDid portableDid, KeyManager keyManager) Instantiates a BearerDid object for the DID JWK method from a given PortableDid.
      final DidResolutionResult resolve(String did) Resolves a "did:jwk" DID into a DidResolutionResult, which contains the DID Document and possible related metadata.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • create

        @JvmOverloads() final BearerDid create(KeyManager keyManager, AlgorithmId algorithmId)

        Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.

        The method-specific identifier of a "did:jwk" DID is a base64url encoded json web key serialized as a UTF-8 string.

        Note: Defaults to ES256K if no options are provided

        Parameters:
        keyManager - A keyManager instance where the new key will be stored.
        Returns:

        A DidJwk instance representing the newly created "did:jwk" DID.

      • create

        @JvmOverloads() final BearerDid create(KeyManager keyManager)

        Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.

        The method-specific identifier of a "did:jwk" DID is a base64url encoded json web key serialized as a UTF-8 string.

        Note: Defaults to ES256K if no options are provided

        Parameters:
        keyManager - A keyManager instance where the new key will be stored.
        Returns:

        A DidJwk instance representing the newly created "did:jwk" DID.

      • create

        @JvmOverloads() final BearerDid create()

        Creates a new "did:jwk" DID, derived from a public key, and stores the associated private key in the provided keyManager.

        The method-specific identifier of a "did:jwk" DID is a base64url encoded json web key serialized as a UTF-8 string.

        Note: Defaults to ES256K if no options are provided

        Returns:

        A DidJwk instance representing the newly created "did:jwk" DID.

      • import

         final BearerDid import(PortableDid portableDid, KeyManager keyManager)

        Instantiates a BearerDid object for the DID JWK method from a given PortableDid.

        This method allows for the creation of a BearerDid object using a previously created DID's key material, DID document, and metadata.

        Parameters:
        portableDid -
        • The PortableDid object to import.

        keyManager -
        • Optionally specify an external Key Management System (KMS) used to generate keys and sign data. If not given, a new InMemoryKeyManager instance will be created and used.

      • resolve

         final DidResolutionResult resolve(String did)

        Resolves a "did:jwk" DID into a DidResolutionResult, which contains the DID Document and possible related metadata.

        This implementation primarily constructs a DID Document with a single verification method derived from the DID's method-specific identifier (the public key).

        Parameters:
        did - The "did:jwk" DID that needs to be resolved.
        Returns:

        A DidResolutionResult instance containing the DID Document and related context.