0.1.3 • Published 1 year ago

@belongnet/enoki-vue v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@belongnet/enoki-vue

Version Downloads install size npm bundle size

publint | arethetypeswrong

Enoki (zkLogin Sui) use hooks Vue 3, based and on Enoki TypeScript SDK and inspired React integration.

Installation

  1. Install dependencies:
pnpm add @belongnet/enoki-vue @mysten/enoki
  1. Get your API key from Enoki Portal and write direct to config or set env VITE_ENOKI_API_KEY.

  2. 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,
  },
})
  1. 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

License

This project is licensed under the terms of the MIT license.

0.0.9

1 year ago

0.1.3

1 year ago

0.0.2

1 year ago