@meeco/cryppo
Version:
In-browser encryption and decryption. Clone of Ruby Cryppo
29 lines (28 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.strategyToAlgorithm = exports.CipherStrategy = void 0;
var CipherStrategy;
(function (CipherStrategy) {
CipherStrategy["AES_GCM"] = "AES-GCM";
// AES_ECB = 'AES-ECB',
// Require 16 bytes IV And not tested crosscompatiblity with other cryppo
// AES_CBC = 'AES-CBC',
// AES_CFB = 'AES-CFB',
// AES_OFB = 'AES-OFB',
// AES_CTR = 'AES-CTR',
// DES_ECB = 'DES-ECB',
// DES_CBC = 'DES-CBC',
// Not currently suppoted as they have different key size (256 not supported)
// THREE_DES_ECB = '3DES-ECB',
// THREE_DES_CBC = '3DES-CBC',
})(CipherStrategy = exports.CipherStrategy || (exports.CipherStrategy = {}));
/*
* Convert an algorithm from a serialized payload (e.g Aes256Gcm.data.artifacts) in the ruby lib's naming
* scheme to one that can be used by forge
*/
exports.strategyToAlgorithm = function (algorithm) {
return algorithm
.split(/[0-9]+/)
.map(function (v) { return v.toUpperCase(); })
.join('-');
};