Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@biscuit-auth/biscuit-wasm

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@biscuit-auth/biscuit-wasm - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

116

dist/biscuit.d.ts

@@ -15,11 +15,15 @@ /* tslint:disable */

/**
* @param {Biscuit} token
*/
add_token(token: Biscuit): void;
/**
* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_fact(fact: string): void;
add_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_rule(rule: string): void;
add_rule(rule: Rule): void;
/**

@@ -29,5 +33,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_check(check: string): void;
add_check(check: Check): void;
/**

@@ -39,5 +43,5 @@ * Adds a policy

* succeed
* @param {string} policy
* @param {Policy} policy
*/
add_policy(policy: string): void;
add_policy(policy: Policy): void;
/**

@@ -148,16 +152,16 @@ * Adds facts, rules, checks and policies as one code block

/**
* @param {KeyPair} root
* @param {PrivateKey} root
* @returns {Biscuit}
*/
build(root: KeyPair): Biscuit;
build(root: PrivateKey): Biscuit;
/**
* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_authority_fact(fact: string): void;
add_authority_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_authority_rule(rule: string): void;
add_authority_rule(rule: Rule): void;
/**

@@ -167,5 +171,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_authority_check(check: string): void;
add_authority_check(check: Check): void;
}

@@ -179,10 +183,10 @@ /**

* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_fact(fact: string): void;
add_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_rule(rule: string): void;
add_rule(rule: Rule): void;
/**

@@ -192,5 +196,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_check(check: string): void;
add_check(check: Check): void;
/**

@@ -203,2 +207,32 @@ * Adds facts, rules, checks and policies as one code block

/**
*/
export class Check {
free(): void;
/**
* @param {string} source
* @returns {Check}
*/
static from_str(source: string): Check;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
*/
export class Fact {
free(): void;
/**
* @param {string} source
* @returns {Fact}
*/
static from_str(source: string): Fact;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
* A pair of public and private key

@@ -222,2 +256,17 @@ */

*/
export class Policy {
free(): void;
/**
* @param {string} source
* @returns {Policy}
*/
static from_str(source: string): Policy;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
*/
export class PrivateKey {

@@ -240,3 +289,3 @@ free(): void;

*/
from_bytes(data: Uint8Array): PrivateKey;
static from_bytes(data: Uint8Array): PrivateKey;
/**

@@ -247,3 +296,3 @@ * Deserializes a private key from a hexadecimal string

*/
from_hex(data: string): PrivateKey;
static from_hex(data: string): PrivateKey;
}

@@ -270,3 +319,3 @@ /**

*/
from_bytes(data: Uint8Array): PublicKey;
static from_bytes(data: Uint8Array): PublicKey;
/**

@@ -277,3 +326,18 @@ * Deserializes a public key from a hexadecimal string

*/
from_hex(data: string): PublicKey;
static from_hex(data: string): PublicKey;
}
/**
*/
export class Rule {
free(): void;
/**
* @param {string} source
* @returns {Rule}
*/
static from_str(source: string): Rule;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}

@@ -5,20 +5,4 @@ let imports = {};

let wasm;
const { TextDecoder, TextEncoder } = require(`util`);
const { TextEncoder, TextDecoder } = require(`util`);
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
let cachegetUint8Memory0 = null;
function getUint8Memory0() {
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory0;
}
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
const heap = new Array(32).fill(undefined);

@@ -28,32 +12,14 @@

let heap_next = heap.length;
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
function getObject(idx) { return heap[idx]; }
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
function isLikeNone(x) {
return x === undefined || x === null;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
let cachegetFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return instance.ptr;
return cachegetFloat64Memory0;
}

@@ -71,7 +37,8 @@

function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
let cachegetUint8Memory0 = null;
function getUint8Memory0() {
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory0;
}

@@ -132,2 +99,47 @@

let heap_next = heap.length;
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function getArrayU8FromWasm0(ptr, len) {

@@ -197,4 +209,13 @@ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);

/**
* @param {Biscuit} token
*/
add_token(token) {
_assertClass(token, Biscuit);
var ptr0 = token.ptr;
token.ptr = 0;
wasm.authorizer_add_token(this.ptr, ptr0);
}
/**
* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/

@@ -204,5 +225,6 @@ add_fact(fact) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(fact, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.authorizer_add_fact(retptr, this.ptr, ptr0, len0);
_assertClass(fact, Fact);
var ptr0 = fact.ptr;
fact.ptr = 0;
wasm.authorizer_add_fact(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -219,3 +241,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/

@@ -225,5 +247,6 @@ add_rule(rule) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.authorizer_add_rule(retptr, this.ptr, ptr0, len0);
_assertClass(rule, Rule);
var ptr0 = rule.ptr;
rule.ptr = 0;
wasm.authorizer_add_rule(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -242,3 +265,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/

@@ -248,5 +271,6 @@ add_check(check) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(check, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.authorizer_add_check(retptr, this.ptr, ptr0, len0);
_assertClass(check, Check);
var ptr0 = check.ptr;
check.ptr = 0;
wasm.authorizer_add_check(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -267,3 +291,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* succeed
* @param {string} policy
* @param {Policy} policy
*/

@@ -273,5 +297,6 @@ add_policy(policy) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.authorizer_add_policy(retptr, this.ptr, ptr0, len0);
_assertClass(policy, Policy);
var ptr0 = policy.ptr;
policy.ptr = 0;
wasm.authorizer_add_policy(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -608,3 +633,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

/**
* @param {KeyPair} root
* @param {PrivateKey} root
* @returns {Biscuit}

@@ -616,3 +641,3 @@ */

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(root, KeyPair);
_assertClass(root, PrivateKey);
wasm.biscuitbuilder_build(retptr, ptr, root.ptr);

@@ -632,3 +657,3 @@ var r0 = getInt32Memory0()[retptr / 4 + 0];

* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/

@@ -638,5 +663,6 @@ add_authority_fact(fact) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(fact, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.biscuitbuilder_add_authority_fact(retptr, this.ptr, ptr0, len0);
_assertClass(fact, Fact);
var ptr0 = fact.ptr;
fact.ptr = 0;
wasm.biscuitbuilder_add_authority_fact(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -653,3 +679,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/

@@ -659,5 +685,6 @@ add_authority_rule(rule) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.biscuitbuilder_add_authority_rule(retptr, this.ptr, ptr0, len0);
_assertClass(rule, Rule);
var ptr0 = rule.ptr;
rule.ptr = 0;
wasm.biscuitbuilder_add_authority_rule(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -676,3 +703,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/

@@ -682,5 +709,6 @@ add_authority_check(check) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(check, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.biscuitbuilder_add_authority_check(retptr, this.ptr, ptr0, len0);
_assertClass(check, Check);
var ptr0 = check.ptr;
check.ptr = 0;
wasm.biscuitbuilder_add_authority_check(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -722,3 +750,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/

@@ -728,5 +756,6 @@ add_fact(fact) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(fact, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.blockbuilder_add_fact(retptr, this.ptr, ptr0, len0);
_assertClass(fact, Fact);
var ptr0 = fact.ptr;
fact.ptr = 0;
wasm.blockbuilder_add_fact(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -743,3 +772,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/

@@ -749,5 +778,6 @@ add_rule(rule) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.blockbuilder_add_rule(retptr, this.ptr, ptr0, len0);
_assertClass(rule, Rule);
var ptr0 = rule.ptr;
rule.ptr = 0;
wasm.biscuitbuilder_add_authority_rule(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -766,3 +796,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/

@@ -772,5 +802,6 @@ add_check(check) {

const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(check, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.blockbuilder_add_check(retptr, this.ptr, ptr0, len0);
_assertClass(check, Check);
var ptr0 = check.ptr;
check.ptr = 0;
wasm.biscuitbuilder_add_authority_check(retptr, this.ptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -807,2 +838,130 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

/**
*/
class Check {
static __wrap(ptr) {
const obj = Object.create(Check.prototype);
obj.ptr = ptr;
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_check_free(ptr);
}
/**
* @param {string} source
* @returns {Check}
*/
static from_str(source) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.check_from_str(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return Check.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {string} name
* @param {any} value
*/
set(name, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.check_set(retptr, this.ptr, ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.Check = Check;
/**
*/
class Fact {
static __wrap(ptr) {
const obj = Object.create(Fact.prototype);
obj.ptr = ptr;
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_fact_free(ptr);
}
/**
* @param {string} source
* @returns {Fact}
*/
static from_str(source) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.fact_from_str(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return Fact.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {string} name
* @param {any} value
*/
set(name, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.fact_set(retptr, this.ptr, ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.Fact = Fact;
/**
* A pair of public and private key

@@ -854,2 +1013,66 @@ */

*/
class Policy {
static __wrap(ptr) {
const obj = Object.create(Policy.prototype);
obj.ptr = ptr;
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_policy_free(ptr);
}
/**
* @param {string} source
* @returns {Policy}
*/
static from_str(source) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.policy_from_str(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return Policy.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {string} name
* @param {any} value
*/
set(name, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.policy_set(retptr, this.ptr, ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.Policy = Policy;
/**
*/
class PrivateKey {

@@ -917,3 +1140,3 @@

*/
from_bytes(data) {
static from_bytes(data) {
try {

@@ -923,3 +1146,3 @@ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);

var len0 = WASM_VECTOR_LEN;
wasm.privatekey_from_bytes(retptr, this.ptr, ptr0, len0);
wasm.privatekey_from_bytes(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -941,3 +1164,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

*/
from_hex(data) {
static from_hex(data) {
try {

@@ -947,3 +1170,3 @@ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);

var len0 = WASM_VECTOR_LEN;
wasm.privatekey_from_hex(retptr, this.ptr, ptr0, len0);
wasm.privatekey_from_hex(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -1027,3 +1250,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

*/
from_bytes(data) {
static from_bytes(data) {
try {

@@ -1033,3 +1256,3 @@ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);

var len0 = WASM_VECTOR_LEN;
wasm.publickey_from_bytes(retptr, this.ptr, ptr0, len0);
wasm.publickey_from_bytes(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -1051,3 +1274,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

*/
from_hex(data) {
static from_hex(data) {
try {

@@ -1057,3 +1280,3 @@ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);

var len0 = WASM_VECTOR_LEN;
wasm.publickey_from_hex(retptr, this.ptr, ptr0, len0);
wasm.publickey_from_hex(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -1072,12 +1295,97 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

module.exports.PublicKey = PublicKey;
/**
*/
class Rule {
module.exports.__wbg_log_c356e0b68ddd07b6 = function(arg0, arg1) {
console.log(getStringFromWasm0(arg0, arg1));
static __wrap(ptr) {
const obj = Object.create(Rule.prototype);
obj.ptr = ptr;
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_rule_free(ptr);
}
/**
* @param {string} source
* @returns {Rule}
*/
static from_str(source) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.rule_from_str(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return Rule.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {string} name
* @param {any} value
*/
set(name, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
wasm.rule_set(retptr, this.ptr, ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
}
module.exports.Rule = Rule;
module.exports.__wbindgen_boolean_get = function(arg0) {
const v = getObject(arg0);
var ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
return ret;
};
module.exports.__wbindgen_string_new = function(arg0, arg1) {
var ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
module.exports.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
var ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
module.exports.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
var ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
module.exports.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
module.exports.__wbg_log_0aa4360e666c80c6 = function(arg0, arg1) {
console.log(getStringFromWasm0(arg0, arg1));
};
module.exports.__wbindgen_json_parse = function(arg0, arg1) {

@@ -1088,2 +1396,7 @@ var ret = JSON.parse(getStringFromWasm0(arg0, arg1));

module.exports.__wbindgen_string_new = function(arg0, arg1) {
var ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
module.exports.__wbg_new_693216e109162396 = function() {

@@ -1110,6 +1423,2 @@ var ret = new Error();

module.exports.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
module.exports.__wbg_debug_6df4b1a327dd2e94 = function(arg0, arg1, arg2, arg3) {

@@ -1116,0 +1425,0 @@ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));

@@ -15,11 +15,15 @@ /* tslint:disable */

/**
* @param {Biscuit} token
*/
add_token(token: Biscuit): void;
/**
* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_fact(fact: string): void;
add_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_rule(rule: string): void;
add_rule(rule: Rule): void;
/**

@@ -29,5 +33,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_check(check: string): void;
add_check(check: Check): void;
/**

@@ -39,5 +43,5 @@ * Adds a policy

* succeed
* @param {string} policy
* @param {Policy} policy
*/
add_policy(policy: string): void;
add_policy(policy: Policy): void;
/**

@@ -148,16 +152,16 @@ * Adds facts, rules, checks and policies as one code block

/**
* @param {KeyPair} root
* @param {PrivateKey} root
* @returns {Biscuit}
*/
build(root: KeyPair): Biscuit;
build(root: PrivateKey): Biscuit;
/**
* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_authority_fact(fact: string): void;
add_authority_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_authority_rule(rule: string): void;
add_authority_rule(rule: Rule): void;
/**

@@ -167,5 +171,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_authority_check(check: string): void;
add_authority_check(check: Check): void;
}

@@ -179,10 +183,10 @@ /**

* Adds a Datalog fact
* @param {string} fact
* @param {Fact} fact
*/
add_fact(fact: string): void;
add_fact(fact: Fact): void;
/**
* Adds a Datalog rule
* @param {string} rule
* @param {Rule} rule
*/
add_rule(rule: string): void;
add_rule(rule: Rule): void;
/**

@@ -192,5 +196,5 @@ * Adds a check

* All checks, from authorizer and token, must be validated to authorize the request
* @param {string} check
* @param {Check} check
*/
add_check(check: string): void;
add_check(check: Check): void;
/**

@@ -203,2 +207,32 @@ * Adds facts, rules, checks and policies as one code block

/**
*/
export class Check {
free(): void;
/**
* @param {string} source
* @returns {Check}
*/
static from_str(source: string): Check;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
*/
export class Fact {
free(): void;
/**
* @param {string} source
* @returns {Fact}
*/
static from_str(source: string): Fact;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
* A pair of public and private key

@@ -222,2 +256,17 @@ */

*/
export class Policy {
free(): void;
/**
* @param {string} source
* @returns {Policy}
*/
static from_str(source: string): Policy;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
/**
*/
export class PrivateKey {

@@ -240,3 +289,3 @@ free(): void;

*/
from_bytes(data: Uint8Array): PrivateKey;
static from_bytes(data: Uint8Array): PrivateKey;
/**

@@ -247,3 +296,3 @@ * Deserializes a private key from a hexadecimal string

*/
from_hex(data: string): PrivateKey;
static from_hex(data: string): PrivateKey;
}

@@ -270,3 +319,3 @@ /**

*/
from_bytes(data: Uint8Array): PublicKey;
static from_bytes(data: Uint8Array): PublicKey;
/**

@@ -277,3 +326,18 @@ * Deserializes a public key from a hexadecimal string

*/
from_hex(data: string): PublicKey;
static from_hex(data: string): PublicKey;
}
/**
*/
export class Rule {
free(): void;
/**
* @param {string} source
* @returns {Rule}
*/
static from_str(source: string): Rule;
/**
* @param {string} name
* @param {any} value
*/
set(name: string, value: any): void;
}
{
"name": "@biscuit-auth/biscuit-wasm",
"description": "WebAssembly wrapper for Biscuit authorization tokens",
"version": "0.2.0",
"version": "0.3.0",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc