Skip to content

Operations

Info

Cryptographic operations refer to the signing and encryption specified in the JWS (JSON Web Signature) and JWE (JSON Web Encryption) standards, respectively.

Sign dataclass

JWS serialization implementation.

add_key(kr)

Bind signature keys to JWS serialization.

Parameters:

Name Type Description Default
kr Keyring

Keyring to assoc with signature

required

Returns:

Type Description
Sign

Sign object

Source code in nucleus/sdk/expose/crypto.py
23
24
25
26
27
28
29
30
31
32
def add_key(self, kr: Keyring) -> Sign:
    """Bind signature keys to JWS serialization.

    :param kr: Keyring to assoc with signature
    :return: Sign object
    """

    header = {**dict(kr), **dict(self._s8r)}
    self._jws.add_signature(kr.jwk(), None, json_encode(header))
    return self

serialize()

Trigger and notify to underneath serializer for JWS post-processing . In this step additional data could be added/modified into JWS.

Returns:

Type Description
Serializer

The ready to use serializer object

Source code in nucleus/sdk/expose/crypto.py
34
35
36
37
38
39
40
def serialize(self) -> Serializer:
    """Trigger and notify to underneath serializer for JWS post-processing .
    In this step additional data could be added/modified into JWS.

    :return: The ready to use serializer object
    """
    return self._s8r.update(self._jws)

!!!