mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-26 11:36:03 +03:00
deploy: e825f7366b
This commit is contained in:
parent
db9d71ecf6
commit
00ad76e332
4 changed files with 30 additions and 4 deletions
|
@ -184,7 +184,20 @@ set the displayname (optional, <code>username</code> by default).</p>
|
|||
<p>The MAC is the hex digest output of the HMAC-SHA1 algorithm, with the key being
|
||||
the shared secret and the content being the nonce, user, password, either the
|
||||
string "admin" or "notadmin", and optionally the user_type
|
||||
each separated by NULs. For an example of generation in Python:</p>
|
||||
each separated by NULs.</p>
|
||||
<p>Here is an easy way to generate the HMAC digest if you have Bash and OpenSSL:</p>
|
||||
<pre><code class="language-bash"># Update these values and then paste this code block into a bash terminal
|
||||
nonce='thisisanonce'
|
||||
username='pepper_roni'
|
||||
password='pizza'
|
||||
admin='admin'
|
||||
secret='shared_secret'
|
||||
|
||||
printf '%s\0%s\0%s\0%s' "$nonce" "$username" "$password" "$admin" |
|
||||
openssl sha1 -hmac "$secret" |
|
||||
awk '{print $2}'
|
||||
</code></pre>
|
||||
<p>For an example of generation in Python:</p>
|
||||
<pre><code class="language-python">import hmac, hashlib
|
||||
|
||||
def generate_mac(nonce, user, password, admin=False, user_type=None):
|
||||
|
|
|
@ -10852,7 +10852,20 @@ set the displayname (optional, <code>username</code> by default).</p>
|
|||
<p>The MAC is the hex digest output of the HMAC-SHA1 algorithm, with the key being
|
||||
the shared secret and the content being the nonce, user, password, either the
|
||||
string "admin" or "notadmin", and optionally the user_type
|
||||
each separated by NULs. For an example of generation in Python:</p>
|
||||
each separated by NULs.</p>
|
||||
<p>Here is an easy way to generate the HMAC digest if you have Bash and OpenSSL:</p>
|
||||
<pre><code class="language-bash"># Update these values and then paste this code block into a bash terminal
|
||||
nonce='thisisanonce'
|
||||
username='pepper_roni'
|
||||
password='pizza'
|
||||
admin='admin'
|
||||
secret='shared_secret'
|
||||
|
||||
printf '%s\0%s\0%s\0%s' "$nonce" "$username" "$password" "$admin" |
|
||||
openssl sha1 -hmac "$secret" |
|
||||
awk '{print $2}'
|
||||
</code></pre>
|
||||
<p>For an example of generation in Python:</p>
|
||||
<pre><code class="language-python">import hmac, hashlib
|
||||
|
||||
def generate_mac(nonce, user, password, admin=False, user_type=None):
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue