-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcdn.html
65 lines (63 loc) · 1.78 KB
/
testcdn.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello Nostr!</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #74ebd5, #acb6e5);
font-family: Arial, sans-serif;
}
.button {
border: none;
padding: 20px;
font-size: 24px;
color: white;
background: linear-gradient(135deg, #e65c00, #f9d423);
border-radius: 50px;
cursor: pointer;
outline: none;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.button:hover {
transform: translateY(-2px);
}
.result {
margin-top: 40px;
font-size: 24px;
text-align: center;
}
</style>
</head>
<body>
<div class="result" id="result"></div>
<script type="module">
import awaitNostr from 'https://cdn.skypack.dev/awaitnostr'
async function getPublicKey() {
const resultElement = document.getElementById('result')
try {
await awaitNostr()
const publicKey = await window.nostr.getPublicKey()
const link = document.createElement('a')
link.href = `https://iris.to/${publicKey}`
link.target = '_blank'
link.textContent = `Public Key: ${publicKey}`
resultElement.innerHTML = ''
resultElement.appendChild(link)
} catch (error) {
resultElement.textContent = `Error: ${error.message}`
}
}
getPublicKey()
</script>
</body>
</html>