ShogunDID class for decentralized identity management

Hierarchy

  • EventEmitter
    • ShogunDID

Constructors

  • Initialize ShogunDID manager

    Parameters

    • shogunCore: IShogunCore
    • OptionalregistryConfig: Partial<DIDRegistryConfig>
    • Optionaloptions: { useSecureRandomPassword?: boolean; [key: string]: any }

    Returns ShogunDID

Properties

DEFAULT_CACHE_DURATION: number = ...
DEFAULT_MAX_RETRIES: 3
DEFAULT_RETRY_DELAY: 1000
DEFAULT_TIMEOUT: 10000
didCache: Map<string, DIDCacheEntry> = ...
methodName: string = "shogun"
options: { useSecureRandomPassword?: boolean; [key: string]: any }
registryConfig: DIDRegistryConfig = ...

Methods

  • Authenticate using a DID

    Parameters

    • did: string

      The DID to authenticate

    • Optionalchallenge: string

      Optional challenge for authentication

    Returns Promise<AuthResult>

    Authentication result

  • Parameters

    • authMethod: { controller: string; id: string; type: string }
    • Optionalchallenge: string

    Returns Promise<AuthResult>

  • Parameters

    • username: string
    • Optionalchallenge: string

    Returns Promise<any>

  • Parameters

    • authMethod: { controller: string; id: string; type: string }
    • Optionalchallenge: string

    Returns Promise<AuthResult>

  • Clear DID cache

    Returns void

  • Deactivate a DID

    Parameters

    • did: string

      The DID to deactivate

    Returns Promise<boolean>

    Whether the deactivation was successful

  • Emits an event with arguments

    Parameters

    • event: EventType
    • Optionaldata: unknown

    Returns boolean

  • Parameters

    Returns null | { controller: string; id: string; type: string }

  • Get the current user's DID

    Returns Promise<null | string>

    The user's DID or null if not found

  • Helper to get document from cache entry (compatibility)

    Parameters

    • cache: DIDCacheEntry

    Returns null | DIDDocument

  • Helper to get public key of current user

    Returns null | string

  • Returns null | Wallet

  • Validate if a string is a properly formatted DID

    Parameters

    • did: string

      The DID to validate

    Returns boolean

    Whether the DID is valid

  • Removes an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers an event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Registers a one-time event listener

    Parameters

    • event: EventType
    • listener: (data: unknown) => void

    Returns void

  • Parameters

    • did: string
    • data: any

    Returns DIDDocument

  • Register DID on blockchain with retry logic

    Parameters

    • did: string
    • Optionalsigner: Signer

    Returns Promise<{ error?: string; success: boolean; txHash?: string }>

  • Removes all listeners for an event or all events

    Parameters

    • Optionalevent: EventType

    Returns void

  • Remove specific DID from cache

    Parameters

    • did: string

    Returns void

  • Resolve a DID with caching

    Parameters

    • did: string
    • options: DIDResolutionOptions = {}

    Returns Promise<DIDResolutionResult>

  • Store DID document

    Parameters

    • did: string

      DID identifier

    • options: DIDCreateOptions

      DID creation options or document

    Returns Promise<void>

    Promise that resolves when DID is stored

  • Update DID Document

    Parameters

    • did: string

      DID to update

    • updates: Partial<DIDDocument>

      Partial DID Document to merge with existing document

    Returns Promise<boolean>

    True if the document was updated successfully

  • Verifica se un DID è registrato sulla blockchain

    Parameters

    • did: string

      Il DID da verificare

    Returns Promise<{ controller?: string; error?: string; isRegistered: boolean }>

    Promise con il risultato della verifica