DID
Manage DID operation using DID APIs
Please generate access token before proceeding. Once you generated the access_token, you can pass this token as bearer authorization token in the header for all APIs.
There are 3 steps involved in DID creation:
Generate a DID Document: Generate the data structure of the DID document.
Sign a DID Document (optional): Sign the DID Document using verification method.
Register a DID Document (optional) : Registers the signed DID Document on the blockchain network.
Create a DID
Generates the a new DID and DID Document.
Bearer <access_token>
Origin as you set in application cors
Namespace to be added in did.
testnetMethodSpecificId to be added in did
0x19d73aeeBcc6FEf2d0342375090401301Fe9663FkeyType used for verification
{"keyType":"Ed25519VerificationKey2020","chainId":"0x1","publicKey":"z76tzt4XCb6FNqC3CPZvsxRfEDX5HHQc2VPux4DeZYndW","walletAddress":"0x01978e553Df0C54A63e2E063DFFe71c688d91C76","verificationRelationships":["assertionMethod","authentication"]}DID Created
Error occured at the time of creating did
Duplicate key error
POST /api/v1/did/create HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 340
{
"namespace": "testnet",
"methodSpecificId": "0x19d73aeeBcc6FEf2d0342375090401301Fe9663F",
"options": {
"keyType": "Ed25519VerificationKey2020",
"chainId": "0x1",
"publicKey": "z76tzt4XCb6FNqC3CPZvsxRfEDX5HHQc2VPux4DeZYndW",
"walletAddress": "0x01978e553Df0C54A63e2E063DFFe71c688d91C76",
"verificationRelationships": [
"assertionMethod",
"authentication"
]
}
}{
"did": "did:hid:namespace:.......................",
"registrationStatus": "COMPLETED/PROCESSING",
"metaData": {
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1"
],
"id": "did:hid:method:......",
"controller": [
"did:hid:method:......"
],
"alsoKnownAs": [
"did:hid:method:......"
],
"verificationMethod": [
{
"id": "did:hid:testnet:z28ScfSszr2zi2Bd7qmNE4mfHX5j8nCwx4DBF6nAUHu4p#key-1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:hid:method:..............",
"blockchainAccountId": "eip155:1:0x19d73aeeBcc6FEf2d0342375090401301Fe9663F"
}
],
"authentication": [
"did:hid:method:......"
],
"assertionMethod": [
"did:hid:method:......"
],
"keyAgreement": [
"did:hid:method:......"
],
"capabilityInvocation": [
"did:hid:method:......"
],
"capabilityDelegation": [
"did:hid:method:......"
],
"service": [
{
"id": "did:hid:testnet:z23dCariJNNpMNca86EtVZVvrLpn61isd86fWVyWa8Jkm#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://stage.hypermine.in/studioserver/api/v1/org/did:hid:testnet:......................"
}
]
}
}
}Request Body Parameters
Namespace: DID name space. Possible value is
testnet
Optional Parameters
MethodSpecificId: Custom Id string which you want to attach with the DID. Please read did:hid method spec for details about possible format.
Options.keyTypes: We support
Ed25519VerificationKey2020,EcdsaSecp256k1RecoveryMethod2020verification method key types. So only these two are possible values. Read the full specification here.Options.publicKey: Please pass the
options.publickeyproperty only forEd25519VerificationKey2020verification method key type. ForEcdsaSecp256k1RecoveryMethod2020, this property can be kept blank. Its value would be publickey (in multi base format)Options.walletAddress: Please pass
options.walletAddressfor keyTypeEcdsaSecp256k1RecoveryMethod2020Options.chainId: ChainId in HEX format. For example for Etheruem main net, the chain id would be
0x1. This property is only required for keytypeEcdsaSecp256k1RecoveryMethod2020
Register a DID
Registers a Signed DID Document in DID registry. The Gas fee (network fee) for this DID registration will be done by applications' walletAddress.
Bearer <access_token>
Origin as you set in application cors
Did doc to be registered
Verification Method id for did registration
did:hid:testnet:........#key-${idx}IClientSpec 'eth-personalSign' or 'cosmos-ADR036'
eth-personalSignSignature for clientSpec
afafljagahgp9agjagknaglkj/kagka=DID Registred
Error occured at the time of creating did
POST /api/v1/did/register HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1028
{
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1"
],
"id": "did:hid:method:......",
"controller": [
"did:hid:method:......"
],
"alsoKnownAs": [
"did:hid:method:......"
],
"verificationMethod": [
{
"id": "did:hid:testnet:z28ScfSszr2zi2Bd7qmNE4mfHX5j8nCwx4DBF6nAUHu4p#key-1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:hid:method:..............",
"blockchainAccountId": "eip155:1:0x19d73aeeBcc6FEf2d0342375090401301Fe9663F"
}
],
"authentication": [
"did:hid:method:......"
],
"assertionMethod": [
"did:hid:method:......"
],
"keyAgreement": [
"did:hid:method:......"
],
"capabilityInvocation": [
"did:hid:method:......"
],
"capabilityDelegation": [
"did:hid:method:......"
],
"service": [
{
"id": "did:hid:testnet:z23dCariJNNpMNca86EtVZVvrLpn61isd86fWVyWa8Jkm#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://stage.hypermine.in/studioserver/api/v1/org/did:hid:testnet:......................"
}
]
},
"verificationMethodId": "did:hid:testnet:........#key-${idx}",
"clientSpec": "eth-personalSign",
"signature": "afafljagahgp9agjagknaglkj/kagka="
}{
"did": "did:hid:namespace:.......................",
"registrationStatus": "COMPLETED/PROCESSING",
"metaData": {
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1"
],
"id": "did:hid:method:......",
"controller": [
"did:hid:method:......"
],
"alsoKnownAs": [
"did:hid:method:......"
],
"verificationMethod": [
{
"id": "did:hid:testnet:z28ScfSszr2zi2Bd7qmNE4mfHX5j8nCwx4DBF6nAUHu4p#key-1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:hid:method:..............",
"blockchainAccountId": "eip155:1:0x19d73aeeBcc6FEf2d0342375090401301Fe9663F"
}
],
"authentication": [
"did:hid:method:......"
],
"assertionMethod": [
"did:hid:method:......"
],
"keyAgreement": [
"did:hid:method:......"
],
"capabilityInvocation": [
"did:hid:method:......"
],
"capabilityDelegation": [
"did:hid:method:......"
],
"service": [
{
"id": "did:hid:testnet:z23dCariJNNpMNca86EtVZVvrLpn61isd86fWVyWa8Jkm#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://stage.hypermine.in/studioserver/api/v1/org/did:hid:testnet:......................"
}
]
}
},
"transactionHash": "XYAIFLKFLKHSLFHKLAOHFOAIHG.........."
}Request Parameters
didDocument : DID documented generated using
/api1/v1/did/createAPIverificationMethodId : Verification Method id of referred verification method in the didDocument
Optional Parameters
clientSpec : Wallet specifications which are used to sign the didDocument string. Use
eth-personalSignfor Metamask andcosmos-ADR036for Keplr wallet. Learn more about client specifications here.signature: If didDocument is signed using client wallets (Metamask or Keply) then pass the signature hex string.
Note: Read how to use Metamask to create Hypersign DID.
Resolve a DID
Given a DID Id (example: did:hid:testnet:0x123123123123), this API will resolve the corresponding DID Document from the DID registry (or Hypersign Blockchain).
Bearer <access_token>
Origin as you set in application cors
DID Resolved
GET /api/v1/did/resolve/{did} HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
DID Resolved
{
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1"
],
"id": "did:hid:method:......",
"controller": [
"did:hid:method:......"
],
"alsoKnownAs": [
"did:hid:method:......"
],
"verificationMethod": [
{
"id": "did:hid:testnet:z28ScfSszr2zi2Bd7qmNE4mfHX5j8nCwx4DBF6nAUHu4p#key-1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:hid:method:..............",
"blockchainAccountId": "eip155:1:0x19d73aeeBcc6FEf2d0342375090401301Fe9663F"
}
],
"authentication": [
"did:hid:method:......"
],
"assertionMethod": [
"did:hid:method:......"
],
"keyAgreement": [
"did:hid:method:......"
],
"capabilityInvocation": [
"did:hid:method:......"
],
"capabilityDelegation": [
"did:hid:method:......"
],
"service": [
{
"id": "did:hid:testnet:z23dCariJNNpMNca86EtVZVvrLpn61isd86fWVyWa8Jkm#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://stage.hypermine.in/studioserver/api/v1/org/did:hid:testnet:......................"
}
]
},
"didDocumentMetadata": {
"created": "2023-01-23T13:45:17Z",
"updated": "2023-01-23T13:45:17Z",
"deactivated": "false",
"versionId": "095A65E4D2F9CA2AACE0D17A28883A0E5DDC1BBE1C9BF9D............."
}
}Fetch all DIDs for your apps
Page value
1Fetch limited list of data
10Bearer <access_token>
Origin as you set in application cors
DID List
Error in finding resource
GET /api/v1/did HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
{
"totalCount": 12,
"data": [
"did:hid:testnet:............"
]
}
]Update a DID
Update a DIDDocument
Bearer <access_token>
Origin as you set in application cors
Did doc to be updated
Field to check if to deactivate did or to update it
falseVerification Method id for did updation
did:hid:testnet:........#key-${idx}IClientSpec 'eth-personalSign' or 'cosmos-ADR036'
eth-personalSignSignature for clientSpec
afafljagahgp9agjagknaglkj/kagka=DID Updated
Invalid didDoc
Resource not found
PATCH /api/v1/did HTTP/1.1
Host:
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1047
{
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1"
],
"id": "did:hid:method:......",
"controller": [
"did:hid:method:......"
],
"alsoKnownAs": [
"did:hid:method:......"
],
"verificationMethod": [
{
"id": "did:hid:testnet:z28ScfSszr2zi2Bd7qmNE4mfHX5j8nCwx4DBF6nAUHu4p#key-1",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:hid:method:..............",
"blockchainAccountId": "eip155:1:0x19d73aeeBcc6FEf2d0342375090401301Fe9663F"
}
],
"authentication": [
"did:hid:method:......"
],
"assertionMethod": [
"did:hid:method:......"
],
"keyAgreement": [
"did:hid:method:......"
],
"capabilityInvocation": [
"did:hid:method:......"
],
"capabilityDelegation": [
"did:hid:method:......"
],
"service": [
{
"id": "did:hid:testnet:z23dCariJNNpMNca86EtVZVvrLpn61isd86fWVyWa8Jkm#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://stage.hypermine.in/studioserver/api/v1/org/did:hid:testnet:......................"
}
]
},
"deactivate": false,
"verificationMethodId": "did:hid:testnet:........#key-${idx}",
"clientSpec": "eth-personalSign",
"signature": "afafljagahgp9agjagknaglkj/kagka="
}{
"transactionHash": "XYAIFLKFLKHSLFHKLAOHFOAIHG.........."
}Request Parameters
didDocument : DID documented to be updated
verificationMethodId : Verification Method id of referred verification method in the didDocument
deactivate :
trueis you want to deactivate this DID,falseotherwise.
Optional Parameters
clientSpec : Wallet specifications which are used to sign the didDocument string. Use
eth-personalSignfor Metamask andcosmos-ADR036for Keplr wallet. Learn more about client specifications here.signature: If didDocument is signed using client wallets (Metamask or Keply) then pass the signature hex string.
Last updated