Skip to content

Instantly share code, notes, and snippets.

View daviddahl's full-sized avatar
💭
burning the midnight oil

David Dahl daviddahl

💭
burning the midnight oil
View GitHub Profile
/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
// Difference between Container Encryption and Item Encryption
// (Short answer: Item Encryption & decryption is identical to container encryoption and decryoption, just 1 step & simpler with no diffs, etc)
// Containers Encryption:
// https://github.com/SpiderOak/crypton/blob/a7e6a76f0c099ef2762c27f85f474bfb1c62727b/client/src/session.js#L663-L699
var selfPeer = new crypton.Peer({
session: this,
pubKey: this.account.pubKey,
signKeyPub: this.account.signKeyPub
@daviddahl
daviddahl / gist:1095855
Created July 20, 2011 20:31 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
function base64ArrayBuffer(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
@daviddahl
daviddahl / recycle.js
Created August 30, 2012 16:25
recycle collection data
function RecyclingDataCollector(){}
RecyclingDataCollector.prototype = {
collectWeight: function _collectWeight(type, weight, max)
{
var err;
if (!weight || !type) {
error("Weight and Type are required args");
}
var result;
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
@daviddahl
daviddahl / bridgeapi.js
Created October 10, 2012 19:43
DOM Crypto "Bridge" API
//
@daviddahl
daviddahl / Kloak QA Plan 1
Last active October 14, 2015 19:02
A plan for anyone testing Kloak to follow, Private Beta (Copy this Gist to begin)
Name:
Date/Time:
Kloak Version:
1. Install Kloak from Apple Test Flight
* Bugs, Problems:
---
@daviddahl
daviddahl / scema.diff
Created November 11, 2015 19:11
Diff from HEAD to the current production database
diff --git a/928a5500234abb5db508ba07b1d2f6c385fe8d19:server/lib/stores/postgres/sql/setup.sql b/HEAD:server/lib/stores/postgres/sql/setup.sql
index ed69e77..1091725 100644
--- a/928a5500234abb5db508ba07b1d2f6c385fe8d19:server/lib/stores/postgres/sql/setup.sql
+++ b/HEAD:server/lib/stores/postgres/sql/setup.sql
@@ -620,4 +620,165 @@ create unique index transaction_delete_message_msg_id_idx
on transaction_delete_message
(transaction_id, message_id);
+
+create table item (
begin;
create table item (
item_id int8 not null primary key default nextval('version_identifier'),
account_id int8 not null references account,
name_hmac bytea not null unique,
creation_time timestamp not null default current_timestamp,
modified_time timestamp not null default current_timestamp,
deletion_time timestamp,
value bytea,
@daviddahl
daviddahl / nsINaCl.diff
Created March 7, 2013 03:17
NaCl in Gecko: Brian Warner and David Dahl
diff --git a/security/manager/ssl/public/Makefile.in b/security/manager/ssl/public/Makefile.in
index 07eedf7..4269d53 100644
--- a/security/manager/ssl/public/Makefile.in
+++ b/security/manager/ssl/public/Makefile.in
@@ -102,6 +102,7 @@ XPIDLSRCS = \
nsIKeyModule.idl \
nsIProtectedAuthThread.idl \
nsIDataSignatureVerifier.idl \
+ nsINACL.idl \
$(NULL)