# vue-cryptojs

> A small wrapper for integrating crypto-js into VueJS

Latest version **2.4.8** (published 2026-02-28) · AFL-2.0 license · 0 weekly downloads

## Install

```sh
npm install vue-cryptojs
pnpm add vue-cryptojs
yarn add vue-cryptojs
bun add vue-cryptojs
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.4.8 |
| Published | 2026-02-28 |
| First published | 2019-10-13 |
| Weekly downloads | 0 |
| License | AFL-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Tate Peñaranda |
| Maintainers | tpenaranda |
| Keywords | crypto, crypto-js, encrypt, vue, vuejs, wrapper |

## Links

- npm: https://www.npmjs.com/package/vue-cryptojs
- Repository: https://github.com/tpenaranda/vue-cryptojs
- Homepage: https://github.com/tpenaranda/vue-cryptojs#readme
- Issues: https://github.com/tpenaranda/vue-cryptojs/issues
- npm.io page: https://npm.io/package/vue-cryptojs

## Dependencies (1)

- [crypto-js](https://npm.io/package/crypto-js.md) ^4.0.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.4.8 (latest) — 2026-02-28
- 2.4.7 — 2024-07-18
- 2.4.6 — 2024-05-03
- 2.4.5 — 2023-10-20
- 2.4.4 — 2023-10-11
- 2.4.3 — 2023-05-17
- 2.4.1 — 2023-05-17
- 2.4.0 — 2023-05-17
- 2.3.1 — 2022-10-11
- 2.3.0 — 2022-06-08
- 2.2.1 — 2021-12-16
- 2.2.0 — 2021-12-16
- 2.1.6 — 2021-08-11
- 2.1.5 — 2020-07-20
- 2.1.4 — 2020-03-21
- … 5 more at https://npm.io/package/vue-cryptojs/versions

## README

# vue-cryptojs
A small wrapper for integrating crypto-js into Vue3 and Vue2

## Discontinued

Active development of Vue-CryptoJS has been discontinued. This library is no longer maintained.

Nowadays, NodeJS and modern browsers have a native `Crypto` module. The latest version of CryptoJS already uses the native Crypto module for random number generation, since `Math.random()` is not crypto-safe. Further development of CryptoJS would result in it only being a wrapper of native Crypto. Therefore, development and maintenance has been discontinued, it is time to go for the native `crypto` module.

## How to install:
```bash
npm install vue-cryptojs
```

### Vue3
Entry file:
```js

import { createApp } from 'vue'
import VueCryptojs from 'vue-cryptojs'

createApp(...).use(VueCryptojs).mount(...)
```

TS Component:
```js
<script setup lang="ts">
  import { inject } from 'vue'
  import CryptoJS from 'crypto-js'

  const cryptojs = inject('cryptojs') as typeof CryptoJS
</script>

<template>
  <p>{{cryptojs.AES.encrypt("Hi There!", "Secret Passphrase").toString()}}</p>
  <p>{{cryptojs.AES.decrypt("U2FsdGVkX1/zclTGSirKJ+oYxGJFRR96i9MkjOb8X0s=", "Secret Passphrase").toString(cryptojs.enc.Utf8)}}</p>
</template>
```

`inject` on Composition API without TS:
```js
<script>
import { inject } from 'vue'

export default {
  setup() {
    const cryoptojs = inject('cryptojs')

    return {
      cryoptojs
    }
  }
}
</script>
```

### Vue2
```js
import Vue from 'vue'
import VueCryptojs from 'vue-cryptojs'

Vue.use(VueCryptojs)
```

This binds `CryptoJS` to `Vue` or `this` if you're using single file component.

Simple AES text encrypt/decrypt example:
```js
const encryptedText = this.$CryptoJS.AES.encrypt("Hi There!", "Secret Passphrase").toString()
const decryptedText = this.$CryptoJS.AES.decrypt(encryptedText, "Secret Passphrase").toString(this.$CryptoJS.enc.Utf8)
```

Directly on a template:
```js
<template>
  <img alt="Vue logo" src="./assets/logo.png" />
  <HelloWorld msg="Hello Vue 3 + Vite" />
  {{ $CryptoJS.AES.encrypt("Hi There!", "Secret Passphrase").toString() }}
</template>
```

Please kindly check full documention of [crypto-js](https://github.com/brix/crypto-js)

---
_Source: https://npm.io/package/vue-cryptojs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
