Используемая вами команда curl не отправляет JSON. JSON требует двойных кавычек вокруг ключей и значений.
Измените все ваши «на» и оберните их так:
--data '{"header":{"alg":"ES256K",...}' -X POST https://beta.ion.microsoft.com/api/1.0/register
Когда я это сделал, я получил HTTP/1.1 200 OK
(Кроме того, -X POST
не является необходимым - POST
уже подразумевается другими частями команды curl
.)
ОБНОВЛЕНИЕ 1 Исходя из вашего комментария от 6/30, я обновил этот ответ не сокращенной формой того, что я имею в виду, с выводом curl, показывающим, что он работает:
полная команда скручивания
curl -v -H "Content-Type: application/json" --data '{"header":{"alg":"ES256K","kid":"#key-1","operation":"create","proofOfWork":"{}"},"payload":"eyJAY29udGV4dCI6Imh0dHBzOi8vdzNpZC5vcmcvZGlkL3YxIiwicHVibGljS2V5IjpbeyJpZCI6IiNrZXktMSIsInR5cGUiOiJTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE4IiwicHVibGljS2V5SndrIjp7Imt0eSI6IkVDIiwia2lkIjoiI2tleS0xIiwiY3J2IjoiUC0yNTZLIiwieCI6IjVvTEg2ZUVfdWZjZ2VlZ1U2NFo1ZFlEdUxjWWJSV3hsYk1xdFVnbmVRRWMiLCJ5IjoieXZEcXhwaXlCYlZsUlF1cXhHUm54U3hNbDJwSFFTem5Ub0U1dTZKMzBkSSIsInVzZSI6InZlcmlmeSIsImRlZmF1bHRFbmNyeXB0aW9uQWxnb3JpdGhtIjoibm9uZSIsImRlZmF1bHRTaWduQWxnb3JpdGhtIjoiRVMyNTZLIn19XSwic2VydmljZSI6W3siaWQiOiJJZGVudGl0eUh1YiIsInR5cGUiOiJJZGVudGl0eUh1YiIsInNlcnZpY2VFbmRwb2ludCI6eyJAY29udGV4dCI6InNjaGVtYS5pZGVudGl0eS5mb3VuZGF0aW9uL2h1YiIsIkB0eXBlIjoiVXNlclNlcnZpY2VFbmRwb2ludCIsImluc3RhbmNlIjpbImRpZDp0ZXN0Omh1Yi5pZCJdfX1dfQ","signature":"MEYCIQCb7qxCFyIcYumN-HbYqleTc5YldwRnNrhDzlB1DEubQQIhAMkAdsa-BxwV5EghhLljbr84MjkmUYI5narCTnapBcxs"}' -X POST https://beta.ion.microsoft.com/api/1.0/register
Скручивание коробки передач
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 52.183.24.15...
* TCP_NODELAY set
* Connected to beta.ion.microsoft.com (52.183.24.15) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=beta.ion.microsoft.com
* start date: Apr 25 21:41:42 2019 GMT
* expire date: Apr 25 21:41:42 2020 GMT
* subjectAltName: host "beta.ion.microsoft.com" matched cert's "beta.ion.microsoft.com"
* issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT TLS CA 2
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f9e0e00c600)
> POST /api/1.0/register HTTP/2
> Host: beta.ion.microsoft.com
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 908
>
ответ curl
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< request-id: 3545fb10-998e-4871-a28c-bc92e7d82648
< vary: Origin, Accept-Encoding
< x-dns-prefetch-control: off
< x-frame-options: SAMEORIGIN
< strict-transport-security: max-age=31536000; includeSubDomains
< x-download-options: noopen
< x-content-type-options: nosniff
< x-xss-protection: 1; mode=block
< content-type: application/json; charset=utf-8
< content-length: 828
< server-timing: total;dur=171.0000
< date: Mon, 01 Jul 2019 03:56:45 GMT
< x-envoy-upstream-service-time: 173
< server: envoy
<
{
"@context": "https://w3id.org/did/v1",
"publicKey": [
{
"id": "#key-1",
"type": "Secp256k1VerificationKey2018",
"publicKeyJwk": {
"kty": "EC",
"kid": "#key-1",
"crv": "P-256K",
"x": "5oLH6eE_ufcgeegU64Z5dYDuLcYbRWxlbMqtUgneQEc",
"y": "yvDqxpiyBbVlRQuqxGRnxSxMl2pHQSznToE5u6J30dI",
"use": "verify",
"defaultEncryptionAlgorithm": "none",
"defaultSignAlgorithm": "ES256K"
}
}
],
"service": [
{
"id": "IdentityHub",
"type": "IdentityHub",
"serviceEndpoint": {
"@context": "schema.identity.foundation/hub",
"@type": "UserServiceEndpoint",
"instance": [
"did:test:hub.id"
]
}
}
],
"id": "did:ion:test:EiBXX4kWVIMsvP-evbWvr37Vy2UY32ALpNu9nssBhj_Pdg"
* Connection #0 to host beta.ion.microsoft.com left intact