Appearance
did:btcr2 Update
This page explains states and a typical flow of client-managed secret mode with the did:btcr2 method.
States
🚧 Under Construction
Requests and Responses
Request 1:
bash
curl -X POST "https://api.godiddy.com/1.0.0/universal-registrar/update" \
-H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-H "Content-Type: application/json" \
-d '{
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"didDocumentOperation" : [ "addToDidDocument" ],
"didDocument" : [ {
"service" : [ {
"id" : "#didcomm",
"type" : "DIDCommMessaging",
"serviceEndpoint" : "http://example.com/didcomm"
} ]
} ],
"options" : {
"clientSecretMode" : true,
"publishToIpfs" : true
},
"secret" : { }
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Response A: action=getVerificationMethod
json
{
"jobId": null,
"didState": {
"state" : "action",
"action" : "getVerificationMethod",
"verificationMethodTemplate" : [ {
"purpose" : [ "capabilityInvocation" ],
"publicKeyJwk" : {
"crv" : "secp256k1",
"kty" : "EC"
}
} ]
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Request 2: verificationMethod "#initialKey"
bash
curl -X POST "https://api.godiddy.com/1.0.0/universal-registrar/update" \
-H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-H "Content-Type: application/json" \
-d '{
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"didDocumentOperation" : [ "addToDidDocument" ],
"didDocument" : [ {
"service" : [ {
"id" : "#didcomm",
"type" : "DIDCommMessaging",
"serviceEndpoint" : "http://example.com/didcomm"
} ]
} ],
"options" : {
"clientSecretMode" : true,
"publishToIpfs" : true
},
"secret" : {
"verificationMethod" : [ {
"publicKeyMultibase" : "zQ3shfZbaDJq3RVyH2pjaLSnTU1oeigrrGWeCGUZCF3R4A4T4",
"id" : "#initialKey",
"type" : "Multikey",
"controller" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"purpose" : [ "authentication", "assertionMethod", "capabilityInvocation", "capabilityDelegation" ]
} ]
}
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Response B: action=signPayload with "update"
json
{
"jobId": { ... },
"didState": {
"state": "action",
"action": "signPayload",
"signingRequest": {
"update": {
"kid": "#initialKey",
"alg": "ES256KS",
"purpose" : "capabilityInvocation",
"serializedPayload": "<-- base 64 encoded -->"
}
}
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Request 3: signingResponse for "update"
bash
curl -X POST "https://api.godiddy.com/1.0.0/universal-registrar/update" \
-H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-H "Content-Type: application/json" \
-d '{
"jobId": { ... },
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"didDocumentOperation" : [ "addToDidDocument" ],
"didDocument" : [ {
"service" : [ {
"id" : "#didcomm",
"type" : "DIDCommMessaging",
"serviceEndpoint" : "http://example.com/didcomm"
} ]
} ],
"options" : {
"clientSecretMode" : true,
"publishToIpfs" : true
},
"secret" : {
"signingResponse" : {
"update" : {
"kid" : "#initialKey",
"alg" : "ES256KS",
"purpose" : "capabilityInvocation",
"signature" : "bIfegnSmiajDKszJBOa2tjccWn/kBZbrv9fYmX0ppKfEsup84yyNvWF3W4VCBuBqqQivyuOIgH4WJe4hmY6AZw=="
}
}
}
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Response C: action=action with "fundAddress"
json
{
"jobId": { ... },
"didState": {
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"state" : "action",
"action" : "fundAddress",
"minimumValue" : 100,
"address" : "muzfoioNKyteAM7dW63XhE2ioThN24cHsr"
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Request 4: signingResponse for "update"
Note: This Request 4 is the same as Request 3.
bash
curl -X POST "https://api.godiddy.com/1.0.0/universal-registrar/update" \
-H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-H "Content-Type: application/json" \
-d '{
"jobId": { ... },
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"didDocumentOperation" : [ "addToDidDocument" ],
"didDocument" : [ {
"service" : [ {
"id" : "#didcomm",
"type" : "DIDCommMessaging",
"serviceEndpoint" : "http://example.com/didcomm"
} ]
} ],
"options" : {
"clientSecretMode" : true,
"publishToIpfs" : true
},
"secret" : {
"signingResponse" : {
"update" : {
"kid" : "#initialKey",
"alg" : "ES256KS",
"purpose" : "capabilityInvocation",
"signature" : "bIfegnSmiajDKszJBOa2tjccWn/kBZbrv9fYmX0ppKfEsup84yyNvWF3W4VCBuBqqQivyuOIgH4WJe4hmY6AZw=="
}
}
}
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Response D: action=signPayload with "utxoSingleton0"
json
{
"jobId": { ... },
"didState": {
"state": "action",
"action": "signPayload",
"signingRequest": {
"utxoSingleton0": {
"alg" : "ES256KRR",
"purpose" : "capabilityInvocation",
"serializedPayload" : "aPXFN5g6vhp0iMJcrq1OMHXXzNiEbN188WWHzY/qDOA="
}
}
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Request 5: signingResponse for "utxoSingleton0"
bash
curl -X POST "https://api.godiddy.com/1.0.0/universal-registrar/update" \
-H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-H "Content-Type: application/json" \
-d '{
"jobId": { ... },
"did" : "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"didDocumentOperation" : [ "addToDidDocument" ],
"didDocument" : [ {
"service" : [ {
"id" : "#didcomm",
"type" : "DIDCommMessaging",
"serviceEndpoint" : "http://example.com/didcomm"
} ]
} ],
"options" : {
"clientSecretMode" : true,
"publishToIpfs" : true
},
"secret" : {
"signingResponse" : {
"utxoSingleton0" : {
"kid" : "#initialKey",
"alg" : "ES256KRR",
"purpose" : "capabilityInvocation",
"signature" : "jGqKzYDKKyPdWqxxNHxK9/AwsKNFacKIhK+8Ise/yyxA722z7pPqE0J4GtywE8Ow+xQwhLCNuC1tB2slfEougBs="
}
}
}
}'1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Response E: state=finished
json
{
"jobId": { ... },
"didState": {
"state": "finished",
"did": "did:btcr2:k1q5psmvljwps2h27fyg3y0zl65m3gq3p8p83mdm2rcrar9g2l3fus26cwdyc82",
"secret": { }
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
OpenSSL Commands
For Response B and Response D
See Response B and Response D.
Extract the value of serializedPayload from Response B. Then Base64-decode the payload and write to a file:
shell
echo "<-- base64 encoded -->"|basenc -d --base64 >payload1
For Request 3 and Request 5
Sign the payload with the DID controller private key:
shell
openssl pkeyutl -sign -in payload -inkey privkey -keyform DER >signature_der
openssl asn1parse -in signature_der -inform DER| sed 2!d| cut -d ':' -f4| basenc -d --base16 >signature_bin
openssl asn1parse -in signature_der -inform DER| sed 3!d| cut -d ':' -f4| basenc -d --base16 >>signature_bin
echo -n "1B"| basenc -d --base16 >>signature_bin # or 1C instead of 1B (recovery bit)
cat signature_bin| basenc -w0 --base64 >signature1
2
3
4
5
2
3
4
5
The result can then be used as value of signature in Request 3 and Request 5.