Trust network
How to configure a trust network?
The configuration of roles is flexible and can be done through modifying your node's configuration files. All of the available properties can be found under trust_network. For the roles to take effect, indexing must be set to true, otherwise the roles will not be stored by the indexer.
1
{
2
"trust_network": {
3
"indexing": true,
4
"roles": {
5
"root": { "description": "The root role" }
6
}
7
}
8
}
Copied!
Under roles, you can describe what are the roles for your trust network, giving each of them a description.

Structure

The blockchain address of your own node is always the root of the network. In the example, the university role is an association from the root account to the university account.
1
"roles": {
2
"root": {
3
"description": "My identity",
4
"issues": [
5
{"type": 100, "role": "university"},
6
]
7
},
8
"university": {
9
"description": "University"
10
}
11
}
Copied!
When the trust network configuration changes, the roles need to be reindexed. Resolving roles is only deterministic if the configuration is unchanged.

Hierarchy

A role can also issue other roles, which can be configured through the issues property. This can be used to create a hierarchy, where your node only creates an association to follow an authority.
1
"roles": {
2
"root": {
3
"description": "My identity",
4
"issues": [
5
{"type": 101, "role": "authority"},
6
]
7
},
8
"authority": {
9
"description": "Authority to appoint universities",
10
"issues": [
11
{"type": 100, "role": "university"}
12
]
13
},
14
"university": {
15
"description": "University"
16
}
17
}
Copied!
Under the issues property, you specify which roles can be issued, and what's the type of association for that role. In the example above, authority role can issue university role to an address when the association is type: 100.
The issues property is optional. When omitted, the role is an endpoint; it can't issue other roles.

Sub-roles

The type property does not mean the id of the role, but instead the association type. Different roles can issue differently based on the type. This can be used to create more complex structures.
1
"roles": {
2
"root": {
3
"description": "My identity",
4
"issues": [
5
{"type": 900, "role": "ministry"},
6
]
7
},
8
"ministry": {
9
"description": "Ministry of education",
10
"issues": [
11
{"type": 100, "role": "university"},
12
{"type": 101, "role": "authority"} // issues "authority" for type 101
13
]
14
},
15
"authority": {
16
"description": "Delegated authority to appoint universities",
17
"issues": [
18
{"type": 100, "role": "university"},
19
{"type": 101, "role": "sub_authority"}, // issues "sub_authority" for type 101
20
]
21
},
22
"sub_authority": {
23
"description": "Secondary delegated authority to appoint universities",
24
"issues": [
25
{"type": 100, "role": "university"},
26
]
27
},
28
"university": {
29
"description": "University",
30
}
31
}
Copied!
In the example above, we can see that ministry can issue the roles of university and authority by resolving associations of type: 100 and type: 101 respectively. But authority issues the role of sub_authority when the association is type: 101.

Web of trust

In a hierarchy, there is a centralized authority who should be trusted. A web of trust is a decentralized trust network that revolves around trust relationships between identities.
1
"roles": {
2
"root": {
3
"issues": [
4
{"type": 32, "role": "level1"}
5
]
6
},
7
"level1": {
8
"issues": [
9
{"type": 32, "role": "level2"}
10
]
11
},
12
"level2": {
13
"issues": [
14
{"type": 32, "role": "level3"}
15
]
16
},
17
"level3": {
18
}
19
}
Copied!

Authorization

Verifiable credentials are used for identifying subjects, but VCs alone are not enough to provide a complete toolset for verifying the authorization layer. With the trust network, we can build an authorization framework to fill that gap.
The authorization property is an array of credential URLs that the role can issue. The framework is built on this property, which can then be used to verify the authority of a credential.
1
"roles": {
2
"root": {
3
"description": "My identity",
4
"issues": [
5
{"type": 101, "role": "authority"},
6
]
7
},
8
"authority": {
9
"description": "Authority to appoint universities",
10
"issues": [
11
{"type": 100, "role": "university"}
12
]
13
},
14
"university": {
15
"description": "University",
16
"authorization": [
17
"https://www.w3.org/2018/credentials/examples/v1"
18
]
19
}
20
}
Copied!
Now we can validate that the role of university is an authority for issuing /examples/v1 credential, thus providing another layer of security for the network.
Every role is flexible to have multiple credentials, and those can be repeated between different roles. Both university and authority could issue the same credentials for example.
The value for authorization should match JSON-LD URLs as used in the @context property of the verifiable credential. Our example of university roles contains the context for college degrees:
1
// Verifiable Credential
2
{
3
"@context": [
4
"https://www.w3.org/2018/credentials/v1",
5
"https://www.w3.org/2018/credentials/examples/v1"
6
],
7
"id": "http://example.edu/credentials/1872",
8
"credentialSubject": {
9
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
10
"alumniOf": {
11
"id": "did:example:c276e12ec21ebfeb1f712ebc6f1",
12
"name": "Example University"
13
}
14
},
15
...
16
}
Copied!

Sponsored Roles

You can configure roles to be sponsored roles, meaning once an address receives them, a sponsorship transaction will be sent to the configured node. This allows for the authority to effectively sponsor the transactions for an address.
1
"roles": {
2
"authority": {
3
"description": "Authority to appoint universities",
4
"issues": [ {"type": 100, "role": "university"} ]
5
},
6
"university": {
7
"description": "University",
8
"sponsored": true // anyone with the role "university" will be sponsored
9
}
10
}
Copied!
In the same way, when an account loses its sponsored roles through revoking, a cancel sponsorship transaction will be sent, stopping the sponsor.
For sponsored roles, the account configured on the node wallet will be the one sponsoring the accounts that are granted the roles.

Resolving an identity's roles

To retrieve the roles associated with an identity, you need to know the associations made with this particular address. These associations are indexed on the node, so that resolving the roles is easier and faster.
See the documentation on the REST API for retrieving roles.
Last modified 2mo ago