APICreating an envelope

Creating an envelope

Message envelopes

		ArrayList<PublicKey> recipientPublicKeys = new ArrayList<>();
		recipientPublicKeys.add(publicKey1);
		recipientPublicKeys.add(publicKey2);
		...
		Record envelopeRecord = keyPair.createMessageEnvelope(store, contentReference, recipientPublicKeys);
		CondensationObject envelopeObject = envelopeRecord.toObject();
		Hash envelopeHash = envelopeObject.calculateHash();
	
		var recipientPublicKeys = [publicKey1, publicKey2, ...];
		var envelopeRecord = keyPair.createMessageEnvelope(store, contentReference, recipientPublicKeys);
		var envelopeObject = envelopeRecord.toObject();
		var envelopeHash = envelopeObject.calculateHash();
	
		my $recipientPublicKeys = [$publicKey1, $publicKey2, ...];
		my $envelopeRecord = $keyPair->createMessageEnvelope($store, $contentReference, $recipientPublicKeys);
		my $envelopeObject = $envelopeRecord->toObject;
		my $envelopeHash = $envelopeObject->calculateHash;
	

Creates a message envelope pointing to the given content reference on store. The envelope is signed with the key pair's private key, and the AES key is encrypted for each recipient.

		Record envelopeRecord = keyPair.createInlineMessageEnvelope(store, messageRecord, recipientPublicKeys);
	
		var envelopeRecord = keyPair.createInlineMessageEnvelope(store, messageRecord, recipientPublicKeys);
	
		my $envelopeRecord = $keyPair->createInlineMessageEnvelope($store, $messageRecord, $recipientPublicKeys);
	

As above, but inlines a small message into the envelope. Note that stores may reject envelopes exceeding 16 KiB.

Private box envelopes

		ArrayList<PublicKey> recipientPublicKeys = new ArrayList<>();
		recipientPublicKeys.add(publicKey1);
		recipientPublicKeys.add(publicKey2);
		...
		Record envelopeRecord = keyPair.createPrivateEnvelope(contentReference, recipientPublicKeys);
		CondensationObject envelopeObject = envelopeRecord.toObject();
		Hash envelopeHash = envelopeObject.calculateHash();
	
		var recipientPublicKeys = [publicKey1, publicKey2, ...];
		var envelopeRecord = keyPair.createPrivateEnvelope(contentReference, recipientPublicKeys);
		var envelopeObject = envelopeRecord.toObject();
		var envelopeHash = envelopeObject.calculateHash();
	
		my $recipientPublicKeys = [$publicKey1, $publicKey2, ...];
		my $envelopeRecord = $keyPair->createPrivateEnvelope($contentReference, $recipientPublicKeys);
		my $envelopeObject = $envelopeRecord->toObject;
		my $envelopeHash = $envelopeObject->calculateHash;
	

Creates a private envelope pointing to the given content reference. The envelope is signed with the key pair's private key, and the AES key is encrypted for each recipient.

Public box envelopes

		Record envelopeRecord = keyPair.createPublicEnvelope(contentHash);
		CondensationObject envelopeObject = envelopeRecord.toObject();
		Hash envelopeHash = envelopeObject.calculateHash();
	
		var envelopeRecord = keyPair.createPublicEnvelope(contentHash);
		var envelopeObject = envelopeRecord.toObject();
		var envelopeHash = envelopeObject.calculateHash();
	
		my $envelopeRecord = $keyPair->createPublicEnvelope($contentHash);
		my $envelopeObject = $envelopeRecord->toObject;
		my $envelopeHash = $envelopeObject->calculateHash;
	

Creates a public envelope pointing to the given content hash. The envelope is signed with the key pair's private key.