@relaycorp/webcrypto-kms
Version:
WebCrypto-compatible client for Key Management Services like GCP KMS
23 lines • 916 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const webcrypto_1 = require("../testUtils/webcrypto");
const utils_1 = require("./utils");
let provider;
let keyPair;
beforeAll(async () => {
provider = await (0, index_1.initKmsProviderFromEnv)('AWS');
keyPair = await provider.generateKey(webcrypto_1.RSA_PSS_CREATION_ALGORITHM, true, ['sign', 'verify']);
});
afterAll(async () => {
if (keyPair) {
await provider?.destroyKey(keyPair.privateKey);
}
await provider?.close();
});
test('AWS KMS', async () => {
const { publicKey, privateKey } = keyPair;
const signature = await provider.sign(webcrypto_1.RSA_PSS_SIGN_ALGORITHM, privateKey, utils_1.PLAINTEXT);
await expect((0, utils_1.verifyAsymmetricSignature)(publicKey, signature, utils_1.PLAINTEXT)).resolves.toBe(true);
});
//# sourceMappingURL=aws.test.js.map