Fix CDS fetches; use proper hashing mechanism
This commit is contained in:
parent
e4db9358cf
commit
a1c534ec0c
3 changed files with 22 additions and 7 deletions
|
@ -5,12 +5,21 @@ import { assert } from 'chai';
|
|||
import crypto from 'crypto';
|
||||
|
||||
import { typedArrayToArrayBuffer as toArrayBuffer } from '../../Crypto';
|
||||
import { hash, sign, encrypt, decrypt } from '../../util/synchronousCrypto';
|
||||
import {
|
||||
HashType,
|
||||
hash,
|
||||
sign,
|
||||
encrypt,
|
||||
decrypt,
|
||||
} from '../../util/synchronousCrypto';
|
||||
|
||||
describe('synchronousCrypto', () => {
|
||||
describe('hash', () => {
|
||||
it('returns SHA512 hash of the input', () => {
|
||||
const result = hash(toArrayBuffer(Buffer.from('signal')));
|
||||
const result = hash(
|
||||
HashType.size512,
|
||||
toArrayBuffer(Buffer.from('signal'))
|
||||
);
|
||||
assert.strictEqual(
|
||||
Buffer.from(result).toString('base64'),
|
||||
'WxneQjrfSlY95Bi+SAzDAr2cf3mxUXePeNYn6DILN4a8NFr9VelTbP5tGHdthi+' +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue