natureco-cli 5.51.2 → 5.51.3
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.
- package/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/utils/natureco-account.js +31 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to NatureCo CLI will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [5.51.3] - 2026-07-11 — "account: implicit magic link (fragment access_token)"
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Giriş linki fragment'inde `access_token`+`refresh_token` doğrudan geldiğinde de çalışır** (Supabase implicit-flow / SiteURL redirect). Link `#access_token=...&refresh_token=...` biçimindeyse /verify gerekmez — CLI tokenları doğrudan kaydeder, kullanıcıyı JWT'den çözer. (5.51.2 yalnız token_hash biçimini işliyordu.)
|
|
9
|
+
|
|
5
10
|
## [5.51.2] - 2026-07-11 — "account: giriş linki (magic link) desteği"
|
|
6
11
|
|
|
7
12
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.51.
|
|
3
|
+
"version": "5.51.3",
|
|
4
4
|
"description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"natureco": "bin/natureco.js"
|
|
@@ -75,21 +75,41 @@ async function verifyOtp(email, token) {
|
|
|
75
75
|
return saveSession(_shape(await _post('/verify', { type: 'email', email, token })));
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
// JWT access_token içinden kullanıcıyı çöz (imza doğrulaması yok — sadece görüntüleme)
|
|
79
|
+
function _userFromJwt(token) {
|
|
80
|
+
try {
|
|
81
|
+
const p = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString('utf8'));
|
|
82
|
+
return { id: p.sub, email: p.email };
|
|
83
|
+
} catch (_) { return null; }
|
|
84
|
+
}
|
|
85
|
+
|
|
78
86
|
/**
|
|
79
|
-
* E-postadan gelen GİRİŞ LİNKİ'ni
|
|
80
|
-
*
|
|
87
|
+
* E-postadan gelen GİRİŞ LİNKİ'ni işle (şablon 6 haneli kod yerine magic link
|
|
88
|
+
* gönderdiğinde). İki biçim:
|
|
89
|
+
* 1) Implicit: link fragment'inde ZATEN access_token+refresh_token var → doğrudan oturum.
|
|
90
|
+
* 2) token_hash: /verify ile doğrula.
|
|
81
91
|
*/
|
|
82
92
|
async function verifyLink(link) {
|
|
83
|
-
let
|
|
84
|
-
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
let u;
|
|
94
|
+
try { u = new URL(link.trim()); }
|
|
95
|
+
catch (e) { throw new Error('Geçersiz link', { cause: e }); }
|
|
96
|
+
const q = u.searchParams;
|
|
97
|
+
const frag = new URLSearchParams((u.hash || '').replace(/^#/, ''));
|
|
98
|
+
const pick = (k) => frag.get(k) || q.get(k);
|
|
99
|
+
|
|
100
|
+
const access_token = pick('access_token');
|
|
101
|
+
if (access_token) {
|
|
102
|
+
return saveSession(_shape({
|
|
103
|
+
access_token,
|
|
104
|
+
refresh_token: pick('refresh_token'),
|
|
105
|
+
token_type: pick('token_type') || 'bearer',
|
|
106
|
+
expires_at: parseInt(pick('expires_at') || '0', 10) || null,
|
|
107
|
+
expires_in: parseInt(pick('expires_in') || '0', 10) || null,
|
|
108
|
+
user: _userFromJwt(access_token),
|
|
109
|
+
}));
|
|
92
110
|
}
|
|
111
|
+
const token_hash = pick('token_hash') || pick('token');
|
|
112
|
+
const type = pick('type') || 'magiclink';
|
|
93
113
|
if (!token_hash) throw new Error("Linkte doğrulama token'ı bulunamadı");
|
|
94
114
|
return saveSession(_shape(await _post('/verify', { type, token_hash })));
|
|
95
115
|
}
|