@astralbeam/sdk 0.9.0 → 0.11.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.
@@ -0,0 +1,117 @@
1
+ //#region node_modules/.deno/jose@6.2.9/node_modules/jose/dist/webapi/lib/buffer_utils.js
2
+ const encoder = new TextEncoder();
3
+ const decoder = new TextDecoder();
4
+ const strictDecoder = new TextDecoder("utf-8", { fatal: true });
5
+ function concat(...buffers) {
6
+ const size = buffers.reduce((acc, { length }) => acc + length, 0);
7
+ const buf = new Uint8Array(size);
8
+ let i = 0;
9
+ for (const buffer of buffers) {
10
+ buf.set(buffer, i);
11
+ i += buffer.length;
12
+ }
13
+ return buf;
14
+ }
15
+ function encode$1(string) {
16
+ const bytes = new Uint8Array(string.length);
17
+ for (let i = 0; i < string.length; i++) {
18
+ const code = string.charCodeAt(i);
19
+ if (code > 127) throw new TypeError("non-ASCII string encountered in encode()");
20
+ bytes[i] = code;
21
+ }
22
+ return bytes;
23
+ }
24
+ //#endregion
25
+ //#region node_modules/.deno/jose@6.2.9/node_modules/jose/dist/webapi/util/errors.js
26
+ var JOSEError = class extends Error {
27
+ static code = "ERR_JOSE_GENERIC";
28
+ code = "ERR_JOSE_GENERIC";
29
+ constructor(message, options) {
30
+ super(message, options);
31
+ this.name = this.constructor.name;
32
+ Error.captureStackTrace?.(this, this.constructor);
33
+ }
34
+ };
35
+ var JOSENotSupported = class extends JOSEError {
36
+ static code = "ERR_JOSE_NOT_SUPPORTED";
37
+ code = "ERR_JOSE_NOT_SUPPORTED";
38
+ };
39
+ var JWSInvalid = class extends JOSEError {
40
+ static code = "ERR_JWS_INVALID";
41
+ code = "ERR_JWS_INVALID";
42
+ };
43
+ var JWTInvalid = class extends JOSEError {
44
+ static code = "ERR_JWT_INVALID";
45
+ code = "ERR_JWT_INVALID";
46
+ };
47
+ //#endregion
48
+ //#region node_modules/.deno/jose@6.2.9/node_modules/jose/dist/webapi/lib/base64.js
49
+ function encodeBase64(input) {
50
+ if (Uint8Array.prototype.toBase64) return input.toBase64();
51
+ const CHUNK_SIZE = 32768;
52
+ const arr = [];
53
+ for (let i = 0; i < input.length; i += CHUNK_SIZE) arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
54
+ return btoa(arr.join(""));
55
+ }
56
+ function decodeBase64(encoded) {
57
+ if (Uint8Array.fromBase64) return Uint8Array.fromBase64(encoded);
58
+ const binary = atob(encoded);
59
+ const bytes = new Uint8Array(binary.length);
60
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
61
+ return bytes;
62
+ }
63
+ //#endregion
64
+ //#region node_modules/.deno/jose@6.2.9/node_modules/jose/dist/webapi/util/base64url.js
65
+ const invalid = "The input to be decoded is not correctly encoded.";
66
+ function decode(input) {
67
+ if (Uint8Array.fromBase64) try {
68
+ return Uint8Array.fromBase64(typeof input === "string" ? input : decoder.decode(input), { alphabet: "base64url" });
69
+ } catch (cause) {
70
+ throw new TypeError(invalid, { cause });
71
+ }
72
+ let encoded = input;
73
+ if (encoded instanceof Uint8Array) encoded = decoder.decode(encoded);
74
+ if (encoded.includes("+") || encoded.includes("/")) throw new TypeError(invalid);
75
+ encoded = encoded.replace(/-/g, "+").replace(/_/g, "/");
76
+ try {
77
+ return decodeBase64(encoded);
78
+ } catch {
79
+ throw new TypeError(invalid);
80
+ }
81
+ }
82
+ function encode(input) {
83
+ let unencoded = input;
84
+ if (typeof unencoded === "string") unencoded = encoder.encode(unencoded);
85
+ if (Uint8Array.prototype.toBase64) return unencoded.toBase64({
86
+ alphabet: "base64url",
87
+ omitPadding: true
88
+ });
89
+ return encodeBase64(unencoded).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
90
+ }
91
+ //#endregion
92
+ //#region node_modules/.deno/jose@6.2.9/node_modules/jose/dist/webapi/lib/type_checks.js
93
+ function isObject(input) {
94
+ if (typeof input !== "object" || input === null || Object.prototype.toString.call(input) !== "[object Object]") return false;
95
+ const prototype = Object.getPrototypeOf(input);
96
+ if (prototype === null) return true;
97
+ let proto = prototype;
98
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
99
+ return prototype === proto;
100
+ }
101
+ function isDisjoint(...headers) {
102
+ const parameters = /* @__PURE__ */ new Set();
103
+ for (const header of headers) {
104
+ if (!header) continue;
105
+ for (const parameter of Object.keys(header)) {
106
+ if (parameters.has(parameter)) return false;
107
+ parameters.add(parameter);
108
+ }
109
+ }
110
+ return true;
111
+ }
112
+ const isJWK = (key) => isObject(key) && typeof key.kty === "string";
113
+ const isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
114
+ const isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
115
+ const isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
116
+ //#endregion
117
+ export { isPublicJWK as a, encode as c, JWTInvalid as d, concat as f, strictDecoder as h, isPrivateJWK as i, JOSENotSupported as l, encoder as m, isJWK as n, isSecretJWK as o, encode$1 as p, isObject as r, decode as s, isDisjoint as t, JWSInvalid as u };