You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
478 B
JavaScript
19 lines
478 B
JavaScript
"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
|
|
};
|
|
};
|