Giter Site home page Giter Site logo

Comments (3)

junkurihara avatar junkurihara commented on August 17, 2024 1

@abhijithvijayan this isn't related to jscu. it is about jseu. Please open the issue at the repo.

Also, you should let me know your environment on which you executed the code.

[Addition]
You have a bug in your code:
if you encode an uint8array to base64url here:

export const keyTobase64uri = keyArray => {
    return jseu.encoder.encodeBase64Url(keyArray);
};

Then, the following should be a decoder of base64url as well (NOT base64)

export const base64uriToArray = encoded => {
    return jseu.encoder.decodeBase64(encoded); // this should be decodeBase64Url
};

from jscu.

abhijithvijayan avatar abhijithvijayan commented on August 17, 2024

file 1

import jseu from 'js-encoding-utils';

export const keyTobase64uri = keyArray => {
    return jseu.encoder.encodeBase64Url(keyArray);
};

file 2

const base64EncKeySalt = await keyTobase64uri(encryptionKeySalt);

encryptionKeySalt being a Uint8Array

from jscu.

abhijithvijayan avatar abhijithvijayan commented on August 17, 2024

Later when I call this

File 3

import jseu from 'js-encoding-utils';

export const base64uriToArray = encoded => {
    return jseu.encoder.decodeBase64(encoded);
};

File 4

const encryptionKeySalt = await base64uriToArray(base64EncKeySalt);

I get this error DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

from jscu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.