zntrio / paseto Goto Github PK
View Code? Open in Web Editor NEWv3/v4 Golang PASETO implementation
License: Apache License 2.0
v3/v4 Golang PASETO implementation
License: Apache License 2.0
Describe the bug
I've been checking your library and wanted to try to encrypt in GO and decrypt in nodeJS.
I've generated a token using a string as key that is 'vZ2WkkcJCeFXuQtpogPt2Ywof43X0h0x'
Then i went on doing this in javascript
import { PasetoV4Local } from "paseto-browser";
const localKey = 'vZ2WkkcJCeFXuQtpogPt2Ywof43X0h0x';//generateKeys('local');
const token = 'v4.local.GeneratedToken';
try {
let key = new TextEncoder("utf-8").encode(localKey);
console.log(key)
const paseto = new PasetoV4Local(key)
const decrypted = await paseto.decrypt(token, key, {
validatePayload: false,
});
console.log(decrypted);
} catch(err) {
console.log(err)
}
It gave me this error 'Error: Invalid tag'
I tried another library that is paseto-ts and it gave me the same error, it seems the tag always differ from the go implementation.
I'm not sure if i missuse something there but i didn't add any kind of custom things, here is my encrypt call
// account is a marshalled json
token, err := pasetov4.Encrypt(rand.Reader, "vZ2WkkcJCeFXuQtpogPt2Ywof43X0h0x", account, nil, nil)
Expected behavior
Encrypting on go should still have a valid decode using other language libraries
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.