summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeAuthenticatorExtensions.test.ts
blob: a9b3642710fb93e1946f67fc8aa083514f70bc89 (plain)
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
30
31
import { decodeAuthenticatorExtensions } from './decodeAuthenticatorExtensions';

test('should decode authenticator extensions', () => {
  const extensions = decodeAuthenticatorExtensions(
    Buffer.from(
      'A16F6465766963655075626C69634B6579A56364706B584DA5010203262001215820991A' +
        'ABED9DE4271A9EDEAD8806F9DC96D6DCCD0C476253A5510489EC8379BE5B225820A0973C' +
        'FDEDBB79E27FEF4EE7481673FB3312504DDCA5434CFD23431D6AD29EDA63736967584730' +
        '45022100EFB38074BD15B8C82CF09F87FBC6FB3C7169EA4F1806B7E90937374302345B7A' +
        '02202B7113040731A0E727D338D48542863CE65880AA79E5EA740AC8CCD94347988E656E' +
        '6F6E6365406573636F706541006661616775696450000000000000000000000000000000' +
        '00',
      'hex',
    ),
  );
  expect(extensions).toMatchObject({
    devicePublicKey: {
      dpk: Buffer.from(
        'A5010203262001215820991AABED9DE4271A9EDEAD8806F9DC96D6DCCD0C476253A5510489EC8379BE5B225820A0973CFDEDBB79E27FEF4EE7481673FB3312504DDCA5434CFD23431D6AD29EDA',
        'hex',
      ),
      sig: Buffer.from(
        '3045022100EFB38074BD15B8C82CF09F87FBC6FB3C7169EA4F1806B7E90937374302345B7A02202B7113040731A0E727D338D48542863CE65880AA79E5EA740AC8CCD94347988E',
        'hex',
      ),
      nonce: Buffer.from('', 'hex'),
      scope: Buffer.from('00', 'hex'),
      aaguid: Buffer.from('00000000000000000000000000000000', 'hex'),
    },
  });
});