everx-labs/ever-sdk-js

Keypair derivation from secret key works wrong

pavlovdog opened this issue · 2 comments

Here's the sample code

  const secret = '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb';
  const keyPair = await client.crypto.nacl_sign_keypair_from_secret_key({
    secret
  });
  
  console.log(keyPair);

The keypair in the output is wrong. Looks like the secret is actual secret concatenated with public:

{
  public: '88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e',
  secret: '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e'
}

Here's the sample code

  const secret = '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb';
  const keyPair = await client.crypto.nacl_sign_keypair_from_secret_key({
    secret
  });
  
  console.log(keyPair);

The keypair in the output is wrong. Looks like the secret is actual secret concatenated with public:

{
  public: '88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e',
  secret: '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e'
}
```  const secret = '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb';

const keyPair = await client.crypto.nacl_sign_keypair_from_secret_key({
secret
});

console.log(keyPair);