XEP-0454: OMEMO Media Sharing

class slixmpp.plugins.xep_0454.XEP_0454(xmpp, config=None)[source]

XEP-0454: OMEMO Media Sharing

static decrypt(input_file, fragment)[source]

Decrypts file-like.

Parameters:
  • input_file (IO[bytes]) – Binary file stream on the file, containing the tag (16 bytes) at the end.

  • fragment (str) – 88 hex chars string composed of iv (24 chars) + key (64 chars).

Return type:

bytes

static encrypt(input_file=None, filename=None)[source]

Encrypts file as specified in XEP-0454 for use in file sharing

Parameters:
  • input_file (Optional[IO[bytes]]) – Binary file stream on the file.

  • filename (Path | None) – Path to the file to upload.

Return type:

tuple[bytes, str]

One of input_file or filename must be specified. If both are passed, input_file will be used and filename ignored.

static format_url(url, fragment)[source]

Helper to format a HTTPS URL to an AESGCM URI

Return type:

str

static map_extensions(ext)[source]

Apply conversions to extensions to reduce the number of variations, (e.g., JPEG -> jpg).

Return type:

str

async upload_file(filename, _size=None, content_type=None, **kwargs)[source]

Wrapper to xep_0363 (HTTP Upload)’s upload_file method.

Parameters:
  • input_file – Binary file stream on the file.

  • filename (Path) – Path to the file to upload.

Return type:

str

Same as XEP_0454.encrypt, one of input_file or filename must be specified. If both are passed, input_file will be used and filename ignored.

Other arguments passed in are passed to the actual XEP_0363.upload_file call.