Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/std/src/base64/base64.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { base64abc } from './_base64abc'
import { validateBinaryLike } from './_validate-binary-like'

/**
* @deprecated use `Uint8Array.toBase64` instead.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64}
*/
export const encodeBase64 = (data: ArrayBuffer | string | Uint8Array): string => {
const uint8 = validateBinaryLike(data)
let result = ''
Expand Down Expand Up @@ -35,6 +39,10 @@ export const encodeBase64 = (data: ArrayBuffer | string | Uint8Array): string =>
return result
}

/**
* @deprecated use `Uint8Array.fromBase64` instead.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64}
*/
export const decodeBase64 = (b64: string): Uint8Array => {
// eslint-disable-next-line @masknet/no-builtin-base64
const binString = atob(b64)
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/base64/base64url.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable sonarjs/deprecation */
import { decodeBase64, encodeBase64 } from './base64'

const addPaddingToBase64url = (b64url: string): string => {
Expand Down