Skip to content

Commit

Permalink
refactor: shortened newFromProviderAndKeyPairHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
WyvernIXTL committed Feb 19, 2025
1 parent 4c036df commit 58cdb80
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/crypto-layer/CryptoAsymmetricKeyHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,9 @@ export class CryptoAsymmetricKeyHandle extends CryptoSerializableAsync {
): Promise<T> {
const result = new this();

if (other?.providerName) {
result.providerName = other.providerName;
} else {
result.providerName = await provider.providerName();
}

if (other?.keyId) {
result.id = other.keyId;
} else {
result.id = await keyPairHandle.id();
}

if (other?.keySpec) {
result.spec = other.keySpec;
} else {
result.spec = await keyPairHandle.spec();
}
result.providerName = other?.providerName ?? (await provider.providerName());
result.id = other?.keyId ?? (await keyPairHandle.id());
result.spec = other?.keySpec ?? (await keyPairHandle.spec());

result.provider = provider;
result.keyPairHandle = keyPairHandle;
Expand Down

0 comments on commit 58cdb80

Please sign in to comment.