Skip to content
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

docs: initial architecture (ECO-1386) #43

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**/*.secret
**/*.md
**/*.py
**/*.puml
.DS_Store

node_modules
Expand Down
165 changes: 165 additions & 0 deletions docs/architecture/keyring_class.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
@startuml

package router {
interface MessageRequester {
sendMessage()
}

abstract Router {
#msgRegistry
#registeredHandler
#guards
#port
+registerMessage()
+addHandler()
+addGuard()
+handleMessage()

---
Abstract members
--
+listen()
+unlisten()
}

class MessageRegistry {
-registeredMsgType
+registerMessage()
+parseMessage()
}
Router --o MessageRegistry
}
package common {
interface KVStore {
get<T>()
set<T>()
prefix()
}
}

package store {
class KeyRingStore {
+status: KeyRingStatus
+multiKeyStoreInfo
#requester: MessageRequester
+createMnemonicKey()
+createPrivateKey()
+createLedgerKey()
+addMnemonicKey()
+addPrivateKey()
+addLedgerKey()
+changeKeyRing()
+lock()
+unlock()
+deleteKeyRing()
+updateNameKeyRing()
#restore()
}
}

package router-extension {
class InExtensionMessageRequester {
+sendMessage()
}
InExtensionMessageRequester --|> MessageRequester
KeyRingStore --o InExtensionMessageRequester

class ExtensionRouter {
+listen()
+unlisten()
#onMessage()
#onMessageHandler()
}
ExtensionRouter -|> Router
}

package crypto {
interface KeyStore {
version: string
coinTypeForChain: CoinTypeForChain
type
bip44HDPath
meta
crypto
}

interface "KeyStoreCrypto (embedded)" as KeyStoreCrypto {
cipher
ciphertext
kdf
mac
}
KeyStore --* KeyStoreCrypto
}

package background {
class KeyRing {
-keystore
-multiKeyStore
}
KeyRing --o "\nkeyStore[]\n\n" KeyStore
KeyRing --o KVStore

class KeyRingService {
-keyRing: KeyRing

+restore()
+enable()
+deleteKeyRing()
+updateNameKeyRing()
+showKeyRing()
+createMnemonicKey()
+createPrivateKey()
+createLedgerKey()
+lock()
+unlock()
+getKey()
+getKeyStoreMeta()
+getKeyRingType()
+requestSignAmino()
+requestSignDirect()
+sign()
+addMnemonicKey()
+addPrivateKey()
+addLedgerKey()
+changeKeyStoreFromMultiKeyStore()
}
KeyRingService "keyRing" --o KeyRing

interface MultiKeyStoreInfoElem {
version
coinTypeForChain
type
bip44HDPath
meta
}
MultiKeyStoreInfoElem --* KeyStore : "Pick<KeyStore, K>\n(where K = members of\nMultiKeyStoreInfoElem)"
KeyRingStore -o "many" MultiKeyStoreInfoElem
}

package extension {
class RootStore {
+keyRingStore
}
RootStore --o KeyRingStore
}

node legend {
package "package" {
interface "interface" {}
abstract "abstract interface" {}
class "class" {
-private_attribute
#protected_attribute
+public_attribute
-private_method()
#protected_method()
+public_method()

}
"class" -* "interface" : composition
"class" -o "arity" "interface" : aggregation
"class" -|> "interface" : interface realization
}
}
@enduml
104 changes: 104 additions & 0 deletions docs/architecture/keyring_component.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@startuml
frame "Background Document" {
package common {
[KVStore]
}

package background {
[KeyRingService]
[KeyRing]
[KeyRingService] -> [KeyRing]
}

package extension as bg_extension {
[ExtensionRouter] ------> [KeyRingService]
}
}

frame "Chrome" {
package browser {
component runtime {
}

component tabs {
}
}
}

frame "Popup Document" {
package stores {
[KeyRingStore]
[KeyRing] -> [KVStore]
}

package crypto {
[KeyStore]
[KeyRingStore] --> [KeyStore]
}

package extension as pop_extension {
component RootStore {
' portout UIConfigStore
' portout ChainStore
portout KeyRingStore as pKeyRingStore
' portout IBCChannelStore
portout InteractionStore
portout PermissionStore
' portout SignInteractionStore
' portout LedgerInitStore
' portout ChainSuggestStore
' portout QueriesStore
' portout AccountStore
' portout CoinGeckoPriceStore
' portout TokensStore
' portout AnalyticStore

component IBCCurrencyRegistrar {
}
}
RootStore -> [KeyRingStore]
}

package router-extension {
component InExtensionMessageRequester {
port Messages
portout Requests

' component browser.runtime {
' portin Messages as brMessages
' }
' Messages -- brMessages
component browser.runtime {
}
Messages --> "Message" browser.runtime
}
pKeyRingStore -0)-> Messages : Message
Requests ..> [ExtensionRouter]
}
}

node legend {
frame "execution context" {
package "package" {
component "component" {
}
skinparam componentStyle rectangle
component legend_text [
"Direct use" imports related component.

"Cross-context use" uses related component via
message passing request/response between isolated
javascript contexts.
' TODO: explain "role"
'
' The relation label should
' reference the (sub-)component or module responsible
' for initiating the respective message passing request.
]
[component] -> legend_text : direct use
[component] .> "role (to component)" legend_text : cross-context use
[component] -0)- legend_text : "role (to text node)" required interface
}
}
}
@enduml