Skip to content

Instantly share code, notes, and snippets.

@transducer
transducer / device-client.js
Created June 4, 2018 16:41
Process an authorization revoked message
/**
* Process MAM message revoked: authorization
* @param message {Object} MAM message of type {@link AUTHORIZATION_REVOKED_TYPE}.
* @returns {undefined}
*/
processAuthorizationRevokedMessage(message) {
const newSideKey = DeviceClient.createSideKey();
this.authorizedServiceProviders.remove(message.policy.serviceProvider);
this.informUpdateSideKey(
this.authorizedServiceProviders.getAll(),
@transducer
transducer / device-client.js
Created June 4, 2018 16:48
Send encrypted MAM_DATA to a service provider.
/**
* Send encrypted MAM data to a service provider.
*
* @function sendMamData
* @param {string} seed IOTA seed of sender
* @param {string} address IOTA address of the service provider
* @param {string} publicKey Public key of the service provider in trytes
* @returns {Promise} containing IOTA transactions
*/
async sendMamData(seed, address, publicKey) {
@transducer
transducer / KEY_ROTATION
Last active June 4, 2018 17:02
Example KEY_ROTATION message
{
type: 'KEY_ROTATION,
// IOTA address Side key encrypted with authorized service provider's public key
TOBVJSE9FAAMQGJXYDB...: 'TYBD9HVRWENQKYLKRAKZOHNWJYMDTTVXGOP...',
CUEIYQBOFIYGRBMOEG9...: 'ACNIUSZKCMSSEQ9ILSEACKWLQWSYMRAZYIR...'
}
@transducer
transducer / defprogramming
Created November 28, 2018 16:56
defprogramming.org quotes in fortune file
"Formal education will make you a living. Self-education will make you a
fortune."
~ Jim Rohn
%
"Programming is not easy like Sunday morning, it is silent poetry."
~ Waseem Latif
%
"The best way to get the right answer on the internet is not to ask a question;
it's to post the wrong answer."
~ Cunningham's Law
@transducer
transducer / custom-resteasy-client.clj
Created November 6, 2023 15:13
Custom RESTEasy client for Keycloak in Clojure
(ns custom-resteasy-client
"Creates a custom `javax.ws.rs.client.Client` with settings for timeouts,
evicting idle connections and a retry handler. This client can be a
resteasyClient for KeycloakBuilder that does not lead to \"RESTEASY004655
Unable to invoke request: java.net.SocketException: Connection reset errors\"
according to the suggestion in
https://github.com/keycloak/keycloak/issues/8917#issuecomment-1712895984."
(:import
(java.util.concurrent TimeUnit)
(org.apache.http.impl.client DefaultHttpRequestRetryHandler HttpClients)