Skip to content

Types

Keyring

Bases: Protocol

Keyring specifies the required methods for handling keys based on the JWK (JSON Web Key) RFC 7517 standard.

__iter__()

Yield alg and jwk headers specified in RFC 7517-7516 standard.

Returns:

Type Description
Setting

The iterable header settings to associate

Source code in nucleus/sdk/expose/types.py
111
112
113
114
115
116
def __iter__(self) -> Setting:
    """Yield `alg` and `jwk` headers specified in RFC 7517-7516 standard.

    :return: The iterable header settings to associate
    """
    ...

as_dict()

Exports the key in the standard JSON format.

Returns:

Type Description
Raw

A portable representation of the key in JWK format.

Source code in nucleus/sdk/expose/types.py
150
151
152
153
154
155
def as_dict(self) -> Raw:
    """Exports the key in the standard JSON format.

    :return: A portable representation of the key in JWK format.
    """
    ...

fingerprint()

Return the base64 decoded thumbprint as specified by RFC 7638

Returns:

Type Description
str

The decoded thumbprint as string. eg: sha256, blake, etc..

Source code in nucleus/sdk/expose/types.py
125
126
127
128
129
130
def fingerprint(self) -> str:
    """Return the base64 decoded thumbprint as specified by RFC 7638

    :return: The decoded thumbprint as string. eg: sha256, blake, etc..
    """
    ...

from_dict(jwk) classmethod

Creates a Keyring object from a JWK (JSON Web Key) dictionary.

Parameters:

Name Type Description Default
jwk Raw

The JWK dictionary to import

required

Returns:

Type Description
Keyring

KeyRing object

Source code in nucleus/sdk/expose/types.py
141
142
143
144
145
146
147
148
@classmethod
def from_dict(cls, jwk: Raw) -> Keyring:
    """Creates a Keyring object from a JWK (JSON Web Key) dictionary.

    :param jwk: The JWK dictionary to import
    :return: KeyRing object
    """
    ...

import_key(jwk)

Restore the internal key associated with a JWK (JSON Web Key).

Parameters:

Name Type Description Default
jwk Raw

The JWK to restore.

required

Returns:

Type Description
Keyring

Keyring object

Source code in nucleus/sdk/expose/types.py
132
133
134
135
136
137
138
139
def import_key(self, jwk: Raw) -> Keyring:
    """Restore the internal key associated with a JWK (JSON Web Key).

    :param jwk: The JWK to restore.
    :return: Keyring object

    """
    ...

jwk()

Return the internal JWK (JSON Web Key) instance.

Returns:

Type Description
JWK

The JWK (JSON Web Key) instance

Source code in nucleus/sdk/expose/types.py
118
119
120
121
122
123
def jwk(self) -> JWK:
    """Return the internal JWK (JSON Web Key) instance.

    :return: The JWK (JSON Web Key) instance
    """
    ...

Serializer(standard)

Bases: Protocol

Serializer specifies methods to handle serialization for each strategy according to the SEP-001 serialization spec.

Serializer must be initialized with the SEP-001 standard implementation.

Parameters:

Name Type Description Default
standard Standard

The standard implementation

required
Source code in nucleus/sdk/expose/types.py
80
81
82
83
84
85
def __init__(self, standard: Standard):
    """Serializer must be initialized with the SEP-001 standard implementation.

    :param standard: The standard implementation
    """
    ...

__bytes__()

Serialization as bytes.

Returns:

Type Description
bytes
Source code in nucleus/sdk/expose/types.py
66
67
68
69
70
71
def __bytes__(self) -> bytes:
    """Serialization as bytes.

    :return:
    """
    ...

__iter__()

Yield typ headers specified in SEP-001 standard.

Returns:

Type Description
Setting

The iterable media type settings

Source code in nucleus/sdk/expose/types.py
73
74
75
76
77
78
def __iter__(self) -> Setting:
    """Yield `typ` headers specified in SEP-001 standard.

    :return: The iterable media type settings
    """
    ...

__str__()

Serialization as string.

