Comments (6)
Sorry my bad, I was setting the environment incorrectly! The key was incomplete. I've now fixed it and it seems to be working!
from cloudflare-worker-jwt.
Sorry actually I'm getting this error during verify now,
[TypeError: Failed to execute 'importKey' on 'SubtleCrypto': 2nd argument is not instance of ArrayBuffer, Buffer, TypedArray, or DataView.] {
code: 'ERR_INVALID_ARG_TYPE'
}
from cloudflare-worker-jwt.
Are you sure that env.AUTH_PUBLIC_KEY
is defined?
from cloudflare-worker-jwt.
Are you sure that
env.AUTH_PUBLIC_KEY
is defined?
Yep. I specifically double checked that it had the correct value. I also use a library that'll fail during bundling if the env isn't specified.
from cloudflare-worker-jwt.
I did some debugging and it looks like it's getting the key as well as converting to array buffer I think. still not sure what goes wrong, Here's some output,
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmQmGcpQpL1achUFUTsUo
QKDj39LTdyk71eaB2ECiVRJH5jB76ZPQNZBWfyTcL/aK4iQc23osXcU0o/RqXGGY
gb1VpsLOYx5xqTyj9gjmEJcRNf/8Ebp0ZZP+Quk55bgFT76/WwVE6sE9dMZ/3t4o
r5HrypjnboWTe2ga0pf9opqHoVO0HPX9H2HjqLiM04GCueP1i60/gZMNFuC/8FL3
TZRbJABKKxZ1r1Y3V0M8L1SB+8NhCiVONl6Z7rW4jazNy5iOGgWNhPwjgeDE3pgx
W3yGwwHX1DfJijLZQc1191uv20mUB80AwhxHsErpxcTmWaaCYLJy6sVS+uBybXjw
ewIDAQAB
-----END PUBLIC KEY-----
�0�b 0�"*�H�÷
à¿ðR÷M�[$J+u¯V7WC</T�ûÃaßÒÓw);Õæ�Ø@¢UGæ0{é�Ð5�V�$Ü/ö�â$Ûz,]Å4£ôj\a��½U¦ÂÎcq©<£æ�5ÿüºte�þBé9å¸O¾¿[DêÁ=tÆ�ÞÞ(¯�ëÊ�çn��{hÒ�ý¢��¡S´õýa㨸�Ó��¹ãõ�?��
%N6^��¬ÍË����ü#�àÄÞ�1[|�Ã×Ô7É�2ÙAÍu÷[¯ÛI�ÍÂG°JéÅÄæY¦�`²rêÅRúàrmxð{
bufView Uint8Array(294) [
48,
130,
1,
34,
48,
13,
6,
9,
42,
134,
72,
134,
247,
13,
1,
1,
1,
5,
0,
3,
130,
1,
15,
0,
48,
130,
1,
10,
2,
130,
1,
1,
0,
153,
9,
134,
114,
148,
41,
47,
86,
156,
133,
65,
84,
78,
197,
40,
64,
160,
227,
223,
210,
211,
119,
41,
59,
213,
230,
129,
216,
64,
162,
85,
18,
71,
230,
48,
123,
233,
147,
208,
53,
144,
86,
127,
36,
220,
47,
246,
138,
226,
36,
28,
219,
122,
44,
93,
197,
52,
163,
244,
106,
92,
97,
152,
129,
189,
85,
166,
194,
206,
99,
30,
113,
169,
60,
163,
246,
8,
230,
16,
151,
17,
53,
255,
252,
17,
186,
116,
101,
147,
254,
66,
233,
57,
229,
184,
5,
79,
190,
191,
91,
5,
68,
234,
193,
61,
116,
198,
127,
222,
222,
40,
175,
145,
235,
202,
152,
231,
110,
133,
147,
123,
104,
26,
210,
151,
253,
162,
154,
135,
161,
83,
180,
28,
245,
253,
31,
97,
227,
168,
184,
140,
211,
129,
130,
185,
227,
245,
139,
173,
63,
129,
147,
13,
22,
224,
191,
240,
82,
247,
77,
148,
91,
36,
0,
74,
43,
22,
117,
175,
86,
55,
87,
67,
60,
47,
84,
129,
251,
195,
97,
10,
37,
78,
54,
94,
153,
238,
181,
184,
141,
172,
205,
203,
152,
142,
26,
5,
141,
132,
252,
35,
129,
224,
196,
222,
152,
49,
91,
124,
134,
195,
1,
215,
212,
55,
201,
138,
50,
217,
65,
205,
117,
247,
91,
175,
219,
73,
148,
7,
205,
0,
194,
28,
71,
176,
74,
233,
197,
196,
230,
89,
166,
130,
96,
178,
114,
234,
197,
82,
250,
224,
114,
109,
120,
240,
123,
2,
3,
1,
0,
1
]
buf ArrayBuffer { }
keyData ArrayBuffer { }
typeof keyData object
[TypeError: Failed to execute 'importKey' on 'SubtleCrypto': 2nd argument is not instance of ArrayBuffer, Buffer, TypedArray, or DataView.] {
code: 'ERR_INVALID_ARG_TYPE'
}
from cloudflare-worker-jwt.
Hey I had to use encryption for the token so I had to switch to another library for now. I think we're good with this. Thanks!
from cloudflare-worker-jwt.
Related Issues (20)
- There is no possibility to modify header HOT 1
- HMAC "jwk" key import requires a JSON Web Key with Key Type parameter ("kty") equal to "oct" (encountered "RSA") HOT 3
- Verify always returns false. HOT 2
- Type definition does not allow for `kid`
- Allow passing CryptoKey directly
- Decoding the payload results in garbled text when the JWT contains non-ASCII characters
- JSON Web Key (JWK) not working with RS256 algorithm HOT 6
- JwtPayload is too lax
- Signing/Verifying an ES256 JWT fails HOT 3
- Cannot find module ... @tsndr/cloudflare-worker-jwt/utils HOT 9
- algo validation missing HOT 1
- Feature request - clockTolerance HOT 2
- verify function fail HOT 5
- Error: EXPIRED
- Not handling tokens correctly (or at least discrepant) HOT 2
- Full verification of Cloudflare Access token
- kid not passed
- Make verify to return the decoded token
- Why does this not work with normal nodejs? HOT 1
- [CF Pages Sveltkit Server-side] ReferenceError: CryptoKey is not defined
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 cloudflare-worker-jwt.