Skip to content

Commit

Permalink
Merge branch 'release/v0.25.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Nov 7, 2024
2 parents 7aff870 + ec0270e commit 834990a
Show file tree
Hide file tree
Showing 7 changed files with 662 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.25.10",
"version": "0.25.11",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down
2 changes: 1 addition & 1 deletion src/browser/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export function urlBase64ToUint8Array(base64String: string): Uint8Array | undefined {
const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/')
const rawData = window.atob(base64)
const rawData = atob(base64)
const outputArray = new Uint8Array(rawData.length)
for (let i = 0; i < rawData.length; ++i)
outputArray[i] = rawData.charCodeAt(i)
Expand Down
13 changes: 13 additions & 0 deletions src/common/data/basex-secure.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { base64 } from './basex-secure'

describe('baseX-secure', () => {

it('should do the same as atob and btoa', () => {
const str = 'Hello, World!'
const bin = new TextEncoder().encode(str)
expect(base64.encode(bin)).toBe('SGVsbG8sIFdvcmxkIQ==')
expect(btoa(str)).toBe('SGVsbG8sIFdvcmxkIQ==')
expect(base64.encode(bin)).toBe(btoa(str))
expect(base64.decode(btoa(str))).toEqual(bin)
})
})
Loading

0 comments on commit 834990a

Please sign in to comment.