MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / wrapKeyPair

Function wrapKeyPair

packages/@stdlib/crypto/src/keys/key-pair.ts:4–32  ·  view source on GitHub ↗
(publicKey: PublicKey, privateKey: PrivateKey)

Source from the content-addressed store, hash-verified

2import type { PublicKey } from './public-key';
3
4export function wrapKeyPair(publicKey: PublicKey, privateKey: PrivateKey) {
5 return new (class KeyPair {
6 get publicKey() {
7 return publicKey;
8 }
9 get privateKey() {
10 return privateKey;
11 }
12
13 encrypt(
14 plaintext: Uint8Array,
15 recipientsPublicKey: PublicKey,
16 params?: { padding?: boolean },
17 ): Uint8Array {
18 return privateKey.encrypt(
19 plaintext,
20 recipientsPublicKey,
21 publicKey,
22 params,
23 );
24 }
25 decrypt(
26 ciphertext: Uint8Array,
27 params?: { padding?: boolean },
28 ): Uint8Array {
29 return privateKey.decrypt(ciphertext, params);
30 }
31 })();
32}
33
34export type KeyPair = ReturnType<typeof wrapKeyPair>;

Callers 4

generateRandomUserKeysFunction · 0.90
generateGroupValuesFunction · 0.90
tryRefreshTokensFunction · 0.90
step2Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected