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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
__bytes__()
Serialization as bytes.
Returns:
Type | Description |
---|---|
bytes
|
Source code in nucleus/sdk/expose/types.py
66 67 68 69 70 71 |
|
__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 |
|
__str__()
Serialization as string.
Returns:
Type | Description |
---|---|
str
|
Source code in nucleus/sdk/expose/types.py
59 60 61 62 63 64 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
payload()
Return the standard payload
Returns:
Type | Description |
---|---|
Raw
|
Source code in nucleus/sdk/expose/types.py
46 47 48 49 50 51 |
|