How to use the @ledgerhq/devices/lib/scrambling.wrapApdu function in @ledgerhq/devices

To help you get started, we’ve selected a few @ledgerhq/devices examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LedgerHQ / ledgerjs / packages / hw-transport-webauthn / src / TransportWebAuthn.js View on Github external
if (!navigator.credentials) {
    throw new TransportError("WebAuthn not supported", "NotSupported");
  }

  return (
    navigator.credentials
      // $FlowFixMe
      .get({
        publicKey: {
          timeout,
          challenge: new Uint8Array(32),
          allowCredentials: [
            {
              type: "public-key",
              id: new Uint8Array(wrapApdu(apdu, scrambleKey))
            }
          ]
        }
      })
      // $FlowFixMe
      .then(r => Buffer.from(r.response.signature))
  );
};