diff --git a/holo-key-manager-extension/scripts/helpers.ts b/holo-key-manager-extension/scripts/helpers.ts index 84bc72e..a1e255c 100644 --- a/holo-key-manager-extension/scripts/helpers.ts +++ b/holo-key-manager-extension/scripts/helpers.ts @@ -4,7 +4,7 @@ import { seedBundleReady, UnlockedSeedBundle } from '@holochain/hc-seed-bundle'; -import { AUTHENTICATED_APPS_LIST, DEEP_KEY_AGENT_OFFSET, SESSION } from '@shared/const'; +import { AUTHENTICATED_APPS_LIST, DEEP_KEY_AGENT_OFFSET, KEY_INDEX, SESSION } from '@shared/const'; import { base64ToUint8Array, uint8ArrayToBase64 } from '@shared/helpers'; import { getDeviceKey, storageService } from '@shared/services'; import { @@ -41,13 +41,15 @@ export const signMessageLogic = async ({ message, happId, session }: SignMessage const pw = new TextEncoder().encode(session); const keyUnlocked = cipherList[0].unlock(parseSecret(pw)); - const appKey = keyUnlocked.derive(index + DEEP_KEY_AGENT_OFFSET); + const agent = keyUnlocked.derive(index + DEEP_KEY_AGENT_OFFSET); + const appKey = agent.derive(KEY_INDEX); const uIntArrayMessage = base64ToUint8Array(message); const signedMessage = appKey.sign(uIntArrayMessage); keyUnlocked.zero(); + agent.zero(); appKey.zero(); const validatedSchema = SuccessMessageSignedSchema.safeParse({ diff --git a/holo-key-manager-extension/src/lib/const/index.ts b/holo-key-manager-extension/src/lib/const/index.ts index 29b4a01..c9fa73e 100644 --- a/holo-key-manager-extension/src/lib/const/index.ts +++ b/holo-key-manager-extension/src/lib/const/index.ts @@ -1,2 +1 @@ -export const KEY_INDEX = 0; export const DEEP_KEY_INDEX = 0; diff --git a/holo-key-manager-extension/src/lib/helpers/queries.ts b/holo-key-manager-extension/src/lib/helpers/queries.ts index 9433970..b4daba2 100644 --- a/holo-key-manager-extension/src/lib/helpers/queries.ts +++ b/holo-key-manager-extension/src/lib/helpers/queries.ts @@ -2,12 +2,13 @@ import { encodeHashToBase64 } from '@holochain/client'; import { encode } from '@msgpack/msgpack'; import type { QueryClient } from '@tanstack/svelte-query'; -import { DEEP_KEY_INDEX, KEY_INDEX } from '$const'; +import { DEEP_KEY_INDEX } from '$const'; import { createGetKeysObjectParams, getKeys, unlockKey } from '$services'; import { AUTHENTICATED_APPS_LIST, EXTENSION_SESSION_INFO, GET_EXTENSION_SESSION, + KEY_INDEX, LOCAL, PASSWORD, SENDER_EXTENSION, diff --git a/holo-key-manager-extension/static/manifest.json b/holo-key-manager-extension/static/manifest.json index 542d8a6..422313e 100644 --- a/holo-key-manager-extension/static/manifest.json +++ b/holo-key-manager-extension/static/manifest.json @@ -1,7 +1,7 @@ { "name": "Holo key manager", "description": "A browser extension to manage holo keys", - "version": "0.0.70", + "version": "0.0.71", "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiAtKvbHNTN3O2BLRZH7RkLczaMLenSeZu+YP+KomPQPZ18nt4DY9boIN/+GWts7gCzEeQq59l8edGdF2P7xAbsRxYR88+zFEbxMtIyfyqJZIlzXwnvPJkwGu/S6arNtX48K7q1+xnJEE7VyeYSj6/i2LR+LmPigCzY9JCP7+SmWVeYbdm3kZmReK0ecfh15RXSNjZpXJUgrbea/RVxweggYKnmhhOUBmuJSCLoWTXIuJPBMwGQK1O2GKBqHOq94bPVSF7j+4WzSpPan70ZZJX/reFsOFE/idfFN6wbizjR1Ne50Po03kudEmfQgoqUhVpd0wP8A3YbqE7ODdZcCPPwIDAQAB", "manifest_version": 3, "action": { diff --git a/shared/const/app.ts b/shared/const/app.ts index ed237da..fd13921 100644 --- a/shared/const/app.ts +++ b/shared/const/app.ts @@ -4,6 +4,7 @@ export const SENDER_WEBAPP = 'webapp'; export const SENDER_EXTENSION = 'extension'; export const SENDER_BACKGROUND_SCRIPT = 'background-script'; export const DEEP_KEY_AGENT_OFFSET = 1; +export const KEY_INDEX = 0; export const HOLO_KEY_MANAGER_EXTENSION_MARKER_ID = 'user-holo-key-manager-extension-marker';