virgil_sdk.client package

Submodules

virgil_sdk.client.base_card_client module

class virgil_sdk.client.base_card_client.BaseCardClient[source]

Bases: object

The BaseCardClient defines a list of operations with Virgil Cards service.

get_card(card_id, token)[source]

Gets a card from Virgil Services by specified card ID.

Parameters:
  • card_id – The card ID.
  • token – The string representation of Jwt token.
Returns:

An instance of RawSignedModel class and flag, which determines whether or not this raw card is superseded.

publish_card(request, token)[source]

Publishes card in Virgil Cards service.

Parameters:
  • request – An instance of RawSignedModel class.
  • token – The string representation of Jwt token.
Returns:

Published raw card.

search_card(identity, token)[source]

Searches a cards on Virgil Services by specified identity.

Parameters:
  • identity – The identity.
  • token – The string representation of Jwt token.
Returns:

A list of found cards in raw form.

virgil_sdk.client.card_client module

class virgil_sdk.client.card_client.CardClient(api_url='https://api.virgilsecurity.com', connection=None)[source]

Bases: virgil_sdk.client.base_card_client.BaseCardClient

The CardClient class provides operations with Virgil Cards service.

api_url

Get service url.

get_card(card_id, token)[source]

Gets a card from Virgil Services by specified card ID.

Parameters:
  • card_id – The Card ID.
  • token – The string representation of Jwt token.
Returns:

An instance of RawSignedModel class and flag, which determines whether or not this raw card is superseded.

Raises:

ValueError – Missed argument.

publish_card(raw_card, token)[source]

Publishes card in Virgil Cards service.

Parameters:
  • raw_card – An instance of RawSignedModel class.
  • token – The string representation of Jwt token.
Returns:

Published raw card.

search_card(identity, token)[source]

Searches a cards on Virgil Services by specified identity.

Parameters:
  • identity – The identity.
  • token – The string representation of Jwt token.
Returns:

A list of found cards in raw form.

virgil_sdk.client.client_exception module

exception virgil_sdk.client.client_exception.ClientException(message, error_codes)[source]

Bases: Exception

virgil_sdk.client.raw_signature module

class virgil_sdk.client.raw_signature.RawSignature(signer, signature, signature_snapshot=None)[source]

Bases: object

RawSignature provides signature for RawSignedModel.

signature

Signature data.

signer

Signer id. It must be unique among the RawSignedModel signatures.

snapshot

Additional data.

to_json()[source]

RawSignature json representation.

virgil_sdk.client.raw_signed_model module

class virgil_sdk.client.raw_signed_model.RawSignedModel(content_snapshot, signatures=None)[source]

Bases: object

The RawSignedModel provides transitional model of <see cref=”Card”/> and used by CardClient.

add_signature(signature)[source]

Add signature to RawSignedModel list.

Parameters:signature – Card signature.
Raises:ValueError – Attempt to add existing signature.
content_snapshot

Snapshot of RawCardContent.

classmethod from_json(raw_signed_model_json)[source]

Deserialize RawSignedModel from json representation.

classmethod from_string(raw_signed_model_string)[source]

Deserialize RawSignedModel from base64 encoded string.

classmethod generate(public_key, identity, created_at, previous_card_id=None)[source]

Generate card RawSignedModel.

Parameters:
  • public_key – Card public key.
  • identity – Unique card identity.
  • created_at – Creation timestamp.
  • previous_card_id – Previous card ID.
Returns:

Generate RawSignedModel instance.

signatures

A list of signatures.

to_json()[source]

RawSignedModel json representation.

to_string()[source]

Serialize to base64 encoded string.

Returns:Base64 encoded string.

virgil_sdk.client.unauthorized_client_exception module

exception virgil_sdk.client.unauthorized_client_exception.UnauthorizedClientException(message, error_codes)[source]

Bases: virgil_sdk.client.client_exception.ClientException

Module contents