DID

class atproto_crypto.did.Multikey(jwt_alg: str, key_bytes: bytes)
static from_str(multikey: str) Multikey

Create multikey from string.

Parameters:

multikey – Multikey.

Returns:

Multikey.

Return type:

Multikey

jwt_alg: str
key_bytes: bytes
to_str() str

Format multikey.

Returns:

Multikey.

Return type:

str

atproto_crypto.did.format_did_key(jwt_alg: str, key: bytes) str

Format DID key.

Parameters:
  • jwt_alg – JWT alg.

  • key – Key bytes.

Returns:

DID key.

Return type:

str

atproto_crypto.did.format_did_key_multikey(multikey: str) str

Format DID key from multikey.

Parameters:

multikey – Multikey.

Returns:

DID key.

Return type:

str

atproto_crypto.did.format_multikey(jwt_alg: str, key: bytes) str

Format multikey to multibase.

Compress pubkey and encode with base58btc.

Parameters:
  • jwt_alg – JWT alg.

  • key – Key bytes.

Returns:

Multikey in multibase.

Return type:

str

Raises:

UnsupportedKeyTypeError – Unsupported key type.

atproto_crypto.did.get_did_key(key_type: str, key: str) str | None

Get DID key.

Parameters:
  • key_type – Key type.

  • key – Key.

Returns:

DID key or None if a key type is not supported.

Return type:

str

atproto_crypto.did.get_multikey_alg(multikey: str) str

Get JWT alg for multikey.

Parameters:

multikey – Multikey.

Returns:

JWT alg.

Return type:

str

atproto_crypto.did.parse_did_key(did_key: str) Multikey

Parse DID key.

Parameters:

did_key – DID key.

Returns:

Multikey.

Return type:

Multikey

Raises:

IncorrectDidKeyPrefixError – Incorrect prefix for DID key.

atproto_crypto.did.parse_multikey(multikey: str) Multikey

Parse multikey.

Parameters:

multikey – Multikey.

Returns:

Multikey.

Return type:

Multikey

Raises: