-
Notifications
You must be signed in to change notification settings - Fork 24
NIP-76: Private Channels - Draft 2 - Includes Client Implementation and Tool kit library #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
d-krause
wants to merge
42
commits into
block-core:main
Choose a base branch
from
d-krause:nip76-draft-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
e7f5e23
fixing of ExpressionChangedAfterItHasBeenCheckedError in profile. com…
d-krause 42babae
adding Observable to NostrRelaySubscription type - makes it easier to…
d-krause d0d8c0d
NIP76 initial commit
d-krause 434875d
basic key sharing , viewing other peoples private threads
d-krause a0cf4bd
adding follows, replies, and reactions, new nprivatethread nip19
d-krause 08eca5d
expiring single use only cookie to encrypt the session
d-krause ddedb4b
Merge remote-tracking branch 'upstream/main' into main
d-krause 57d1667
pre-refactor ContentDocument
d-krause 5507832
some refactoring, more to come
d-krause 0dcfdeb
nip76-tools update changes - Buffers are now Uint8Arrays, crypto is n…
d-krause 08c7b30
more refactoring, storing content as array, signing all content, prev…
d-krause c559ca8
renaming Private Thread to Private Channel
d-krause 97a9d81
more refactoring, removing the bastard rp key, isolating wallet stora…
d-krause bbd81c1
new created_at and keyset index reducer utilities. fully functioning …
d-krause 0137320
new HDKIndex replaces IndexDocument - much more organized. removing u…
d-krause 0313856
removing content sig, now verifying by pubkey owenership. pushing mor…
d-krause 63f279e
condensing wallet indexes down to one documentsIndex. removing isTop…
d-krause 880e430
renming add-thread to add-channel
d-krause bb4d950
renaming add-thread to add-channel
d-krause 6ed051a
adding channel invitations is working, now need to work on reading an…
d-krause 2456d6b
fully functioning invitations and rsvps
d-krause 27bb01f
event deleting, copying invitation without saving, ability to delete …
d-krause 475fcab
new rsvp class resembles a PrivateChannelPointer - channel owner can …
d-krause b3e8dce
new diagnostics component. handling invites and rsvps, suspension and…
d-krause ea6eb79
better ui flow
d-krause 9de1dc5
rename component part 1
d-krause 2820cd0
rename component part 2
d-krause ad1297c
rename component part 3
d-krause ad29b31
adding demo starter components
d-krause 7a023f8
fully functionining demo code
d-krause d18fb91
Merge remote-tracking branch 'upstream/main' into nip76-draft-2
d-krause 037c7d6
new dependency for event-buttons component
d-krause 0183a96
updating package.json to use npmjs version of animiq-nip76-tools
d-krause a7bc303
cleanup demo and dev only changes
d-krause e8898c4
cleanup demo and dev only changes
d-krause d935900
cleanup demo and dev only changes
d-krause b142b67
cleanup demo and dev only changes removed
d-krause f07b0f2
cleanup demo and dev only changes removed
d-krause 1889e9f
Merge remote-tracking branch 'upstream/main' into nip76-draft-2
d-krause 9ee0818
WORK IN PROGRESS: refactors for supporting blockcore-wallet extensions
d-krause db973ae
blockcore-wallet no longer exposes any private channel private keys t…
d-krause 88e8ab5
refactor moving key management from wallet to web storage. streamlini…
d-krause File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/app/nip76/demo-only/nip76-demo-starter/nip76-demo-starter.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <mat-card class="intro"> | ||
| <b>Thanks for coming to checkout the Nip76 Private Channels Demo.</b> | ||
| <p> | ||
| You may use your own private nostr key, but we understand why many users would be hesitant | ||
| to do this. If so, please feel free to use a demo profile like | ||
| <a class="action-link" (click)="copyKey('Alice')">Alice</a> | ||
| or <a class="action-link" (click)="copyKey('Bob')">Bob</a>, | ||
| or create an entirely new user. | ||
| </p> | ||
| <div class="menubar"> | ||
| <button class="menubar-button" mat-flat-button (click)="demoUserType = 'existing'" | ||
| [color]="demoUserType === 'existing' ? 'primary' : 'secondary'"> Use Existing User </button> | ||
| <button class="menubar-button" mat-flat-button (click)="demoUserType = 'new'" | ||
| [color]="demoUserType === 'new' ? 'primary' : 'secondary'"> Create New User </button> | ||
| </div> | ||
| </mat-card> | ||
| <nip76-demo-key *ngIf="demoUserType === 'existing'"></nip76-demo-key> | ||
| <nip76-demo-create *ngIf="demoUserType === 'new'"></nip76-demo-create> |
28 changes: 28 additions & 0 deletions
28
src/app/nip76/demo-only/nip76-demo-starter/nip76-demo-starter.component.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| .intro { | ||
| position: absolute; | ||
| top: 86px; | ||
| padding: 8px; | ||
| left: 198px; | ||
| z-index: 1000; | ||
| width: 66%; | ||
| background-color: floralwhite; | ||
| border-radius: 20px; | ||
| } | ||
|
|
||
| .menubar { | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .menubar-button { | ||
| display: flex; | ||
| } | ||
|
|
||
| .action-link { | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| p { | ||
| margin: 4px 0px; | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/app/nip76/demo-only/nip76-demo-starter/nip76-demo-starter.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { Nip76DemoStarterComponent } from './nip76-demo-starter.component'; | ||
|
|
||
| describe('LoginOrCreateNewComponent', () => { | ||
| let component: Nip76DemoStarterComponent; | ||
| let fixture: ComponentFixture<Nip76DemoStarterComponent>; | ||
|
|
||
| beforeEach(async () => { | ||
| await TestBed.configureTestingModule({ | ||
| declarations: [ Nip76DemoStarterComponent ] | ||
| }) | ||
| .compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(Nip76DemoStarterComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); |
103 changes: 103 additions & 0 deletions
103
src/app/nip76/demo-only/nip76-demo-starter/nip76-demo-starter.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { MatDialog } from '@angular/material/dialog'; | ||
| import { MatSnackBar } from '@angular/material/snack-bar'; | ||
| import { Router } from '@angular/router'; | ||
| import { filter } from 'rxjs'; | ||
| import { CreateProfileComponent } from 'src/app/connect/create/create'; | ||
| import { ConnectKeyComponent } from 'src/app/connect/key/key'; | ||
| import { AuthenticationService } from 'src/app/services/authentication'; | ||
| import { DataService } from 'src/app/services/data'; | ||
| import { ProfileService } from 'src/app/services/profile'; | ||
| import { SecurityService } from 'src/app/services/security'; | ||
| import { ThemeService } from 'src/app/services/theme'; | ||
| import { Utilities } from 'src/app/services/utilities'; | ||
| import { defaultSnackBarOpts } from '../../nip76.service'; | ||
| import { Nip76DemoService } from '../nip76-demo.service'; | ||
|
|
||
|
|
||
|
|
||
| @Component({ | ||
| selector: 'app-nip76-demo-starter', | ||
| templateUrl: './nip76-demo-starter.component.html', | ||
| styleUrls: ['./nip76-demo-starter.component.scss'] | ||
| }) | ||
| export class Nip76DemoStarterComponent { | ||
| demoUserType: 'existing' | 'new' = 'existing'; | ||
| constructor( | ||
| private snackBar: MatSnackBar, | ||
| private profileService: ProfileService, | ||
| private router: Router | ||
| ) { } | ||
|
|
||
| ngOnInit() { | ||
| this.profileService.profile$.pipe(filter(x => !!x)).subscribe(x => { | ||
| this.router.navigateByUrl('/private-channels'); | ||
| }); | ||
| } | ||
|
|
||
| copyKey(name: 'Alice' | 'Bob') { | ||
| const key = { | ||
| 'Alice': 'nsec1y72ekupwshrl6zca2kx439uz23x4fqppc6gg9y9e5up5es06qqxqlcw698', | ||
| 'Bob': 'nsec12l6c5g8e7gt9twyctk0t073trlrf2zzs88240k3d2dmqlyh2hwhq9s2wl3' | ||
| }[name]; | ||
| navigator.clipboard.writeText(key); | ||
| this.snackBar.open(`${name}'s key is now in your clipboard.`, 'Hide', defaultSnackBarOpts); | ||
| } | ||
| } | ||
|
|
||
| @Component({ | ||
| selector: 'nip76-demo-key', | ||
| templateUrl: '../../../connect/key/key.html', | ||
| styleUrls: ['../../../connect/key/key.css', '../../../connect/connect.css'] | ||
| }) | ||
| export class Nip76DemoKeyComponent extends ConnectKeyComponent { | ||
|
|
||
| constructor( | ||
| dialog: MatDialog, | ||
| theme: ThemeService, | ||
| private router1: Router, | ||
| security: SecurityService, | ||
| nip76DemoService: Nip76DemoService | ||
|
|
||
| ) { | ||
| super(dialog, theme, router1, security); | ||
| this.step = 3; | ||
| } | ||
|
|
||
| override async persistKey() { | ||
| super.persistKey(); | ||
| setTimeout(() => { | ||
| this.router1.navigateByUrl('/private-channels'); | ||
| }, 200) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| @Component({ | ||
| selector: 'nip76-demo-create', | ||
| templateUrl: '../../../connect/create/create.html', | ||
| styleUrls: ['../../../connect/create/create.css', '../../../connect/connect.css'] | ||
| }) | ||
| export class Nip76DemoCreateComponent extends CreateProfileComponent { | ||
|
|
||
| constructor( | ||
| utilities: Utilities, | ||
| dataService: DataService, | ||
| profileService: ProfileService, | ||
| authService: AuthenticationService, | ||
| theme: ThemeService, | ||
| private router1: Router, | ||
| security: SecurityService, | ||
| nip76DemoService: Nip76DemoService | ||
| ) { | ||
| super(utilities, dataService, profileService, authService, theme, router1, security) | ||
| } | ||
|
|
||
| override async persistKey() { | ||
| super.persistKey(); | ||
| setTimeout(() => { | ||
| this.router1.navigateByUrl('/private-channels'); | ||
| }, 200) | ||
| } | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.