@jokio/sdk 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![npm license](https://img.shields.io/npm/l/@jokio/sdk.svg)](https://www.npmjs.com/package/@jokio/sdk)
6
6
 
7
7
  SDK for building decentralised localfirst web apps.
8
- Provides tts ai model integrations, realtime p2p communication & crypto encryptions.
8
+ Provides authentication (guest, passkeys, email), tts ai model integrations, realtime communication & crypto encryptions.
9
9
 
10
10
  # Examples
11
11
 
@@ -0,0 +1,25 @@
1
+ type Config = {
2
+ authUrl: string;
3
+ };
4
+ export declare class AuthService {
5
+ private config;
6
+ constructor(config: Config);
7
+ requestEmailLogin(email: string, returnUrl?: string): Promise<boolean>;
8
+ completeEmailLogin(email: string, otpCode: string): Promise<IdentityUser>;
9
+ requestPasskeyLogin(opts?: {
10
+ displayName?: string;
11
+ isRegistration?: boolean;
12
+ addAsAdditionalDevice?: boolean;
13
+ }): Promise<IdentityUser>;
14
+ guestLogin(): Promise<IdentityUser>;
15
+ clearLoginData(): Promise<void>;
16
+ getLastLoginData(): any;
17
+ }
18
+ export type IdentityUser = {
19
+ name: string;
20
+ email: string;
21
+ userId: string;
22
+ sessionId: string;
23
+ verified: boolean;
24
+ };
25
+ export {};
@@ -0,0 +1 @@
1
+ export declare function playAudioFromBuffer(buffer: ArrayBuffer): HTMLAudioElement;
@@ -0,0 +1,9 @@
1
+ export declare class CryptoService {
2
+ createSessionKeyPair(): Promise<CryptoKeyPair>;
3
+ exportPublicKey(publicKey: CryptoKey): Promise<string>;
4
+ deriveAESKey(privateKey: CryptoKey, publicKeyString: string): Promise<CryptoKey>;
5
+ exportRawKey(key: CryptoKey): Promise<string>;
6
+ encrypt(text: string, key: CryptoKey): Promise<string>;
7
+ decrypt(encryptedText: string, key: CryptoKey): Promise<string>;
8
+ hashString(text: string): Promise<string>;
9
+ }
@@ -0,0 +1,18 @@
1
+ import { AuthService } from './auth.service';
2
+ import { CryptoService } from './crypto.service';
3
+ import { NatsService } from './nats.service';
4
+ import { EdgeTtsService } from './tts.service';
5
+ export { NatsService } from './nats.service';
6
+ export { VoicevoxTtsService } from './voicevoxTts';
7
+ type Config = {
8
+ debug: boolean;
9
+ authUrl: string;
10
+ natsUrl: string;
11
+ };
12
+ export declare const jok: {
13
+ setup(config: Partial<Config>): void;
14
+ auth: AuthService;
15
+ tts: EdgeTtsService;
16
+ nats: NatsService<unknown>;
17
+ crypto: CryptoService;
18
+ };