|
@ -479,7 +479,7 @@ export type AccountKeyInfo = Account & KeyMetaWithPrivate; |
|
|
export const retrieveAccountCount = async (): Promise<number> => { |
|
|
export const retrieveAccountCount = async (): Promise<number> => { |
|
|
let result = 0; |
|
|
let result = 0; |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const dbResult = await platformService.dbQuery( |
|
|
const dbResult = await platformService.dbQueryRaw( |
|
|
`SELECT COUNT(*) FROM accounts`, |
|
|
`SELECT COUNT(*) FROM accounts`, |
|
|
); |
|
|
); |
|
|
if (dbResult?.values?.[0]?.[0]) { |
|
|
if (dbResult?.values?.[0]?.[0]) { |
|
@ -496,7 +496,7 @@ export const retrieveAccountCount = async (): Promise<number> => { |
|
|
|
|
|
|
|
|
export const retrieveAccountDids = async (): Promise<string[]> => { |
|
|
export const retrieveAccountDids = async (): Promise<string[]> => { |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const dbAccounts = await platformService.dbQuery(`SELECT did FROM accounts`); |
|
|
const dbAccounts = await platformService.dbQueryRaw(`SELECT did FROM accounts`); |
|
|
let allDids = |
|
|
let allDids = |
|
|
databaseUtil |
|
|
databaseUtil |
|
|
.mapQueryResultToValues(dbAccounts) |
|
|
.mapQueryResultToValues(dbAccounts) |
|
@ -522,7 +522,7 @@ export const retrieveAccountMetadata = async ( |
|
|
): Promise<Account | undefined> => { |
|
|
): Promise<Account | undefined> => { |
|
|
let result: Account | undefined = undefined; |
|
|
let result: Account | undefined = undefined; |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const dbAccount = await platformService.dbQuery( |
|
|
const dbAccount = await platformService.dbQueryRaw( |
|
|
`SELECT * FROM accounts WHERE did = ?`, |
|
|
`SELECT * FROM accounts WHERE did = ?`, |
|
|
[activeDid], |
|
|
[activeDid], |
|
|
); |
|
|
); |
|
@ -563,7 +563,7 @@ export const retrieveFullyDecryptedAccount = async ( |
|
|
): Promise<Account | undefined> => { |
|
|
): Promise<Account | undefined> => { |
|
|
let result: Account | undefined = undefined; |
|
|
let result: Account | undefined = undefined; |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const dbSecrets = await platformService.dbQuery( |
|
|
const dbSecrets = await platformService.dbQueryRaw( |
|
|
`SELECT secretBase64 from secret`, |
|
|
`SELECT secretBase64 from secret`, |
|
|
); |
|
|
); |
|
|
if ( |
|
|
if ( |
|
@ -577,7 +577,7 @@ export const retrieveFullyDecryptedAccount = async ( |
|
|
} |
|
|
} |
|
|
const secretBase64 = dbSecrets.values[0][0] as string; |
|
|
const secretBase64 = dbSecrets.values[0][0] as string; |
|
|
const secret = base64ToArrayBuffer(secretBase64); |
|
|
const secret = base64ToArrayBuffer(secretBase64); |
|
|
const dbAccount = await platformService.dbQuery( |
|
|
const dbAccount = await platformService.dbQueryRaw( |
|
|
`SELECT * FROM accounts WHERE did = ?`, |
|
|
`SELECT * FROM accounts WHERE did = ?`, |
|
|
[activeDid], |
|
|
[activeDid], |
|
|
); |
|
|
); |
|
@ -611,7 +611,7 @@ export const retrieveFullyDecryptedAccount = async ( |
|
|
|
|
|
|
|
|
export const retrieveAllAccountsMetadata = async (): Promise<Account[]> => { |
|
|
export const retrieveAllAccountsMetadata = async (): Promise<Account[]> => { |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const dbAccounts = await platformService.dbQuery(`SELECT * FROM accounts`); |
|
|
const dbAccounts = await platformService.dbQueryRaw(`SELECT * FROM accounts`); |
|
|
const accounts = databaseUtil.mapQueryResultToValues(dbAccounts) as Account[]; |
|
|
const accounts = databaseUtil.mapQueryResultToValues(dbAccounts) as Account[]; |
|
|
let result = accounts.map((account) => { |
|
|
let result = accounts.map((account) => { |
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@ -643,7 +643,7 @@ export async function saveNewIdentity( |
|
|
try { |
|
|
try { |
|
|
// add to the new sql db
|
|
|
// add to the new sql db
|
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const platformService = PlatformServiceFactory.getInstance(); |
|
|
const secrets = await platformService.dbQuery( |
|
|
const secrets = await platformService.dbQueryRaw( |
|
|
`SELECT secretBase64 FROM secret`, |
|
|
`SELECT secretBase64 FROM secret`, |
|
|
); |
|
|
); |
|
|
if (!secrets?.values?.length || !secrets.values[0]?.length) { |
|
|
if (!secrets?.values?.length || !secrets.values[0]?.length) { |
|
|