@vibes.diy/identity 14.3.456 → 14.3.458
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/device-id/verify.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/keybag/keybag.js +1 -1
- package/keybag/sys-file-system/deno-filesystem.js +4 -4
- package/package.json +2 -2
- package/runtime/settled-once.d.ts +10 -0
- package/runtime/settled-once.js +35 -0
- package/sts/text-blocks.js +1 -1
package/device-id/verify.js
CHANGED
|
@@ -164,7 +164,7 @@ export class DeviceIdVerifyMsg {
|
|
|
164
164
|
throw new Error(`Certificate has expired (valid to: ${notAfter.toISOString()})`);
|
|
165
165
|
}
|
|
166
166
|
const trustedCA = this.findTrustedCA(cert, this.#trustedCAs) ?? null;
|
|
167
|
-
if (
|
|
167
|
+
if (trustedCA === null) {
|
|
168
168
|
throw new Error("Certificate not issued by a trusted CA");
|
|
169
169
|
}
|
|
170
170
|
return {
|
|
@@ -198,7 +198,7 @@ export class DeviceIdVerifyMsg {
|
|
|
198
198
|
}
|
|
199
199
|
const cert = certInfo.certificate.asCert();
|
|
200
200
|
const trustedCA = this.findTrustedCA(cert, this.#trustedCAs);
|
|
201
|
-
if (
|
|
201
|
+
if (trustedCA === undefined) {
|
|
202
202
|
return Result.Err(new Error("Certificate not issued by a trusted CA"));
|
|
203
203
|
}
|
|
204
204
|
const rCaKey = await sts.importJWK(trustedCA.certificate.subjectPublicKeyInfo, "ES256");
|
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { ClerkClaimSchema, ClerkEmailTemplateClaimSchema, type ClerkClaim } from
|
|
|
3
3
|
export { ensureSuperThis, ensureLogger, runtimeFn } from "./runtime/superthis.js";
|
|
4
4
|
export * as sts from "./sts/index.js";
|
|
5
5
|
export { hashObjectSync } from "./runtime/hashing.js";
|
|
6
|
-
export { settledOnce } from "./runtime/settled-once.js";
|
|
6
|
+
export { settledKeyedOnce, settledOnce, type SettledKeyedOnce, type SettledKeyedOnceOpts } from "./runtime/settled-once.js";
|
|
7
7
|
export type { DashAuthType, ReqCertFromCsr, ResCertFromCsr, VerifiedClaimsResult, VerifiedAuthResult, WithAuth, FPApiParameters, FPApiToken, } from "./types/wire.js";
|
|
8
8
|
export type { VerifiedResult } from "./dash-api/protocols-dashboard/index.js";
|
|
9
9
|
export type { SuperThis, DocTypes } from "./types/sthis.js";
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { ClerkClaimSchema, ClerkEmailTemplateClaimSchema } from "./clerk-claim.j
|
|
|
3
3
|
export { ensureSuperThis, ensureLogger, runtimeFn } from "./runtime/superthis.js";
|
|
4
4
|
export * as sts from "./sts/index.js";
|
|
5
5
|
export { hashObjectSync } from "./runtime/hashing.js";
|
|
6
|
-
export { settledOnce } from "./runtime/settled-once.js";
|
|
6
|
+
export { settledKeyedOnce, settledOnce } from "./runtime/settled-once.js";
|
|
7
7
|
export { JWKPrivateSchema, JWKPublicSchema } from "./types/wire.js";
|
|
8
8
|
export { ClerkApiToken } from "./dash-api/clerk-token.js";
|
|
9
9
|
export { clerkDashApi, DashboardApiImpl } from "./dash-api/dash-client.js";
|
package/keybag/keybag.js
CHANGED
|
@@ -40,7 +40,7 @@ export function deviceIdKeybagFilePath(sthis, instance) {
|
|
|
40
40
|
function defaultKeyBagOpts(sthis, kbo) {
|
|
41
41
|
const url = kbo.url ? URI.from(kbo.url) : defaultKeyBagUrl(sthis);
|
|
42
42
|
const kitem = keyBagProviderFactories.get(url.protocol);
|
|
43
|
-
if (
|
|
43
|
+
if (kitem === undefined) {
|
|
44
44
|
throw new Error(`unsupported protocol: ${url.toString()}`);
|
|
45
45
|
}
|
|
46
46
|
if (url.hasParam("masterkey")) {
|
|
@@ -33,11 +33,11 @@ export class DenoFileSystem {
|
|
|
33
33
|
return {
|
|
34
34
|
isFile: () => x.isFile,
|
|
35
35
|
isDirectory: () => x.isDirectory,
|
|
36
|
-
isBlockDevice: () =>
|
|
37
|
-
isCharacterDevice: () =>
|
|
36
|
+
isBlockDevice: () => x.isBlockDevice === true,
|
|
37
|
+
isCharacterDevice: () => x.isCharDevice === true,
|
|
38
38
|
isSymbolicLink: () => x.isSymlink,
|
|
39
|
-
isFIFO: () =>
|
|
40
|
-
isSocket: () =>
|
|
39
|
+
isFIFO: () => x.isFifo === true,
|
|
40
|
+
isSocket: () => x.isSocket === true,
|
|
41
41
|
uid: x.uid,
|
|
42
42
|
gid: x.gid,
|
|
43
43
|
size: x.size,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/identity",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.458",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@adviser/ts-xxhash": "~1.0.2",
|
|
20
20
|
"@clerk/shared": "~4.50.0",
|
|
21
21
|
"@hono/node-server": "~2.1.9",
|
|
22
|
-
"@vibes.diy/cmd-tools": "14.3.
|
|
22
|
+
"@vibes.diy/cmd-tools": "14.3.458",
|
|
23
23
|
"arktype": "~2.2.10",
|
|
24
24
|
"hono": "~4.13.19",
|
|
25
25
|
"jose": "~6.2.18",
|
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export declare function settledOnce<A extends unknown[], T>(load: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
2
|
+
export interface SettledKeyedOnceOpts {
|
|
3
|
+
readonly ttlMs: number;
|
|
4
|
+
readonly maxEntries?: number;
|
|
5
|
+
readonly now?: () => number;
|
|
6
|
+
}
|
|
7
|
+
export interface SettledKeyedOnce<T> {
|
|
8
|
+
get(key: string, load: () => Promise<T>): Promise<T>;
|
|
9
|
+
reset(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function settledKeyedOnce<T>(opts: SettledKeyedOnceOpts): SettledKeyedOnce<T>;
|
package/runtime/settled-once.js
CHANGED
|
@@ -8,3 +8,38 @@ export function settledOnce(load) {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
export function settledKeyedOnce(opts) {
|
|
12
|
+
const maxEntries = opts.maxEntries ?? 64;
|
|
13
|
+
const now = opts.now ?? Date.now;
|
|
14
|
+
const kept = new Map();
|
|
15
|
+
const fresh = (key) => {
|
|
16
|
+
const hit = kept.get(key);
|
|
17
|
+
if (hit === undefined)
|
|
18
|
+
return undefined;
|
|
19
|
+
if (now() - hit.at > opts.ttlMs) {
|
|
20
|
+
kept.delete(key);
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return hit;
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
async get(key, load) {
|
|
27
|
+
const hit = fresh(key);
|
|
28
|
+
if (hit !== undefined)
|
|
29
|
+
return hit.value;
|
|
30
|
+
const value = await load();
|
|
31
|
+
if (fresh(key) === undefined) {
|
|
32
|
+
kept.set(key, { value, at: now() });
|
|
33
|
+
for (const oldest of kept.keys()) {
|
|
34
|
+
if (kept.size <= maxEntries)
|
|
35
|
+
break;
|
|
36
|
+
kept.delete(oldest);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
},
|
|
41
|
+
reset() {
|
|
42
|
+
kept.clear();
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
package/sts/text-blocks.js
CHANGED
|
@@ -32,7 +32,7 @@ export function mimeBlockParser(mime) {
|
|
|
32
32
|
if (foundEnd) {
|
|
33
33
|
i++;
|
|
34
34
|
const postEnd = [];
|
|
35
|
-
while (i < lines.length &&
|
|
35
|
+
while (i < lines.length && lines[i].match(/^-{3,}\s*BEGIN\s+.+-{3,}$/i) === null) {
|
|
36
36
|
postEnd.push(lines[i]);
|
|
37
37
|
i++;
|
|
38
38
|
}
|