smbcloud-auth 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +7 -7
- data/ext/auth/Cargo.toml +4 -7
- data/ext/auth/build.rs +11 -0
- data/ext/auth/src/lib.rs +26 -1
- data/lib/auth/version.rb +1 -1
- data/lib/auth.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a95dc4f6b4ad08686b7995a769b2e58a05dcc039b53fd4bcb24ef6e5077f2963
|
|
4
|
+
data.tar.gz: 3b9ecc7c1de1085628474ac77d4944f33a8a80ea3572ca5f9b484536432436cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '059e81aab6b89031c9d6d0c022cfbee560015820cee1ca34eeffe29775de551738535eea11c103c07934b6134c9287d93158bca678d103a4cbb25fcf0ccc8701'
|
|
7
|
+
data.tar.gz: '032839a38277178800a20beb0afb9f58500bfa64e0cac727db375944b358e68d9796b4ab0f956e84af3a4b5bc35a35c69297967044bb590aad135507d4942353'
|
data/Cargo.lock
CHANGED
|
@@ -104,7 +104,7 @@ dependencies = [
|
|
|
104
104
|
|
|
105
105
|
[[package]]
|
|
106
106
|
name = "auth"
|
|
107
|
-
version = "0.4.
|
|
107
|
+
version = "0.4.5"
|
|
108
108
|
dependencies = [
|
|
109
109
|
"magnus",
|
|
110
110
|
"serde",
|
|
@@ -1520,9 +1520,9 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
|
|
1520
1520
|
|
|
1521
1521
|
[[package]]
|
|
1522
1522
|
name = "smbcloud-auth-sdk"
|
|
1523
|
-
version = "0.4.
|
|
1523
|
+
version = "0.4.5"
|
|
1524
1524
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1525
|
-
checksum = "
|
|
1525
|
+
checksum = "812bf9eba336ad210fb84f28b28a4d3874b68a6fd9fb2c1dc3ffe0d9ce900348"
|
|
1526
1526
|
dependencies = [
|
|
1527
1527
|
"base64",
|
|
1528
1528
|
"reqwest",
|
|
@@ -1537,9 +1537,9 @@ dependencies = [
|
|
|
1537
1537
|
|
|
1538
1538
|
[[package]]
|
|
1539
1539
|
name = "smbcloud-model"
|
|
1540
|
-
version = "0.4.
|
|
1540
|
+
version = "0.4.5"
|
|
1541
1541
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1542
|
-
checksum = "
|
|
1542
|
+
checksum = "61272a05b496508688f8620e271ed2017f1df8c21a179d600b95fdf69c3ef557"
|
|
1543
1543
|
dependencies = [
|
|
1544
1544
|
"chrono",
|
|
1545
1545
|
"log",
|
|
@@ -1555,9 +1555,9 @@ dependencies = [
|
|
|
1555
1555
|
|
|
1556
1556
|
[[package]]
|
|
1557
1557
|
name = "smbcloud-network"
|
|
1558
|
-
version = "0.4.
|
|
1558
|
+
version = "0.4.5"
|
|
1559
1559
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1560
|
-
checksum = "
|
|
1560
|
+
checksum = "867ce76b473fe300acaee1c2058f540b7eafa9174e5c2d59b8c105f6bda01cd7"
|
|
1561
1561
|
dependencies = [
|
|
1562
1562
|
"clap 4.6.1",
|
|
1563
1563
|
"log",
|
data/ext/auth/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "auth"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.5"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
authors = ["Seto Elkahfi <hej@setoelkahfi.se>"]
|
|
6
6
|
publish = false
|
|
@@ -17,9 +17,6 @@ tokio = { version = "1", features = ["rt-multi-thread"] }
|
|
|
17
17
|
# smbcloud-auth was split into smbcloud-auth-sdk (pure HTTP SDK, no CLI plumbing).
|
|
18
18
|
# smbcloud-networking is an internal dep of the old smbcloud-auth crate and is
|
|
19
19
|
# not re-exported by smbcloud-auth-sdk, so it is dropped here.
|
|
20
|
-
smbcloud-auth-sdk = { version = "0.4" }
|
|
21
|
-
|
|
22
|
-
smbcloud-
|
|
23
|
-
# smbcloud-model = { path = "./../../../../../crates/smbcloud-model" }
|
|
24
|
-
smbcloud-network = { version = "0.4" }
|
|
25
|
-
# smbcloud-network = { path = "./../../../../../crates/smbcloud-network" }
|
|
20
|
+
smbcloud-auth-sdk = { version = "0.4.5" }
|
|
21
|
+
smbcloud-model = { version = "0.4.5" }
|
|
22
|
+
smbcloud-network = { version = "0.4.5" }
|
data/ext/auth/build.rs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
fn main() {
|
|
2
|
+
// On macOS, a Rust `cdylib` is emitted with an empty LC_ID_DYLIB install
|
|
3
|
+
// name. The dyld in macOS 15+/Tahoe (Darwin 27) validates this strictly and
|
|
4
|
+
// refuses to load the resulting `.bundle` with:
|
|
5
|
+
// "load command #4 string extends beyond end of load command"
|
|
6
|
+
// Give the dylib a valid install name at link time so the Ruby extension
|
|
7
|
+
// loads on the stricter loader.
|
|
8
|
+
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
|
|
9
|
+
println!("cargo:rustc-cdylib-link-arg=-Wl,-install_name,@rpath/auth.bundle");
|
|
10
|
+
}
|
|
11
|
+
}
|
data/ext/auth/src/lib.rs
CHANGED
|
@@ -2,7 +2,8 @@ use magnus::{function, prelude::*, Error, Ruby};
|
|
|
2
2
|
use serde::Serialize;
|
|
3
3
|
use smbcloud_auth_sdk::{
|
|
4
4
|
client_credentials::ClientCredentials, login::login_with_client, logout::logout_with_client,
|
|
5
|
-
me::me_with_client, remove::remove_with_client,
|
|
5
|
+
me::me_with_client, remove::remove_with_client,
|
|
6
|
+
reset_password::reset_password_with_client, signup::signup_with_client,
|
|
6
7
|
};
|
|
7
8
|
use smbcloud_model::{error_codes::ErrorResponse, login::AccountStatus, signup::SignupResult};
|
|
8
9
|
use smbcloud_network::environment::Environment;
|
|
@@ -125,6 +126,26 @@ fn login_with_client_json(
|
|
|
125
126
|
})
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
fn reset_password_with_client_json(
|
|
130
|
+
environment: String,
|
|
131
|
+
app_id: String,
|
|
132
|
+
app_secret: String,
|
|
133
|
+
email: String,
|
|
134
|
+
) -> Result<String, Error> {
|
|
135
|
+
let env = parse_environment(environment)?;
|
|
136
|
+
with_runtime(|runtime| {
|
|
137
|
+
let result = runtime.block_on(reset_password_with_client(
|
|
138
|
+
env,
|
|
139
|
+
credentials(&app_id, &app_secret),
|
|
140
|
+
email,
|
|
141
|
+
));
|
|
142
|
+
match result {
|
|
143
|
+
Ok(result) => to_json(&result),
|
|
144
|
+
Err(error) => Err(raise_error_response(error)),
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
128
149
|
fn me_with_client_json(
|
|
129
150
|
environment: String,
|
|
130
151
|
app_id: String,
|
|
@@ -195,6 +216,10 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
195
216
|
function!(signup_with_client_json, 5),
|
|
196
217
|
)?;
|
|
197
218
|
auth.define_singleton_method("__login_with_client", function!(login_with_client_json, 5))?;
|
|
219
|
+
auth.define_singleton_method(
|
|
220
|
+
"__reset_password_with_client",
|
|
221
|
+
function!(reset_password_with_client_json, 4),
|
|
222
|
+
)?;
|
|
198
223
|
auth.define_singleton_method("__me_with_client", function!(me_with_client_json, 4))?;
|
|
199
224
|
auth.define_singleton_method(
|
|
200
225
|
"__logout_with_client",
|
data/lib/auth/version.rb
CHANGED
data/lib/auth.rb
CHANGED
|
@@ -45,6 +45,16 @@ module SmbCloud
|
|
|
45
45
|
raise Auth.send(:normalize_error, e)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# Requests password-reset instructions for the given email. The endpoint
|
|
49
|
+
# never reveals whether the account exists (no enumeration), and calling
|
|
50
|
+
# it again re-issues the token, so this also serves the "resend reset
|
|
51
|
+
# instructions" flow. Returns { code:, message: }.
|
|
52
|
+
def reset_password(email:)
|
|
53
|
+
Auth.send(:parse_json, Auth.__reset_password_with_client(environment, app_id, app_secret, email))
|
|
54
|
+
rescue RuntimeError => e
|
|
55
|
+
raise Auth.send(:normalize_error, e)
|
|
56
|
+
end
|
|
57
|
+
|
|
48
58
|
def me(access_token:)
|
|
49
59
|
Auth.send(:parse_json, Auth.__me_with_client(environment, app_id, app_secret, access_token))
|
|
50
60
|
rescue RuntimeError => e
|
|
@@ -77,6 +87,10 @@ module SmbCloud
|
|
|
77
87
|
client(environment:, app_id:, app_secret:).login(email:, password:)
|
|
78
88
|
end
|
|
79
89
|
|
|
90
|
+
def reset_password_with_client(environment:, app_id:, app_secret:, email:)
|
|
91
|
+
client(environment:, app_id:, app_secret:).reset_password(email:)
|
|
92
|
+
end
|
|
93
|
+
|
|
80
94
|
def me_with_client(environment:, app_id:, app_secret:, access_token:)
|
|
81
95
|
client(environment:, app_id:, app_secret:).me(access_token:)
|
|
82
96
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smbcloud-auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Seto Elkahfi
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-19 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: json
|
|
@@ -55,6 +55,7 @@ files:
|
|
|
55
55
|
- Rakefile
|
|
56
56
|
- ext/.keep
|
|
57
57
|
- ext/auth/Cargo.toml
|
|
58
|
+
- ext/auth/build.rs
|
|
58
59
|
- ext/auth/extconf.rb
|
|
59
60
|
- ext/auth/src/lib.rs
|
|
60
61
|
- lib/auth.rb
|