Skip to content

Commit

Permalink
chore: fix chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Oct 26, 2024
1 parent 70c0055 commit 835a40b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/crypto/src/keys/rsa/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@ export function jwkToPkix (jwk: JsonWebKey): Uint8Array {
}

function asn1jsIntegerToBase64 (int: asn1js.Integer): string {
const buf = int.valueBlock.valueHexView
const str = uint8ArrayToString(buf, 'base64url')
let buf = int.valueBlock.valueHexView

return str
// chrome rejects values with leading 0s
while (buf[0] === 0) {
buf = buf.subarray(1)
}

return uint8ArrayToString(buf, 'base64url')
}

function bufToBn (u8: Uint8Array): bigint {
Expand Down

0 comments on commit 835a40b

Please sign in to comment.