forge.js availability

is forge.js is available in worker?
2 Replies
cg
cg2y ago
Unsure, what are you trying to do?
bᥲkᥙg᥆
bᥲkᥙg᥆OP2y ago
i wast trying to implement api in cloudflare worker to generate deviceId but my function uses crypto library and i don't find the same function in cloudflare crypto:
using nodejs crypto lib.

function getDeviceI() {
let id = crypto.randomBytes(20).toString("binary");
let hmac = crypto.createHmac(
"sha1",
Buffer.from(
"E7309ECC0953C6FA60005B2765F99DBBC965C8E9",
"hex"
)
);
hmac.update(Buffer.from(Buffer.from("19", "hex") + id, "binary"));
return "19" + Buffer.from(id, "binary").toString("hex") + hmac.digest("hex");
}
correct deviceId:19CEB4EB9340402020E054720BEBAF280A8CEA373CC6E00629C9CEB1B3CB14FD5ABC0D4F5896DBAD4E
using nodejs crypto lib.

function getDeviceI() {
let id = crypto.randomBytes(20).toString("binary");
let hmac = crypto.createHmac(
"sha1",
Buffer.from(
"E7309ECC0953C6FA60005B2765F99DBBC965C8E9",
"hex"
)
);
hmac.update(Buffer.from(Buffer.from("19", "hex") + id, "binary"));
return "19" + Buffer.from(id, "binary").toString("hex") + hmac.digest("hex");
}
correct deviceId:19CEB4EB9340402020E054720BEBAF280A8CEA373CC6E00629C9CEB1B3CB14FD5ABC0D4F5896DBAD4E
u mean the node js crypto? or the crypto that already have in cloudflare worker? name = "cloudflare-workers" main = "src/index.js" compatibility_date = "2023-07-31" compatibility_flags = [ "nodejs_compat" ] i didn't found node:crypto so it's not in worker currently right? ok it's not there i check the page
Want results from more Discord servers?
Add your server