@coffre/core 0.4.4 → 0.4.6
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/identity.d.ts +5 -0
- package/dist/identity.js +9 -1
- package/dist/mcp.js +1 -1
- package/package.json +2 -2
- package/src/identity/tokens.ts +9 -0
- package/src/mcp.ts +1 -1
package/dist/identity.d.ts
CHANGED
|
@@ -475,6 +475,11 @@ export type CredentialKind = 'browser' | 'cli' | 'service';
|
|
|
475
475
|
export declare function generateToken(kind: CredentialKind): string;
|
|
476
476
|
/** Whether a string has the shape of a coffre token, before any lookup. */
|
|
477
477
|
export declare function isCoffreToken(value: string): boolean;
|
|
478
|
+
/**
|
|
479
|
+
* The kind a token's prefix says, before any lookup. Its hash covers the
|
|
480
|
+
* prefix, so a token found under its hash is the kind it says.
|
|
481
|
+
*/
|
|
482
|
+
export declare function tokenKind(token: string): CredentialKind | null;
|
|
478
483
|
export declare function hashToken(token: string): Buffer;
|
|
479
484
|
/**
|
|
480
485
|
* Enough of a token to recognize it in a list, never enough to use it: the
|
package/dist/identity.js
CHANGED
|
@@ -630,6 +630,14 @@ function generateToken(kind) {
|
|
|
630
630
|
function isCoffreToken(value) {
|
|
631
631
|
return TOKEN.test(value);
|
|
632
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* The kind a token's prefix says, before any lookup. Its hash covers the
|
|
635
|
+
* prefix, so a token found under its hash is the kind it says.
|
|
636
|
+
*/
|
|
637
|
+
function tokenKind(token) {
|
|
638
|
+
if (!TOKEN.test(token)) return null;
|
|
639
|
+
return Object.keys(PREFIX).find((kind) => token.startsWith(PREFIX[kind])) ?? null;
|
|
640
|
+
}
|
|
633
641
|
function hashToken(token) {
|
|
634
642
|
return createHash("sha256").update(token, "utf8").digest();
|
|
635
643
|
}
|
|
@@ -822,4 +830,4 @@ function refusalOf(error) {
|
|
|
822
830
|
return new WorkloadTokenRefused("signature", "the token does not verify");
|
|
823
831
|
}
|
|
824
832
|
//#endregion
|
|
825
|
-
export { ACCESS_JWT_HEADER, AccessIdentityVerifier, BindingInvalid, CLOCK_TOLERANCE_SECONDS, GITHUB_EVENTS, GITHUB_ISSUER, GITLAB_ISSUER, GITLAB_PIPELINE_SOURCES, GitHubSigninProvider, MAX_BINDINGS, MAX_CLAIMS, MAX_CLAIM_BYTES, MAX_TOKEN_AGE_SECONDS, MAX_TOKEN_BYTES, OidcSigninProvider, REQUIRED_CLAIMS, SigninError, WORKLOAD_ALGORITHMS, WORKLOAD_PROFILES, WorkloadTokenRefused, canonicalClaims, checkBinding, checkFetchUrl, cloudflareAccess, decodeWorkloadToken, defaultIssuer, defineSignin, deriveKey, fullRef, generateToken, github, githubReusable, githubWorkflow, gitlabProject, google, hashToken, isCoffreToken, issuedRefusal, microsoft, oidc, publicOrigin, seal, signin, toPrincipal, tokenHint, unseal, verifyWorkloadToken, workflowRef };
|
|
833
|
+
export { ACCESS_JWT_HEADER, AccessIdentityVerifier, BindingInvalid, CLOCK_TOLERANCE_SECONDS, GITHUB_EVENTS, GITHUB_ISSUER, GITLAB_ISSUER, GITLAB_PIPELINE_SOURCES, GitHubSigninProvider, MAX_BINDINGS, MAX_CLAIMS, MAX_CLAIM_BYTES, MAX_TOKEN_AGE_SECONDS, MAX_TOKEN_BYTES, OidcSigninProvider, REQUIRED_CLAIMS, SigninError, WORKLOAD_ALGORITHMS, WORKLOAD_PROFILES, WorkloadTokenRefused, canonicalClaims, checkBinding, checkFetchUrl, cloudflareAccess, decodeWorkloadToken, defaultIssuer, defineSignin, deriveKey, fullRef, generateToken, github, githubReusable, githubWorkflow, gitlabProject, google, hashToken, isCoffreToken, issuedRefusal, microsoft, oidc, publicOrigin, seal, signin, toPrincipal, tokenHint, tokenKind, unseal, verifyWorkloadToken, workflowRef };
|
package/dist/mcp.js
CHANGED
|
@@ -23,7 +23,7 @@ const MCP_SCOPE_INFO = {
|
|
|
23
23
|
},
|
|
24
24
|
reveal: {
|
|
25
25
|
label: "Reveal values",
|
|
26
|
-
description: "Secret values, sent to the app.
|
|
26
|
+
description: "Secret values, sent to the app."
|
|
27
27
|
},
|
|
28
28
|
"manage-access": {
|
|
29
29
|
label: "Manage access",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "What coffre's packages share: roles, envelopes, identity, the audit chain and the vault's contract.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@types/node": "26.1.1",
|
|
85
85
|
"tsdown": "0.23.0",
|
|
86
86
|
"typescript": "5.9.3",
|
|
87
|
-
"@coffre/conformance": "0.4.
|
|
87
|
+
"@coffre/conformance": "0.4.6"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "tsdown",
|
package/src/identity/tokens.ts
CHANGED
|
@@ -30,6 +30,15 @@ export function isCoffreToken(value: string): boolean {
|
|
|
30
30
|
return TOKEN.test(value);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The kind a token's prefix says, before any lookup. Its hash covers the
|
|
35
|
+
* prefix, so a token found under its hash is the kind it says.
|
|
36
|
+
*/
|
|
37
|
+
export function tokenKind(token: string): CredentialKind | null {
|
|
38
|
+
if (!TOKEN.test(token)) return null;
|
|
39
|
+
return (Object.keys(PREFIX) as CredentialKind[]).find((kind) => token.startsWith(PREFIX[kind])) ?? null;
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
export function hashToken(token: string): Buffer {
|
|
34
43
|
return createHash('sha256').update(token, 'utf8').digest();
|
|
35
44
|
}
|
package/src/mcp.ts
CHANGED
|
@@ -21,7 +21,7 @@ export const MCP_SCOPE_INFO: Record<McpScope, { label: string; description: stri
|
|
|
21
21
|
},
|
|
22
22
|
reveal: {
|
|
23
23
|
label: 'Reveal values',
|
|
24
|
-
description: 'Secret values, sent to the app.
|
|
24
|
+
description: 'Secret values, sent to the app.',
|
|
25
25
|
},
|
|
26
26
|
'manage-access': {
|
|
27
27
|
label: 'Manage access',
|