

const require_TypedArrayEncoder = require('../../../utils/TypedArrayEncoder.js');
require('../../../utils/index.js');

//#region src/modules/kms/jwk/humanDescription.ts
/**
* Gets text description of a key.
*
* - `EC key with crv '<crv>'`
* - `RSA key with bith length <bitLength>
* - `oct key`
* - `'<kty>' key`
*/
function getJwkHumanDescription(jwk) {
	if (jwk.kty === "EC" || jwk.kty === "OKP") return `${jwk.kty} key with crv '${jwk.crv}'`;
	if (jwk.kty === "RSA") return `RSA key with bit length ${require_TypedArrayEncoder.TypedArrayEncoder.fromBase64(jwk.n).length * 8}`;
	if (jwk.kty === "oct") return "oct key";
	return `'${jwk.kty}' key'`;
}

//#endregion
exports.getJwkHumanDescription = getJwkHumanDescription;