Skip to content

Utilities

es256(**kwargs)

Return a KeyRing with ECDSA settings based on JWA RFC7518 spec.

Usage:

# create a KeyRing with ECDSA settings
sign_algorithm = expose.es256()

Parameters:

Name Type Description Default
**kwargs Any

Any extra settings could be passed as keyword arguments

{}

Returns:

Type Description
SignKeyRing

Ready to use ecdsa signature keyring

Source code in nucleus/sdk/expose/factory.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def es256(**kwargs: Any) -> SignKeyRing:
    """Return a KeyRing with ECDSA settings based on JWA RFC7518 spec.

    Usage:

        # create a KeyRing with ECDSA settings
        sign_algorithm = expose.es256()

    :param **kwargs: Any extra settings could be passed as keyword arguments
    :return: Ready to use ecdsa signature keyring
    """

    return SignKeyRing(
        alg=Algorithm.ES256,
        kty=KeyType.EllipticCurve,
        crv=Curve.P256,
        use=Use.SIG,
        **kwargs,
    )

standard(type)

SEP-001 factory function.

Usage:

# create a new sep-001-video/mp4 instance
media_type = "video/mp4"
sep001 = expose.standard(media_type)

Parameters:

Name Type Description Default
type str

The type of media to expose

required

Returns:

Type Description
SEP001

New standard implementation sep-001 object

Source code in nucleus/sdk/expose/factory.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def standard(type: str) -> SEP001:
    """SEP-001 factory function.

    Usage:

        # create a new sep-001-video/mp4 instance
        media_type = "video/mp4"
        sep001 = expose.standard(media_type)

    :param type: The type of media to expose
    :return: New standard implementation sep-001 object
    """

    return SEP001(
        Header(type),
        Payload(),
    )

Note

The types of media to be exposed are defined in the SEP-001 standard and MUST be included to establish the format of the associated multimedia resource, as specified by the IANA MediaTypes.