Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sdk): Prefer named, direct exports #401

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
DefaultParams,
} from './nanotdf/index.js';
import { keyAgreement } from './nanotdf-crypto/index.js';
import { TypedArray, createAttribute, Policy } from './tdf/index.js';
import { Policy } from './tdf/Policy.js';
import { type TypedArray } from './tdf/TypedArray.js';
import { createAttribute } from './tdf/AttributeObject.js';
import { fetchECKasPubKey } from './access.js';
import { ClientConfig } from './nanotdf/Client.js';
import { ConfigurationError } from './errors.js';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf-crypto/digest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedArray } from '../tdf/index.js';
import { TypedArray } from '../tdf/TypedArray.js';

export default function digest(
hashType: AlgorithmIdentifier,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf/Client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type TypedArray } from '../tdf/index.js';
import { type TypedArray } from '../tdf/TypedArray.js';
import * as base64 from '../encodings/base64.js';
import { generateKeyPair, keyAgreement } from '../nanotdf-crypto/index.js';
import getHkdfSalt from './helpers/getHkdfSalt.js';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf/NanoTDF.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedArray } from '../tdf/index.js';
import { TypedArray } from '../tdf/TypedArray.js';
import { base64 } from '../encodings/index.js';
import Header from './models/Header.js';
import Payload from './models/Payload.js';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf/encrypt-dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Header from './models/Header.js';
import DefaultParams from './models/DefaultParams.js';
import Payload from './models/Payload.js';
import { getBitLength as authTagLengthForCipher } from './models/Ciphers.js';
import TypedArray from '../tdf/TypedArray.js';
import { TypedArray } from '../tdf/TypedArray.js';
import encrypt from '../nanotdf-crypto/encrypt.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import EmbeddedPolicy from './models/Policy/EmbeddedPolicy.js';
import Payload from './models/Payload.js';
import getHkdfSalt from './helpers/getHkdfSalt.js';
import { getBitLength as authTagLengthForCipher } from './models/Ciphers.js';
import { TypedArray } from '../tdf/index.js';
import { TypedArray } from '../tdf/TypedArray.js';
import { GMAC_BINDING_LEN } from './constants.js';
import { AlgorithmName, KeyFormat, KeyUsageType } from './../nanotdf-crypto/enums.js';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanotdf/helpers/getHkdfSalt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedArray } from '../../tdf/index.js';
import { TypedArray } from '../../tdf/TypedArray.js';

import { digest, enums } from '../../nanotdf-crypto/index.js';

Expand Down
42 changes: 0 additions & 42 deletions lib/src/tdf/Crypto.ts

This file was deleted.

2 changes: 1 addition & 1 deletion lib/src/tdf/Policy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type AttributeObject } from './AttributeObject.js';
import { v4 as uuid } from 'uuid';

export default class Policy {
export class Policy {
static CURRENT_VERSION = '1.1.0';

private uuidStr = uuid();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/tdf/PolicyObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface PolicyObjectBody {
readonly dissem: string[];
}

export default interface PolicyObject {
export interface PolicyObject {
readonly uuid: string;
readonly body: PolicyObjectBody;
readonly schemaVersion?: string;
Expand Down
4 changes: 1 addition & 3 deletions lib/src/tdf/TypedArray.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type TypedArray =
export type TypedArray =
| Int8Array
| Uint8Array
| Int16Array
Expand All @@ -8,5 +8,3 @@ type TypedArray =
| Uint8ClampedArray
| Float32Array
| Float64Array;

export default TypedArray;
5 changes: 0 additions & 5 deletions lib/src/tdf/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion lib/tdf3/src/tdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { htmlWrapperTemplate } from './templates/index.js';
// TODO: remove dependencies from ciphers so that we can open-source instead of relying on other Virtru libs
import { AesGcmCipher } from './ciphers/index.js';
import { type AuthProvider, reqSignature } from '../../src/auth/auth.js';
import PolicyObject from '../../src/tdf/PolicyObject.js';
import { PolicyObject } from '../../src/tdf/PolicyObject.js';
import { type CryptoService, type DecryptResult } from './crypto/declarations.js';
import { CentralDirectory } from './utils/zip-reader.js';
import { SymmetricCipher } from './ciphers/symmetric-cipher-base.js';
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/mocha/unit/builders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { type AttributeObject } from '../../../src/tdf/index.js';
import { type AttributeObject } from '../../../src/tdf/AttributeObject.js';
import { EncryptParamsBuilder } from '../../../tdf3/src/client/builders.js';

const aex = {
Expand Down
Loading