1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-09 10:01:45 +03:00

Remove some unnecessary dependencies

This commit is contained in:
Quentin Gliech
2022-04-08 09:10:17 +02:00
parent 19f6cf851a
commit a3f1a880aa
6 changed files with 12 additions and 78 deletions

View File

@ -14,7 +14,6 @@
use argon2::Argon2;
use clap::Parser;
use data_encoding::BASE64;
use mas_config::{DatabaseConfig, RootConfig};
use mas_storage::{
oauth2::client::{insert_client_from_config, lookup_client_by_client_id, truncate_clients},
@ -117,14 +116,7 @@ impl Options {
// TODO: should be moved somewhere else
let encrypted_client_secret = client_secret
.map(|client_secret| {
let nonce: [u8; 12] = rand::random();
let message = encrypter.encrypt(&nonce, client_secret.as_bytes())?;
let concat = [&nonce[..], &message[..]].concat();
let res = BASE64.encode(&concat);
anyhow::Ok(res)
})
.map(|client_secret| encrypter.encryt_to_string(client_secret.as_bytes()))
.transpose()?;
insert_client_from_config(