تسجيل مفتاح
curl --request POST \
--url https://api.truthlocks.com/v1/issuers/{id}/keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"provider": "KMS",
"kid": "<string>",
"public_key_b64url": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: 'KMS', kid: '<string>', public_key_b64url: '<string>'})
};
fetch('https://api.truthlocks.com/v1/issuers/{id}/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/issuers/{id}/keys"
payload = {
"provider": "KMS",
"kid": "<string>",
"public_key_b64url": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/issuers/{id}/keys"
payload := strings.NewReader("{\n \"provider\": \"KMS\",\n \"kid\": \"<string>\",\n \"public_key_b64url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"kid": "<string>",
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"algorithm": "Ed25519",
"public_key": "<string>",
"status": "ACTIVE",
"not_before": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}{
"code": "VALIDATION_ERROR",
"message": "Unsupported algorithm. Must be one of: ES256, ES384, ES512, RS256, RS384, RS512, PS256, PS384, PS512, Ed25519",
"http_status": 400
}المصدرون
إنشاء أو تسجيل مفتاح مُصدر
ينشئ مفتاحًا مُدارًا مخصصًا أو يسجل مفتاح تحقق عام خارجي. يدعم التوليد المُدار Ed25519 و ES256 و ES384 و RS256 و RS512 و PS256 و PS512. يدعم الاستيراد بالإضافة إلى ذلك ES512 و RS384 و PS384؛ استيراد مفتاح عام لا يمكّن سك العملة من جانب الخادم.
POST
/
v1
/
issuers
/
{id}
/
keys
تسجيل مفتاح
curl --request POST \
--url https://api.truthlocks.com/v1/issuers/{id}/keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"provider": "KMS",
"kid": "<string>",
"public_key_b64url": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider: 'KMS', kid: '<string>', public_key_b64url: '<string>'})
};
fetch('https://api.truthlocks.com/v1/issuers/{id}/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/issuers/{id}/keys"
payload = {
"provider": "KMS",
"kid": "<string>",
"public_key_b64url": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/issuers/{id}/keys"
payload := strings.NewReader("{\n \"provider\": \"KMS\",\n \"kid\": \"<string>\",\n \"public_key_b64url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"kid": "<string>",
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"algorithm": "Ed25519",
"public_key": "<string>",
"status": "ACTIVE",
"not_before": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}{
"code": "VALIDATION_ERROR",
"message": "Unsupported algorithm. Must be one of: ES256, ES384, ES512, RS256, RS384, RS512, PS256, PS384, PS512, Ed25519",
"http_status": 400
}ينشئ مفتاحًا مُدارًا أو يسجل مادة مفتاح عام للمصدر المحدد بواسطة معلمة المسار
يعتمد توفر الخوارزمية على المزود المنشور. اسم الخوارزمية وحده لا يثبت الامتثال لمعيار صناعي أو حكومي.
id.
التوقيع المدار
استخدمprovider: "KMS" وalg المطلوب. يدعم التوليد المدار Ed25519, ES256, ES384, RS256, RS512, PS256 and PS512. راجع algorithm support and encoding. استخدم kid الذي تم إنشاؤه والذي تم إرجاعه في الاستجابة؛ لا يتم الاحتفاظ بمعرف مفتاح مطلوب عشوائي في هذا الوضع.
{"provider": "KMS", "alg": "Ed25519"}
تسجيل المفتاح العام
يتطلب وضع الاستيرادkid و alg و public_key_b64url. algorithm و public_key ليسا بديلين. قم بترميز بايتات المفتاح العام DER SubjectPublicKeyInfo كـ base64url غير مبطن.
تسجيل مفتاح عام لا يوفر مفتاحه الخاص، وهو غير كافٍ بحد ذاته لسك العملات من جانب الخادم. لا ترسل أبدًا مادة المفتاح الخاص في هذا الطلب.
يتضمن الرد issuer_id، kid، alg، public_key_b64url، provider، وcreated_at. تأكد من توفر التوقيع قبل السك.الجسم
application/json
- Managed signing key
- Imported public verification key
الاستجابة
تم تسجيل المفتاح

