This page explains states and a typical flow of client-managed secret mode with the did:ebsi
method. See https://identity.foundation/did-registration/#client-managed-secret-mode for more information about the protocol.
Possible states:
verificationMethod
"#key-1"Supported secrets:
curl -H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-X POST "https://api.godiddy.com/0.1.0/universal-registrar/create?method=ebsi" \
-H "Content-Type: application/json" \
-d '{
"options": {
"clientSecretMode": true
},
"secret": {
"token": "<-- onboarding token -->"
},
"didDocument": {
"@context": ["https//www.w3.org/ns/did/v1"],
"service": [{
"id": "#didcomm",
"type": "DIDComm",
"serviceEndpoint": "https://test.com/mydidcomm/endpoint"
}]
}
}'
action=getVerificationMethod
{
"jobId": null,
"didState": {
"state": "action",
"action": "getVerificationMethod",
"verificationMethodTemplate": [{
"id": "#key-1",
"type": "EcdsaSecp256k1VerificationKey2019"
}],
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}
verificationMethod
"#key-1"Supported secrets:
curl -H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-X POST "https://api.godiddy.com/0.1.0/universal-registrar/create?method=ebsi" \
-H "Content-Type: application/json" \
-d '{
"options": {
"clientSecretMode": true
},
"secret": {
"token": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJ..."
},
"didDocument": {
"@context": ["https//www.w3.org/ns/did/v1"],
"verificationMethod": [{
"id": "#key-1",
"type": "EcdsaSecp256k1VerificationKey2019",
"publicKeyHex": "<-- hex encoded -->"
}],
"service": [{
"id": "#didcomm",
"type": "DIDComm",
"serviceEndpoint": "https://test.com/mydidcomm/endpoint"
}]
}
}'
action=signPayload
with "signingRequest1"{
"jobId": "00000000-0000-0000-0000-000000000000",
"didState": {
"state": "action",
"action": "signPayload",
"signingRequest": {
"signingRequest1": {
"kid": "#key-1",
"alg": "ES256K",
"payload": { ... },
"serializedPayload": "<-- base 64 encoded -->"
}
}
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}
signingResponse
for "signingRequest1"curl -H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-X POST "https://api.godiddy.com/0.1.0/universal-registrar/create?method=ebsi" \
-H "Content-Type: application/json" \
-d '{
"jobId": "00000000-0000-0000-0000-000000000000",
"options": {
"clientSecretMode": true
},
"secret": {
"signingResponse": {
"signingRequest1": {
"signature": "<-- base64 encoded -->"
}
}
},
"didDocument": { }
}'
action=signPayload
with "signingRequest1"{
"jobId": "00000000-0000-0000-0000-000000000000",
"didState": {
"state": "action",
"action": "signPayload",
"signingRequest": {
"signingRequest1": {
"kid": "#key-1",
"alg": "ES256KCC",
"payload": { ... },
"serializedPayload": "<-- base 64 encoded -->"
}
}
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}
signingResponse
for "signingRequest1"curl -H "Authorization: Bearer b082c420-df67-4b06-899c-b7c51d75fba0" \
-X POST "https://api.godiddy.com/0.1.0/universal-registrar/create?method=ebsi" \
-H "Content-Type: application/json" \
-d '{
"jobId": "00000000-0000-0000-0000-000000000000",
"options": {
"clientSecretMode": true
},
"secret": {
"signingResponse": {
"signingRequest1": {
"signature": "<-- base64 encoded -->"
}
}
},
"didDocument": { }
}'
state=finished
{
"jobId": "00000000-0000-0000-0000-000000000000",
"didState": {
"state": "finished",
"did": "did:ebsi:zqSjfbi9GYR6cHuehD85ePw",
"secret": { }
},
"didRegistrationMetadata": { ... },
"didDocumentMetadata": { ... }
}
Generate a new DID controller keypair (secp256k1):
openssl ecparam -genkey -name secp256k1 -outform DER >privkey
openssl ec -conv_form uncompressed -in privkey -pubout -out pubkey -inform DER -outform DER
Convert DID controller public key to hex:
cat pubkey| tail -c +24| basenc -w0 --base16
The result can then be used as value of publicKeyHex
in Request 2.
Extract the value of serializedPayload
from Response B or Response C or Response D or Response E. Then Base64-decode the payload and write to a file:
echo "<-- base64 encoded -->"| basenc -d --base64 >payload
Sign the payload with the DID controller private key:
openssl pkeyutl -sign -rawin -in payload -inkey privkey -keyform DER -digest sha256 >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
cat signature_bin| basenc -w0 --base64 >signature
The result can then be used as value of signature
in Request 3 or Request 4 or Request 5.
Sign the payload with the DID controller private key:
openssl pkeyutl -sign -rawin -in payload -inkey privkey -keyform DER -digest sha3-256 >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
cat signature_bin| basenc -w0 --base64 >signature
The result can then be used as value of signature
in Request 6.