near-api-js: Error: Length of buffer does not match length of ASN.1 sequence

Prerequisites

  • I’m using the latest version of near-api-js.
  • I have tried to start with a fresh project and reproduce the defect with minimal code changes.
  • I have read the console error messages carefully (if applicable).

Description

We have several users using Chromium-based browsers (v120+) like Brave, Chrome and Edge on Windows machines.

We integrated @near-js/biometric-ed25519 and the getKeys method throws an error when executed in this environment.

Reproducible demo

https://wallet.mintbase.xyz

Steps to reproduce

  1. Open any browser based on Chromium (v120+) on a Windows machine
  2. Create an account (this should work)
  3. Try signing any transaction with the wallet

Expected behavior

Not to throw an error and return keys.

Actual behavior

Error: Length of buffer does not match length of ASN.1 sequence.
at V.parse (4011-d66488a438fc0322.js:477:36669)
at 4011-d66488a438fc0322.js:470:51173
at Generator.next (<anonymous>)
at 4011-d66488a438fc0322.js:470:49049
at new Promise (<anonymous>)
at en (4011-d66488a438fc0322.js:470:48830)
at 4011-d66488a438fc0322.js:470:50853
at async i (page-4ae5a0be2a9f3743.js:1:20136)
at async sendTransaction (page-4ae5a0be2a9f3743.js:1:15438)
at async send (page-4ae5a0be2a9f3743.js:1:16668) 'error'

Your environment

  • NEAR JavaScript API version used: 1.0.1
  • Frontend framework (if applicable): NextJS (client rendered component)
  • OS: Windows

Self-service

  • I’d be willing to fix this bug myself.

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 2
  • Comments: 30 (7 by maintainers)

Most upvoted comments

#1309 Should resolve the issue, waiting for the CI node to be back up, so that checks can pass and we will release it. Thank you for the patience.

Hey, we’ve been investigating the issue in the past weeks. Unfortunately, no substantial progress has been made and this issue won’t be a quick fix. We’re researching currently what it will take to make the module working.

For the time being, please use v1.0.1 which doesn’t work on Windows as per your comments.

1.0.1 -> Doesn’t work on any window machines - Error: Length of buffer does not match length of ASN.1 sequence.

1.1.0 -> Doesn’t work in general (all machines we tested)- Error: r must be 0 < r < CURVE.n

reproduction -> create, get, check console https://near-biometric-issue-repro.vercel.app/

This issue is quite critical for us at the moment

@microchipgnu, is this error coming from the getKeys method again?