How to use the belter/src.base64encode function in belter

To help you get started, we’ve selected a few belter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / paypal-sdk-client / src / meta.js View on Github external
export function getSDKMeta() : string {
    return base64encode(JSON.stringify({
        url:          getScriptUrl(),
        stageHost:    getStageHost(),
        apiStageHost: getAPIStageHost()
    })).replace(/\=+$/, ''); // eslint-disable-line no-useless-escape
}
github paypal / paypal-sdk-client / test / client / script.js View on Github external
it('should successfully get client access token', () => {
        const clientAccessToken = 'abc12354321';
        const clientToken = base64encode(JSON.stringify({
            paypal: {
                accessToken: clientAccessToken
            }
        }));

        const url = insertMockSDKScript({
            attributes: {
                'data-client-token': clientToken
            }
        });

        if (clientAccessToken !== getClientAccessToken()) {
            throw new Error(`Expected client access token to be ${ clientAccessToken }, got ${ getClientAccessToken() || 'undefined' } from ${ url }`);
        }
    });
github paypal / paypal-checkout-components / src / billing / index.js View on Github external
def:         () => {
                return base64encode(JSON.stringify({
                    url: getCurrentScriptUrl()
                }));
            }
        }
github paypal / paypal-smart-payment-buttons / src / api / auth.js View on Github external
return inlineMemoize(createAccessToken, () => {

        getLogger().info(`rest_api_create_access_token`);

        const basicAuth = base64encode(`${ clientID }:`);

        return request({

            method:  `post`,
            url:     AUTH_API_URL,
            headers: {
                Authorization: `Basic ${ basicAuth }`
            },
            data: {
                grant_type: `client_credentials`
            }

        }).then(({ body }) => {

            if (body && body.error === 'invalid_client') {
                throw new Error(`Auth Api invalid client id: ${ clientID }:\n\n${ JSON.stringify(body, null, 4) }`);
github krakenjs / zoid / dist / module / component / window.js View on Github external
export function buildChildWindowName(name, childPayload) {
    var normalizedName = normalizeString(name);
    var encodedPayload = base64encode(JSON.stringify(childPayload));

    return '__' + ZOID + '__' + normalizedName + '__' + encodedPayload + '__';
}
github paypal / paypal-checkout-components / src / threeDomainSecure / index.js View on Github external
def:         () => {
                return base64encode(JSON.stringify({
                    url: getCurrentScriptUrl()
                }));
            }
        },
github krakenjs / zoid / src / parent / index.js View on Github external
buildWindowName({ proxyWin, childDomain, domain, target, uid, context } : { proxyWin : ProxyWindow, childDomain : string, domain : string | RegExp, target : CrossDomainWindowType, context : $Values, uid : string }) : string {
        const childPayload = this.buildChildPayload({ proxyWin, childDomain, domain, target, context, uid });
        return `__${ ZOID }__${ this.component.name }__${ base64encode(JSON.stringify(childPayload)) }__`;
    }
github paypal / paypal-checkout-components / src / billing / template / containerTemplate.jsx View on Github external
const paypalLogo = (typeof fundingLogos.paypal === 'function')
        ? fundingLogos.paypal({ logoColor })
        : fundingLogos.paypal[logoColor];

    const el = (
        <div aria-label="PayPal Checkout Overlay" aria-modal="true" role="dialog" class="{" id="{">
            <a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
            </a><div class="paypal-checkout-modal"><a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
                <div class="paypal-checkout-logo">
                    <img src="{" alt="pp" class="paypal-checkout-logo-pp">
                    <img src="{" alt="paypal" class="paypal-checkout-logo-paypal">
                </div>
                <div class="paypal-checkout-message">
                    {content.windowMessage}
                </div>
                </a><div class="paypal-checkout-continue"><a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
                    </a><a href="#">{content.continue}</a>
                </div>
                <div class="paypal-checkout-loader">
                    <div class="paypal-spinner">
                </div>
            </div>

            <div class="paypal-checkout-iframe-container">
                {outlet}
            </div>
</div></div>
github paypal / paypal-sdk-client / src / api.js View on Github external
return inlineMemoize(createAccessToken, () => {

        getLogger().info(`rest_api_create_access_token`);

        const basicAuth = base64encode(`${ clientID }:`);

        return request({

            method:  `post`,
            url:     getAuthAPIUrl(),
            headers: {
                Authorization: `Basic ${ basicAuth }`
            },
            data: {
                grant_type: `client_credentials`
            }

        }).then(({ body }) => {

            if (body && body.error === 'invalid_client') {
                throw new Error(`Auth Api invalid client id: ${ clientID }:\n\n${ JSON.stringify(body, null, 4) }`);
github paypal / paypal-checkout-components / src / button / template / componentTemplate.jsx View on Github external
return cards.map(name =&gt; {
        const logo = cardLogos[name];

        return (
            <div tabindex="0" class="{" name="" size="">
                <img name="" alt="{" src="{" style="{">
            </div>
        );
    });
}