"use strict";

// FIXME: Rename to map-encrypted-object or map-encrypted-string-object, depending on what it represents?

module.exports = function mapEncryptedFileObject(object) {
	// FIXME: Proper validation
	if (object.key.alg !== "A256CTR") {
		throw new Error(`Invalid algorithm: ${object.key.alg}`);
	}

	return {
		protocolVersion: object.v,
		url: object.url,
		hashes: object.hashes,
		iv: object.iv,
		key: object.key // NOTE: JWK format, so we don't map these
	};
};
