func makeScryptKey(pw []byte) (Key, error) {
	salt := make([]byte, saltLength)
	_, err := rand.Read(salt)
	if err != nil {
		return Key{}, err
	}
	key, err := scrypt.Key(pw, salt, n, r, p, keyLength)
	if err != nil {
		return Key{}, err
	}
	if len(key) != 32 {
		return Key{}, errors.New("key must be of length 32 in order to be used with AES")
	}
	var aesSecret aes.Secret
	copy(aesSecret[:], key[:])
	sV := Key{
		N:      n,
		R:      r,
		P:      p,
		KeyLen: keyLength,
		Salt:   salt,
		key:    aesSecret,
	}
	return sV, nil
}
derives a key from password
package scrypt
import (
	"crypto/rand"
	"encoding/json"
	"errors"
	aes "github.com/Bit-Nation/panthalassa/crypto/aes"
	scrypt "golang.org/x/crypto/scrypt"
)
const n = 16384
const r = 8
const p = 1
const saltLength = 50
const keyLength = 32
var cfbDecrypt = aes.CFBDecrypt
type Key struct {
	N      int    `json:"n"`
	R      int    `json:"r"`
	P      int    `json:"p"`
	KeyLen int    `json:"key_len"`
	Salt   []byte `json:"salt"`
	key    aes.Secret
}
type CipherText struct {
	CipherText aes.CipherText `json:"cipher_text"`
	ScryptKey  Key            `json:"scrypt_key"`
	Version    uint8          `json:"version"`
}
func (s *CipherText) Marshal() ([]byte, error) {
	return json.Marshal(s)
}