feat: migrate to UnifiedPush
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export function b64uEncode(buf: Buffer | Uint8Array): string {
|
||||
const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf);
|
||||
return b
|
||||
.toString('base64')
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=+$/, '');
|
||||
}
|
||||
|
||||
export function b64uDecode(value: string): Buffer {
|
||||
const padded = value.replace(/-/g, '+').replace(/_/g, '/');
|
||||
const padLen = (4 - (padded.length % 4)) % 4;
|
||||
return Buffer.from(padded + '='.repeat(padLen), 'base64');
|
||||
}
|
||||
Reference in New Issue
Block a user