@@ -84,7 +84,7 @@ export const createLocalAuth = (
8484 id : OwnerId ,
8585 options ?: LocalAuthOptions ,
8686 ) : Promise < void > => {
87- await deps . secureStorage . setItem ( AUTH_METAKEY_LAST_OWNER , id , {
87+ await deps . secureStorage . setItem ( localAuthMetakeyLastOwner , id , {
8888 ...buildAuthOptions ( options ) ,
8989 accessControl : "none" ,
9090 } ) ;
@@ -93,7 +93,7 @@ export const createLocalAuth = (
9393 const getLastOwnerId = async (
9494 options ?: LocalAuthOptions ,
9595 ) : Promise < OwnerId | undefined > => {
96- const item = await deps . secureStorage . getItem ( AUTH_METAKEY_LAST_OWNER , {
96+ const item = await deps . secureStorage . getItem ( localAuthMetakeyLastOwner , {
9797 ...buildAuthOptions ( options ) ,
9898 accessControl : "none" ,
9999 } ) ;
@@ -103,7 +103,7 @@ export const createLocalAuth = (
103103 const getOwnerNames = async (
104104 options ?: LocalAuthOptions ,
105105 ) : Promise < Record < OwnerId , string > > => {
106- const item = await deps . secureStorage . getItem ( AUTH_METAKEY_OWNER_NAMES , {
106+ const item = await deps . secureStorage . getItem ( localAuthMetakeyOwnerNames , {
107107 ...buildAuthOptions ( options ) ,
108108 accessControl : "none" ,
109109 } ) ;
@@ -122,7 +122,7 @@ export const createLocalAuth = (
122122 const names = await getOwnerNames ( options ) ;
123123 names [ id ] = username ;
124124 await deps . secureStorage . setItem (
125- AUTH_METAKEY_OWNER_NAMES ,
125+ localAuthMetakeyOwnerNames ,
126126 JSON . stringify ( names ) ,
127127 {
128128 ...buildAuthOptions ( options ) ,
@@ -137,7 +137,7 @@ export const createLocalAuth = (
137137 ) : Promise < void > => {
138138 const { [ id ] : _ , ...names } = await getOwnerNames ( options ) ;
139139 await deps . secureStorage . setItem (
140- AUTH_METAKEY_OWNER_NAMES ,
140+ localAuthMetakeyOwnerNames ,
141141 JSON . stringify ( names ) ,
142142 {
143143 ...buildAuthOptions ( options ) ,
@@ -157,8 +157,8 @@ export const createLocalAuth = (
157157 . filter ( Boolean )
158158 . filter (
159159 ( i ) =>
160- i . key !== AUTH_METAKEY_LAST_OWNER &&
161- i . key !== AUTH_METAKEY_OWNER_NAMES ,
160+ i . key !== localAuthMetakeyLastOwner &&
161+ i . key !== localAuthMetakeyOwnerNames ,
162162 )
163163 . map ( ( i ) => i . key as OwnerId ) ;
164164 } ;
@@ -171,7 +171,7 @@ export const createLocalAuth = (
171171 username ?: string ,
172172 ) : LocalAuthOptions => {
173173 const newOptions : LocalAuthOptions = {
174- ...AUTH_DEFAULT_OPTIONS ,
174+ ...localAuthDefaultOptions ,
175175 ...( username && { webAuthnUsername : username } ) ,
176176 ...options ,
177177 } ;
@@ -311,13 +311,11 @@ export const createLocalAuth = (
311311 } ;
312312} ;
313313
314- // TOHO: With `const`, we don't need UPPER_CASE
315- export const AUTH_NAMESPACE = "evolu" ;
316- export const AUTH_METAKEY_LAST_OWNER = "_last_owner" ;
317- export const AUTH_METAKEY_OWNER_NAMES = "_owner_names" ;
318- export const AUTH_DEFAULT_OPTIONS : LocalAuthOptions = {
319- service : AUTH_NAMESPACE ,
320- keychainGroup : AUTH_NAMESPACE ,
314+ export const localAuth_Namespace = "evolu" ;
315+
316+ export const localAuthDefaultOptions : LocalAuthOptions = {
317+ service : localAuth_Namespace ,
318+ keychainGroup : localAuth_Namespace ,
321319 androidBiometricsStrongOnly : true ,
322320 iosSynchronizable : true ,
323321 webAuthnUsername : "Evolu User" ,
@@ -326,6 +324,9 @@ export const AUTH_DEFAULT_OPTIONS: LocalAuthOptions = {
326324 } ,
327325} ;
328326
327+ const localAuthMetakeyLastOwner = "_last_owner" ;
328+ const localAuthMetakeyOwnerNames = "_owner_names" ;
329+
329330export interface AuthResult {
330331 /** The app owner created during registration. */
331332 readonly owner : AppOwner | undefined ;
0 commit comments