1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import cbor from 'cbor';
import { COSEKEYS } from '@webauthntine/typescript-types';
import convertCOSEtoPKCS from './convertCOSEtoPKCS';
test('should throw an error curve if, somehow, curve coordinate x is missing', () => {
const mockCOSEKey = new Map<number, number | Buffer>();
mockCOSEKey.set(COSEKEYS.y, 1);
jest.spyOn(cbor, 'decodeFirstSync').mockReturnValue(mockCOSEKey);
expect(() => {
convertCOSEtoPKCS(Buffer.from('123', 'ascii'));
}).toThrow();
});
test('should throw an error curve if, somehow, curve coordinate y is missing', () => {
const mockCOSEKey = new Map<number, number | Buffer>();
mockCOSEKey.set(COSEKEYS.x, 1);
jest.spyOn(cbor, 'decodeFirstSync').mockReturnValue(mockCOSEKey);
expect(() => {
convertCOSEtoPKCS(Buffer.from('123', 'ascii'));
}).toThrow();
});
|