Skip to content

Commit eb7493b

Browse files
committed
fix: Fixes issue with nsec key import for Nostr. Closes #354
1 parent f815122 commit eb7493b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎angular/src/app/account/create/create.component.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MessageService } from 'src/shared';
88
import { MatSnackBar } from '@angular/material/snack-bar';
99
import { TranslateService } from '@ngx-translate/core';
1010
import { nip19 } from 'nostr-tools';
11+
import * as secp from '@noble/secp256k1';
1112
const { v4: uuidv4 } = require('uuid');
1213

1314
@Component({
@@ -164,7 +165,7 @@ export class AccountCreateComponent implements OnInit, OnDestroy {
164165
async import() {
165166
if (this.privateKeyImport.startsWith('nsec')) {
166167
const decoded = nip19.decode(this.privateKeyImport);
167-
this.privateKeyImport = decoded.data as string;
168+
this.privateKeyImport = secp.utils.bytesToHex(decoded.data as Uint8Array);
168169
}
169170

170171
const account: Account = {

0 commit comments

Comments
 (0)