import { asObject, uncleaner } from 'cleaners'

import { asBase64 } from '../../browser'


export const asEdgeStorageKeys = asObject({
  dataKey: asBase64,
  syncKey: asBase64
})
export const wasEdgeStorageKeys = uncleaner(asEdgeStorageKeys)


/**
 * Makes keys for accessing an encrypted Git repo.
 */
export function createStorageKeys(ai) {
  const { io } = ai.props
  return {
    dataKey: io.random(32),
    syncKey: io.random(20)
  }
}
