@vitia.ai/secure-api-client-vue
v0.1.4
Published
Vue 3 SDK (browser-only), Pinia, fetch, Vite library build
Maintainers
Readme
@your-scope/vue-sdk
Vue 3 SDK (browser-only), using WebCrypto + fetch, built with Vite (library mode).
Install
pnpm add @your-scope/vue-sdk
# peer deps
pnpm add vue piniaUsage
import { createApp } from 'vue';
import App from './App.vue';
import { SdkPlugin, SecureApiClient } from '@your-scope/vue-sdk';
createApp(App)
.use(SdkPlugin, {
baseUrl: 'https://api.example.com',
clientId: 'YOUR_CLIENT_ID',
serverPublicKeyPem: '-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----',
clientIdentityPrivateKeyPem: '-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----'
})
.mount('#app');Or instantiate directly:
import { SecureApiClient } from '@your-scope/vue-sdk';
const client = new SecureApiClient({ /* same options */ });
await client.ensureSession();
const data = await client.get('/some/endpoint');Notes
- This SDK keeps a small persistent layer in
localStoragefor non-cryptographic session fields (tokens, expiry, userId). Cryptographic session keys are not persisted and a new handshake is performed after reload. - Ensure your API CORS allows the custom headers used by the client.
