diff --git a/cli/src/cli.ts b/cli/src/cli.ts index 91af19d0..f0175f2c 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -536,7 +536,11 @@ export const handleArgs = (args: string[]) => { }, async (argv) => { log('DEBUG', 'Running decrypt command'); - const allowedKases = argv.allowList?.split(','); + let allowedKases = argv.allowList?.split(','); + if (!allowedKases) { + allowedKases = argv.kasEndpoint ? [argv.kasEndpoint] : []; + } + log('DEBUG', `Allowed KASes: ${allowedKases}`); const ignoreAllowList = !!argv.ignoreAllowList; const authProvider = await processAuth(argv); log('DEBUG', `Initialized auth provider ${JSON.stringify(authProvider)}`); diff --git a/lib/src/opentdf.ts b/lib/src/opentdf.ts index 7fd4186c..278bce0d 100644 --- a/lib/src/opentdf.ts +++ b/lib/src/opentdf.ts @@ -209,7 +209,7 @@ export class RewrapCache { } close() { - if (this.closer) { + if (this.closer !== undefined) { clearInterval(this.closer); delete this.closer; delete this.cache; diff --git a/lib/src/tdf/AttributeObject.ts b/lib/src/tdf/AttributeObject.ts index 340644b7..31ddf52e 100644 --- a/lib/src/tdf/AttributeObject.ts +++ b/lib/src/tdf/AttributeObject.ts @@ -7,8 +7,6 @@ export interface AttributeObject { /** PEM encoded public key */ readonly pubKey: string; readonly kasUrl: string; - /** The most recent version 1.1.0. */ - readonly schemaVersion?: string; } export async function createAttribute( @@ -22,6 +20,5 @@ export async function createAttribute( displayName: '', pubKey: pubKey.publicKey, kasUrl, - schemaVersion: '1.1.0', }; } diff --git a/lib/src/tdf/Policy.ts b/lib/src/tdf/Policy.ts index da0dfd98..035b6261 100644 --- a/lib/src/tdf/Policy.ts +++ b/lib/src/tdf/Policy.ts @@ -7,7 +7,6 @@ export class Policy { private uuidStr = uuid(); private dataAttributesList: AttributeObject[] = []; private dissemList: string[] = []; - // private schemaVersionStr = Policy.CURRENT_VERSION; /** * Adds a group of entities, to the Policy's dissem list diff --git a/lib/src/tdf/PolicyObject.ts b/lib/src/tdf/PolicyObject.ts index 0002c016..5dfa3ee2 100644 --- a/lib/src/tdf/PolicyObject.ts +++ b/lib/src/tdf/PolicyObject.ts @@ -8,5 +8,4 @@ export interface PolicyObjectBody { export interface PolicyObject { readonly uuid: string; readonly body: PolicyObjectBody; - readonly schemaVersion?: string; } diff --git a/lib/tdf3/src/models/manifest.ts b/lib/tdf3/src/models/manifest.ts index 4dffa8b8..9fb666e7 100644 --- a/lib/tdf3/src/models/manifest.ts +++ b/lib/tdf3/src/models/manifest.ts @@ -6,5 +6,7 @@ export type Manifest = { payload: Payload; encryptionInformation: EncryptionInformation; assertions: Assertion[]; - tdf_spec_version: string; + schemaVersion: string; + // Deprecated + tdf_spec_version?: string; }; diff --git a/lib/tdf3/src/models/policy.ts b/lib/tdf3/src/models/policy.ts index 589ec1db..89514153 100644 --- a/lib/tdf3/src/models/policy.ts +++ b/lib/tdf3/src/models/policy.ts @@ -9,7 +9,6 @@ export type PolicyBody = { }; export type Policy = { - tdf_spec_version?: string; uuid?: string; body?: PolicyBody; }; diff --git a/lib/tdf3/src/tdf.ts b/lib/tdf3/src/tdf.ts index 9f2c9861..ee405c86 100644 --- a/lib/tdf3/src/tdf.ts +++ b/lib/tdf3/src/tdf.ts @@ -261,7 +261,6 @@ async function _generateManifest( url: '0.payload', protocol: 'zip', isEncrypted: true, - schemaVersion: '3.0.0', ...(mimeType && { mimeType }), }; @@ -272,7 +271,7 @@ async function _generateManifest( // generate the manifest first, then insert integrity information into it encryptionInformation: encryptionInformationStr, assertions: assertions, - tdf_spec_version: tdfSpecVersion, + schemaVersion: tdfSpecVersion, }; } @@ -887,7 +886,8 @@ export async function readStream(cfg: DecryptConfiguration) { const encryptedSegmentSizeDefault = defaultSegmentSize || DEFAULT_SEGMENT_SIZE; // check if the TDF is a legacy TDF - const isLegacyTDF = !manifest.tdf_spec_version; + const specVersion = manifest.schemaVersion || manifest.tdf_spec_version; + const isLegacyTDF = !specVersion || specVersion.startsWith('3.'); // Decode each hash and store it in an array of Uint8Array const segmentHashList = segments.map(