Skip to content

Commit e624f92

Browse files
rename unwrapKey -> unwrapSymmetricKey
1 parent 28f9ee2 commit e624f92

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

packages/fdc3-security/src/encryption/EncryptingChannelDelegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class EncryptingChannelDelegate extends AbstractChannelDelegate implement
4343
this.keyUnwrapFunction = keyUnwrapFunction;
4444
} else {
4545
if (typeof (fdc3Security as any).unwrapKey === 'function') {
46-
this.keyUnwrapFunction = ctx => (fdc3Security as PrivateFDC3Security).unwrapKey(ctx);
46+
this.keyUnwrapFunction = ctx => (fdc3Security as PrivateFDC3Security).unwrapSymmetricKey(ctx);
4747
} else {
4848
throw new Error(
4949
'Must provide keyUnwrapFunction or a PrivateFDC3Security implementation that supports unwrapKey'

packages/fdc3-security/src/encryption/EncryptingPrivateChannel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export interface EncryptingPrivateChannel extends PrivateChannel {
123123
* @example
124124
* ```typescript
125125
* // After receiving a wrapped key response
126-
* const unwrappedKey = await security.unwrapKey(wrappedKeyResponse);
126+
* const unwrappedKey = await security.unwrapSymmetricKey(wrappedKeyResponse);
127127
* await channel.setSymmetricKey(unwrappedKey);
128128
* // Channel can now decrypt incoming messages
129129
* ```

packages/fdc3-security/src/encryption/SymmetricKeyContextListener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function createSymmetricKeyResponseContextListener(
5555

5656
if (ma?.signed && ma.trusted && ma.valid) {
5757
const skr = context as SymmetricKeyResponse;
58-
const key = await fdc3Security.unwrapKey(skr);
58+
const key = await fdc3Security.unwrapSymmetricKey(skr);
5959
if (key) {
6060
channel.setSymmetricKey(key);
6161
}

packages/fdc3-security/src/impl/JosePrivateFDC3Security.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class JosePrivateFDC3Security extends JosePublicFDC3Security implements P
111111
};
112112
}
113113

114-
async unwrapKey(ctx: SymmetricKeyResponse): Promise<JsonWebKey> {
114+
async unwrapSymmetricKey(ctx: SymmetricKeyResponse): Promise<JsonWebKey> {
115115
const key = await jose.importJWK(this.wrappingPrivateKey, this.algorithms.keyWrapping);
116116
const result = await jose.compactDecrypt(ctx.wrappedKey, key);
117117
const jsonString = new TextDecoder().decode(result.plaintext);

packages/fdc3-security/src/impl/PrivateFDC3Security.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface PrivateFDC3Security extends PublicFDC3Security {
5353
* @returns A promise resolving to the unwrapped symmetric key in JWK format
5454
* @throws Error if unwrapping fails
5555
*/
56-
unwrapKey(ctx: SymmetricKeyResponse): Promise<JsonWebKey>;
56+
unwrapSymmetricKey(ctx: SymmetricKeyResponse): Promise<JsonWebKey>;
5757

5858
/**
5959
* Create a signed JWT token for user identity.

packages/fdc3-security/test/FDC3Security.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ describe('JosePrivateFDC3Security', () => {
179179
const symmetricJWK = await sender.createSymmetricKey();
180180

181181
// Sender wraps the symmetric key for the receiver
182-
const wrappedKeyResponse = await sender.wrapKey(symmetricJWK, receiverBaseUrl);
182+
const wrappedKeyResponse = await sender.wrapSymmetricKey(symmetricJWK, receiverBaseUrl);
183183

184184
// Verify the wrapped key response structure
185185
expect(wrappedKeyResponse.type).toBe('fdc3.security.symmetricKeyResponse');
186186
expect(wrappedKeyResponse.id.pki).toBe(receiverBaseUrl);
187187
expect(wrappedKeyResponse.wrappedKey).toBeDefined();
188188

189189
// Receiver unwraps the symmetric key
190-
const unwrappedKey = await receiver.unwrapKey(wrappedKeyResponse);
190+
const unwrappedKey = await receiver.unwrapSymmetricKey(wrappedKeyResponse);
191191

192192
// Verify the unwrapped key matches the original
193193
expect(unwrappedKey).toEqual(symmetricJWK);

0 commit comments

Comments
 (0)