core.bones.credential ===================== .. py:module:: core.bones.credential Classes ------- .. autoapisummary:: core.bones.credential.CredentialBone Module Contents --------------- .. py:class:: CredentialBone(*, max_length = None, **kwargs) Bases: :py:obj:`viur.core.bones.string.StringBone` A bone for storing credentials. This bone is designed to store sensitive information like passwords, API keys, or other secret strings. This is always empty if read from the database. If it's saved, its ignored if its values is still empty. If its value is not empty, it will update the value in the database :ivar str type: The type identifier of the bone, set to "str.credential". Initializes a new StringBone. :param caseSensitive: When filtering for values in this bone, should it be case-sensitive? :param max_length: The maximum length allowed for values of this bone. Set to None for no limitation. :param min_length: The minimum length allowed for values of this bone. Set to None for no limitation. :param natural_sorting: Allows a more natural sorting than the default sorting on the plain values. This uses the .sort_idx property. `True` enables sorting according to DIN 5007 Variant 2. With passing a `callable`, a custom transformer method can be set that creates the value for the index property. :param escape_html: Replace some characters in the string with HTML-safe sequences with using :meth:`utils.string.escape` for safe use in HTML. :param kwargs: Inherited arguments from the BaseBone. .. py:attribute:: type :value: 'str.credential' .. py:method:: isInvalid(value) Returns None if the value would be valid for this bone, an error-message otherwise. .. py:method:: serialize(skel, name, parentIndexed) Serializes the bone's value for the database. Updates the value in the entity only if a new value is supplied. Ensures the value is never indexed. :param skel: The skeleton instance that the bone is part of. :type skel: SkeletonInstance :param str name: The name of the bone attribute. :param bool parentIndexed: Indicates whether the parent entity is indexed. :return: True if the value was updated in the database, False otherwise. :rtype: bool .. py:method:: unserialize(valuesCache, name) Unserializes the bone's value from the database. This method always returns an empty dictionary as the CredentialBone's value is always empty when read from the database. :param dict valuesCache: A dictionary containing the serialized values from the datastore. :param str name: The name of the bone attribute. :return: An empty dictionary, as the CredentialBone's value is always empty when read from the database. :rtype: dict .. py:method:: singleValueFromClient(value, skel, bone_name, client_data) Returns None and the escaped value if the value would be valid for this bone, otherwise the empty value and an error-message.