Skip to content

keychain

NPM version

Platform Support

Platform Support

Platform Support

Platform Support

介绍:

钥匙串插件

Reference

Method

  • keys

    读取钥匙串中所有键值

ts
import { 
keychainPlugin
} from "@plaoc/plugins";
const
res
= await
keychainPlugin
.
keys
();
  • get

    返回给定键值在钥匙串中绑定的值

ts
import { 
keychainPlugin
} from "@plaoc/plugins";
await
keychainPlugin
.
get
("test");
  • set

    将指定的键值与值绑定到钥匙串中

ts
import { 
keychainPlugin
} from "@plaoc/plugins";
await
keychainPlugin
.
set
("test", "xxx");
  • delete

    删除钥匙串中与指定键值绑定的值

ts
import { 
keychainPlugin
} from "@plaoc/plugins";
await
keychainPlugin
.
delete
("test");
  • has

    判断钥匙串中是否有与指定键值绑定的值

ts
import { 
keychainPlugin
} from "@plaoc/plugins";
await
keychainPlugin
.
has
("test");

Usage Plugins

vue
<script setup lang="ts">
import { 
keychainPlugin
} from "@plaoc/plugins";
async function
keys
() {
await
keychainPlugin
.
keys
();
} async function
get
() {
await
keychainPlugin
.
get
("test");
} async function
set
() {
await
keychainPlugin
.
set
("test", "xxx");
} async function
deleteKey
() {
await
keychainPlugin
.
delete
("test");
} async function
has
() {
await
keychainPlugin
.
has
("test");
} </script>

Usage WebComponent

vue
<script setup lang="ts">
import { 
onMounted
,
ref
} from "vue";
import {
HTMLDwebKeychainElement
} from "@plaoc/plugins";
const
$keychainPlugin
=
ref
<
HTMLDwebKeychainElement
>();
let
keychain
:
HTMLDwebKeychainElement
;
onMounted
(async () => {
keychain
=
$keychainPlugin
.
value
!;
}); async function
keys
() {
await
keychain
.
keys
();
} async function
get
() {
await
keychain
.
get
("test");
} async function
set
() {
await
keychain
.
set
("test", "xxx");
} async function
deleteKey
() {
await
keychain
.
delete
("test");
} async function
has
() {
await
keychain
.
has
("test");
} </script> <template> <
dweb-keychain
ref
="
$keychainPlugin
"></
dweb-keychain
>
</template>

基于 MIT 许可发布