You can pass an array to it, example that is not copy-paste ready
pubKeySelect ïs an html select list:
var pubKeySelect = document.getElementById("pubKeySelect");// Build Public
Keys list from selected for (k=0; k < pubKeySelect.options.length ; k++) {
if (pubKeySelect.options[k].selected) {
pubKeys=pubKeys.concat(openpgp.key.readArmored(pubKeySelect.options[k].value).keys);
} }
openpgp.encryptMessage(pubKeys, msg).then( function(pgpMessage) {
Then console.log(pgpMessage)
Barry
> Date: Thu, 26 Mar 2015 17:31:43 +0100
> From: [email protected]
> To: [email protected]
> Subject: [openpgpjs] How to encode with multiple keys.
>
> I can not figure out how to encode a message with multiple keys
>
> I read:
> /**
> * Reads an OpenPGP armored text and returns one or multiple key objects
> * @param {String} armoredText text to be parsed
> * @return {{keys: Array<module:key~Key>, err: (Array<Error>|null)}}
> result object with key and error arrays
> * @static
> */
> function readArmored(armoredText) {
> var result = {};
> result.keys = [];
> try {
> var input = armor.decode(armoredText); <======== This one
>
> ends up in
> /encoding/armor.js
> function dearmor(text) {
> ..//
> result = {
> data: base64.decode(msg_sum.body),
> headers: msg.headers,
> type: type
> };
> ..//
> And is not pushed to an array
> .//
> return result;
> }
> Looks to me like only one key is used (the first) and returned
>
> Am I missing something or is this something that should be implemented?
>
> Regards and thank you for all the work already done!
>
>
> _______________________________________________
>
> http://openpgpjs.org
> Subscribe/unsubscribe: http://list.openpgpjs.org
_______________________________________________
http://openpgpjs.org
Subscribe/unsubscribe: http://list.openpgpjs.org