virgil_sdk.cards package¶
Submodules¶
virgil_sdk.cards.card module¶
-
class
virgil_sdk.cards.card.
Card
(card_id, identity, public_key, version, created_at, signatures, previous_card_id, content_snapshot, is_outdated=False)[source]¶ Bases:
object
The Card class is the main entity of Virgil Services. Every user/device is represented with a Virgil Card which contains a public key and information about identity.
-
content_snapshot
¶ Card content snapshot :returns: Card snapshot.
-
created_at
¶ Gets the date and time fo card creation in UTC. :returns: Creation date in UTC datetime.
-
classmethod
from_signed_model
(card_crypto, raw_singed_model, is_outdated=False)[source]¶ Creates card from SignedModel snapshot and signatures. :param card_crypto: Users CardCrypto witch provides cryptographic operations. :param raw_singed_model: Card RawSignedModel :param is_outdated: State of obsolescence
Returns: Card created from RawSignedModel.
-
classmethod
from_snapshot
(content_snapshot)[source]¶ Creates card from content snapshot. :param content_snapshot: Model content snapshot.
Returns: Card created from model content snapshot.
-
id
¶ Gets the Card ID that uniquely identifies the Card in Virgil Services. :returns: Card id.
-
identity
¶ Gets the identity value that can be anything which identifies the user in your application. :returns: User identity.
-
previous_card_id
¶ Get previous Card ID that current card is used to override to. :returns: Previous card id.
-
public_key
¶ Gets the public key. :returns: Public key.
-
signatures
¶ Gets a list of signatures. :returns: List of signatures
-
version
¶ Gets the version of the card. :returns: Card version.
-
virgil_sdk.cards.card_manager module¶
-
class
virgil_sdk.cards.card_manager.
CardManager
(card_crypto, access_token_provider, card_verifier, sign_callback=None, api_url='https://api.virgilsecurity.com', retry_on_unauthorized=False)[source]¶ Bases:
object
The CardsManager class provides a list of methods to manage the VirgilCard entities.
-
card_client
¶ Card service client.
Returns: Returns an instance of CardClient with provides card service operations.
-
card_verifier
¶ Card verifier.
Returns: Returns an instance of CardVerifier which provides card verification.
-
export_card_to_json
(card)[source]¶ Exports the specified card as a json.
Parameters: card – Card instance to be exported. Returns: Serialize card to json.
-
export_card_to_raw_card
(card)[source]¶ Exports the specified card as a RawSignedModel.
Parameters: card – Card instance to be exported. Returns: Returns instance of RawSignedModel representing Card.
-
export_card_to_string
(card)[source]¶ Exports the specified card as a BASE64 string.
Parameters: card – Card instance to be exported. Returns: Serialize card to base64.
-
generate_raw_card
(private_key, public_key, identity, previous_card_id='', extra_fields=None)[source]¶ Parameters: - private_key – PrivateKey for generate self signature.
- public_key – Card Public key.
- identity – Unique identity value.
- previous_card_id – Previous card id that current card is used to override to.
- extra_fields – The additional data associated with the card.
Returns: The instance of newly published Card.
-
get_card
(card_id)[source]¶ Gets the card by specified ID.
Parameters: card_id – The card ID to be found. Returns: The instance of found Card
-
import_card
(card_to_import)[source]¶ Imports and verifies Card.
Parameters: card_to_import – Exported data of signed model. Returns: Imported and verified card.
-
model_signer
¶ Card signer.
Returns: Returns instance of ModelSigner witch provides sign operations.
-
publish_card
(*args, **kwargs)[source]¶ Publish a new Card using specified params.
Parameters: - *args – raw_card: Unpublished raw signed model. or private_key: PrivateKey for generate self signature. public_key: Card Public key. identity: Unique identity value. previous_card_id: Previous card id that current card is used to override to. extra_fields: The additional data associated with the card.
- **kwargs – raw_card: Unpublished raw signed model. or private_key: PrivateKey for generate self signature. public_key: Card Public key. identity: Unique identity value. previous_card_id: Previous card id that current card is used to override to. extra_fields: The additional data associated with the card.
Returns: The instance of newly published Card.
-
virgil_sdk.cards.card_signature module¶
-
class
virgil_sdk.cards.card_signature.
CardSignature
(signer, signature, snapshot=None, extra_fields=None)[source]¶ Bases:
object
CardSignature provides signature for Card.
-
extra_fields
¶ Get the custom fields associated with the signature.
Returns: Custom fields.
-
signature
¶ Get the generated digital signature.
Returns: Digital signature.
-
signer
¶ Gets the type of signer signature.
Returns: Type of signer signature.
-
snapshot
¶ Get the signature snapshot.
Returns: Signature snapshot.
-
virgil_sdk.cards.raw_card_content module¶
-
class
virgil_sdk.cards.raw_card_content.
RawCardContent
(identity, public_key, created_at, version='5.0', previous_card_id=None)[source]¶ Bases:
object
RawCardContent provides content of Virgil Card.
-
content_snapshot
¶ RawCardContent snapshot.
Returns: Snapshot of RawCardContent.
-
created_at
¶ Gets the date and time fo card creation in UTC.
Returns: Creation date in UTC datetime.
-
classmethod
from_signed_model
(card_crypto, raw_singed_model)[source]¶ RawCardContent deserializer from RawSignedModel representation.
Parameters: - card_crypto – CardCrypto witch provides crypto operations.
- raw_singed_model – Card raw signed model.
Returns: Loaded RawCardContent instance.
-
classmethod
from_snapshot
(content_snapshot)[source]¶ RawCardContent deserializer from snapshot representation.
Parameters: content_snapshot – RawCardContent serialized snapshot. Returns: Loaded RawCardContent instance.
-
identity
¶ Gets the identity value that can be anything which identifies the user in your application.
Returns: User identity.
-
previous_card_id
¶ Get previous Card ID that current card is used to override to.
Returns: Previous card id.
-
public_key
¶ Gets the public key.
Returns: Public key.
-
to_json
()[source]¶ Raw card content json representation.
Returns: Serialize raw card content to json.
-
version
¶ Gets the version of the card.
Returns: Card version.
-