@fireproof/core-protocols-dashboard 0.24.8-dev-fp-token → 0.24.8-dev-move-pubkey

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,5 @@
1
+ import { Result } from "@adviser/cement";
2
+ import { JWKPublic, SuperThis } from "@fireproof/core-types-base";
3
+ export declare function getCloudPubkeyFromEnv(cloudToken?: string, sthis?: SuperThis): Promise<Result<{
4
+ keys: JWKPublic[];
5
+ }>>;
@@ -0,0 +1,36 @@
1
+ import { isArrayBuffer, isUint8Array, Result } from "@adviser/cement";
2
+ import { ensureSuperThis, sts } from "@fireproof/core-runtime";
3
+ import { JWKPublicSchema, toJwksAlg } from "@fireproof/core-types-base";
4
+ import { exportJWK } from "jose";
5
+ export async function getCloudPubkeyFromEnv(cloudToken, sthis = ensureSuperThis()) {
6
+ const cstPub = cloudToken ?? sthis.env.get("CLOUD_SESSION_TOKEN_PUBLIC");
7
+ if (!cstPub) {
8
+ return Result.Err("no public key: env:CLOUD_SESSION_TOKEN_PUBLIC");
9
+ }
10
+ const cryptoKeys = await sts.env2jwk(cstPub, undefined, sthis);
11
+ const keys = [];
12
+ for (const key of cryptoKeys) {
13
+ const jwKey = await exportJWK(key);
14
+ if (isUint8Array(jwKey) || isArrayBuffer(jwKey)) {
15
+ return Result.Err("invalid key: jwk is ArrayBuffer or Uint8Array");
16
+ }
17
+ const rAlg = toJwksAlg(jwKey);
18
+ if (rAlg.isErr()) {
19
+ return Result.Err(rAlg);
20
+ }
21
+ const rJwtPublicKey = JWKPublicSchema.safeParse({
22
+ use: "sig",
23
+ ...jwKey,
24
+ alg: rAlg.Ok(),
25
+ ext: undefined,
26
+ key_ops: undefined,
27
+ kid: undefined,
28
+ });
29
+ if (!rJwtPublicKey.success) {
30
+ return Result.Err(rJwtPublicKey.error);
31
+ }
32
+ keys.push(rJwtPublicKey.data);
33
+ }
34
+ return Result.Ok({ keys });
35
+ }
36
+ //# sourceMapping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C;QACD,MAAM,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC;YAC9C,GAAG,EAAE,KAAK;YAEV,GAAG,KAAK;YACR,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;YACd,GAAG,EAAE,SAAS;YACd,OAAO,EAAE,SAAS;YAClB,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAAA,CAC5B"}
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./msg-api.js";
2
2
  export * from "./dashboard-api.js";
3
3
  export * from "./token.js";
4
+ export * from "./get-cloud-pubkey-from-env.js";
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./msg-api.js";
2
2
  export * from "./dashboard-api.js";
3
3
  export * from "./token.js";
4
+ export * from "./get-cloud-pubkey-from-env.js";
4
5
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireproof/core-protocols-dashboard",
3
- "version": "0.24.8-dev-fp-token",
3
+ "version": "0.24.8-dev-move-pubkey",
4
4
  "description": "Live ledger for the web.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -36,13 +36,13 @@
36
36
  "dependencies": {
37
37
  "@adviser/cement": "0.5.15",
38
38
  "@clerk/shared": "3.41.1",
39
- "@fireproof/core-device-id": "0.24.8-dev-fp-token",
40
- "@fireproof/core-runtime": "0.24.8-dev-fp-token",
41
- "@fireproof/core-types-base": "0.24.8-dev-fp-token",
42
- "@fireproof/core-types-device-id": "0.24.8-dev-fp-token",
43
- "@fireproof/core-types-protocols-cloud": "0.24.8-dev-fp-token",
44
- "@fireproof/core-types-protocols-dashboard": "0.24.8-dev-fp-token",
45
- "@fireproof/vendor": "0.24.8-dev-fp-token",
39
+ "@fireproof/core-device-id": "0.24.8-dev-move-pubkey",
40
+ "@fireproof/core-runtime": "0.24.8-dev-move-pubkey",
41
+ "@fireproof/core-types-base": "0.24.8-dev-move-pubkey",
42
+ "@fireproof/core-types-device-id": "0.24.8-dev-move-pubkey",
43
+ "@fireproof/core-types-protocols-cloud": "0.24.8-dev-move-pubkey",
44
+ "@fireproof/core-types-protocols-dashboard": "0.24.8-dev-move-pubkey",
45
+ "@fireproof/vendor": "0.24.8-dev-move-pubkey",
46
46
  "jose": "6.1.3",
47
47
  "zod": "4.3.5"
48
48
  }