yet another attempt at nostr-tools nip06 fix
This commit is contained in:
@@ -229,18 +229,10 @@
|
|||||||
import "leaflet/dist/leaflet.css";
|
import "leaflet/dist/leaflet.css";
|
||||||
import { AxiosError, AxiosRequestHeaders } from "axios";
|
import { AxiosError, AxiosRequestHeaders } from "axios";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { hexToBytes } from "@noble/hashes/utils";
|
|
||||||
// these core imports could also be included as "import type ..."
|
|
||||||
import {
|
|
||||||
EventTemplate,
|
|
||||||
UnsignedEvent,
|
|
||||||
VerifiedEvent,
|
|
||||||
} from "nostr-tools/lib/types/core";
|
|
||||||
import {
|
|
||||||
accountFromExtendedKey,
|
|
||||||
extendedKeysFromSeedWords,
|
|
||||||
} from "nostr-tools/lib/types/nip06";
|
|
||||||
import { finalizeEvent, serializeEvent } from "nostr-tools";
|
import { finalizeEvent, serializeEvent } from "nostr-tools";
|
||||||
|
// these core imports could also be included as "import type ..."
|
||||||
|
import { EventTemplate, UnsignedEvent, VerifiedEvent } from "nostr-tools/core";
|
||||||
|
import * as nip06 from "nostr-tools/nip06";
|
||||||
import { Component, Vue } from "vue-facing-decorator";
|
import { Component, Vue } from "vue-facing-decorator";
|
||||||
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
|
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
|
||||||
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
||||||
@@ -668,15 +660,15 @@ export default class NewEditProjectView extends Vue {
|
|||||||
// remove any trailing '
|
// remove any trailing '
|
||||||
const finalDerNumNoApostrophe = finalDerNum?.replace(/'/g, "");
|
const finalDerNumNoApostrophe = finalDerNum?.replace(/'/g, "");
|
||||||
const accountNum = Number(finalDerNumNoApostrophe || 0);
|
const accountNum = Number(finalDerNumNoApostrophe || 0);
|
||||||
const extPubPri = extendedKeysFromSeedWords(
|
const extPubPri = nip06.extendedKeysFromSeedWords(
|
||||||
account?.mnemonic as string,
|
account?.mnemonic as string,
|
||||||
"",
|
"",
|
||||||
accountNum,
|
accountNum,
|
||||||
);
|
);
|
||||||
const publicExtendedKey: string = extPubPri?.publicExtendedKey;
|
const publicExtendedKey: string = extPubPri?.publicExtendedKey;
|
||||||
const privateExtendedKey = extPubPri?.privateExtendedKey;
|
const privateExtendedKey = extPubPri?.privateExtendedKey;
|
||||||
const privateKey = accountFromExtendedKey(privateExtendedKey).privateKey;
|
const privateBytes: Uint8Array =
|
||||||
const privateBytes = hexToBytes(privateKey);
|
nip06.accountFromExtendedKey(privateExtendedKey).privateKey;
|
||||||
// No real content is necessary, we just want something signed,
|
// No real content is necessary, we just want something signed,
|
||||||
// so we might as well use nostr libs for nostr functions.
|
// so we might as well use nostr libs for nostr functions.
|
||||||
// Besides: someday we may create real content that we can relay.
|
// Besides: someday we may create real content that we can relay.
|
||||||
@@ -710,7 +702,8 @@ export default class NewEditProjectView extends Vue {
|
|||||||
const endorserPartnerUrl = partnerServer + "/api/partner/link";
|
const endorserPartnerUrl = partnerServer + "/api/partner/link";
|
||||||
const timeSafariUrl = window.location.origin + "/claim/" + jwtId;
|
const timeSafariUrl = window.location.origin + "/claim/" + jwtId;
|
||||||
const content = this.fullClaim.name + " - see " + timeSafariUrl;
|
const content = this.fullClaim.name + " - see " + timeSafariUrl;
|
||||||
const publicKeyHex = accountFromExtendedKey(publicExtendedKey).publicKey;
|
const publicKeyHex =
|
||||||
|
nip06.accountFromExtendedKey(publicExtendedKey).publicKey;
|
||||||
const unsignedPayload: UnsignedEvent = {
|
const unsignedPayload: UnsignedEvent = {
|
||||||
// why doesn't "...signedPayload" work?
|
// why doesn't "...signedPayload" work?
|
||||||
kind: signedPayload.kind,
|
kind: signedPayload.kind,
|
||||||
|
|||||||
Reference in New Issue
Block a user