@sudoplatform/sudo-common 7.1.3 → 8.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.
- package/bin/outdated-with-suppression.sh +203 -0
- package/bin/suppress-audit.sh +15 -0
- package/bin/suppress-outdated.sh +60 -0
- package/bin/yarn-audit-with-suppression.sh +19 -0
- package/cjs/configurationManager/defaultConfigurationManager.d.ts +123 -0
- package/cjs/configurationManager/defaultConfigurationManager.js +122 -0
- package/cjs/configurationManager/defaultConfigurationManager.js.map +1 -0
- package/cjs/errors/error.d.ts +263 -0
- package/cjs/errors/error.js +442 -0
- package/cjs/errors/error.js.map +1 -0
- package/cjs/index.d.ts +9 -0
- package/cjs/index.js +13 -0
- package/cjs/index.js.map +1 -0
- package/cjs/logging/bunyanLogger.d.ts +8 -0
- package/cjs/logging/bunyanLogger.js +36 -0
- package/cjs/logging/bunyanLogger.js.map +1 -0
- package/cjs/logging/logger.d.ts +87 -0
- package/cjs/logging/logger.js +77 -0
- package/cjs/logging/logger.js.map +1 -0
- package/cjs/sudoKeyArchive/index.d.ts +4 -0
- package/cjs/sudoKeyArchive/index.js +8 -0
- package/cjs/sudoKeyArchive/index.js.map +1 -0
- package/cjs/sudoKeyArchive/keyArchive.d.ts +137 -0
- package/cjs/sudoKeyArchive/keyArchive.js +84 -0
- package/cjs/sudoKeyArchive/keyArchive.js.map +1 -0
- package/cjs/sudoKeyArchive/keyInfo.d.ts +41 -0
- package/cjs/sudoKeyArchive/keyInfo.js +17 -0
- package/cjs/sudoKeyArchive/keyInfo.js.map +1 -0
- package/cjs/sudoKeyArchive/keyType.d.ts +13 -0
- package/cjs/sudoKeyArchive/keyType.js +39 -0
- package/cjs/sudoKeyArchive/keyType.js.map +1 -0
- package/cjs/sudoKeyArchive/sudoKeyArchive.d.ts +190 -0
- package/cjs/sudoKeyArchive/sudoKeyArchive.js +373 -0
- package/cjs/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
- package/cjs/sudoKeyManager/index.d.ts +4 -0
- package/cjs/sudoKeyManager/index.js +8 -0
- package/cjs/sudoKeyManager/index.js.map +1 -0
- package/cjs/sudoKeyManager/keyData.d.ts +56 -0
- package/cjs/sudoKeyManager/keyData.js +46 -0
- package/cjs/sudoKeyManager/keyData.js.map +1 -0
- package/cjs/sudoKeyManager/publicKey.d.ts +8 -0
- package/cjs/sudoKeyManager/publicKey.js +9 -0
- package/cjs/sudoKeyManager/publicKey.js.map +1 -0
- package/cjs/sudoKeyManager/sudoCryptoProvider.d.ts +324 -0
- package/cjs/sudoKeyManager/sudoCryptoProvider.js +12 -0
- package/cjs/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
- package/cjs/sudoKeyManager/sudoKeyManager.d.ts +344 -0
- package/cjs/sudoKeyManager/sudoKeyManager.js +140 -0
- package/cjs/sudoKeyManager/sudoKeyManager.js.map +1 -0
- package/cjs/types/types.d.ts +115 -0
- package/cjs/types/types.js +45 -0
- package/cjs/types/types.js.map +1 -0
- package/cjs/utils/base64.d.ts +44 -0
- package/cjs/utils/base64.js +71 -0
- package/cjs/utils/base64.js.map +1 -0
- package/cjs/utils/buffer.d.ts +13 -0
- package/cjs/utils/buffer.js +37 -0
- package/cjs/utils/buffer.js.map +1 -0
- package/cjs/utils/stream.d.ts +6 -0
- package/cjs/utils/stream.js +70 -0
- package/cjs/utils/stream.js.map +1 -0
- package/lib/configurationManager/defaultConfigurationManager.js +106 -156
- package/lib/configurationManager/defaultConfigurationManager.js.map +1 -0
- package/lib/errors/error.js +226 -438
- package/lib/errors/error.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +10 -109
- package/lib/index.js.map +1 -0
- package/lib/logging/bunyanLogger.js +29 -41
- package/lib/logging/bunyanLogger.js.map +1 -0
- package/lib/logging/logger.js +66 -92
- package/lib/logging/logger.js.map +1 -0
- package/lib/sudoKeyArchive/index.js +5 -57
- package/lib/sudoKeyArchive/index.js.map +1 -0
- package/lib/sudoKeyArchive/keyArchive.d.ts +8 -8
- package/lib/sudoKeyArchive/keyArchive.js +69 -96
- package/lib/sudoKeyArchive/keyArchive.js.map +1 -0
- package/lib/sudoKeyArchive/keyInfo.js +11 -49
- package/lib/sudoKeyArchive/keyInfo.js.map +1 -0
- package/lib/sudoKeyArchive/keyType.js +27 -37
- package/lib/sudoKeyArchive/keyType.js.map +1 -0
- package/lib/sudoKeyArchive/sudoKeyArchive.js +351 -444
- package/lib/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
- package/lib/sudoKeyManager/index.js +5 -57
- package/lib/sudoKeyManager/index.js.map +1 -0
- package/lib/sudoKeyManager/keyData.js +38 -33
- package/lib/sudoKeyManager/keyData.js.map +1 -0
- package/lib/sudoKeyManager/publicKey.js +5 -12
- package/lib/sudoKeyManager/publicKey.js.map +1 -0
- package/lib/sudoKeyManager/sudoCryptoProvider.js +8 -26
- package/lib/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
- package/lib/sudoKeyManager/sudoKeyManager.js +135 -173
- package/lib/sudoKeyManager/sudoKeyManager.js.map +1 -0
- package/lib/types/types.js +27 -33
- package/lib/types/types.js.map +1 -0
- package/lib/utils/base64.js +63 -93
- package/lib/utils/base64.js.map +1 -0
- package/lib/utils/buffer.js +28 -46
- package/lib/utils/buffer.js.map +1 -0
- package/lib/utils/stream.d.ts +6 -0
- package/lib/utils/stream.js +63 -0
- package/lib/utils/stream.js.map +1 -0
- package/package.json +35 -27
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/errors/error.ts"],"names":[],"mappings":";;;AAYA,SAAgB,qBAAqB,CAAC,CAAQ;IAC5C,8DAA8D;IAC9D,OAAO,CAAC,CAAE,CAAiB,CAAC,YAAY,CAAA;AAC1C,CAAC;AAHD,sDAGC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,KAAc;QACxB,MAAM,iBAAiB,GAAG,KAAqB,CAAA;QAC/C,IA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B,4BAA4B,CAC1C,KAA0B;IAE1B,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;IACvC,QAAQ,YAAY,CAAC,UAAU,EAAE;QAC/B,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,EAAE,CAAA;QACjC;YACE,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;KACvE;AACH,CAAC;AAVD,oEAUC"}
|
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './configurationManager/defaultConfigurationManager';
|
|
2
|
+
export * from './sudoKeyArchive';
|
|
3
|
+
export * from './sudoKeyManager';
|
|
4
|
+
export * from './utils/base64';
|
|
5
|
+
export * from './utils/buffer';
|
|
6
|
+
export * from './utils/stream';
|
|
7
|
+
export * from './errors/error';
|
|
8
|
+
export * from './logging/logger';
|
|
9
|
+
export * from './types/types';
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./configurationManager/defaultConfigurationManager"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./sudoKeyArchive"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./sudoKeyManager"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./utils/base64"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./utils/buffer"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./utils/stream"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./errors/error"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./logging/logger"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./types/types"), exports);
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6FAAkE;AAClE,2DAAgC;AAChC,2DAAgC;AAChC,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,2DAAgC;AAChC,wDAA6B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createLogger } from 'browser-bunyan';
|
|
2
|
+
import * as t from 'io-ts';
|
|
3
|
+
declare const Level: t.UnionC<[t.LiteralC<"trace">, t.LiteralC<"debug">, t.LiteralC<"info">, t.LiteralC<"warn">, t.LiteralC<"error">, t.LiteralC<"fatal">]>;
|
|
4
|
+
declare type Level = t.TypeOf<typeof Level>;
|
|
5
|
+
export declare function getLogLevel(level: string | undefined): Level | undefined;
|
|
6
|
+
export declare function createBunyanLogger(identifier?: string, logLevel?: string): BunyanLogger;
|
|
7
|
+
export declare type BunyanLogger = ReturnType<typeof createLogger>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBunyanLogger = exports.getLogLevel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const browser_bunyan_1 = require("browser-bunyan");
|
|
6
|
+
const console_plain_stream_1 = require("@browser-bunyan/console-plain-stream");
|
|
7
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
+
const pipeable_1 = require("fp-ts/lib/pipeable");
|
|
9
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
10
|
+
const Level = t.union([
|
|
11
|
+
t.literal('trace'),
|
|
12
|
+
t.literal('debug'),
|
|
13
|
+
t.literal('info'),
|
|
14
|
+
t.literal('warn'),
|
|
15
|
+
t.literal('error'),
|
|
16
|
+
t.literal('fatal'),
|
|
17
|
+
]);
|
|
18
|
+
function getLogLevel(level) {
|
|
19
|
+
if (!level) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return (0, pipeable_1.pipe)(Level.decode(level), (0, Either_1.fold)(() => undefined, (v) => v));
|
|
23
|
+
}
|
|
24
|
+
exports.getLogLevel = getLogLevel;
|
|
25
|
+
function createBunyanLogger(identifier, logLevel) {
|
|
26
|
+
const level = getLogLevel(process.env.LOG_LEVEL) || getLogLevel(logLevel) || 'info';
|
|
27
|
+
const log = (0, browser_bunyan_1.createLogger)({
|
|
28
|
+
name: process.env.PROJECT_NAME || identifier || 'rootLogger',
|
|
29
|
+
level,
|
|
30
|
+
serializers: browser_bunyan_1.stdSerializers,
|
|
31
|
+
stream: new console_plain_stream_1.ConsolePlainStream(),
|
|
32
|
+
});
|
|
33
|
+
return log;
|
|
34
|
+
}
|
|
35
|
+
exports.createBunyanLogger = createBunyanLogger;
|
|
36
|
+
//# sourceMappingURL=bunyanLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bunyanLogger.js","sourceRoot":"","sources":["../../src/logging/bunyanLogger.ts"],"names":[],"mappings":";;;;AAAA,mDAA6D;AAC7D,+EAAyE;AACzE,iDAA0B;AAC1B,iDAAyC;AACzC,6CAAuC;AAEvC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IACpB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;CACnB,CAAC,CAAA;AAIF,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,IAAA,eAAI,EACT,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACnB,IAAA,aAAI,EACF,GAAG,EAAE,CAAC,SAAS,EACf,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CACT,CACF,CAAA;AACH,CAAC;AAZD,kCAYC;AAED,SAAgB,kBAAkB,CAChC,UAAmB,EACnB,QAAiB;IAEjB,MAAM,KAAK,GACT,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAA;IACvE,MAAM,GAAG,GAAG,IAAA,6BAAY,EAAC;QACvB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,UAAU,IAAI,YAAY;QAC5D,KAAK;QACL,WAAW,EAAE,+BAAc;QAC3B,MAAM,EAAE,IAAI,yCAAkB,EAAE;KACjC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC;AAbD,gDAaC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface encapsulating logger functions.
|
|
3
|
+
*/
|
|
4
|
+
export interface Logger {
|
|
5
|
+
/**
|
|
6
|
+
* @returns Whether or not trace level logging is enabled
|
|
7
|
+
*/
|
|
8
|
+
trace(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Will log the given message with the logger implementation using the TRACE level
|
|
11
|
+
* @param message the message to be logged
|
|
12
|
+
* @param fields optional fields that represent an object
|
|
13
|
+
*/
|
|
14
|
+
trace(message: string, fields?: Record<string, unknown>): void;
|
|
15
|
+
/**
|
|
16
|
+
* @returns Whether or not debug level logging is enabled
|
|
17
|
+
*/
|
|
18
|
+
debug(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Will log the given message with the logger implementation using the DEBUG level
|
|
21
|
+
* @param message the message to be logged
|
|
22
|
+
* @param fields optional fields that represent an object
|
|
23
|
+
*/
|
|
24
|
+
debug(message: string, fields?: Record<string, unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* @returns Whether or not info level logging is enabled
|
|
27
|
+
*/
|
|
28
|
+
info(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Will log the given message with the logger implementation using the INFO level
|
|
31
|
+
* @param message the message to be logged
|
|
32
|
+
* @param fields optional fields that represent an object
|
|
33
|
+
*/
|
|
34
|
+
info(message: string, fields?: Record<string, unknown>): void;
|
|
35
|
+
/**
|
|
36
|
+
* @returns Whether or not warn level logging is enabled
|
|
37
|
+
*/
|
|
38
|
+
warn(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Will log the given message with the logger implementation using the WARN level
|
|
41
|
+
* @param message the message to be logged
|
|
42
|
+
* @param fields optional fields that represent an object
|
|
43
|
+
*/
|
|
44
|
+
warn(message: string, fields?: Record<string, unknown>): void;
|
|
45
|
+
/**
|
|
46
|
+
* @returns Whether or not error level logging is enabled
|
|
47
|
+
*/
|
|
48
|
+
error(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Will log the given message with the logger implementation using the ERROR level
|
|
51
|
+
* @param message the message to be logged
|
|
52
|
+
* @param fields optional fields that represent an object
|
|
53
|
+
*/
|
|
54
|
+
error(message: string, fields?: Record<string, unknown>): void;
|
|
55
|
+
/**
|
|
56
|
+
* @returns Whether or not fatal level logging is enabled
|
|
57
|
+
*/
|
|
58
|
+
fatal(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Will log the given message with the logger implementation using the FATAL level
|
|
61
|
+
* @param message the message to be logged
|
|
62
|
+
* @param fields optional fields that represent an object
|
|
63
|
+
*/
|
|
64
|
+
fatal(message: string, fields?: Record<string, unknown>): void;
|
|
65
|
+
}
|
|
66
|
+
export declare class DefaultLogger implements Logger {
|
|
67
|
+
private logger;
|
|
68
|
+
/**
|
|
69
|
+
* The default logger implementation which wraps browser-bunyan
|
|
70
|
+
*
|
|
71
|
+
* @param identifier the name of the module
|
|
72
|
+
* @param logLevel the log level for the module
|
|
73
|
+
*/
|
|
74
|
+
constructor(identifier?: string, logLevel?: string);
|
|
75
|
+
trace(): boolean;
|
|
76
|
+
trace(message: string, fields?: Record<string, unknown>): void;
|
|
77
|
+
debug(): boolean;
|
|
78
|
+
debug(message: string, fields?: Record<string, unknown>): void;
|
|
79
|
+
info(): boolean;
|
|
80
|
+
info(message: string, fields?: Record<string, unknown>): void;
|
|
81
|
+
warn(): boolean;
|
|
82
|
+
warn(message: string, fields?: Record<string, unknown>): void;
|
|
83
|
+
error(): boolean;
|
|
84
|
+
error(message: string, fields?: Record<string, unknown>): void;
|
|
85
|
+
fatal(): boolean;
|
|
86
|
+
fatal(message: string, fields?: Record<string, unknown>): void;
|
|
87
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultLogger = void 0;
|
|
4
|
+
const bunyanLogger_1 = require("./bunyanLogger");
|
|
5
|
+
class DefaultLogger {
|
|
6
|
+
/**
|
|
7
|
+
* The default logger implementation which wraps browser-bunyan
|
|
8
|
+
*
|
|
9
|
+
* @param identifier the name of the module
|
|
10
|
+
* @param logLevel the log level for the module
|
|
11
|
+
*/
|
|
12
|
+
constructor(identifier, logLevel) {
|
|
13
|
+
this.logger = (0, bunyanLogger_1.createBunyanLogger)(identifier, logLevel);
|
|
14
|
+
}
|
|
15
|
+
trace(message, fields) {
|
|
16
|
+
if (message === undefined)
|
|
17
|
+
return this.logger.trace();
|
|
18
|
+
if (fields) {
|
|
19
|
+
this.logger.trace({ obj: fields }, message);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.logger.trace(message);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
debug(message, fields) {
|
|
26
|
+
if (message === undefined)
|
|
27
|
+
return this.logger.debug();
|
|
28
|
+
if (fields) {
|
|
29
|
+
this.logger.debug({ obj: fields }, message);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.logger.debug(message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
info(message, fields) {
|
|
36
|
+
if (message === undefined)
|
|
37
|
+
return this.logger.info();
|
|
38
|
+
if (fields) {
|
|
39
|
+
this.logger.info({ obj: fields }, message);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.logger.info(message);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
warn(message, fields) {
|
|
46
|
+
if (message === undefined)
|
|
47
|
+
return this.logger.warn();
|
|
48
|
+
if (fields) {
|
|
49
|
+
this.logger.warn({ obj: fields }, message);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.logger.warn(message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
error(message, fields) {
|
|
56
|
+
if (message === undefined)
|
|
57
|
+
return this.logger.error();
|
|
58
|
+
if (fields) {
|
|
59
|
+
this.logger.error({ obj: fields }, message);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.logger.error(message);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
fatal(message, fields) {
|
|
66
|
+
if (message === undefined)
|
|
67
|
+
return this.logger.fatal();
|
|
68
|
+
if (fields) {
|
|
69
|
+
this.logger.fatal({ obj: fields }, message);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.logger.fatal(message);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.DefaultLogger = DefaultLogger;
|
|
77
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logging/logger.ts"],"names":[],"mappings":";;;AAAA,iDAAiE;AA+EjE,MAAa,aAAa;IAGxB;;;;;OAKG;IACH,YAAY,UAAmB,EAAE,QAAiB;QAChD,IAAI,CAAC,MAAM,GAAG,IAAA,iCAAkB,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IACxD,CAAC;IAID,KAAK,CAAC,OAAgB,EAAE,MAAgC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,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,CAAC,OAAgB,EAAE,MAAgC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QAErD,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAA;SAC5C;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC3B;IACH,CAAC;IAID,KAAK,CAAC,OAAgB,EAAE,MAAgC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QAErD,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAA;SAC5C;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC3B;IACH,CAAC;CACF;AApFD,sCAoFC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./keyArchive"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./keyInfo"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./keyType"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./sudoKeyArchive"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,oDAAyB;AACzB,oDAAyB;AACzB,2DAAgC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const CURRENT_ARCHIVE_VERSION = 3;
|
|
3
|
+
export declare const InsecureKeyArchiveType = "Insecure";
|
|
4
|
+
export declare const InsecureKeyArchiveCodec: t.TypeC<{
|
|
5
|
+
/**
|
|
6
|
+
* Discriminant for InsecureKeyArchive type.
|
|
7
|
+
*/
|
|
8
|
+
Type: t.LiteralC<"Insecure">;
|
|
9
|
+
/**
|
|
10
|
+
* Array of exported keys in clear text.
|
|
11
|
+
*/
|
|
12
|
+
Keys: t.ArrayC<t.TypeC<{
|
|
13
|
+
Name: t.StringC;
|
|
14
|
+
Type: t.Type<import("./keyType").KeyArchiveKeyType, string, unknown>;
|
|
15
|
+
Data: t.StringC;
|
|
16
|
+
Synchronizable: t.BooleanC;
|
|
17
|
+
Exportable: t.BooleanC;
|
|
18
|
+
NameSpace: t.StringC;
|
|
19
|
+
}>>;
|
|
20
|
+
/**
|
|
21
|
+
* Version this archive format.
|
|
22
|
+
*/
|
|
23
|
+
Version: t.LiteralC<3>;
|
|
24
|
+
/**
|
|
25
|
+
* Metainfo user is able to associate with the archive.
|
|
26
|
+
*/
|
|
27
|
+
MetaInfo: t.RecordC<t.StringC, t.StringC>;
|
|
28
|
+
}>;
|
|
29
|
+
export declare type InsecureKeyArchive = t.TypeOf<typeof InsecureKeyArchiveCodec>;
|
|
30
|
+
export declare const SecureKeyArchiveType = "Secure";
|
|
31
|
+
export declare const UnrecognizedKeyArchiveCodec: t.PartialC<{
|
|
32
|
+
Version: t.NumberC;
|
|
33
|
+
Type: t.StringC;
|
|
34
|
+
}>;
|
|
35
|
+
export declare type UnrecognizedKeyArchive = t.TypeOf<typeof UnrecognizedKeyArchiveCodec>;
|
|
36
|
+
export declare const SecureKeyArchiveCodec: t.TypeC<{
|
|
37
|
+
/**
|
|
38
|
+
* Discriminant for SecureKeyArchive type.
|
|
39
|
+
*/
|
|
40
|
+
Type: t.LiteralC<"Secure">;
|
|
41
|
+
/**
|
|
42
|
+
* Format is:
|
|
43
|
+
*
|
|
44
|
+
* base64(gzip(encrypt(stringify(array of KeyArchiveKeyInfo)))
|
|
45
|
+
*
|
|
46
|
+
* Encrypt is 256-bit AES-CBC using symmetric key derived from
|
|
47
|
+
* password and IV specified by IV property.
|
|
48
|
+
*/
|
|
49
|
+
Keys: t.StringC;
|
|
50
|
+
/**
|
|
51
|
+
* Rounds of PBKDF2 applied to password to derive symmetric key.
|
|
52
|
+
*/
|
|
53
|
+
Rounds: t.NumberC;
|
|
54
|
+
/**
|
|
55
|
+
* Salt passed to PBKDF2 to derive symmetric key.
|
|
56
|
+
*/
|
|
57
|
+
Salt: t.StringC;
|
|
58
|
+
/**
|
|
59
|
+
* IV used for AES encryption of keys.
|
|
60
|
+
*/
|
|
61
|
+
IV: t.StringC;
|
|
62
|
+
/**
|
|
63
|
+
* Version this archive format.
|
|
64
|
+
*/
|
|
65
|
+
Version: t.LiteralC<3>;
|
|
66
|
+
/**
|
|
67
|
+
* Metainfo user is able to associate with the archive.
|
|
68
|
+
*/
|
|
69
|
+
MetaInfo: t.RecordC<t.StringC, t.StringC>;
|
|
70
|
+
}>;
|
|
71
|
+
export declare type SecureKeyArchive = t.TypeOf<typeof SecureKeyArchiveCodec>;
|
|
72
|
+
export declare const KeyArchiveCodec: t.UnionC<[t.TypeC<{
|
|
73
|
+
/**
|
|
74
|
+
* Discriminant for SecureKeyArchive type.
|
|
75
|
+
*/
|
|
76
|
+
Type: t.LiteralC<"Secure">;
|
|
77
|
+
/**
|
|
78
|
+
* Format is:
|
|
79
|
+
*
|
|
80
|
+
* base64(gzip(encrypt(stringify(array of KeyArchiveKeyInfo)))
|
|
81
|
+
*
|
|
82
|
+
* Encrypt is 256-bit AES-CBC using symmetric key derived from
|
|
83
|
+
* password and IV specified by IV property.
|
|
84
|
+
*/
|
|
85
|
+
Keys: t.StringC;
|
|
86
|
+
/**
|
|
87
|
+
* Rounds of PBKDF2 applied to password to derive symmetric key.
|
|
88
|
+
*/
|
|
89
|
+
Rounds: t.NumberC;
|
|
90
|
+
/**
|
|
91
|
+
* Salt passed to PBKDF2 to derive symmetric key.
|
|
92
|
+
*/
|
|
93
|
+
Salt: t.StringC;
|
|
94
|
+
/**
|
|
95
|
+
* IV used for AES encryption of keys.
|
|
96
|
+
*/
|
|
97
|
+
IV: t.StringC;
|
|
98
|
+
/**
|
|
99
|
+
* Version this archive format.
|
|
100
|
+
*/
|
|
101
|
+
Version: t.LiteralC<3>;
|
|
102
|
+
/**
|
|
103
|
+
* Metainfo user is able to associate with the archive.
|
|
104
|
+
*/
|
|
105
|
+
MetaInfo: t.RecordC<t.StringC, t.StringC>;
|
|
106
|
+
}>, t.TypeC<{
|
|
107
|
+
/**
|
|
108
|
+
* Discriminant for InsecureKeyArchive type.
|
|
109
|
+
*/
|
|
110
|
+
Type: t.LiteralC<"Insecure">;
|
|
111
|
+
/**
|
|
112
|
+
* Array of exported keys in clear text.
|
|
113
|
+
*/
|
|
114
|
+
Keys: t.ArrayC<t.TypeC<{
|
|
115
|
+
Name: t.StringC;
|
|
116
|
+
Type: t.Type<import("./keyType").KeyArchiveKeyType, string, unknown>;
|
|
117
|
+
Data: t.StringC;
|
|
118
|
+
Synchronizable: t.BooleanC;
|
|
119
|
+
Exportable: t.BooleanC;
|
|
120
|
+
NameSpace: t.StringC;
|
|
121
|
+
}>>;
|
|
122
|
+
/**
|
|
123
|
+
* Version this archive format.
|
|
124
|
+
*/
|
|
125
|
+
Version: t.LiteralC<3>;
|
|
126
|
+
/**
|
|
127
|
+
* Metainfo user is able to associate with the archive.
|
|
128
|
+
*/
|
|
129
|
+
MetaInfo: t.RecordC<t.StringC, t.StringC>;
|
|
130
|
+
}>, t.PartialC<{
|
|
131
|
+
Version: t.NumberC;
|
|
132
|
+
Type: t.StringC;
|
|
133
|
+
}>]>;
|
|
134
|
+
export declare type KeyArchive = t.TypeOf<typeof KeyArchiveCodec>;
|
|
135
|
+
export declare function isSecureKeyArchive(keyArchive: KeyArchive): keyArchive is SecureKeyArchive;
|
|
136
|
+
export declare function isInsecureKeyArchive(keyArchive: KeyArchive): keyArchive is InsecureKeyArchive;
|
|
137
|
+
export declare function isUnrecognizedKeyArchive(keyArchive: KeyArchive): keyArchive is UnrecognizedKeyArchive;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUnrecognizedKeyArchive = exports.isInsecureKeyArchive = exports.isSecureKeyArchive = exports.KeyArchiveCodec = exports.SecureKeyArchiveCodec = exports.UnrecognizedKeyArchiveCodec = exports.SecureKeyArchiveType = exports.InsecureKeyArchiveCodec = exports.InsecureKeyArchiveType = exports.CURRENT_ARCHIVE_VERSION = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
6
|
+
const keyInfo_1 = require("./keyInfo");
|
|
7
|
+
exports.CURRENT_ARCHIVE_VERSION = 3;
|
|
8
|
+
const CommonKeyArchiveRequiredProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Version this archive format.
|
|
11
|
+
*/
|
|
12
|
+
Version: t.literal(exports.CURRENT_ARCHIVE_VERSION),
|
|
13
|
+
/**
|
|
14
|
+
* Metainfo user is able to associate with the archive.
|
|
15
|
+
*/
|
|
16
|
+
MetaInfo: t.record(t.string, t.string),
|
|
17
|
+
};
|
|
18
|
+
exports.InsecureKeyArchiveType = 'Insecure';
|
|
19
|
+
const InsecureKeyArchiveRequiredProps = {
|
|
20
|
+
...CommonKeyArchiveRequiredProps,
|
|
21
|
+
/**
|
|
22
|
+
* Discriminant for InsecureKeyArchive type.
|
|
23
|
+
*/
|
|
24
|
+
Type: t.literal(exports.InsecureKeyArchiveType),
|
|
25
|
+
/**
|
|
26
|
+
* Array of exported keys in clear text.
|
|
27
|
+
*/
|
|
28
|
+
Keys: t.array(keyInfo_1.KeyArchiveKeyInfoCodec),
|
|
29
|
+
};
|
|
30
|
+
exports.InsecureKeyArchiveCodec = t.type(InsecureKeyArchiveRequiredProps, 'InsecureKeyArchive');
|
|
31
|
+
exports.SecureKeyArchiveType = 'Secure';
|
|
32
|
+
const SecureKeyArchiveRequiredProps = {
|
|
33
|
+
...CommonKeyArchiveRequiredProps,
|
|
34
|
+
/**
|
|
35
|
+
* Discriminant for SecureKeyArchive type.
|
|
36
|
+
*/
|
|
37
|
+
Type: t.literal(exports.SecureKeyArchiveType),
|
|
38
|
+
/**
|
|
39
|
+
* Format is:
|
|
40
|
+
*
|
|
41
|
+
* base64(gzip(encrypt(stringify(array of KeyArchiveKeyInfo)))
|
|
42
|
+
*
|
|
43
|
+
* Encrypt is 256-bit AES-CBC using symmetric key derived from
|
|
44
|
+
* password and IV specified by IV property.
|
|
45
|
+
*/
|
|
46
|
+
Keys: t.string,
|
|
47
|
+
/**
|
|
48
|
+
* Rounds of PBKDF2 applied to password to derive symmetric key.
|
|
49
|
+
*/
|
|
50
|
+
Rounds: t.number,
|
|
51
|
+
/**
|
|
52
|
+
* Salt passed to PBKDF2 to derive symmetric key.
|
|
53
|
+
*/
|
|
54
|
+
Salt: t.string,
|
|
55
|
+
/**
|
|
56
|
+
* IV used for AES encryption of keys.
|
|
57
|
+
*/
|
|
58
|
+
IV: t.string,
|
|
59
|
+
};
|
|
60
|
+
const UnrecognizedKeyArchiveProps = {
|
|
61
|
+
Version: t.number,
|
|
62
|
+
Type: t.string,
|
|
63
|
+
};
|
|
64
|
+
exports.UnrecognizedKeyArchiveCodec = t.partial(UnrecognizedKeyArchiveProps);
|
|
65
|
+
exports.SecureKeyArchiveCodec = t.type(SecureKeyArchiveRequiredProps, 'SecureKeyArchive');
|
|
66
|
+
exports.KeyArchiveCodec = t.union([
|
|
67
|
+
exports.SecureKeyArchiveCodec,
|
|
68
|
+
exports.InsecureKeyArchiveCodec,
|
|
69
|
+
// Leave UnrecognizedKeyArchiveCodec last so it's tried last
|
|
70
|
+
exports.UnrecognizedKeyArchiveCodec,
|
|
71
|
+
], 'KeyArchive');
|
|
72
|
+
function isSecureKeyArchive(keyArchive) {
|
|
73
|
+
return keyArchive.Type === exports.SecureKeyArchiveType;
|
|
74
|
+
}
|
|
75
|
+
exports.isSecureKeyArchive = isSecureKeyArchive;
|
|
76
|
+
function isInsecureKeyArchive(keyArchive) {
|
|
77
|
+
return keyArchive.Type === exports.InsecureKeyArchiveType;
|
|
78
|
+
}
|
|
79
|
+
exports.isInsecureKeyArchive = isInsecureKeyArchive;
|
|
80
|
+
function isUnrecognizedKeyArchive(keyArchive) {
|
|
81
|
+
return !isSecureKeyArchive(keyArchive) && !isInsecureKeyArchive(keyArchive);
|
|
82
|
+
}
|
|
83
|
+
exports.isUnrecognizedKeyArchive = isUnrecognizedKeyArchive;
|
|
84
|
+
//# sourceMappingURL=keyArchive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyArchive.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/keyArchive.ts"],"names":[],"mappings":";;;;AAAA,iDAA0B;AAC1B,uCAAkD;AAErC,QAAA,uBAAuB,GAAG,CAAC,CAAA;AAExC,MAAM,6BAA6B,GAAG;IACpC;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,+BAAuB,CAAC;IAE3C;;OAEG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;CACvC,CAAA;AAEY,QAAA,sBAAsB,GAAG,UAAU,CAAA;AAEhD,MAAM,+BAA+B,GAAG;IACtC,GAAG,6BAA6B;IAChC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,8BAAsB,CAAC;IAEvC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAsB,CAAC;CACtC,CAAA;AAEY,QAAA,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAC3C,+BAA+B,EAC/B,oBAAoB,CACrB,CAAA;AAIY,QAAA,oBAAoB,GAAG,QAAQ,CAAA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|
|
4
|
+
Type: t.Type<import("./keyType").KeyArchiveKeyType, string, unknown>;
|
|
5
|
+
Data: t.StringC;
|
|
6
|
+
Synchronizable: t.BooleanC;
|
|
7
|
+
Exportable: t.BooleanC;
|
|
8
|
+
NameSpace: t.StringC;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const KeyArchiveKeyInfoArrayCodec: t.ArrayC<t.TypeC<{
|
|
11
|
+
Name: t.StringC;
|
|
12
|
+
Type: t.Type<import("./keyType").KeyArchiveKeyType, string, unknown>;
|
|
13
|
+
Data: t.StringC;
|
|
14
|
+
Synchronizable: t.BooleanC;
|
|
15
|
+
Exportable: t.BooleanC;
|
|
16
|
+
NameSpace: t.StringC;
|
|
17
|
+
}>>;
|
|
18
|
+
/**
|
|
19
|
+
* Record of key in a key archive
|
|
20
|
+
*
|
|
21
|
+
* @property NameSpace
|
|
22
|
+
* NameSpace to which the key belongs.
|
|
23
|
+
*
|
|
24
|
+
* @property Name
|
|
25
|
+
* Name of the key within the namespace
|
|
26
|
+
*
|
|
27
|
+
* @property Type
|
|
28
|
+
* Type of the key (also implies key format)
|
|
29
|
+
*
|
|
30
|
+
* @property Data
|
|
31
|
+
* Base64 encoded key data
|
|
32
|
+
*
|
|
33
|
+
* @property Synchronizable
|
|
34
|
+
* Whether key should be synced out of band of archiving.
|
|
35
|
+
* For future use - always false for now.
|
|
36
|
+
*
|
|
37
|
+
* @property Exportable
|
|
38
|
+
* Whether restored key should be exportable. Always true on archive.
|
|
39
|
+
* For future use on unarchive.
|
|
40
|
+
*/
|
|
41
|
+
export declare type KeyArchiveKeyInfo = t.TypeOf<typeof KeyArchiveKeyInfoCodec>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyArchiveKeyInfoArrayCodec = exports.KeyArchiveKeyInfoCodec = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
6
|
+
const keyType_1 = require("./keyType");
|
|
7
|
+
const KeyArchiveKeyInfoRequiredProps = {
|
|
8
|
+
Name: t.string,
|
|
9
|
+
Type: keyType_1.KeyArchiveKeyTypeCodec,
|
|
10
|
+
Data: t.string,
|
|
11
|
+
Synchronizable: t.boolean,
|
|
12
|
+
Exportable: t.boolean,
|
|
13
|
+
NameSpace: t.string,
|
|
14
|
+
};
|
|
15
|
+
exports.KeyArchiveKeyInfoCodec = t.type(KeyArchiveKeyInfoRequiredProps, 'KeyArchiveKeyInfo');
|
|
16
|
+
exports.KeyArchiveKeyInfoArrayCodec = t.array(exports.KeyArchiveKeyInfoCodec, 'KeyArchiveKeyInfoArray');
|
|
17
|
+
//# sourceMappingURL=keyInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyInfo.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/keyInfo.ts"],"names":[],"mappings":";;;;AAAA,iDAA0B;AAE1B,uCAAkD;AAElD,MAAM,8BAA8B,GAAG;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,IAAI,EAAE,gCAAsB;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,cAAc,EAAE,CAAC,CAAC,OAAO;IACzB,UAAU,EAAE,CAAC,CAAC,OAAO;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM;CACpB,CAAA;AAEY,QAAA,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAC1C,8BAA8B,EAC9B,mBAAmB,CACpB,CAAA;AAEY,QAAA,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAChD,8BAAsB,EACtB,wBAAwB,CACzB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
/**
|
|
3
|
+
* Key types supported in key archives
|
|
4
|
+
*
|
|
5
|
+
* These form part of the interoperable secure key archive format.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum KeyArchiveKeyType {
|
|
8
|
+
Password = "password",
|
|
9
|
+
PrivateKey = "privateKey",
|
|
10
|
+
PublicKey = "publicKey",
|
|
11
|
+
SymmetricKey = "symmetricKey"
|
|
12
|
+
}
|
|
13
|
+
export declare const KeyArchiveKeyTypeCodec: t.Type<KeyArchiveKeyType, string, unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyArchiveKeyTypeCodec = exports.KeyArchiveKeyType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
6
|
+
/**
|
|
7
|
+
* Key types supported in key archives
|
|
8
|
+
*
|
|
9
|
+
* These form part of the interoperable secure key archive format.
|
|
10
|
+
*/
|
|
11
|
+
var KeyArchiveKeyType;
|
|
12
|
+
(function (KeyArchiveKeyType) {
|
|
13
|
+
// Byte array of secret data - to be stored and retrievable using *Password
|
|
14
|
+
// methods on key managers
|
|
15
|
+
KeyArchiveKeyType["Password"] = "password";
|
|
16
|
+
// PKCS8 PrivateKey encoded RSA private key
|
|
17
|
+
KeyArchiveKeyType["PrivateKey"] = "privateKey";
|
|
18
|
+
// SPKI encoded RSA public key
|
|
19
|
+
KeyArchiveKeyType["PublicKey"] = "publicKey";
|
|
20
|
+
// Byte array of AES symmetric key
|
|
21
|
+
KeyArchiveKeyType["SymmetricKey"] = "symmetricKey";
|
|
22
|
+
})(KeyArchiveKeyType = exports.KeyArchiveKeyType || (exports.KeyArchiveKeyType = {}));
|
|
23
|
+
// Android is tolerating the following case insensitive alias key type
|
|
24
|
+
// names so we will do the same
|
|
25
|
+
const keyArchiveKeyTypeAlternatives = {
|
|
26
|
+
password: KeyArchiveKeyType.Password,
|
|
27
|
+
privatekey: KeyArchiveKeyType.PrivateKey,
|
|
28
|
+
private_key: KeyArchiveKeyType.PrivateKey,
|
|
29
|
+
publickey: KeyArchiveKeyType.PublicKey,
|
|
30
|
+
public_key: KeyArchiveKeyType.PublicKey,
|
|
31
|
+
symmetrickey: KeyArchiveKeyType.SymmetricKey,
|
|
32
|
+
symmetric_key: KeyArchiveKeyType.SymmetricKey,
|
|
33
|
+
};
|
|
34
|
+
const failureMessage = `Key type is not one of: ${Object.keys(keyArchiveKeyTypeAlternatives).join(',')}`; // eslint-disable-line tree-shaking/no-side-effects-in-initialization
|
|
35
|
+
const isKeyArchiveKeyType = (u) => t.string.is(u) && keyArchiveKeyTypeAlternatives[u.toLowerCase()] !== undefined;
|
|
36
|
+
exports.KeyArchiveKeyTypeCodec = new t.Type('KeyArchiveKeyType', isKeyArchiveKeyType, (u, c) => isKeyArchiveKeyType(u)
|
|
37
|
+
? t.success(keyArchiveKeyTypeAlternatives[u.toLowerCase()])
|
|
38
|
+
: t.failure(u, c, failureMessage), t.identity);
|
|
39
|
+
//# sourceMappingURL=keyType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyType.js","sourceRoot":"","sources":["../../src/sudoKeyArchive/keyType.ts"],"names":[],"mappings":";;;;AAAA,iDAA0B;AAE1B;;;;GAIG;AACH,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC3B,2EAA2E;IAC3E,0BAA0B;IAC1B,0CAAqB,CAAA;IAErB,2CAA2C;IAC3C,8CAAyB,CAAA;IAEzB,8BAA8B;IAC9B,4CAAuB,CAAA;IAEvB,kCAAkC;IAClC,kDAA6B,CAAA;AAC/B,CAAC,EAbW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAa5B;AAED,sEAAsE;AACtE,+BAA+B;AAC/B,MAAM,6BAA6B,GAAsC;IACvE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;IACpC,UAAU,EAAE,iBAAiB,CAAC,UAAU;IACxC,WAAW,EAAE,iBAAiB,CAAC,UAAU;IACzC,SAAS,EAAE,iBAAiB,CAAC,SAAS;IACtC,UAAU,EAAE,iBAAiB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