window.nostr.js 0.4.0 → 0.4.2

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/iframe/build.js DELETED
@@ -1,9 +0,0 @@
1
- import {build} from 'esbuild'
2
-
3
- build({
4
- entryPoints: ['iframe/iframe.ts'],
5
- bundle: true,
6
- sourcemap: 'external',
7
- outfile: 'dist/iframe.js',
8
- format: 'iife'
9
- }).then(() => console.log('iframe built'))
@@ -1 +0,0 @@
1
- <script src="iframe.js"></script>
package/iframe/iframe.ts DELETED
@@ -1,21 +0,0 @@
1
- import {parseBunkerInput} from 'nostr-tools/nip46'
2
- import {localStorageKeys} from '../src/lib'
3
-
4
- window.onmessage = async (ev: MessageEvent) => {
5
- if (
6
- !ev.origin.startsWith('https://join.the-nostr.org') &&
7
- !ev.origin.startsWith('http://localhost:6711')
8
- ) {
9
- return
10
- }
11
-
12
- const {bunker} = ev.data
13
- if (bunker) {
14
- const bp = await parseBunkerInput(bunker)
15
- if (bp) {
16
- localStorage.setItem(localStorageKeys.BUNKER_POINTER, JSON.stringify(bp))
17
- } else {
18
- console.error('wnj iframe got an invalid bunker url:', bunker)
19
- }
20
- }
21
- }
package/src/lib.ts DELETED
@@ -1,7 +0,0 @@
1
- export const localStorageKeys = {
2
- ORIGIN: 'wnj:origin',
3
- CLIENT_SECRET: 'wnj:clientSecret',
4
- Y_POS: 'wnj:ypos',
5
- CALLBACK_TOKEN: 'wnj:callbackToken',
6
- BUNKER_POINTER: 'wnj:bunkerPointer'
7
- }