@authsec/sdk 4.0.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.
Files changed (56) hide show
  1. package/README.md +253 -0
  2. package/dist/ciba.d.ts +47 -0
  3. package/dist/ciba.d.ts.map +1 -0
  4. package/dist/ciba.js +172 -0
  5. package/dist/ciba.js.map +1 -0
  6. package/dist/config.d.ts +32 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +92 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/decorators.d.ts +59 -0
  11. package/dist/decorators.d.ts.map +1 -0
  12. package/dist/decorators.js +142 -0
  13. package/dist/decorators.js.map +1 -0
  14. package/dist/http.d.ts +19 -0
  15. package/dist/http.d.ts.map +1 -0
  16. package/dist/http.js +156 -0
  17. package/dist/http.js.map +1 -0
  18. package/dist/index.d.ts +47 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +69 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/mcp-server.d.ts +42 -0
  23. package/dist/mcp-server.d.ts.map +1 -0
  24. package/dist/mcp-server.js +353 -0
  25. package/dist/mcp-server.js.map +1 -0
  26. package/dist/rbac.d.ts +12 -0
  27. package/dist/rbac.d.ts.map +1 -0
  28. package/dist/rbac.js +130 -0
  29. package/dist/rbac.js.map +1 -0
  30. package/dist/service-access.d.ts +31 -0
  31. package/dist/service-access.d.ts.map +1 -0
  32. package/dist/service-access.js +82 -0
  33. package/dist/service-access.js.map +1 -0
  34. package/dist/spiffe/index.d.ts +4 -0
  35. package/dist/spiffe/index.d.ts.map +1 -0
  36. package/dist/spiffe/index.js +10 -0
  37. package/dist/spiffe/index.js.map +1 -0
  38. package/dist/spiffe/proto/workload.proto +126 -0
  39. package/dist/spiffe/quick-start-svid.d.ts +74 -0
  40. package/dist/spiffe/quick-start-svid.d.ts.map +1 -0
  41. package/dist/spiffe/quick-start-svid.js +191 -0
  42. package/dist/spiffe/quick-start-svid.js.map +1 -0
  43. package/dist/spiffe/workload-api-client.d.ts +71 -0
  44. package/dist/spiffe/workload-api-client.d.ts.map +1 -0
  45. package/dist/spiffe/workload-api-client.js +355 -0
  46. package/dist/spiffe/workload-api-client.js.map +1 -0
  47. package/dist/spiffe/workload-svid.d.ts +44 -0
  48. package/dist/spiffe/workload-svid.d.ts.map +1 -0
  49. package/dist/spiffe/workload-svid.js +137 -0
  50. package/dist/spiffe/workload-svid.js.map +1 -0
  51. package/dist/types.d.ts +95 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +23 -0
  54. package/dist/types.js.map +1 -0
  55. package/package.json +45 -0
  56. package/src/spiffe/proto/workload.proto +126 -0
