Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Refactor; Implementation of Service and capabilityDelegation in didSpec #75

Merged
merged 1 commit into from
Feb 20, 2022

Conversation

arnabghose997
Copy link
Contributor

Changelog

  • Code Refactor
    • The types DidDocStructCreateDID and DidDocStructUpdateDID have been replaced with the generic type Did
    • Message server and Message types for DID and Schema are merged into singular files.
  • Service and capabilityDelegation has been implemented in the DidDoc

Tests for Service field

The CLI commands, upon executing, gave the expected results.

1. Invalid Service ID

hid-noded tx ssi create-did '{
"context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/v1",
"https://schema.org"
],
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51",
"controller": [],
"alsoKnownAs": ["did:hs:1f49341a-de30993e6c51"],
"verificationMethod": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf",
"type": "Ed25519VerificationKey2020",
"controller": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51",
"publicKeyMultibase": "zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf"
}
],
"service": [
{
"id": "did:something:0f49341a-20ef-43d1-bc93-de30993e6c51#service-1",
"type": "LinkedDomains",
"serviceEndpoint": "example.com"
}
],
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf"
]
}' did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf --ver-key oVtY1xceDZQjkfwlbCEC2vgeADcxpgd27vtYasBhcM/JLR6PnPoD9jvjSJrMsMJwS7faPy5OlFCdj/kgLVZMEg== --from alice --chain-id hidnode --yes

Result:

raw_log: 'failed to execute message; message index: 0: Service ID did:something:0f49341a-20ef-43d1-bc93-de30993e6c51#service-1
  is Invalid: Invalid Service [cosmos/cosmos-sdk@v0.44.5/types/errors/errors.go:273]:
  DidDoc is invalid

2. Invalid Service Type

hid-noded tx ssi create-did '{
"context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/v1",
"https://schema.org"
],
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52",
"controller": ["did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52"],
"alsoKnownAs": ["did:hs:1f49341a-de30993e6c52"],
"verificationMethod": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4",
"type": "Ed25519VerificationKey2020",
"controller": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52",
"publicKeyMultibase": "z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4"
}
],
"service": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#service-1",
"type": "SomeType",
"serviceEndpoint": "example.com"
}
],
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4"
]
}' did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4 --ver-key bZBUkLGChnJujYHUZ4L8PECoN2Odv6adWGXc1qVWCRVqtEx0o/FmtFZnd5pT3laR518P58TRUGY5q5KSrToSmQ== --from alice --chain-id hidnode --yes

Result:

raw_log: 'failed to execute message; message index: 0: Service Type SomeType is Invalid:
  Invalid Service [cosmos/cosmos-sdk@v0.44.5/types/errors/errors.go:273]: DidDoc is
  invalid'

3. Duplicate Services

hid-noded tx ssi create-did '{
"context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/v1",
"https://schema.org"
],
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51",
"controller": [],
"alsoKnownAs": ["did:hs:1f49341a-de30993e6c51"],
"verificationMethod": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf",
"type": "Ed25519VerificationKey2020",
"controller": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51",
"publicKeyMultibase": "zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf"
}
],
"service": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#service-1",
"type": "LinkedDomains",
"serviceEndpoint": "example.com"
},
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#service-2",
"type": "LinkedDomains",
"serviceEndpoint": "example.com/index"
}
],
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf"
]
}' did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf --ver-key oVtY1xceDZQjkfwlbCEC2vgeADcxpgd27vtYasBhcM/JLR6PnPoD9jvjSJrMsMJwS7faPy5OlFCdj/kgLVZMEg== --from alice --chain-id hidnode --yes

Result:

raw_log: 'failed to execute message; message index: 0: Service with Id: did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#service-1
  is duplicate: Invalid Service [cosmos/cosmos-sdk@v0.44.5/types/errors/errors.go:273]:
  DidDoc is invalid'

@arnabghose997 arnabghose997 self-assigned this Feb 20, 2022
@arnabghose997 arnabghose997 added this to In progress in Hypersign Identity Network v0.0.2 via automation Feb 20, 2022
@arnabghose997 arnabghose997 merged commit 42ee9fe into main Feb 20, 2022
Hypersign Identity Network v0.0.2 automation moved this from In progress to Done Feb 20, 2022
@arnabghose997 arnabghose997 deleted the ssi-module-code-restructure-service branch February 21, 2022 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Refactor Code to reduce redundancy Implment service property in did doc
1 participant