Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-encryption-plugin

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-encryption-plugin

pinia插件加密、实现本地数据加密解密

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

你的 Pinia 加密插件

你的 Pinia 加密插件是一个基于 Pinia 的实用工具,用于在 Vue.js 应用程序中加密和解密敏感数据。它提供了一种简单且安全的方式来保护你的数据。

安装

你可以使用 npm 或 yarn 安装插件:

pnpm i vue3-encryption-plugin

使用方法

在你的主应用程序入口文件(例如 main.js)中,导入并使用 Pinia store 以及加密插件:

// main.js
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import EncryptionPlugin from "vue3-encryption-plugin";

const app = createApp(App);

const pinia = createPinia();
app.use(pinia);

// 注册加密插件并提供自定义的密钥(可选)
app.use(EncryptionPlugin, { key: "your-custom-secret-key" });

app.mount("#app");

加密和解密 一旦你设置了插件,你就可以在组件中使用 $encrypt 和 $decrypt 方法:

<!-- YourComponent.vue -->
import { onMounted, ref, getCurrentInstance } from "vue";
const { proxy }: any = getCurrentInstance();

function handClick() {
	console.log("!这里输出 🚀 ==>:", proxy.$encrypt({ name: "zk", age: "25" }));
	console.log(
		"!这里输出 🚀 ==>:",
		proxy.$decrypt(
			"U2FsdGVkX19kB72fxBYMht5yxXk0MHaYk4qCymMRh7uEA7lb6qOLVInVvTpyNIN0"
		)
	);
}

Keywords

FAQs

Package last updated on 03 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc