The Codebase Consistency Update
This commit is contained in:
@@ -1,25 +1,23 @@
|
||||
# Generates a key in the format compatible with Synapse and Vona.
|
||||
|
||||
import base64
|
||||
import os
|
||||
|
||||
# Generates a key in the format compatible with Synapse and Vona.
|
||||
|
||||
|
||||
def mkchar() -> str:
|
||||
return os.urandom(4).hex()[:1]
|
||||
|
||||
|
||||
key = (
|
||||
base64.b64encode(os.urandom(32))
|
||||
.decode("utf-8")[:43]
|
||||
.replace("/", mkchar())
|
||||
.replace("+", mkchar())
|
||||
)
|
||||
def random(length):
|
||||
return (
|
||||
base64.b64encode(os.urandom(length))
|
||||
.decode("utf-8")[:length]
|
||||
.replace("/", mkchar())
|
||||
.replace("+", mkchar())
|
||||
)
|
||||
|
||||
key_id = (
|
||||
base64.b64encode(os.urandom(32))
|
||||
.decode("utf-8")[:6]
|
||||
.replace("/", mkchar())
|
||||
.replace("+", mkchar())
|
||||
)
|
||||
|
||||
key = random(43)
|
||||
key_id = random(6)
|
||||
|
||||
print(f"ed25519 {key_id} {key}")
|
||||
|
||||
Reference in New Issue
Block a user