Returns:

Type Description
str
Source code in nucleus/sdk/expose/types.py
59
60
61
62
63
64
def __str__(self) -> str:
    """Serialization as string.

    :return:
    """
    ...

save_to(store)

Publishes serialization into the local store.

Parameters:

Name Type Description Default
store Store

The local store function

required

Returns:

Type Description
Object

Object instance

Source code in nucleus/sdk/expose/types.py
87
88
89
90
91
92
93
94
def save_to(self, store: Store) -> Object:
    """Publishes serialization into the local store.

    :param store: The local store function
    :return: Object instance
    """

    ...

update(jwt)

Receive updates when cryptographic operations are ready to be used. This step allows for adding a new state or performing operations on JWS/JWE to handle additional encoding.

Parameters:

Name Type Description Default
jwt JWT

The type of JWT implementation to handle.

required

Returns:

Type Description
Serializer

Self serializer

Source code in nucleus/sdk/expose/types.py
 96
 97
 98
 99
100
101
102
103
def update(self, jwt: JWT) -> Serializer:
    """Receive updates when cryptographic operations are ready to be used.
    This step allows for adding a new state or performing operations on JWS/JWE to handle additional encoding.

    :param jwt: The type of JWT implementation to handle.
    :return: Self serializer
    """
    ...

Crypto(serializer)

Bases: Protocol

Crypto specifies a pub/sub middleware that handles cryptographic operations on serializers. It notifies serializers when crypto operations are ready to be used.

Initialize with the serializer on which we will operate.

Parameters:

Name Type Description Default
serializer Serializer

The serializer implementation

required
Source code in nucleus/sdk/expose/types.py
163
164
165
166
167
168
def __init__(self, serializer: Serializer):
    """Initialize with the serializer on which we will operate.

    :param serializer: The serializer implementation
    """
    ...

add_key(kr)

Bind keys to the serialization process.

Parameters:

Name Type Description Default
kr Keyring

Keyring to associate with operation

required

Returns:

Type Description
Crypto

Crypto object

Source code in nucleus/sdk/expose/types.py
178
179
180
181
182
183
184
def add_key(self, kr: Keyring) -> Crypto:
    """Bind keys to the serialization process.

    :param kr: Keyring to associate with operation
    :return: Crypto object
    """
    ...

serialize()

Notify the underlying serializer of the current state of the cryptographic operation. During this process, the serializer may modify its state or store the results of the cryptographic operations.

Returns:

Type Description
Serializer

The input Serializer with a new ready to use state

Source code in nucleus/sdk/expose/types.py
170
171
172
173
174
175
176
def serialize(self) -> Serializer:
    """Notify the underlying serializer of the current state of the cryptographic operation.
    During this process, the serializer may modify its state or store the results of the cryptographic operations.

    :return: The input Serializer with a new ready to use state
    """
    ...

Metadata

Bases: Protocol

Metadata defines the expected behavior of metadata types. Examples of metadata types include:

  • Descriptive
  • Structural
  • Technical

__str__()

Metadata types MUST return the specified claims as a string. Examples of valid claims include: s, t, d

Returns:

Type Description
Claims

The claim type specified in SEP-001

Source code in nucleus/sdk/expose/types.py
26
27
28
29
30
31
32
33
def __str__(self) -> Claims:
    """Metadata types MUST return the specified claims as a string.
    Examples of valid claims include:
        s, t, d

    :return: The claim type specified in SEP-001
    """
    ...

Standard

Bases: Protocol

Standard defines the expected behavior of the standard implementations according to SEP-001.

header()

Return the standard header

Returns:

Type Description
Raw
Source code in nucleus/sdk/expose/types.py
39
40
41
42
43
44
def header(self) -> Raw:
    """Return the standard header

    :return:
    """
    ...

payload()

Return the standard payload

Returns:

Type Description
Raw
Source code in nucleus/sdk/expose/types.py
46
47
48
49
50
51
def payload(self) -> Raw:
    """Return the standard payload

    :return:
    """
    ...