Closed nyfever007 closed 5 months ago
Yeah adding .replace(/\r?\n|\r/g, '')
should fix the issue. Honestly certificate
should be Uint8Array
but that's breaking change
Yeah adding
.replace(/\r?\n|\r/g, '')
should fix the issue. Honestlycertificate
should beUint8Array
but that's breaking change
Yup. i created customApple(since I couldn't PR) and tested it and adding that line indeed resolved the issue. Hope you update this. Thanks!
Hello. I've spent. hours to figure this out and hope someone can help me out with this. I am using Vercel to host my project and every time validateAuthorizationCode is triggered(no matter how i tried to handle certificate ). I tried to
I've done some research and first, and based on following code I am wondering if upgrade/update is need to this. https://github.com/pilcrowOnPaper/arctic/blob/main/src/providers/apple.ts
function isValidBase64(str: string): boolean { const base64Pattern = /^[a-zA-Z0-9+/=]*$/; return base64Pattern.test(str); }
function parsePKCS8PEM(pkcs8: string): Uint8Array { const base64 = pkcs8 .replace(/-----BEGIN PRIVATE KEY-----/, '') .replace(/-----END PRIVATE KEY-----/, '') .replace(/\r?\n|\r/g, '') // Remove all newlines .trim();
// Validate the Base64 string if (!isValidBase64(base64)) { throw new Error('Invalid Base64 string'); }
return decodeBase64(base64); }