Skip to content

Commit

Permalink
Fix signature issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mrruby committed Jul 15, 2024
1 parent 775b6b8 commit 1fa6292
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions holo-key-manager-extension/scripts/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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({
Expand Down
1 change: 0 additions & 1 deletion holo-key-manager-extension/src/lib/const/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export const KEY_INDEX = 0;
export const DEEP_KEY_INDEX = 0;
3 changes: 2 additions & 1 deletion holo-key-manager-extension/src/lib/helpers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion holo-key-manager-extension/static/manifest.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 1 addition & 0 deletions shared/const/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit 1fa6292

Please sign in to comment.