/
diddoc.go
37 lines (33 loc) · 1.23 KB
/
diddoc.go
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
30
31
32
33
34
35
36
37
// Copyright (c) 2020 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
package did
const (
// DIDPrefix is the prefix string
DIDPrefix = "did:io:"
// DIDAuthType is the authentication type
DIDAuthType = "EcdsaSecp256k1VerificationKey2019"
// DIDOwner is the suffix string
DIDOwner = "#owner"
)
type (
authenticationStruct struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Controller string `json:"controller,omitempty"`
PublicKeyHex string `json:"publicKeyHex,omitempty"`
}
// Doc is the DID document struct
Doc struct {
Context string `json:"@context,omitempty"`
ID string `json:"id,omitempty"`
Authentication []authenticationStruct `json:"authentication,omitempty"`
}
)
func newDIDDoc() *Doc {
return &Doc{
Context: "https://www.w3.org/ns/did/v1",
}
}