Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps!: Remove fast-text-encoding as a dependency #1547

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
5 changes: 0 additions & 5 deletions browser-test/test.crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ import {BrowserCrypto} from '../src/crypto/browser/crypto';
import {privateKey, publicKey} from './fixtures/keys';
import {describe, it} from 'mocha';

// Not all browsers support `TextEncoder`. The following `require` will
// provide a fast UTF8-only replacement for those browsers that don't support
// text encoding natively.
require('fast-text-encoding');

describe('Browser crypto tests', () => {
const crypto = createCrypto();

Expand Down
6 changes: 0 additions & 6 deletions browser-test/test.oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ import {assert} from 'chai';
import * as sinon from 'sinon';
import {privateKey, publicKey} from './fixtures/keys';
import {it, describe, beforeEach} from 'mocha';

// Not all browsers support `TextEncoder`. The following `require` will
// provide a fast UTF8-only replacement for those browsers that don't support
// text encoding natively.
require('fast-text-encoding');

import {CodeChallengeMethod, OAuth2Client} from '../src';
import {CertificateFormat} from '../src/auth/oauth2client';
import {JwkCertificate} from '../src/crypto/crypto';
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^5.0.0",
"gcp-metadata": "^5.3.0",
"gtoken": "^6.1.0",
Expand Down
9 changes: 0 additions & 9 deletions src/crypto/browser/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
// SubtleCrypto interface `window.crypto.subtle`.

import * as base64js from 'base64-js';

// Not all browsers support `TextEncoder`. The following `require` will
// provide a fast UTF8-only replacement for those browsers that don't support
// text encoding natively.
// eslint-disable-next-line node/no-unsupported-features/node-builtins
if (typeof process === 'undefined' && typeof TextEncoder === 'undefined') {
require('fast-text-encoding');
}

import {Crypto, JwkCertificate, fromArrayBufferToHex} from '../crypto';

export class BrowserCrypto implements Crypto {
Expand Down
6 changes: 0 additions & 6 deletions test/test.crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ describe('crypto', () => {
assert.strictEqual(encodedString, base64String);
});

it('should not load fast-text-encoding while running in nodejs', () => {
const loadedModules = Object.keys(require('module')._cache);
const hits = loadedModules.filter(x => x.includes('fast-text-encoding'));
assert.strictEqual(hits.length, 0);
});

it('should calculate SHA256 digest in hex encoding', async () => {
const input = 'I can calculate SHA256';
const expectedHexDigest =
Expand Down
Loading