File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ import { getAuthManager } from './lib/auth-manager' ;
2+ import { localStorage } from './lib/storage' ;
3+
4+ import type { LitAuthStorageProvider } from './lib/storage/types' ;
5+ import type { LitAuthData } from './lib/types' ;
6+
7+ export type { LitAuthStorageProvider , LitAuthData } ;
8+
9+ export const storagePlugins = { localStorage } ;
10+
11+ export { getAuthManager } ;
Original file line number Diff line number Diff line change 1+ import { nacl } from '@lit-protocol/nacl' ;
2+ import { SessionKeyPair } from '@lit-protocol/types' ;
3+ import { uint8arrayToString } from '@lit-protocol/uint8arrays' ;
4+
5+ import type { LitAuthStorageProvider } from './storage/types' ;
6+ import type { LitAuthData } from '@lit-protocol/auth' ;
7+
8+ interface LitAuthManagerConfig {
9+ storage : LitAuthStorageProvider ;
10+ }
11+
12+ function generateSessionKeyPair ( ) : SessionKeyPair {
13+ const keyPair = nacl . sign . keyPair ( ) ;
14+
15+ return {
16+ publicKey : uint8arrayToString ( keyPair . publicKey , 'base16' ) ,
17+ secretKey : uint8arrayToString ( keyPair . secretKey , 'base16' ) ,
18+ } ;
19+ }
20+
21+ async function tryGetCachedAuthData ( ) {
22+ // Use `storage` to see if there is cached auth data
23+ // If error thrown trying to get it, error to caller or ??
24+ }
25+
26+ async function tryGetAuthMethodFromAuthenticator ( ) {
27+ // Use authenticator `getAuthMethod()` method to get a new auth method
28+ }
29+
30+ function validateAuthData ( authData : LitAuthData ) {
31+ // Validate auth data is not expired, and is well-formed
32+ }
33+
34+ async function signSessionKey ( { storage } : LitAuthManagerConfig ) {
35+ // Use LitNodeClient to signSessionKey with AuthData
36+ }
37+
38+ export function getAuthManager ( { storage } : LitAuthManagerConfig ) {
39+ return {
40+ getAuthContext ( ) { } ,
41+ } ;
42+ }
Original file line number Diff line number Diff line change 1+ // AuthProviders live in this dir tree
You can’t perform that action at this time.
0 commit comments