Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
d15115ef
Commit
d15115ef
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Fix comments
parent
fbe4e274
No related branches found
No related tags found
2 merge requests
!60
Revert "Fail a test to be sure it works"
,
!32
Admin Commands
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wasm/channels.go
+17
-2
17 additions, 2 deletions
wasm/channels.go
with
17 additions
and
2 deletions
wasm/channels.go
+
17
−
2
View file @
d15115ef
...
...
@@ -1357,7 +1357,7 @@ func (cm *ChannelsManager) IsChannelAdmin(_ js.Value, args []js.Value) any {
// format. Returns an error if the user is not an admin of the channel.
//
// This key can be provided to other users in a channel to grant them admin
// access using ImportChannelAdminKey.
// access using
[ChannelsManager.
ImportChannelAdminKey
]
.
//
// The private key is encrypted using a key generated from the password using
// Argon2. Each call to ExportChannelAdminKey produces a different encrypted
...
...
@@ -1389,7 +1389,8 @@ func (cm *ChannelsManager) ExportChannelAdminKey(_ js.Value, args []js.Value) an
}
// VerifyChannelAdminKey verifies that the encrypted private key can be
// decrypted and that it matches the expected channel.
// decrypted and that it matches the expected channel. Returns false if private
// key does not belong to the given channel.
//
// Parameters:
// - args[0] - Marshalled bytes of the channel's [id.ID] (Uint8Array).
...
...
@@ -1400,6 +1401,14 @@ func (cm *ChannelsManager) ExportChannelAdminKey(_ js.Value, args []js.Value) an
// - Returns false if private key does not belong to the given channel ID
// (boolean).
// - Throws a TypeError if the password is invalid.
//
// Returns:
// - bool - True if the private key belongs to the channel and false
// otherwise.
// - Throws a TypeError with the message [Channels.WrongPasswordErr] for an
// invalid password.
// - Throws a TypeError with the message [Channels.ChannelDoesNotExistsErr] i
// the channel has not already been joined.
func
(
cm
*
ChannelsManager
)
VerifyChannelAdminKey
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
channelID
:=
utils
.
CopyBytesToGo
(
args
[
0
])
encryptionPassword
:=
args
[
1
]
.
String
()
...
...
@@ -1427,6 +1436,12 @@ func (cm *ChannelsManager) VerifyChannelAdminKey(_ js.Value, args []js.Value) an
// Returns:
// - Throws a TypeError if the password is invalid or the private key does
// not match the channel ID.
// - Throws a TypeError with the message [Channels.WrongPasswordErr] for an
// invalid password.
// - Throws a TypeError with the message [Channels.ChannelDoesNotExistsErr] if
// the channel has not already been joined.
// - Throws a TypeError with the message [Channels.WrongPrivateKeyErr] if the
// private key does not belong to the channel.
func
(
cm
*
ChannelsManager
)
ImportChannelAdminKey
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
channelID
:=
utils
.
CopyBytesToGo
(
args
[
0
])
encryptionPassword
:=
args
[
1
]
.
String
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment