Skip to content

Commit

Permalink
Removed dependency library
Browse files Browse the repository at this point in the history
  • Loading branch information
rleojoseph committed Mar 26, 2024
1 parent 00ebd5b commit a87d696
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 0 additions & 3 deletions js-miniapp-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"browser": "build/miniapp.bundle.js",
"module": "build/js-miniapp-sdk/src/index.js",
"types": "build/js-miniapp-sdk/src/index.d.ts",
"dependencies": {
"libbase64": "1.2.1"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/chai": "^4.2.11",
Expand Down
15 changes: 13 additions & 2 deletions js-miniapp-sdk/src/modules/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Contact } from '../../../js-miniapp-bridge/src';
import libbase64 from 'libbase64';
import { Buffer } from 'buffer';

/**
* Interfaces to Decode any input
Expand Down Expand Up @@ -31,11 +31,22 @@ export class DecodeManager implements Decoder {

private async decodeBase64(input: string): Promise<string> {
try {
const decoded = await libbase64.decode(input);
const decoded = await this.decode(input);
return decoded.toString();
} catch (error) {
console.error(`Error decoding input: ${error.message}`);
return '';
}
}

/**
* Decodes a base64 encoded string to a Buffer object
*
* @param {String} str base64 encoded string
* @returns {Buffer} Decoded value
*/
decode(str) {
str = str || '';
return Buffer.from(str, 'base64');
}
}
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8194,11 +8194,6 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"

[email protected]:
version "1.2.1"
resolved "https://registry.yarnpkg.com/libbase64/-/libbase64-1.2.1.tgz#fb93bf4cb6d730f29b92155b6408d1bd2176a8c8"
integrity sha512-l+nePcPbIG1fNlqMzrh68MLkX/gTxk/+vdvAb388Ssi7UuUN31MI44w4Yf33mM3Cm4xDfw48mdf3rkdHszLNew==

[email protected]:
version "2.1.0"
resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52"
Expand Down

0 comments on commit a87d696

Please sign in to comment.