@openkey/sdk 0.12.0-beta.1 → 0.12.0
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 +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,9 +37,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
var y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
38
38
|
function u(e) {
|
|
39
39
|
let n = "", t = e.length;
|
|
40
|
-
for (let
|
|
41
|
-
let
|
|
42
|
-
n += y[c >> 18 & 63], n += y[c >> 12 & 63], n +=
|
|
40
|
+
for (let i = 0; i < t; i += 3) {
|
|
41
|
+
let r = e[i], s = i + 1 < t ? e[i + 1] : 0, a = i + 2 < t ? e[i + 2] : 0, c = r << 16 | s << 8 | a;
|
|
42
|
+
n += y[c >> 18 & 63], n += y[c >> 12 & 63], n += i + 1 < t ? y[c >> 6 & 63] : "", n += i + 2 < t ? y[c & 63] : "";
|
|
43
43
|
}
|
|
44
44
|
return n.replace(/\+/g, "-").replace(/\//g, "_");
|
|
45
45
|
}
|
|
@@ -48,20 +48,20 @@ function B() {
|
|
|
48
48
|
return crypto.getRandomValues(e), u(e);
|
|
49
49
|
}
|
|
50
50
|
async function I(e) {
|
|
51
|
-
let t = new TextEncoder().encode(e),
|
|
52
|
-
return new Uint8Array(
|
|
51
|
+
let t = new TextEncoder().encode(e), i = await crypto.subtle.digest("SHA-256", t);
|
|
52
|
+
return new Uint8Array(i);
|
|
53
53
|
}
|
|
54
54
|
async function W(e, n) {
|
|
55
|
-
let
|
|
56
|
-
return u(
|
|
55
|
+
let i = await (n ?? I)(e);
|
|
56
|
+
return u(i);
|
|
57
57
|
}
|
|
58
58
|
function j() {
|
|
59
59
|
let e = new Uint8Array(16);
|
|
60
60
|
return crypto.getRandomValues(e), u(e);
|
|
61
61
|
}
|
|
62
62
|
function G(e) {
|
|
63
|
-
let { host: n, clientId: t, redirectUri:
|
|
64
|
-
return d.searchParams.set("client_id", t), d.searchParams.set("redirect_uri",
|
|
63
|
+
let { host: n, clientId: t, redirectUri: i, codeChallenge: r, state: s, scopes: a, authorizePath: c = "/api/auth/oauth2/authorize" } = e, d = new URL(c, n);
|
|
64
|
+
return d.searchParams.set("client_id", t), d.searchParams.set("redirect_uri", i), d.searchParams.set("response_type", "code"), d.searchParams.set("scope", a.join(" ")), d.searchParams.set("state", s), d.searchParams.set("code_challenge", r), d.searchParams.set("code_challenge_method", "S256"), d.toString();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// src/nostr.ts
|