-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connect): add nostrGetPublicKey method
- Loading branch information
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Assert } from '@trezor/schema-utils'; | ||
|
||
import { AbstractMethod } from '../core/AbstractMethod'; | ||
import { validatePath } from '../utils/pathUtils'; | ||
import { NostrGetPublicKey as NostrGetPubkeySchema } from '../types/api/nostrGetPublicKey'; | ||
|
||
export default class NostrGetPublicKey extends AbstractMethod<'nostrGetPublicKey', Params> { | ||
init() { | ||
this.requiredPermissions = ['read']; | ||
|
||
// create a bundle with only one batch if bundle doesn't exists | ||
|
||
// validate bundle type | ||
Assert(NostrGetPubkeySchema, this.payload); | ||
|
||
const address_n = validatePath(this.payload.path); | ||
|
||
this.params = { | ||
address_n, | ||
}; | ||
} | ||
|
||
get info() { | ||
return 'Export nostr public key'; | ||
} | ||
|
||
get confirmation() { | ||
return { | ||
view: 'export-xpub' as const, | ||
label: 'hello', | ||
}; | ||
} | ||
|
||
async run() { | ||
const cmd = this.device.getCommands(); | ||
const response = await cmd.typedCall('NostrGetPubkey', 'NostrPubkey', this.params); | ||
return response.message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Static } from '@trezor/schema-utils'; | ||
import { PROTO } from '../../constants'; | ||
import { Params, Response, GetPublicKey } from '../params'; | ||
|
||
export type NostrGetPublicKey = Static<typeof GetPublicKey>; | ||
export const NostrGetPublicKey = GetPublicKey; | ||
|
||
export declare function nostrGetPublicKey( | ||
params: Params<GetPublicKey>, | ||
): Response<PROTO.NostrPubkey>; |