Bun Support
panva opened this issue · 0 comments
Warning
If you happen to have jose
as a transitive dependency from a module which Bun resolves using its Node.js compatibility layer it is very likely it's not going to work for now. There are multiple issues at hand which the @oven-sh team is attempting to solve to get this to work seamlessly.
When and if Bun finishes its node:crypto
compatibility fully it will be possible for the "bun" target in jose's package.json to be pointed to the node.js build. Doing so now only peels off a layer of errors only to immediately fail on crypto.sign, crypto.verify, crypto.diffieHellman, and possibly other, missing APIs.
jose
is a universal module, but the way it is used in some projects may be runtime-specific.
Tip
If you use jose
directly in your code executed in Bun, then you're all set and good.
Bun makes use of Web Cryptography API for the cryptographic operations.
JSON Web Key Type Support
Supported | kty value |
||
---|---|---|---|
RSA | ✓ | RSA | |
Elliptic Curve | ✓ | EC | supported curves: P-256, P-384, P-521 |
Octet Key Pair | ✓ | OKP | supported subtypes: Ed25519 |
Octet sequence | ✓ | oct |
JWS Algorithm Support
Supported | alg values |
|
---|---|---|
RSASSA-PKCS1-v1_5 | ✓ | RS256, RS384, RS512 |
RSASSA-PSS | ✓ | PS256, PS384, PS512 |
ECDSA | ✓ | ES256, ES384, ES512 |
Edwards-curve DSA | ✓ | EdDSA |
HMAC with SHA-2 | ✓ | HS256, HS384, HS512 |
Unsecured JWS | ✓ | none |
JWE Key Management Algorithm Support
Supported | alg values |
|
---|---|---|
AES | ✓ | A128KW, A192KW, A256KW |
AES GCM | ✓ | A128GCMKW, A192GCMKW, A256GCMKW |
Direct Key Agreement | ✓ | dir |
RSAES OAEP | ✓ | RSA-OAEP, RSA-OAEP-256, RSA-OAEP-384, RSA-OAEP-512 |
PBES2 | ✓ | PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW |
ECDH-ES | ✓ | ECDH-ES, ECDH-ES+A128KW, ECDH-ES+A192KW, ECDH-ES+A256KW |
JWE Content Encryption Algorithm Support
Supported | enc values |
|
---|---|---|
AES GCM | ✓ | A128GCM, A192GCM, A256GCM |
AES CBC w/ HMAC | ✓ | A128CBC-HS256, A192CBC-HS384, A256CBC-HS512 |
See also