cURL
curl --request GET \
--url https://development.knotapi.com/jwe/key \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://development.knotapi.com/jwe/key"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://development.knotapi.com/jwe/key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://development.knotapi.com/jwe/key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://development.knotapi.com/jwe/key"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://development.knotapi.com/jwe/key")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://development.knotapi.com/jwe/key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"alg": "RSA-OAEP-256",
"e": "...",
"key_ops": [
"encrypt"
],
"kid": "...",
"kty": "RSA",
"n": "...",
"use": "enc"
}{
"error_type": "INVALID_INPUT",
"error_code": "INVALID_API_KEYS",
"error_message": "Invalid client_id or secret provided."
}CardSwitcher
Retrieve JWK
Retrieve a public key in JWK format.
GET
/
jwe
/
key
cURL
curl --request GET \
--url https://development.knotapi.com/jwe/key \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://development.knotapi.com/jwe/key"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://development.knotapi.com/jwe/key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://development.knotapi.com/jwe/key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://development.knotapi.com/jwe/key"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://development.knotapi.com/jwe/key")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://development.knotapi.com/jwe/key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"alg": "RSA-OAEP-256",
"e": "...",
"key_ops": [
"encrypt"
],
"kid": "...",
"kty": "RSA",
"n": "...",
"use": "enc"
}{
"error_type": "INVALID_INPUT",
"error_code": "INVALID_API_KEYS",
"error_message": "Invalid client_id or secret provided."
}Building the JWE
See code samples here for how to structure and encrypt the JWE in various programming languages.
- RSA 2048 certificate in JWK format
- RSA-OAEP-256 as key encryption algorithm
- A256GCM as content encryption algorithm
JSON
{
"user": {
"name": {
"first_name": "Ada", // Max length: 255
"last_name": "Lovelace" // Max length: 255
},
"address": {
"street": "100 Main Street", // Max length: 46
"street2": "#100", // Max length: 46
"city": "NEW YORK", // Max length: 32
"region": "NY", // Must be an ISO 3166-2 sub-division code
"postal_code": "12345", // Min length: 5, Max length: 10
"country": "US" // Must be an ISO 3166-1 alpha-2 code
},
"phone_number": "+11234567890" // Must be in E.164 format
},
"card": {
"number": "4242424242424242",
"expiration": "08/2030", // MM/YYYY or MM/YY format
"cvv": "012" // Max length: 4
}
}
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password. Use your client_id as the username and your secret as the password value.
Response
Successful request.
Algorithm intended for use with the key.
Example:
"RSA-OAEP-256"
Exponent value for the RSA public key in Base64 URL format.
Example:
"..."
Operation permitted for the key.
Example:
["encrypt"]
Unique identifier for the kid.
Example:
"..."
Type of key.
Example:
"RSA"
Modulus value for the RSA public key in Base64 URL format.
Example:
"..."
Intended use of the key.
Example:
"enc"
Was this page helpful?
⌘I