@orangecheck/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -476,6 +476,21 @@ function isNip07Available() {
|
|
|
476
476
|
}
|
|
477
477
|
return !!window.nostr;
|
|
478
478
|
}
|
|
479
|
+
async function getNostrPublicKey() {
|
|
480
|
+
if (!isNip07Available()) {
|
|
481
|
+
log2.warn("NIP-07 extension not available");
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
const nostr = window.nostr;
|
|
486
|
+
const pubkey = await nostr.getPublicKey();
|
|
487
|
+
log2.info({ pubkey }, "Got Nostr public key from NIP-07");
|
|
488
|
+
return pubkey;
|
|
489
|
+
} catch (err) {
|
|
490
|
+
log2.error({ error: err }, "Failed to get Nostr public key");
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
479
494
|
async function signNostrEvent(event) {
|
|
480
495
|
if (!isNip07Available()) {
|
|
481
496
|
log2.warn("NIP-07 extension not available");
|
|
@@ -491,6 +506,17 @@ async function signNostrEvent(event) {
|
|
|
491
506
|
return null;
|
|
492
507
|
}
|
|
493
508
|
}
|
|
509
|
+
function getNip07Info() {
|
|
510
|
+
if (!isNip07Available()) {
|
|
511
|
+
return { available: false };
|
|
512
|
+
}
|
|
513
|
+
const nostr = window.nostr;
|
|
514
|
+
return {
|
|
515
|
+
available: true,
|
|
516
|
+
name: nostr._metadata?.name,
|
|
517
|
+
version: nostr._metadata?.version
|
|
518
|
+
};
|
|
519
|
+
}
|
|
494
520
|
|
|
495
521
|
// src/attestation.ts
|
|
496
522
|
var log3 = createLogger("ocp/attestation");
|
|
@@ -1925,6 +1951,6 @@ var STATUS_META = {
|
|
|
1925
1951
|
}
|
|
1926
1952
|
};
|
|
1927
1953
|
|
|
1928
|
-
export { DEFAULT_RELAYS, STATUS_META, buildCanonicalMessage, check, computeScore, createAttestation, createAttestationEnvelope, createAttestationEvent, discoverAttestations, formatIdentities, generateAttestationId, generateGistTemplate, generateTweetText, generateWellKnownContent, getAttestationsForAddress, getAttestationsForIdentity, getDnsVerificationInstructions, getGistCreationUrl, getGitHubVerificationInstructions, getManualVerificationInstructions, getNostrVerificationInstructions, getTweetUrl, getTwitterComposeUrl, getTwitterVerificationInstructions, getVerificationInstructions, getVerificationSummary, getWellKnownUrl, isDnsIdentityVerified, isGitHubIdentityVerified, isNip07Available, isNostrIdentityVerified, isValidDomain, isValidTweetUrl, issueChallenge, parseAttestationFromEvent, parseIdentities, publishAttestation, publishToRelays, queryByAddress, queryByAttestationId, queryByIdentity, requiresManualVerification, signNostrEvent, supportsAutomaticVerification, verify2 as verify, verifyAllIdentities, verifyAttestationById, verifyChallenge, verifyDnsIdentity, verifyGitHubIdentity, verifyIdentity, verifyNostrIdentity, verifyTwitterIdentity };
|
|
1954
|
+
export { DEFAULT_RELAYS, STATUS_META, buildCanonicalMessage, check, computeScore, createAttestation, createAttestationEnvelope, createAttestationEvent, discoverAttestations, formatIdentities, generateAttestationId, generateGistTemplate, generateTweetText, generateWellKnownContent, getAttestationsForAddress, getAttestationsForIdentity, getDnsVerificationInstructions, getGistCreationUrl, getGitHubVerificationInstructions, getManualVerificationInstructions, getNip07Info, getNostrPublicKey, getNostrVerificationInstructions, getTweetUrl, getTwitterComposeUrl, getTwitterVerificationInstructions, getVerificationInstructions, getVerificationSummary, getWellKnownUrl, isDnsIdentityVerified, isGitHubIdentityVerified, isNip07Available, isNostrIdentityVerified, isValidDomain, isValidTweetUrl, issueChallenge, parseAttestationFromEvent, parseIdentities, publishAttestation, publishToRelays, queryByAddress, queryByAttestationId, queryByIdentity, requiresManualVerification, signNostrEvent, supportsAutomaticVerification, verify2 as verify, verifyAllIdentities, verifyAttestationById, verifyChallenge, verifyDnsIdentity, verifyGitHubIdentity, verifyIdentity, verifyNostrIdentity, verifyTwitterIdentity };
|
|
1929
1955
|
//# sourceMappingURL=index.mjs.map
|
|
1930
1956
|
//# sourceMappingURL=index.mjs.map
|