importKey method

Future<ClientResponse<KeyResponse, Errors>> importKey(
  1. String keyId,
  2. KeyRequest request
)

Import an existing RSA or EC key pair or an HMAC secret.

@param {String} keyId (Optional) The Id for the key. If not provided a secure random UUID will be generated. @param {KeyRequest} request The request object that contains all the information used to create the key. @returns {Promise<ClientResponse

Implementation

Future<ClientResponse<KeyResponse, Errors>> importKey(
    String keyId, KeyRequest request) {
  return _start<KeyResponse, Errors>()
      .withUri('/api/key/import')
      .withUriSegment(keyId)
      .withJSONBody(request)
      .withMethod('POST')
      .withResponseHandler(
          defaultResponseHandlerBuilder((d) => KeyResponse.fromJson(d)))
      .go();
}