mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-03-30 15:08:32 +00:00

Mocha v10 requires the lib to be esm compliant. ESM mandates the use of file extensions in imports, so to minimize the changes (for now), we rely on the flag `experimental-specifier-resolution=node` and on `ts-node` (needed only for Node 20). Breaking changes: downstream bundlers might be affected by the package.json changes depending on how they load the library. NB: legacy package.json entrypoints are still available.
15 lines
463 B
JavaScript
15 lines
463 B
JavaScript
import { expect } from 'chai';
|
|
|
|
import * as pkcs5 from '../../src/crypto/pkcs5.js';
|
|
|
|
export default () => describe('PKCS5 padding', function() {
|
|
it('Add and remove padding', function () {
|
|
const m = new Uint8Array([0,1,2,3,4,5,6,7,8]);
|
|
const padded = pkcs5.encode(m);
|
|
const unpadded = pkcs5.decode(padded);
|
|
expect(padded[padded.length - 1]).to.equal(7);
|
|
expect(padded.length % 8).to.equal(0);
|
|
expect(unpadded).to.deep.equal(m);
|
|
});
|
|
});
|