Current section

Files

Jump to
gossamer src gossamer subtle_crypto encrypt_algorithm.ffi.mjs
Raw

src/gossamer/subtle_crypto/encrypt_algorithm.ffi.mjs

// src/gossamer/subtle_crypto/encrypt_algorithm.ffi.ts
import * as $alg from "./encrypt_algorithm.mjs";
function toEncryptAlgorithm(algorithm) {
if ($alg.EncryptAlgorithm$isOther(algorithm)) {
return $alg.EncryptAlgorithm$Other$0(algorithm);
}
if ($alg.EncryptAlgorithm$isAesCbc(algorithm)) {
return {
name: "AES-CBC",
iv: $alg.EncryptAlgorithm$AesCbc$iv(algorithm)
};
}
if ($alg.EncryptAlgorithm$isAesGcm(algorithm)) {
return {
name: "AES-GCM",
iv: $alg.EncryptAlgorithm$AesGcm$iv(algorithm)
};
}
if ($alg.EncryptAlgorithm$isAesGcmWith(algorithm)) {
return {
name: "AES-GCM",
iv: $alg.EncryptAlgorithm$AesGcmWith$iv(
algorithm
),
additionalData: $alg.EncryptAlgorithm$AesGcmWith$additional_data(
algorithm
),
tagLength: $alg.EncryptAlgorithm$AesGcmWith$tag_length(algorithm)
};
}
if ($alg.EncryptAlgorithm$isAesCtr(algorithm)) {
return {
name: "AES-CTR",
counter: $alg.EncryptAlgorithm$AesCtr$counter(
algorithm
),
length: $alg.EncryptAlgorithm$AesCtr$length(algorithm)
};
}
if ($alg.EncryptAlgorithm$isRsaOaepWith(algorithm)) {
return {
name: "RSA-OAEP",
label: $alg.EncryptAlgorithm$RsaOaepWith$label(
algorithm
)
};
}
return { name: "RSA-OAEP" };
}
export {
toEncryptAlgorithm
};