@viyuni/cookie-sync-client
v0.0.3
Published
Sync encrypted cookies to login-sync server and fetch decoded cookies.
Maintainers
Readme
@viyuni/cookie-sync-client
Client package for syncing encrypted cookies to login-sync server and retrieving decoded cookies.
API
import { createCookieSyncClient } from '@viyuni/cookie-sync-client';
const client = createCookieSyncClient(
'http://name:access_token@localhost:3000',
'your-cookie-encrypt-password',
);
await client.sync('session=abc123; Path=/; HttpOnly');
const cookie = await client.getDecodedCookie();Function signature
createCookieSyncClient(connectionUrl: string, password: string)connectionUrl: must be in the formhttp://name:access_token@host:portpassword: secret used by@viyuni/cookie-cryptofor encrypt/decrypt
Methods
sync(cookie: string): Promise<void>- Encrypts cookie then uploads it to
POST /api/:name
- Encrypts cookie then uploads it to
getDecodedCookie(): Promise<string | null>- Fetches encrypted value from
GET /api/:nameand decrypts it locally
- Fetches encrypted value from
