Skip to content

Commit

Permalink
Fix changing message to signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mrruby committed Apr 17, 2024
1 parent 834babb commit e420197
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion holo-key-manager-extension/src/lib/helpers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const signMessage = async (message: string, index: number) => {
appKey.zero();

const validatedSchema = SuccessMessageSignedSchema.safeParse({
message: uint8ArrayToBase64(signedMessage)
signature: uint8ArrayToBase64(signedMessage)
});

if (!validatedSchema.success) {
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.46",
"version": "0.0.47",
"manifest_version": 3,
"action": {
"default_title": "Holo key manager",
Expand Down
3 changes: 1 addition & 2 deletions holo-key-manager-js-client/.npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

node_modules/
/src/
types/
prebuild.cjs
index.ts
*.tgz
tsconfig.json
config.js

9 changes: 4 additions & 5 deletions holo-key-manager-js-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,21 @@ const getGenericErrorMessage = (error) => {
```

## API reference

```typescript
class HoloKeyManagerExtensionClient {
constructor({happId: string, happName: String, happLogo: Url, happUiUrl: Url, requireRegistrationCode: boolean, requireEmail:boolean})

async signIn(): Promise<pubKey: Uint8Array> {} // throws errors

async signUp(): Promise<{ email?: string, registration_code?: string, pubkey: Uint8Array }> {} // returns Promise of email and registration code if required in constructor, throws errors
async logOut() {} // throws errors
async logOut() {} // throws errors

async signMessage(payload: Uint8Array): Promise<Uint8Array> {} // returns Promise of signature, throws errors
async signMessage(payload: Uint8Array): Promise<Uint8Array> {} // returns Promise of signature, throws errors

on('authorized', (Uint8Array, boolean) => void): UnsubscribeFunction {}
on('rejected', () => void): UnsubscribeFunction {}
}

type UnsubscribeFunction = () => void;
```


2 changes: 1 addition & 1 deletion holo-key-manager-js-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@holo-host/holo-key-manager-js-client",
"version": "0.0.2",
"version": "0.0.3",
"description": "A JavaScript client API for managing Holo keys",
"main": "lib/index.js",
"types": "lib/holo-key-manager-js-client/src/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions holo-key-manager-js-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ const createHoloKeyManager = ({
sender: SENDER_WEBAPP
});

const { message } = parseMessagePayload<SuccessMessageSigned>(response, SIGN_MESSAGE_SUCCESS);
const { signature } = parseMessagePayload<SuccessMessageSigned>(response, SIGN_MESSAGE_SUCCESS);

return base64ToUint8Array(message);
return base64ToUint8Array(signature);
};

const performSignOutAction = async () => {
Expand Down
6 changes: 4 additions & 2 deletions shared/types/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ const HappIdSchema = z.object({
});

export const SuccessMessageSignedSchema = z.object({
message: z.string()
signature: z.string()
});

export type SuccessMessageSigned = z.infer<typeof SuccessMessageSignedSchema>;

export const MessageToSignSchema = SuccessMessageSignedSchema.merge(HappIdSchema);
export const MessageToSignSchema = HappIdSchema.extend({
message: z.string()
});

export const PubKeySchema = z.object({
pubKey: z.string()
Expand Down

0 comments on commit e420197

Please sign in to comment.