How to use the lzutf8.decompress function in lzutf8

To help you get started, we’ve selected a few lzutf8 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 blockkeeper / blockkeeper-frontend-web / src / logic / Core.js View on Github external
name: 'AES-GCM',
            tagLength: 128, // 128 bits
            iv: new Uint8Array(data.iv), // 12 bytes
            additionalData: __.strToArrBuf(secrets.userId)
          },
          secrets.cryptKeyObj,
          new Uint8Array(data.cypher)
        )
      } catch (e) {
        throw this.err('Decryption process failed. Most likely reason: ' +
                       'Wrong crypto-key. Other (very unlikely) reasons: ' +
                       'tagLength or iv or additionalData are not ' +
                       'congruent with related encryption values', { e })
      }
      try {
        return JSON.parse(LZUTF8.decompress(new Uint8Array(rawPld)))
      } catch (e) {
        throw this.err('Unpacking process failed', { e })
      }
    } catch (e) {
      if (isLogin) throw this.err('Decrypting data failed', { e })
      throw this.err('Decrypting data failed', { e, sts: 900 })
    }
  }
github RossMcMillan92 / djent / src / generic / scripts / app / utils / short-urls.js View on Github external
require.ensure('lzutf8', (require) => {
            const decompress = require('lzutf8').decompress
            if (!base64Data) rej(Error('No base64 data given'))

            const decompressedData = base64Data
                                  && base64Data.length % 4 === 0
                                  && decompress(base64Data, { inputEncoding: 'Base64' })

            const preset = /[A-Za-z0-9+/=]/.test(decompressedData) ? JSON.parse(decompressedData) : undefined
            res(preset)
        }, 'lzutf8')
    })
github ralscha / blog / pwmanager / client / src / app / password.service.ts View on Github external
private async decrypt(buffer: ArrayBuffer): Promise {
    const iv = buffer.slice(0, this.ivLen);
    const data = buffer.slice(this.ivLen);

    const decrypted = await window.crypto.subtle.decrypt({
        name: 'AES-GCM',
        iv: iv
      },
      this.masterKey,
      data
    );

    const uncompressed = LZUTF8.decompress(new Uint8Array(decrypted));
    this.passwords = new Map(JSON.parse(uncompressed));
  }
github nicolaschan / bell / src / CookieSerializer.js View on Github external
deserialize (value) {
    return JSON.parse(LZUTF8.decompress(value, {
      inputEncoding: 'BinaryString'
    }))
  }
github yDgunz / gunswap / src / ui / Animator.tsx View on Github external
constructor(props : any) {
		super(props);		

		var queryString = parse(window.location.search);

		if (queryString.siteswap) {
			defaultPatternSettings.siteswap = queryString.siteswap.toString();
		}

		if (queryString.patternSettings) {
			var queryStringPatternSettings = JSON.parse(lzutf8.decompress(queryString.patternSettings, {inputEncoding: "Base64"}));
			defaultPatternSettings = queryStringPatternSettings;
		}

		this.state = {
			pattern: new Pattern(new Siteswap(defaultPatternSettings.siteswap), GetDwellPaths(defaultPatternSettings.dwellPath), defaultPatternSettings.dwellRatio, 0),
			patternSettings: defaultPatternSettings
		}

		this.state.pattern.Simulate(100,0.24);

		window.onresize = () => {
			this.forceUpdate();
		}

		this.updatePattern = this.updatePattern.bind(this);
	}
github intershop / intershop-pwa / src / app / shared / services / cache / compressDecompress.service.ts View on Github external
decompress(dataToDeCompress: any) {
        return JSON.parse(LZUTF8.decompress(dataToDeCompress));
    }
}

lzutf8

A high-performance string compression library

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis