# IoT Group Membership Management Using Decentralized Identifiers and Verifiable Credentials
## 3 Design  
### The Did:Self Method  
DID specifications allow DID _methods_ implementors to decide the information that will be included in the DID documents of their method as well as how DID documents will be resolved. Our system uses the _did:self_ DID method (did:self specifications can be found at [[https://github.com/mmlab-aueb/did-self](https://github.com/mmlab-aueb/did-self)]([https://github.com/mmlab-aueb/did-self](https://github.com/mmlab-aueb/did-self)) (accessed on 25 April 2022)) that neither restricts the type of information that can be included in a DID document nor imposes any particular registry type. In particular, owners of _did:self_ DIDs are responsible for disseminating their DID documents by themselves, e.g., by directly transmitting them to interested parties, or by storing them in a Web server: _did:self_ assures that a DID document is correct even if is retrieved over an unsecured channel. Another salient feature of _did:self_ is that it permits multiple valid DID documents for a specific DID to co-exist. In our system, we can take advantage of this feature to allow each IoT device to be configured with a different DID document of the same _did:self_ DID (that of the device owner). A _did:self_-based DID is a base64 url [12] encoded Ed22519 public key [13] prefixed with the string _\"did:self_:\". A _DID document_ in _did:self_ may include any of the properties defined by the DID specifications, and it is encoded using JSON. However, and as we detail in Section 4, in this paper,we experiment with the \"Concise Binary Object Representation\" (CBOR) [14], which results in smaller representations. It should be noted that CBOR representations are compliant to DID specifications. A DID document in our system includes the following properties:  
* id: The DID which the document concerns. * verificationMethod: A list of public keys expressed using the \"JsonWebKey2020\" notation [15]. Each key in the list is identified by an _id_. * authentication: A list of public keys, or public key identifiers that can be used to authenticate the DID holder. * assertion: A list of public keys or public key identifiers that can be used to verify digital signatures of VCs. The private key that corresponds to an _assertion_ key is used in our system for signing issued VCs; hence, the corresponding public key is used for verifying these signatures. Similarly, the private key that corresponds to an _authentication_ key is used for signing CoAP messages; hence, the corresponding public key is used for authenticating message senders. Each public key included in the verificationMethod property is identified by a unique id: there cannot be two keys with same id for the same _did:self_ DID even if these keys are defined in different DID documents. In our system, we take advantage of this property in order to achieve efficient authentication key rotation as well as for detecting breaches of the private key used by an authentication method. These two security properties are achieved by following a \"use the most recent key\" principle. In particular, given two keys with the same id, the one included in the older DID document will be considered invalid, and it wil be discarded. Each DID document in _did:self_ is associated with a _proof_ which is a compact encoded JSON Web Signature (JWS) [16]. However, in this paper, we use CBOR Object Signing and Encryption (COSE) [17] instead. The payload of the proof is a CBOR object that includes the following claims:  
* jti: The DID the proof refers to. * iat: The date and time of the proof's generation. * exp: An expiration time. * s256: The base64 url encoded hash of the DID document, calculated using SHA-256. The signature of the proof is generated using the private key that corresponds to the _did:self_ DID and the _Edwards-curve Digital Signature Algorithm_ (EdDSA). Given a _did:self_ DID, a DID document, and the document proof, any entity can trivially verify the binding between the DID and the document by executing the following steps:  
1.