export function getWrappingAlgorithm()

in modules/raw-rsa-keyring-browser/src/get_import_options.ts [98:111]


export function getWrappingAlgorithm(
  publicKey?: AwsEsdkJsCryptoKey,
  privateKey?: AwsEsdkJsCryptoKey | MixedBackendCryptoKey
) {
  const privateKeys = flattenMixedCryptoKey(privateKey)
  if (publicKey && privateKeys.length) {
    return verify(...[publicKey, ...privateKeys].map(extract))
  } else if (publicKey) {
    return verify(extract(publicKey))
  } else if (privateKeys.length) {
    return verify(...privateKeys.map(extract))
  }
  throw new Error('No Key provided.')
}