Skip to content

Wallets App

Models

Wallet

Wallet(id, user, name, private_key, created_at, updated_at)

Fields

  • id (UUIDField)
  • user (OneToOneField)
  • name (CharField)
  • private_key (EncryptedCharField)
  • created_at (DateTimeField) - blank allowed
  • updated_at (DateTimeField) - blank allowed

Methods

  • adelete(self, using=None, keep_parents=False)
  • arefresh_from_db(self, using=None, fields=None, from_queryset=None)
  • asave(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)
  • clean(self)

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

  • clean_fields(self, exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

  • date_error_message(self, lookup_type, field_name, unique_for)
  • delete(self, using=None, keep_parents=False)
  • full_clean(self, exclude=None, validate_unique=True, validate_constraints=True)

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

  • get_constraints(self)
  • get_deferred_fields(self)

Return a set containing names of deferred fields for this instance.

  • get_next_by_created_at(self, , field=, is_next=True, *kwargs)
  • get_next_by_updated_at(self, , field=, is_next=True, *kwargs)
  • get_previous_by_created_at(self, , field=, is_next=False, *kwargs)
  • get_previous_by_updated_at(self, , field=, is_next=False, *kwargs)
  • prepare_database_save(self, field)
  • refresh_from_db(self, using=None, fields=None, from_queryset=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn't loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

  • save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The 'force_insert' and 'force_update' parameters can be used to insist that the "save" must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

  • save_base(self, raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.

The 'raw' argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

  • serializable_value(self, field_name)

Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value.

Used to serialize a field's value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

  • unique_error_message(self, model_class, unique_check)
  • validate_constraints(self, exclude=None)
  • validate_unique(self, exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.


WalletCredential

WalletCredential(id, wallet, credential, added_at, is_archived)

Fields

  • id (UUIDField)
  • wallet (ForeignKey)
  • credential (ForeignKey)
  • added_at (DateTimeField) - blank allowed
  • is_archived (BooleanField)

Methods

  • adelete(self, using=None, keep_parents=False)
  • arefresh_from_db(self, using=None, fields=None, from_queryset=None)
  • asave(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)
  • clean(self)

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

  • clean_fields(self, exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

  • date_error_message(self, lookup_type, field_name, unique_for)
  • delete(self, using=None, keep_parents=False)
  • full_clean(self, exclude=None, validate_unique=True, validate_constraints=True)

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.

  • get_constraints(self)
  • get_deferred_fields(self)

Return a set containing names of deferred fields for this instance.

  • get_next_by_added_at(self, , field=, is_next=True, *kwargs)
  • get_previous_by_added_at(self, , field=, is_next=False, *kwargs)
  • prepare_database_save(self, field)
  • refresh_from_db(self, using=None, fields=None, from_queryset=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn't loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

  • save(self, *args, force_insert=False, force_update=False, using=None, update_fields=None)

Save the current instance. Override this in a subclass if you want to control the saving process.

The 'force_insert' and 'force_update' parameters can be used to insist that the "save" must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

  • save_base(self, raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.

The 'raw' argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

  • serializable_value(self, field_name)

Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there's no Field object with this name on the model, return the model attribute's value.

Used to serialize a field's value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

  • unique_error_message(self, model_class, unique_check)
  • validate_constraints(self, exclude=None)
  • validate_unique(self, exclude=None)

Check unique constraints on the model and raise ValidationError if any failed.


Views

add_credential

Add a credential to wallet manually


add_credential_to_wallet


archive_credential


backup_wallet

Backup wallet data


compute_sha256

Compute SHA256 hash of a string


credential_detail


download_credential


generate_key_pair

Generate SECP256k1 key pair in hex format


getSampleStyleSheet

Returns a stylesheet object


get_object_or_404

Use get() to return an object, or raise an Http404 exception if the object does not exist.

klass may be a Model, Manager, or QuerySet object. All other passed arguments and keyword arguments are used in the get() query.

Like with QuerySet.get(), MultipleObjectsReturned is raised if more than one object is found.


login_required

Decorator for views that checks that the user is logged in, redirecting to the log-in page if necessary.


redirect

Return an HttpResponseRedirect to the appropriate URL for the arguments passed.

The arguments could be:

* A model: the model's `get_absolute_url()` function will be called.

* A view name, possibly with arguments: `urls.reverse()` will be used
  to reverse-resolve the name.

* A URL, which will be used as-is for the redirect location.

Issues a temporary redirect by default. Set permanent=True to issue a permanent redirect. Set preserve_request=True to instruct the user agent to preserve the original HTTP method and body when following the redirect.


register_view


render

Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.


reverse


share_all_credentials

Share all credentials in wallet


share_credential


unarchive_credential


view_shared_credential

Public view for shared credentials - no login required


wallet_home


Management Commands

fix_wallet_keys

Help: Fix wallets with incompatible private key formats

Methods: - add_arguments(self, parser) - handle(self, args, *options)