Fixed encoding issue: changed from btoa(String.fromCharCode(...)) to Buffer.from().toString('base64')
This commit is contained in:
@@ -218,11 +218,9 @@ export class Libp2pComponent implements ILibp2pComponent {
|
||||
tcpPort: this.options.config?.tcpPort,
|
||||
wsPort: this.options.config?.wsPort,
|
||||
// Convert Uint8Array to base64 for passing to native module
|
||||
keypair: this.options.keypair
|
||||
? {
|
||||
privateKey: btoa(String.fromCharCode(...this.options.keypair.privateKey)),
|
||||
publicKey: btoa(String.fromCharCode(...this.options.keypair.publicKey)),
|
||||
}
|
||||
// Using Buffer.from for proper encoding of binary data
|
||||
privateKey: this.options.keypair?.privateKey
|
||||
? Buffer.from(this.options.keypair.privateKey).toString('base64')
|
||||
: undefined,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user