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.

property card_client

Card service client.

Returns

Returns an instance of CardClient with provides card service operations.

property 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.

property 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.

search_card(identity)[source]

Searches for cards by specified identity.

Parameters

identity – The identity (or list of identity) to be found.

Returns

The list of found Card.