github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/newcmd/did/diddoc.go (about) 1 // Copyright (c) 2022 IoTeX Foundation 2 // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 6 package did 7 8 const ( 9 // DIDPrefix is the prefix string 10 DIDPrefix = "did:io:" 11 // DIDAuthType is the authentication type 12 DIDAuthType = "EcdsaSecp256k1VerificationKey2019" 13 // DIDOwner is the suffix string 14 DIDOwner = "#owner" 15 ) 16 17 type ( 18 authenticationStruct struct { 19 ID string `json:"id,omitempty"` 20 Type string `json:"type,omitempty"` 21 Controller string `json:"controller,omitempty"` 22 PublicKeyHex string `json:"publicKeyHex,omitempty"` 23 } 24 // Doc is the DID document struct 25 Doc struct { 26 Context string `json:"@context,omitempty"` 27 ID string `json:"id,omitempty"` 28 Authentication []authenticationStruct `json:"authentication,omitempty"` 29 } 30 ) 31 32 func newDIDDoc() *Doc { 33 return &Doc{ 34 Context: "https://www.w3.org/ns/did/v1", 35 } 36 }