Skip to content

Latest commit

 

History

History
291 lines (206 loc) · 8.92 KB

README.md

File metadata and controls

291 lines (206 loc) · 8.92 KB

AccessControl

(accessControl())

Overview

Operations related to access control/signing keys api

Available Operations

  • create - Create a signing key
  • getAll - Retrieves signing keys
  • delete - Delete Signing Key
  • get - Retrieves a signing key
  • update - Update a signing key

create

The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, and the privateKey is displayed only on creation. This is the only moment where the client can save the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. Up to 10 signing keys can be generated, after that you must delete at least one signing key to create a new one.

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            CreateSigningKeyResponse res = sdk.accessControl().create()
                .call();

            if (res.signingKey().isPresent()) {
                // handle response
            }
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Response

CreateSigningKeyResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*

getAll

Retrieves signing keys

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetSigningKeysResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            GetSigningKeysResponse res = sdk.accessControl().getAll()
                .call();

            if (res.data().isPresent()) {
                // handle response
            }
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Response

GetSigningKeysResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*

delete

Delete Signing Key

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.DeleteSigningKeyResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            DeleteSigningKeyResponse res = sdk.accessControl().delete()
                .keyId("<value>")
                .call();

            // handle response
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Parameters

Parameter Type Required Description
keyId String ✔️ ID of the signing key

Response

DeleteSigningKeyResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*

get

Retrieves a signing key

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetSigningKeyResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            GetSigningKeyResponse res = sdk.accessControl().get()
                .keyId("<value>")
                .call();

            if (res.signingKey().isPresent()) {
                // handle response
            }
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Parameters

Parameter Type Required Description
keyId String ✔️ ID of the signing key

Response

GetSigningKeyResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*

update

Update a signing key

Example Usage

package hello.world;

import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody;
import studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse;

public class Application {

    public static void main(String[] args) throws Exception {
        try {
            Livepeer sdk = Livepeer.builder()
                .apiKey("<YOUR_BEARER_TOKEN_HERE>")
                .build();

            UpdateSigningKeyResponse res = sdk.accessControl().update()
                .keyId("<value>")
                .requestBody(UpdateSigningKeyRequestBody.builder()
                    .build())
                .call();

            // handle response
        } catch (SDKError e) {
            // handle exception
            throw e;
        } catch (Exception e) {
            // handle exception
            throw e;
        }

    }
}

Parameters

Parameter Type Required Description
keyId String ✔️ ID of the signing key
requestBody UpdateSigningKeyRequestBody ✔️ N/A

Response

UpdateSigningKeyResponse

Errors

Error Object Status Code Content Type
models/errors/SDKError 4xx-5xx */*