Skip to content

Commit

Permalink
Merge pull request #244 from dajiaji/remove-kem-init
Browse files Browse the repository at this point in the history
Remove init() from KemInterface.
  • Loading branch information
dajiaji authored Aug 11, 2023
2 parents 109a852 + b3a1254 commit 9079b4e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 206 deletions.
1 change: 0 additions & 1 deletion src/cipherSuiteNative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ export class CipherSuiteNative {
return;
}
const api = await loadSubtleCrypto();
this._kem.init(api as SubtleCrypto);
this._kdf.init(api as SubtleCrypto, this._suiteId);
this._aead.init(api as SubtleCrypto);
this._api = api;
Expand Down
10 changes: 0 additions & 10 deletions src/interfaces/kemInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ export interface KemInterface {
/** The length in bytes of an encoded private key for this KEM (Nsk). */
readonly privateKeySize: number;

/**
* Initializes the instance by setting a SubtleCrypto API.
*
* Basically, you don't need to call this function directly.
* This function is called by{@link CipherSuite} internally.
*
* @param api A SubtleCrypto API.
*/
init(api: SubtleCrypto): void;

/**
* Generates a key pair.
*
Expand Down
9 changes: 0 additions & 9 deletions src/kems/dhkem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ export class Dhkem extends Algorithm implements KemInterface {
this._kdf = kdf;
}

public init(api: SubtleCrypto): void {
super.init(api);
const suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);
suiteId.set(i2Osp(this.id, 2), 3);
this._prim.init(api);
this._kdf.init(api, suiteId);
super.init(api);
}

public async generateKeyPair(): Promise<CryptoKeyPair> {
await this._setup();
try {
Expand Down
Loading

0 comments on commit 9079b4e

Please sign in to comment.