@microsoft/ccf-app 6.0.0-dev1 → 6.0.0-dev10
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/endpoints.d.ts +12 -6
- package/global.d.ts +1 -1
- package/package.json +7 -4
- package/scripts/build_bundle.d.ts +2 -0
- package/scripts/build_bundle.js +61 -0
package/endpoints.d.ts
CHANGED
|
@@ -101,7 +101,16 @@ export interface AuthnIdentityCommon {
|
|
|
101
101
|
export interface EmptyAuthnIdentity extends AuthnIdentityCommon {
|
|
102
102
|
policy: "no_auth";
|
|
103
103
|
}
|
|
104
|
-
interface
|
|
104
|
+
interface CertAuthnIdentityCommon extends AuthnIdentityCommon {
|
|
105
|
+
/**
|
|
106
|
+
* PEM-encoded certificate.
|
|
107
|
+
*/
|
|
108
|
+
cert: string;
|
|
109
|
+
}
|
|
110
|
+
export interface AnyCertAuthnIdentity extends CertAuthnIdentityCommon {
|
|
111
|
+
policy: "any_cert";
|
|
112
|
+
}
|
|
113
|
+
interface UserMemberAuthnIdentityCommon extends CertAuthnIdentityCommon {
|
|
105
114
|
/**
|
|
106
115
|
* User/member ID.
|
|
107
116
|
*/
|
|
@@ -110,10 +119,6 @@ interface UserMemberAuthnIdentityCommon extends AuthnIdentityCommon {
|
|
|
110
119
|
* User/member data object.
|
|
111
120
|
*/
|
|
112
121
|
data: any;
|
|
113
|
-
/**
|
|
114
|
-
* PEM-encoded user/member certificate.
|
|
115
|
-
*/
|
|
116
|
-
cert: string;
|
|
117
122
|
}
|
|
118
123
|
export interface UserCertAuthnIdentity extends UserMemberAuthnIdentityCommon {
|
|
119
124
|
policy: "user_cert";
|
|
@@ -160,6 +165,7 @@ export interface AllOfAuthnIdentity extends AuthnIdentityCommon {
|
|
|
160
165
|
policy: string[];
|
|
161
166
|
user_cert?: UserCertAuthnIdentity;
|
|
162
167
|
member_cert?: MemberCertAuthnIdentity;
|
|
168
|
+
any_cert?: AnyCertAuthnIdentity;
|
|
163
169
|
user_cose_sign1?: UserCOSESign1AuthnIdentity;
|
|
164
170
|
member_cose_sign1?: MemberCOSESign1AuthnIdentity;
|
|
165
171
|
jwt?: JwtAuthnIdentity;
|
|
@@ -169,7 +175,7 @@ export interface AllOfAuthnIdentity extends AuthnIdentityCommon {
|
|
|
169
175
|
* Each identity corresponds to a matching {@linkcode AuthnIdentityCommon.policy | policy}.
|
|
170
176
|
* Policies have to be declared for each endpoint in ``app.json``.
|
|
171
177
|
*/
|
|
172
|
-
export type AuthnIdentity = EmptyAuthnIdentity | UserCertAuthnIdentity | MemberCertAuthnIdentity | JwtAuthnIdentity | MemberCOSESign1AuthnIdentity | UserCOSESign1AuthnIdentity | AllOfAuthnIdentity;
|
|
178
|
+
export type AuthnIdentity = EmptyAuthnIdentity | UserCertAuthnIdentity | MemberCertAuthnIdentity | AnyCertAuthnIdentity | JwtAuthnIdentity | MemberCOSESign1AuthnIdentity | UserCOSESign1AuthnIdentity | AllOfAuthnIdentity;
|
|
173
179
|
/** See {@linkcode Response.body}. */
|
|
174
180
|
export type ResponseBodyType<T> = string | ArrayBuffer | JsonCompatible<T>;
|
|
175
181
|
/**
|
package/global.d.ts
CHANGED
|
@@ -312,7 +312,7 @@ export interface CCFCrypto {
|
|
|
312
312
|
/**
|
|
313
313
|
* Generate an ECDSA key pair.
|
|
314
314
|
*
|
|
315
|
-
* @param curve The name of the curve, one of "secp256r1", "
|
|
315
|
+
* @param curve The name of the curve, one of "secp256r1", "secp384r1".
|
|
316
316
|
*/
|
|
317
317
|
generateEcdsaKeyPair(curve: string): CryptoKeyPair;
|
|
318
318
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/ccf-app",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-dev10",
|
|
4
4
|
"description": "CCF app support package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,10 +26,13 @@
|
|
|
26
26
|
"colors": "1.4.0",
|
|
27
27
|
"cross-env": "^7.0.3",
|
|
28
28
|
"get-func-name": "3.0.0",
|
|
29
|
-
"mocha": "^
|
|
29
|
+
"mocha": "^11.0.1",
|
|
30
30
|
"node-forge": "^1.2.0",
|
|
31
31
|
"ts-node": "^10.4.0",
|
|
32
|
-
"typedoc": "^0.
|
|
33
|
-
"typescript": "^5.
|
|
32
|
+
"typedoc": "^0.27.0",
|
|
33
|
+
"typescript": "^5.7.2"
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"ccf-build-bundle": "scripts/build_bundle.js"
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readdirSync, statSync, readFileSync, writeFileSync, existsSync, } from "fs";
|
|
3
|
+
import { join, resolve, sep } from "path";
|
|
4
|
+
function getAllFiles(dirPath) {
|
|
5
|
+
const toSearch = [dirPath];
|
|
6
|
+
const agg = [];
|
|
7
|
+
for (const filePath of toSearch) {
|
|
8
|
+
if (statSync(filePath).isDirectory()) {
|
|
9
|
+
for (const subfile of readdirSync(filePath)) {
|
|
10
|
+
toSearch.push(join(filePath, subfile));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
agg.push(filePath);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return agg;
|
|
18
|
+
}
|
|
19
|
+
function removePrefix(s, prefix) {
|
|
20
|
+
if (s.startsWith(prefix)) {
|
|
21
|
+
return s.slice(prefix.length).split(sep).join(sep);
|
|
22
|
+
}
|
|
23
|
+
console.log("Warn: tried to remove invalid prefix", s, prefix);
|
|
24
|
+
return s;
|
|
25
|
+
}
|
|
26
|
+
const args = process.argv.slice(2);
|
|
27
|
+
if (args.length < 1) {
|
|
28
|
+
console.log("Usage: build_bundle <root_directory>");
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
function assertFileExists(path) {
|
|
32
|
+
if (!existsSync(path)) {
|
|
33
|
+
console.log("File not found: %s", path);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const argRootDirPath = args[0];
|
|
38
|
+
assertFileExists(argRootDirPath);
|
|
39
|
+
const rootDirPath = resolve(argRootDirPath);
|
|
40
|
+
const metadataPath = join(rootDirPath, "app.json");
|
|
41
|
+
assertFileExists(metadataPath);
|
|
42
|
+
const srcDirPath = join(rootDirPath, "src");
|
|
43
|
+
assertFileExists(srcDirPath);
|
|
44
|
+
const metadata = JSON.parse(readFileSync(metadataPath, "utf-8"));
|
|
45
|
+
const allFiles = getAllFiles(srcDirPath);
|
|
46
|
+
// The trailing / is included so that it is trimmed in removePrefix.
|
|
47
|
+
// This produces "foo/bar.js" rather than "/foo/bar.js"
|
|
48
|
+
const toTrim = srcDirPath + "/";
|
|
49
|
+
const modules = allFiles.map(function (filePath) {
|
|
50
|
+
return {
|
|
51
|
+
name: removePrefix(filePath, toTrim),
|
|
52
|
+
module: readFileSync(filePath, "utf-8"),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const bundlePath = join(args[0], "bundle.json");
|
|
56
|
+
const bundle = {
|
|
57
|
+
metadata: metadata,
|
|
58
|
+
modules: modules,
|
|
59
|
+
};
|
|
60
|
+
console.log(`Writing bundle containing ${modules.length} modules to ${bundlePath}`);
|
|
61
|
+
writeFileSync(bundlePath, JSON.stringify(bundle));
|