Création d'un composable pour la gestion de la crypto, mise en place de l'initialisation de la première liste et sauvegarde de celle-ci. TODO NEXT : Récupération de la liste en la déchiffrant, mise en place d'une masterKey dérivée du mot de passe pour les utilisateurs non google, basculement vers la page des listes après connexion google etc.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { $Fetch } from 'ofetch';
|
||||
import type { List } from '~/types/lists'
|
||||
import type { List, WPListEncrypted } from '~/types/lists'
|
||||
|
||||
export default class ListRepository {
|
||||
private fetcher: $Fetch;
|
||||
@@ -17,6 +17,23 @@ export default class ListRepository {
|
||||
method: 'POST',
|
||||
body: data
|
||||
});
|
||||
}
|
||||
|
||||
async uploadKeys(data: string) {
|
||||
console.log('uploadEncryptedPrivateKey : data is')
|
||||
console.log(data)
|
||||
|
||||
return await this.fetcher<any>('/lists/PrivKeyCipher', {
|
||||
method: 'POST',
|
||||
body: data
|
||||
})
|
||||
}
|
||||
|
||||
async update(data: WPListEncrypted) {
|
||||
const string = JSON.stringify(data);
|
||||
return await this.fetcher<any>('/lists/' + data.id, {
|
||||
method: 'PUT',
|
||||
body: string
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user