Comments (10)
symmetricKeySize
and asymmetricKeySize
props of the KeyObject generated are both undefined.
Running node 12.16.1
from paseto.
https://nodejs.org/docs/latest-v12.x/api/crypto.html#crypto_keyobject_symmetrickeysize
KeyObjects do not have ‘byteLength’ as your code suggests.
I can’t reproduce this report.
from paseto.
require("crypto")
.createSecretKey( Buffer.from("...", "base64") )
.symmetricKeySize // undefined
Wrong code srry. The symmetricKeySize
property is undefined. Running the same code on console returns its size. Any idea?
from paseto.
The code without the property is not using node 12, it’s likely v11 which used symmetricSize property. V11 is not supported by this module tho.
from paseto.
Node 12.16.1. Anyway it's something related to node.
from paseto.
You asked if I had an idea. Your console is node 12, whatever else you run the code in where it doesn’t work is a different version.
Put a console.log(process.versions) in the code and see the difference.
from paseto.
@panva just to check... The func checkKey
receives two args (header, key), but key is passed as the first argument here:
/lib/V2/encrypt.js
payload = checkPayload(payload)
key = checkKey(key) // <<
/lib/V2/help/symmetric_key_check.js
function checkKey (header, key) {
if (!(key instanceof KeyObject)) {
key = createSecretKey(key)
}
if (key.type !== 'secret' || key.symmetricKeySize !== 32) {
throw new TypeError(`${header} secret key must be 32 bytes long symmetric key`)
}
Is this correct?
I think this combined to the wrong type of symmetricKeySize popping on vscode confused me 😆 .
from paseto.
Yes it is used correctly. Your vscode is running node 11, am i right?
from paseto.
Only one node version, latest lts. Idk which lib included node typing. Now it works, just tired I guess. thanks for you help
from paseto.
I don't see what typings have to do with runtime results but okay.
from paseto.
Related Issues (17)
- question: how to you generate and export private keys? HOT 12
- Generating a public paseto key should give the public key attached HOT 1
- Replacing libsodium-wrappers HOT 3
- Characters that Paseto uses to create tokens HOT 1
- question: How I create a secret key from a string? HOT 3
- TypeError: keyObject must be a KeyObject instance HOT 2
- Node 14 bug - TypeError: Cannot read property 'subtle' of undefined (line 10 of crypto_worker.js) HOT 1
- bug: typescript types missing in install HOT 1
- Fails to verify with `complete: true` option if there is no footer. HOT 1
- `{}` makes decryption results hard to use HOT 3
- At paseto/lib/v1/sign.js HOT 1
- bug: Library breaks on lambda HOT 3
- Bug cannot read property 'subtle' of undefined HOT 1
- Not using ISO8601 Date Format HOT 2
- question: How many requests per second it handles? HOT 1
- question: Nodejs Crypto vs libsodium HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paseto.