Not able to use /n (new line) character. Please HELP!

Options
anu8
anu8 Member
edited September 2023 in ? Help! I'm a Noob

I am trying to create a dynamic public key which will be used to verify signature.I have written lambda function for that.

My code:

const EncodedKey = "-----BEGIN PUBLIC KEY-----" + "\r\n" +$var.publicKey + "\r\n" +"-----END PUBLIC KEY-----";

The error:

error:0909006C:PEM routines:get_name:no start line

Please kindly help me.😔

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Is this a lambda? Because I think you want a second line with "return EncodedKey". YOu can confirm by using "stop-and-debug" after your lambda to confirm the output is the text you're looking for.

  • anu8
    anu8 Member
    Options

    yes it is a lambda function.

    My current code is:

    const EncodedKey = "-----BEGIN PUBLIC KEY-----" + "\r\n" +$var.publicKey + "\r\n" +"-----END PUBLIC KEY-----";

    return EncodedKey;

    The texts in EncodedKey are not appending in new line.

    What I am getting:

    -----BEGIN PUBLIC KEY----- {public key} -----END PUBLIC KEY-----

    My requirement is:

    -----BEGIN PUBLIC KEY-----

    {public key}

    -----END PUBLIC KEY-----

    Please help me with this.