Enum class DidStatus

Package: keychain.constants

Description

DID lifecycle status. The DID state is tracked in the database.

This enum represents the various states a Decentralized Identifier (DID) can be in throughout its lifecycle, from creation to expiration. The status is maintained in the database to track the progression of DIDs through the public-key infrastructure process.

Since: v2.0

Enum Class Summary

Enum Constant Value Description

UNINITIALIZED

0

Yet uninitialized state

CREATED

1

A key pair was created and stored in the database

FUNDING

2

Acquisition of resources necessary for broadcasting is in progress

BROADCASTED

3

The public key self-signed certificate has been broadcasted to the public-key infrastructure

CONFIRMING

4

The public-key infrastructure confirmation of the self-signed certificate is in progress

CONFIRMED

5

The public-key infrastructure has confirmed the self-signed certificate

EXPIRING

6

The expiration time of the self-signed certificate is imminent

EXPIRED

7

The expiration time of the self-signed certificate has passed

Enum Class Detail

UNINITIALIZED

Value: 0

Yet uninitialized state. This is the default state before any DID operations have been performed.

CREATED

Value: 1

A key pair was created and stored in the database. The DID has been generated but not yet prepared for broadcasting.

FUNDING

Value: 2

Acquisition of resources necessary for broadcasting is in progress. This may involve obtaining network tokens or other prerequisites for blockchain transactions.

BROADCASTED

Value: 3

The public key self-signed certificate has been broadcasted to the public-key infrastructure. The DID is now publicly visible but awaiting confirmation.

CONFIRMING

Value: 4

The public-key infrastructure confirmation of the self-signed certificate is in progress. The network is processing and validating the DID registration.

CONFIRMED

Value: 5

The public-key infrastructure has confirmed the self-signed certificate. A persona that has reached the confirmed state at least once is called mature. This is the active, usable state.

EXPIRING

Value: 6

The expiration time of the self-signed certificate is imminent. Action should be taken to renew or rollover the DID before it expires.

EXPIRED

Value: 7

The expiration time of the self-signed certificate has passed. The DID is no longer valid and cannot be used for cryptographic operations.

Usage Example

from keychain.constants import DidStatus

# Check if a DID is mature (has been confirmed at least once)
def is_did_mature(status):
    return status.value >= DidStatus.CONFIRMED.value

# Example usage
current_status = DidStatus.CONFIRMED
print(f"DID status: {current_status}")  # Outputs: DidStatus.CONFIRMED

if is_did_mature(current_status):
    print("DID is mature and can be used")

# Check for expiration concerns
if current_status == DidStatus.EXPIRING:
    print("Warning: DID certificate is about to expire")
elif current_status == DidStatus.EXPIRED:
    print("Error: DID certificate has expired")