findmy.keys¶
Module to work with private and public keys as used in FindMy accessories.
Attributes¶
Classes¶
Enum of possible key types. |
|
ABC for anything that has a public, hashed FindMy-key. |
|
ABC for anything that has a public FindMy-key. |
|
A private-public keypair for a trackable FindMy accessory. |
|
KeyPair generator. |
Module Contents¶
- class findmy.keys.KeyType¶
Bases:
enum.Enum
Enum of possible key types.
- UNKNOWN = 0¶
- PRIMARY = 1¶
- SECONDARY = 2¶
- class findmy.keys.HasHashedPublicKey¶
Bases:
abc.ABC
ABC for anything that has a public, hashed FindMy-key.
Also called a “hashed advertisement” key or “lookup” key.
- property hashed_adv_key_bytes: bytes¶
- Abstractmethod:
Return the hashed advertised (public) key as bytes.
- property hashed_adv_key_b64: str¶
Return the hashed advertised (public) key as a base64-encoded string.
- __hash__() int ¶
- __eq__(other: object) bool ¶
- class findmy.keys.HasPublicKey¶
Bases:
HasHashedPublicKey
,abc.ABC
ABC for anything that has a public FindMy-key.
Also called an “advertisement” key, since it is the key that is advertised by findable devices.
- property adv_key_bytes: bytes¶
- Abstractmethod:
Return the advertised (public) key as bytes.
- property adv_key_b64: str¶
Return the advertised (public) key as a base64-encoded string.
- property mac_address: str¶
Get the mac address from the public key.
- property hashed_adv_key_bytes: bytes¶
See HasHashedPublicKey.hashed_adv_key_bytes.
- class findmy.keys.KeyPair(private_key: bytes, key_type: KeyType = KeyType.UNKNOWN, name: str | None = None)¶
Bases:
HasPublicKey
A private-public keypair for a trackable FindMy accessory.
- property name: str | None¶
Name of this KeyPair.
- classmethod from_b64(key_b64: str) KeyPair ¶
Import an existing KeyPair from its base64-encoded representation.
Same format as returned by KeyPair.private_key_b64.
- property private_key_bytes: bytes¶
Return the private key as bytes.
- property private_key_b64: str¶
Return the private key as a base64-encoded string.
Can be re-imported using KeyPair.from_b64.
- property adv_key_bytes: bytes¶
Return the advertised (public) key as bytes.
- dh_exchange(other_pub_key: cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey) bytes ¶
Do a Diffie-Hellman key exchange using another EC public key.
- __repr__() str ¶
- findmy.keys.K¶