# Did Document Helper

Did Document Helper allows to perform common Did Document related operations.

# Provided Operations

  1. Creates a DidDocument from the given wallet and the pubKeys. Optionally the list service can be specified.
fun fromWallet(
        wallet: Wallet,
        pubKeys: List<PublicKeyWrapper> = listOf(),
        service: List<DidDocumentService>? = null
    ): DidDocument
1
2
3
4
5

# Usage examples

    val info = NetworkInfo(
        bech32Hrp = "did:com:", 
        lcdUrl = "http://localhost:1317"
    )

    val userMnemonic = listOf(
        "will",
        "hard",
        "topic",
        "spray",
        "beyond",
        "ostrich",
        "moral",
        "morning",
        "gas",
        "loyal",
        "couch",
        "horn",
        "boss",
        "across",
        "age",
        "post",
        "october",
        "blur",
        "piece",
        "wheel",
        "film",
        "notable",
        "word",
        "man"
    )
    
    val wallet = Wallet.derive(mnemonic = userMnemonic, networkInfo = info)
    
    // --- Generate keys
    val rsaVerificationKeyPair = KeysHelper.generateRsaKeyPair()
    val rsaSignatureKeyPair = KeysHelper.generateRsaKeyPair(type = "RsaSignatureKey2018")

    // --- Create Did Document
    val didDocument = DidDocumentHelper.fromWallet(
        wallet,
        listOf(rsaVerificationKeyPair.publicWrapper, rsaSignatureKeyPair.publicWrapper)
    )
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
38
39
40
41
42
43