---
# System prepended metadata

title: Liquality veramo plugins

---

# Liquality veramo plugins

liq seed phrase
-> derivation path -> privKey -> pubKey -> addr -> did


You need to provide custom `AbstractKeyStore` and `AbstractDIDStore` implementations that use the liquality account data to `list` and `get` DIDs and keys.


## Using `account data`

 * custom `AbstractDIDStore`:
    * `import()`  => should throw error
    * `delete()`  => should throw error
    * `list()`
         * map account data addresses to DIDs by prefixing them
         * use `get(did)` for each one to return a list of `IIdentifier`
    * `get(did)` => `did:ethr:0xaddr` => substring => `addr` =>
         * build an `IIdentifier` with one entry in the `keys` array
             * `did`: did
             * `provider`: 'did:ethr'
             * `services`: []
             * `keys`: [{`kid`: addr}]
             I think everything else about the `IKey` is meaningless here, but you have all the data needed to construct the key here if needed.
    
 * custom `AbstractKeyStore`:
    liq addr -> der path -> priv key
    * `import()`  => should throw error
    * `delete()`  => should throw error
    * `get(kid)`
        * interpret `kid` as `addr`
        * use `account data` to get `derivation path` for `addr`
        * call https://docs.ethers.io/v5/api/signer/#Wallet.fromMnemonic to get a Wallet instance
        * this would be a good place to compare `wallet.address` with `addr` and if they don't match, there's probably something wrong with the path
        * wallet instance has `privateKey` and `publicKey` which can be used to populate the details of an `IKey`


## How to construct an `IKey` instance
 - `privateKeyHex` `Wallet.fromMnemonic(seed, deriv path).privateKey`
 - `publicKeyHex` `Wallet.fromMnemonic(seed, deriv path).publicKey`
 - `kid` can be the same as `addr`
 - `type`: `TKeyType` => `Secp256k1` (ignore everything else)
 - `kms`: 'local' (has to correspond to the string you use in the config)
 - `meta` ( optional, but can hold derivation path )


## What happens when you create credential

* createVerifiableCredential:
  * plugin uses `issuer` to get `did` => `agent.didManagerGet(did)` => an `IIdentifier` instance
  * `IIdentifier.keys.find(secp256k1)` => an `IKey` instance
  * plugin calls `keyManagerSign({IKey.kid})`