square/js-jose

[Q] Can I use JWK as a singleton?

beans9 opened this issue · 0 comments

const promise = jose.JWK.asKey({
kty: "oct",
k: jose.util.base64url.encode(secret, "utf8"),
alg: 'A256KW',
enc: 'A256CBC-HS512'
})
promise.then(function (key) {
JWK = key;
JWE = jose.JWE.createDecrypt(JWK);
});

Can I continue to use the JWK after making it into a singletone?
Or do I have to make a new one every time?