asnkit-gen-python 2.0.0rc2__tar.gz → 2.0.0rc4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asnkit-gen-python
3
- Version: 2.0.0rc2
3
+ Version: 2.0.0rc4
4
4
  Summary: asnkit plugin that makes Python code with data classes from ASN.1
5
5
  Author: xadaemon
6
6
  Author-email: xadaemon <mxavier@boxtheta.com>
@@ -10,7 +10,7 @@ Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Topic :: Software Development :: Code Generators
13
- Requires-Dist: asnkitrt==2.0.0rc2
13
+ Requires-Dist: asnkitrt==2.0.0rc4
14
14
  Requires-Python: >=3.13
15
15
  Project-URL: source, https://github.com/boxtheta/asnkit
16
16
  Description-Content-Type: text/x-rst
@@ -47,11 +47,11 @@ Options, given with ``--plugin-opt KEY=VALUE``:
47
47
 
48
48
  ``embed``
49
49
  ``false`` to leave the compiled specification out of the module, as
50
- for one sent signed or encrypted. The module then has
51
- ``use_asni(data, ...)``, which takes the contents of the ``.asni``
52
- file with the options of ``asnkitrt.load_asni()`` (``nonce``,
53
- ``bound_to``, ``verification_keys``, ``decryption_keys`` and those
54
- to accept any), checks it once and uses it for every codec. Until it
50
+ for one distributed separately. The module then has
51
+ ``use_asni(data, *, bound_to=None, accept_any_binding=False)``, which
52
+ takes the contents of a version 2 ``.asni`` file, checks its binding
53
+ once and uses it for every codec. By default it accepts only unbound
54
+ files; give ``bound_to`` for an expected binding. Until it
55
55
  is called, encoding and decoding raise ``RuntimeError``. The file has
56
56
  to be compiled from the same specification. Default: ``true``.
57
57
 
@@ -30,11 +30,11 @@ Options, given with ``--plugin-opt KEY=VALUE``:
30
30
 
31
31
  ``embed``
32
32
  ``false`` to leave the compiled specification out of the module, as
33
- for one sent signed or encrypted. The module then has
34
- ``use_asni(data, ...)``, which takes the contents of the ``.asni``
35
- file with the options of ``asnkitrt.load_asni()`` (``nonce``,
36
- ``bound_to``, ``verification_keys``, ``decryption_keys`` and those
37
- to accept any), checks it once and uses it for every codec. Until it
33
+ for one distributed separately. The module then has
34
+ ``use_asni(data, *, bound_to=None, accept_any_binding=False)``, which
35
+ takes the contents of a version 2 ``.asni`` file, checks its binding
36
+ once and uses it for every codec. By default it accepts only unbound
37
+ files; give ``bound_to`` for an expected binding. Until it
38
38
  is called, encoding and decoding raise ``RuntimeError``. The file has
39
39
  to be compiled from the same specification. Default: ``true``.
40
40
 
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "asnkit-gen-python"
3
- version = "2.0.0rc2"
3
+ version = "2.0.0rc4"
4
4
  description = "asnkit plugin that makes Python code with data classes from ASN.1"
5
5
  readme = "README.rst"
6
6
  requires-python = ">=3.13"
7
- dependencies = ["asnkitrt==2.0.0rc2"]
7
+ dependencies = ["asnkitrt==2.0.0rc4"]
8
8
  license = "Apache-2.0"
9
9
  license-files = ["LICENSE-COMPILER"]
10
10
  classifiers = [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "asnkit-gen-python"
3
- version = "2.0.0rc2"
3
+ version = "2.0.0rc4"
4
4
  description = "asnkit plugin that makes Python code with data classes from ASN.1"
5
5
  readme = "README.rst"
6
6
  authors = [
@@ -8,7 +8,7 @@ authors = [
8
8
  ]
9
9
  requires-python = ">=3.13"
10
10
  dependencies = [
11
- "asnkitrt==2.0.0rc2",
11
+ "asnkitrt==2.0.0rc4",
12
12
  ]
13
13
  license = "Apache-2.0"
14
14
  license-files = ["LICENSE-COMPILER"]
@@ -773,13 +773,9 @@ _SPECIFICATION: asnkitrt.syntax.CompiledSpecification | None = None
773
773
 
774
774
  def use_asni(
775
775
  data: bytes | bytearray,
776
- nonce: asnkitrt.syntax.NonceCheck = None,
777
- accept_any_nonce: bool = False,
776
+ *,
778
777
  bound_to: str | None = None,
779
778
  accept_any_binding: bool = False,
780
- verification_keys: asnkitrt.syntax.Keys | None = None,
781
- accept_any_signature: bool = False,
782
- decryption_keys: asnkitrt.syntax.Keys | None = None,
783
779
  ) -> None:
784
780
  \"\"\"Uses the contents of an .asni file, made from the specification this
785
781
  module is made from, for all codecs. It is checked once, here, with the
@@ -790,14 +786,7 @@ def use_asni(
790
786
  global _SPECIFICATION
791
787
 
792
788
  _SPECIFICATION = asnkitrt.syntax.from_asni(
793
- data,
794
- nonce,
795
- accept_any_nonce,
796
- bound_to,
797
- accept_any_binding,
798
- verification_keys,
799
- accept_any_signature,
800
- decryption_keys,
789
+ data, bound_to=bound_to, accept_any_binding=accept_any_binding
801
790
  )
802
791
  spec.cache_clear()
803
792
 
@@ -840,13 +829,12 @@ def generate(
840
829
  embed: bool = True,
841
830
  ) -> str:
842
831
  """Returns the text of a Python module for given contents of an
843
- ``.asni`` file, which must not be signed, encrypted, bound to
844
- something or have a nonce to check, as it may be embedded in the
845
- module and loaded without any of those. `sources` are the names of
846
- the files it was made from, and `codec` is what the module encodes
847
- and decodes with if not told otherwise. Without `embed`, the module
848
- does not have the specification in it, and is given it with its
849
- ``use_asni()``, as from a file that is signed or encrypted.
832
+ ``.asni`` file, which must not be bound to something, as it may be
833
+ embedded in the module and loaded without checking that. `sources`
834
+ are the names of the files it was made from, and `codec` is what
835
+ the module encodes and decodes with if not told otherwise. Without
836
+ `embed`, the module does not have the specification in it, and is
837
+ given it with its ``use_asni()``, as from a file it is sent.
850
838
 
851
839
  """
852
840
 
@@ -854,8 +842,8 @@ def generate(
854
842
  compiled = syntax.from_asni(asni)
855
843
  except Exception as error:
856
844
  raise GenerateError(
857
- "Expected a compiled specification that is not signed, encrypted, "
858
- "bound to something or has a nonce, but: {}".format(error)
845
+ "Expected a compiled specification that is not bound to something, "
846
+ "but: {}".format(error)
859
847
  )
860
848
 
861
849
  return Generator(compiled, asni, sources or [], codec, embed).run()
@@ -2,4 +2,4 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
- __version__ = "2.0.0rc2"
5
+ __version__ = "2.0.0rc4"