package/dist/types.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * Shared TypeScript types for AuthSec SDK
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SimpleSession = void 0;
7
+ /** Session object passed to protected tool handlers */
8
+ class SimpleSession {
9
+ sessionId;
10
+ accessToken;
11
+ tenantId;
12
+ userId;
13
+ orgId;
14
+ constructor(sessionId, userInfo) {
15
+ this.sessionId = sessionId;
16
+ this.accessToken = userInfo.access_token ?? null;
17
+ this.tenantId = userInfo.tenant_id ?? null;
18
+ this.userId = userInfo.user_id ?? null;
19
+ this.orgId = userInfo.org_id ?? null;
20
+ }
21
+ }
22
+ exports.SimpleSession = SimpleSession;
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA2CH,uDAAuD;AACvD,MAAa,aAAa;IACxB,SAAS,CAAS;IAClB,WAAW,CAAgB;IAC3B,QAAQ,CAAgB;IACxB,MAAM,CAAgB;IACtB,KAAK,CAAgB;IAErB,YAAY,SAAiB,EAAE,QAA6B;QAC1D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,SAAS,IAAI,IAAI,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC;IACvC,CAAC;CACF;AAdD,sCAcC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@authsec/sdk",
3
+ "version": "4.0.0",
4
+ "description": "AuthSec SDK for MCP Auth, Services, CIBA, and SPIFFE integration (TypeScript/JavaScript)",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "src/spiffe/proto/workload.proto"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc && mkdir -p dist/spiffe/proto && cp src/spiffe/proto/workload.proto dist/spiffe/proto/",
13
+ "clean": "rm -rf dist",
14
+ "example:memory": "node examples/memory-authsec-wrapper.mjs",
15
+ "prepublishOnly": "npm run clean && npm run build"
16
+ },
17
+ "keywords": [
18
+ "authsec",
19
+ "mcp",
20
+ "oauth",
21
+ "rbac",
22
+ "spiffe",
23
+ "ciba",
24
+ "authentication",
25
+ "authorization"
26
+ ],
27
+ "author": "AuthSec Team <a@authnull.com>",
28
+ "license": "ISC",
29
+ "dependencies": {
30
+ "@grpc/grpc-js": "^1.10.0",
31
+ "@grpc/proto-loader": "^0.7.0",
32
+ "cors": "^2.8.5",
33
+ "express": "^4.21.0"
34
+ },
35
+ "devDependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.26.0",
37
+ "@types/cors": "^2.8.17",
38
+ "@types/express": "^4.17.21",
39
+ "@types/node": "^20.11.0",
40
+ "typescript": "^5.3.0"
41
+ },
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ }
45
+ }
@@ -0,0 +1,126 @@
1
+ // SPIFFE Workload API
2
+ // Based on: https://github.com/spiffe/spiffe/blob/main/standards/SPIFFE_Workload_API.md
3
+
4
+ syntax = "proto3";
5
+
6
+ package spiffe.workload;
7
+
8
+ option go_package = "github.com/spiffe/go-spiffe/v2/proto/spiffe/workload;workload";
9
+
10
+ // SpiffeWorkloadAPI provides methods for workloads to retrieve their SPIFFE identities
11
+ service SpiffeWorkloadAPI {
12
+ // Fetch X.509-SVID - Workloads subscribe to this RPC to receive X.509 SVIDs
13
+ // SVIDs are streamed to the workload and automatically updated before expiry
14
+ rpc FetchX509SVID(X509SVIDRequest) returns (stream X509SVIDResponse);
15
+
16
+ // Fetch X.509 bundles - Returns trust bundles for federated trust domains
17
+ rpc FetchX509Bundles(X509BundlesRequest) returns (stream X509BundlesResponse);
18
+
19
+ // Validate JWT-SVID - Validates a JWT-SVID token
20
+ rpc ValidateJWTSVID(ValidateJWTSVIDRequest) returns (ValidateJWTSVIDResponse);
21
+
22
+ // Fetch JWT-SVID - Fetches a JWT-SVID with specified audience
23
+ rpc FetchJWTSVID(JWTSVIDRequest) returns (JWTSVIDResponse);
24
+
25
+ // Fetch JWT bundles
26
+ rpc FetchJWTBundles(JWTBundlesRequest) returns (stream JWTBundlesResponse);
27
+ }
28
+
29
+ // X.509-SVID Request
30
+ message X509SVIDRequest {
31
+ // Empty - workload is identified by Unix socket peer credentials
32
+ }
33
+
34
+ // X.509-SVID Response
35
+ message X509SVIDResponse {
36
+ // List of X.509 SVIDs
37
+ repeated X509SVID svids = 1;
38
+
39
+ // X.509 certificate bundles (trust bundles)
40
+ // Key is trust domain name (e.g., "example.org")
41
+ map<string, bytes> crl = 2;
42
+
43
+ // Federated bundles (trust bundles for federated trust domains)
44
+ map<string, bytes> federated_bundles = 3;
45
+ }
46
+
47
+ // X.509 SVID
48
+ message X509SVID {
49
+ // SPIFFE ID
50
+ string spiffe_id = 1;
51
+
52
+ // X.509 certificate (PEM encoded)
53
+ bytes x509_svid = 2;
54
+
55
+ // Private key (PEM encoded)
56
+ bytes x509_svid_key = 3;
57
+
58
+ // Certificate bundle (PEM encoded)
59
+ bytes bundle = 4;
60
+ }
61
+
62
+ // X.509 Bundles Request
63
+ message X509BundlesRequest {
64
+ // Empty
65
+ }
66
+
67
+ // X.509 Bundles Response
68
+ message X509BundlesResponse {
69
+ // X.509 certificate bundles
70
+ // Key is trust domain name
71
+ map<string, bytes> bundles = 1;
72
+ }
73
+
74
+ // JWT-SVID Request
75
+ message JWTSVIDRequest {
76
+ // Audience for JWT
77
+ repeated string audience = 1;
78
+
79
+ // SPIFFE ID (optional - defaults to workload's default identity)
80
+ string spiffe_id = 2;
81
+ }
82
+
83
+ // JWT-SVID Response
84
+ message JWTSVIDResponse {
85
+ // List of JWT SVIDs
86
+ repeated JWTSVID svids = 1;
87
+ }
88
+
89
+ // JWT SVID
90
+ message JWTSVID {
91
+ // SPIFFE ID
92
+ string spiffe_id = 1;
93
+
94
+ // JWT token
95
+ string svid = 2;
96
+ }
97
+
98
+ // JWT Bundles Request
99
+ message JWTBundlesRequest {
100
+ // Empty
101
+ }
102
+
103
+ // JWT Bundles Response
104
+ message JWTBundlesResponse {
105
+ // JWT bundles (JWKS)
106
+ // Key is trust domain name
107
+ map<string, bytes> bundles = 1;
108
+ }
109
+
110
+ // Validate JWT-SVID Request
111
+ message ValidateJWTSVIDRequest {
112
+ // JWT token to validate
113
+ string svid = 1;
114
+
115
+ // Expected audience
116
+ string audience = 2;
117
+ }
118
+
119
+ // Validate JWT-SVID Response
120
+ message ValidateJWTSVIDResponse {
121
+ // SPIFFE ID extracted from validated token
122
+ string spiffe_id = 1;
123
+
124
+ // Claims from validated token
125
+ map<string, string> claims = 2;
126
+ }