0xMiden / 0xMiden/web-sdk

[Node.js] deserialize fails because Buffers are converted to arrays

Aperta
#364 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
1
Fork
21
Merge medio
12h 14m
PR unite (30g)
41

Descrizione

### Packages versions

@miden-sdk/miden-sdk@0.16.0-rc.5

### Bug description

In Node.js, the SDK wrapper converts `Buffer` and `Uint8Array` arguments into plain arrays.
`AuthSecretKey.deserialize()` expects a `Buffer`, so it fails through the public SDK export.

This also affects `Word.deserialize()`. Calling the same method through `getNativeModule()` works because it bypasses the wrapper.

### How can this be reproduced?

import { AuthSecretKey } from "@miden-sdk/miden-sdk";

const key = AuthSecretKey.rpoFalconWithRNG(new Uint8Array(32));
const base64 = key.serialize().toString("base64");

AuthSecretKey.deserialize(Buffer.from(base64, "base64"));

### Relevant log output

```shell
Failed to get Buffer pointer and length
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Look at the SDK wrapper code that handles serialization/deserialization, likely in a file like `src/wrapper.ts` or `src/serialization.ts`. Identify where Buffer/Uint8Array arguments are being converted to plain arrays. The fix involves ensuring the native module receives the correct type. Test by running the reproduction script and checking that AuthSecretKey.deserialize works with a Buffer input.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, node.js, typescript
Ambito
api, backend, devtools
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.