@belongnet/enoki-vue
v0.1.3
Published
Enoki Flow zk-login sui integration for Vue.js
Downloads
166
Readme
@belongnet/enoki-vue
Enoki (zkLogin Sui) use hooks Vue 3, based and on Enoki TypeScript SDK and inspired React integration.
Installation
- Install dependencies:
pnpm add @belongnet/enoki-vue @mysten/enoki
Get your API key from Enoki Portal and write direct to config or set env
VITE_ENOKI_API_KEY
.Integrate plugin with your Vue App:
// src/main.ts
import { useEnokiFlow } from '@belongnet/enoki-vue'
app.use(EnokiPlugin, {
config: {
apiKey: import.meta.env.VITE_ENOKI_API_KEY,
},
})
- Hooks are ready to use in your components or composables:
import { useEnokiFlow } from '@belongnet/enoki-vue'
const enokiFlow = useEnokiFlow()
// https://docs.enoki.mystenlabs.com/ts-sdk/examples
function handleSignIn() {
enokiFlow
.createAuthorizationURL({
// ...
})
.then((url) => {
window.location.href = url
})
}
See official documentation for more details, for complex example see playground folder.
Enjoy!
Advanced Usage
import {
useZkLogin,
useZkLoginSession,
useAuthCallback,
useEnokiFlow,
} from '@belongnet/enoki-vue'
Related
- https://github.com/MystenLabs/sui/tree/main/sdk/enoki
License
This project is licensed under the terms of the MIT license.