@tinycloud/cli 0.6.0-beta.7 → 0.6.0-beta.8
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/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -620,6 +620,25 @@ async function localKeySignIn(options) {
|
|
|
620
620
|
// src/auth/browser-auth.ts
|
|
621
621
|
import { createServer } from "http";
|
|
622
622
|
import { createInterface } from "readline";
|
|
623
|
+
var PRIVATE_JWK_FIELDS = /* @__PURE__ */ new Set([
|
|
624
|
+
"d",
|
|
625
|
+
"p",
|
|
626
|
+
"q",
|
|
627
|
+
"dp",
|
|
628
|
+
"dq",
|
|
629
|
+
"qi",
|
|
630
|
+
"oth",
|
|
631
|
+
"k"
|
|
632
|
+
]);
|
|
633
|
+
function publicJwkForDelegation(jwk) {
|
|
634
|
+
const publicJwk = {};
|
|
635
|
+
for (const [key, value] of Object.entries(jwk)) {
|
|
636
|
+
if (!PRIVATE_JWK_FIELDS.has(key)) {
|
|
637
|
+
publicJwk[key] = value;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return publicJwk;
|
|
641
|
+
}
|
|
623
642
|
async function startAuthFlow(did, options = {}) {
|
|
624
643
|
if (options.paste) {
|
|
625
644
|
return pasteFlow(did, options);
|
|
@@ -641,7 +660,9 @@ function buildAuthUrl(did, options = {}) {
|
|
|
641
660
|
params.set("callback", options.callback);
|
|
642
661
|
}
|
|
643
662
|
if (options.jwk) {
|
|
644
|
-
const jwkB64 = Buffer.from(
|
|
663
|
+
const jwkB64 = Buffer.from(
|
|
664
|
+
JSON.stringify(publicJwkForDelegation(options.jwk))
|
|
665
|
+
).toString("base64url");
|
|
645
666
|
params.set("jwk", jwkB64);
|
|
646
667
|
}
|
|
647
668
|
if (options.host) {
|