text: import { Key } from 'interface-datastore';
  import sortKeys from 'sort-keys';
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
  const specKey = new Key('datastore_spec');
  export function spec(store) {
    return {
      exists() {
        return store.has(specKey);
      },
      async get() {
        const buf = await store.get(specKey);
        return JSON.parse(uint8ArrayToString(buf));
      },
      async set(spec) {
        return store.put(specKey, uint8ArrayFromString(JSON.stringify(sortKeys(spec, { deep: true }))));
      }
    };
  }