* It decrypts armored node hash key and verifies embeded signature. * * Note: The function doesn't throw in case of verification issue. * You have to read `verified` result and act based on that.
(
armoredHashKey: string,
decryptionAndVerificationKey: PrivateKey,
extraVerificationKeys: PublicKey[],
)
| 513 | * You have to read `verified` result and act based on that. |
| 514 | */ |
| 515 | async decryptNodeHashKey( |
| 516 | armoredHashKey: string, |
| 517 | decryptionAndVerificationKey: PrivateKey, |
| 518 | extraVerificationKeys: PublicKey[], |
| 519 | ): Promise<{ |
| 520 | hashKey: Uint8Array<ArrayBuffer>; |
| 521 | verified: VERIFICATION_STATUS; |
| 522 | verificationErrors?: Error[]; |
| 523 | }> { |
| 524 | // In the past, we had misunderstanding what key is used to sign hash |
| 525 | // key. Originally, it meant to be the node key, which web used for all |
| 526 | // nodes besides the root one, where address key was used instead. |
| 527 | // Similarly, iOS or Android used address key for all nodes. Latest |
| 528 | // versions should use node key in all cases, but we accept also |
| 529 | // address key. Its still signed with a valid key. |
| 530 | const { |
| 531 | data: hashKey, |
| 532 | verified, |
| 533 | verificationErrors, |
| 534 | } = await this.openPGPCrypto.decryptArmoredAndVerify( |
| 535 | armoredHashKey, |
| 536 | [decryptionAndVerificationKey], |
| 537 | [decryptionAndVerificationKey, ...extraVerificationKeys], |
| 538 | ); |
| 539 | return { |
| 540 | hashKey, |
| 541 | verified, |
| 542 | verificationErrors, |
| 543 | }; |
| 544 | } |
| 545 | |
| 546 | async encryptExtendedAttributes( |
| 547 | extendedAttributes: string, |
no test coverage detected