heimdall-tide 0.12.46 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/enclaves/RequestEnclave.d.ts +18 -9
- package/dist/cjs/enclaves/RequestEnclave.js +2 -20
- package/dist/cjs/enclaves/RequestEnclave.js.map +1 -1
- package/dist/cjs/heimdall.d.ts +0 -11
- package/dist/cjs/heimdall.js +1 -1
- package/dist/cjs/heimdall.js.map +1 -1
- package/dist/cjs/index.d.ts +0 -6
- package/dist/cjs/index.js +1 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/wrapper.d.ts +6 -1
- package/dist/cjs/wrapper.js +97 -4
- package/dist/cjs/wrapper.js.map +1 -1
- package/dist/esm/enclaves/RequestEnclave.d.ts +18 -9
- package/dist/esm/enclaves/RequestEnclave.js +2 -20
- package/dist/esm/enclaves/RequestEnclave.js.map +1 -1
- package/dist/esm/heimdall.d.ts +0 -11
- package/dist/esm/heimdall.js +1 -1
- package/dist/esm/heimdall.js.map +1 -1
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/wrapper.d.ts +6 -1
- package/dist/esm/wrapper.js +93 -1
- package/dist/esm/wrapper.js.map +1 -1
- package/heimdall-tide-0.13.1.tgz +0 -0
- package/package.json +1 -4
- package/package.json.bak +1 -4
- package/src/enclaves/RequestEnclave.ts +20 -34
- package/src/heimdall.ts +0 -11
- package/src/index.ts +1 -8
- package/src/wrapper.ts +118 -2
- package/tsconfig.cjs.json +0 -1
- package/tsconfig.esm.json +1 -1
- package/tsconfig.json +2 -4
- package/.github/PULL_REQUEST_TEMPLATE/release.md +0 -34
- package/.github/workflows/enforce_release.yml +0 -87
- package/dist/cjs/enclaves/ApprovalEnclaveNEW.d.ts +0 -23
- package/dist/cjs/enclaves/ApprovalEnclaveNEW.js +0 -52
- package/dist/cjs/enclaves/ApprovalEnclaveNEW.js.map +0 -1
- package/dist/cjs/models/PolicySignRequest.d.ts +0 -7
- package/dist/cjs/models/PolicySignRequest.js +0 -18
- package/dist/cjs/models/PolicySignRequest.js.map +0 -1
- package/dist/cjs/utils.d.ts +0 -5
- package/dist/cjs/utils.js +0 -75
- package/dist/cjs/utils.js.map +0 -1
- package/dist/esm/enclaves/ApprovalEnclaveNEW.d.ts +0 -23
- package/dist/esm/enclaves/ApprovalEnclaveNEW.js +0 -48
- package/dist/esm/enclaves/ApprovalEnclaveNEW.js.map +0 -1
- package/dist/esm/models/PolicySignRequest.d.ts +0 -7
- package/dist/esm/models/PolicySignRequest.js +0 -15
- package/dist/esm/models/PolicySignRequest.js.map +0 -1
- package/dist/esm/utils.d.ts +0 -5
- package/dist/esm/utils.js +0 -68
- package/dist/esm/utils.js.map +0 -1
- package/heimdall-tide-0.1.0.tgz +0 -0
- package/heimdall-tide-0.12.46.tgz +0 -0
- package/src/enclaves/ApprovalEnclaveNEW.ts +0 -51
- package/src/models/PolicySignRequest.ts +0 -22
- package/src/utils.ts +0 -78
package/dist/esm/wrapper.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TideMemory } from "asgard-tide";
|
|
2
1
|
export declare const version = "1";
|
|
3
2
|
export declare function wrapper(arr: NestedEntry): TideMemory;
|
|
4
3
|
export declare function encodeStr(str: string, enc: string): Uint8Array;
|
|
@@ -8,4 +7,10 @@ interface entry {
|
|
|
8
7
|
encoding?: string;
|
|
9
8
|
}
|
|
10
9
|
type NestedEntry = (entry | Uint8Array | NestedEntry)[];
|
|
10
|
+
export declare class TideMemory extends Uint8Array {
|
|
11
|
+
static CreateFromArray(datas: Uint8Array[]): TideMemory;
|
|
12
|
+
static Create(initialValue: Uint8Array, totalLength: number, version?: number): TideMemory;
|
|
13
|
+
WriteValue(index: number, value: Uint8Array): void;
|
|
14
|
+
GetValue<T extends Uint8Array>(index: number): T;
|
|
15
|
+
}
|
|
11
16
|
export {};
|
package/dist/esm/wrapper.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TideMemory } from "asgard-tide";
|
|
2
1
|
export const version = "1";
|
|
3
2
|
export function wrapper(arr) {
|
|
4
3
|
// If array is only Uint8Arrays - create a TideMemory out of it
|
|
@@ -130,4 +129,97 @@ export function encode(data) {
|
|
|
130
129
|
return undefined;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
132
|
+
// Tide Memory Object helper functions from tide-js
|
|
133
|
+
export class TideMemory extends Uint8Array {
|
|
134
|
+
static CreateFromArray(datas) {
|
|
135
|
+
const length = datas.reduce((sum, next) => sum + next.length, 0);
|
|
136
|
+
const mem = this.Create(datas[0], length);
|
|
137
|
+
for (let i = 1; i < datas.length; i++) {
|
|
138
|
+
mem.WriteValue(i, datas[i]);
|
|
139
|
+
}
|
|
140
|
+
return mem;
|
|
141
|
+
}
|
|
142
|
+
static Create(initialValue, totalLength, version = 1) {
|
|
143
|
+
if (totalLength < initialValue.length + 4) {
|
|
144
|
+
throw new Error("Not enough space to allocate requested data. Make sure to request more space in totalLength than length of InitialValue plus 4 bytes for length.");
|
|
145
|
+
}
|
|
146
|
+
// Total buffer length is 4 (version) + totalLength
|
|
147
|
+
const bufferLength = 4 + totalLength;
|
|
148
|
+
const buffer = new TideMemory(bufferLength);
|
|
149
|
+
const dataView = new DataView(buffer.buffer);
|
|
150
|
+
// Write version at position 0 (4 bytes)
|
|
151
|
+
dataView.setInt32(0, version, true); // true for little-endian
|
|
152
|
+
let dataLocationIndex = 4;
|
|
153
|
+
// Write data length of initialValue at position 4 (4 bytes)
|
|
154
|
+
dataView.setInt32(dataLocationIndex, initialValue.length, true);
|
|
155
|
+
dataLocationIndex += 4;
|
|
156
|
+
// Write initialValue starting from position 8
|
|
157
|
+
buffer.set(initialValue, dataLocationIndex);
|
|
158
|
+
return buffer;
|
|
159
|
+
}
|
|
160
|
+
WriteValue(index, value) {
|
|
161
|
+
if (index < 0)
|
|
162
|
+
throw new Error("Index cannot be less than 0");
|
|
163
|
+
if (index === 0)
|
|
164
|
+
throw new Error("Use CreateTideMemory to set value at index 0");
|
|
165
|
+
if (this.length < 4 + value.length)
|
|
166
|
+
throw new Error("Could not write to memory. Memory too small for this value");
|
|
167
|
+
const dataView = new DataView(this.buffer);
|
|
168
|
+
let dataLocationIndex = 4; // Start after the version number
|
|
169
|
+
// Navigate through existing data segments
|
|
170
|
+
for (let i = 0; i < index; i++) {
|
|
171
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
172
|
+
throw new RangeError("Index out of range.");
|
|
173
|
+
}
|
|
174
|
+
// Read data length at current position
|
|
175
|
+
const nextDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
176
|
+
dataLocationIndex += 4;
|
|
177
|
+
dataLocationIndex += nextDataLength;
|
|
178
|
+
}
|
|
179
|
+
// Check if there's enough space to write the value
|
|
180
|
+
if (dataLocationIndex + 4 + value.length > this.length) {
|
|
181
|
+
throw new RangeError("Not enough space to write value");
|
|
182
|
+
}
|
|
183
|
+
// Check if data has already been written to this index
|
|
184
|
+
const existingLength = dataView.getInt32(dataLocationIndex, true);
|
|
185
|
+
if (existingLength !== 0) {
|
|
186
|
+
throw new Error("Data has already been written to this index");
|
|
187
|
+
}
|
|
188
|
+
// Write data length of value at current position
|
|
189
|
+
dataView.setInt32(dataLocationIndex, value.length, true);
|
|
190
|
+
dataLocationIndex += 4;
|
|
191
|
+
// Write value starting from current position
|
|
192
|
+
this.set(value, dataLocationIndex);
|
|
193
|
+
}
|
|
194
|
+
GetValue(index) {
|
|
195
|
+
// 'a' should be an ArrayBuffer or Uint8Array
|
|
196
|
+
if (this.length < 4) {
|
|
197
|
+
throw new Error("Insufficient data to read.");
|
|
198
|
+
}
|
|
199
|
+
// Create a DataView for reading integers in little-endian format
|
|
200
|
+
const dataView = new DataView(this.buffer, this.byteOffset, this.byteLength);
|
|
201
|
+
// Optional: Read the version if needed
|
|
202
|
+
// const version = dataView.getInt32(0, true);
|
|
203
|
+
let dataLocationIndex = 4;
|
|
204
|
+
for (let i = 0; i < index; i++) {
|
|
205
|
+
// Check if there's enough data to read the length of the next segment
|
|
206
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
207
|
+
throw new RangeError("Index out of range.");
|
|
208
|
+
}
|
|
209
|
+
const nextDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
210
|
+
dataLocationIndex += 4 + nextDataLength;
|
|
211
|
+
}
|
|
212
|
+
// Check if there's enough data to read the length of the final segment
|
|
213
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
214
|
+
throw new RangeError("Index out of range.");
|
|
215
|
+
}
|
|
216
|
+
const finalDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
217
|
+
dataLocationIndex += 4;
|
|
218
|
+
// Check if the final data segment is within bounds
|
|
219
|
+
if (dataLocationIndex + finalDataLength > this.length) {
|
|
220
|
+
throw new RangeError("Index out of range.");
|
|
221
|
+
}
|
|
222
|
+
return this.subarray(dataLocationIndex, dataLocationIndex + finalDataLength);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
133
225
|
//# sourceMappingURL=wrapper.js.map
|
package/dist/esm/wrapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/wrapper.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/wrapper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC;AAE3B,MAAM,UAAU,OAAO,CAAC,GAAgB;IACpC,gEAAgE;IAChE,0DAA0D;IAC1D,qDAAqD;IACrD,IAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;SAC9E,CAAC;QACF,wBAAwB;QACxB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAA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ave",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,9 +38,6 @@
|
|
|
38
38
|
"url": "https://github.com/tide-foundation/heimdall/issues"
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/tide-foundation/heimdall#readme",
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"asgard-tide": "^0.12.46"
|
|
43
|
-
},
|
|
44
41
|
"devDependencies": {
|
|
45
42
|
"typescript": "^5.8.3"
|
|
46
43
|
}
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heimdall-tide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "SDK for communicating with a Tide Enclave",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -38,9 +38,6 @@
|
|
|
38
38
|
"url": "https://github.com/tide-foundation/heimdall/issues"
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://github.com/tide-foundation/heimdall#readme",
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"asgard-tide": "file:~/asgard"
|
|
43
|
-
},
|
|
44
41
|
"devDependencies": {
|
|
45
42
|
"typescript": "^5.8.3"
|
|
46
43
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Heimdall, windowType } from "../heimdall";
|
|
2
|
+
import { TideMemory } from "../wrapper";
|
|
3
|
+
|
|
4
|
+
interface HiddenInit{
|
|
5
|
+
doken: string;
|
|
6
|
+
/**
|
|
7
|
+
* @returns A refresh doken for Heimdall
|
|
8
|
+
*/
|
|
9
|
+
dokenRefreshCallback: () => Promise<string> | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* @returns A function that re authenticates the current user from the client. (Used to update their session key on Identity System). Returns a new doken too.
|
|
12
|
+
*/
|
|
13
|
+
requireReloginCallback: () => Promise<string>;
|
|
14
|
+
}
|
|
4
15
|
|
|
5
16
|
export class RequestEnclave extends Heimdall<RequestEnclave>{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
protected requireReloginCallback: () => Promise<string>;
|
|
17
|
+
private doken: string;
|
|
18
|
+
private dokenRefreshCallback: () => Promise<string> | undefined;
|
|
19
|
+
private requireReloginCallback: () => Promise<string>;
|
|
10
20
|
|
|
11
21
|
_windowType: windowType = windowType.Hidden;
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
private initDone: Promise<any> = this.recieve("init done");
|
|
14
24
|
|
|
15
25
|
init(data: HiddenInit): RequestEnclave {
|
|
16
26
|
if(!data.doken) throw 'Doken not provided';
|
|
@@ -146,7 +156,7 @@ export class RequestEnclave extends Heimdall<RequestEnclave>{
|
|
|
146
156
|
url.searchParams.set("voucherURL", encodeURIComponent(this.voucherURL));
|
|
147
157
|
|
|
148
158
|
// Set requestsed enclave
|
|
149
|
-
url.searchParams.set("type",
|
|
159
|
+
url.searchParams.set("type", "request");
|
|
150
160
|
|
|
151
161
|
return url;
|
|
152
162
|
}
|
|
@@ -168,30 +178,7 @@ export class RequestEnclave extends Heimdall<RequestEnclave>{
|
|
|
168
178
|
}
|
|
169
179
|
}
|
|
170
180
|
|
|
171
|
-
async
|
|
172
|
-
// construct request to sign this request's creation
|
|
173
|
-
const requestToInitialize = BaseTideRequest.decode(request);
|
|
174
|
-
const requestToInitializeDetails = await requestToInitialize.getRequestInitDetails();
|
|
175
|
-
const initRequest = new BaseTideRequest(
|
|
176
|
-
"TideRequestInitialization",
|
|
177
|
-
"1",
|
|
178
|
-
"Doken:1",
|
|
179
|
-
TideMemory.CreateFromArray([
|
|
180
|
-
requestToInitializeDetails.creationTime,
|
|
181
|
-
requestToInitializeDetails.expireTime,
|
|
182
|
-
requestToInitializeDetails.modelId,
|
|
183
|
-
requestToInitializeDetails.draftHash
|
|
184
|
-
]),
|
|
185
|
-
new TideMemory()
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const creationSig = (await this.execute(initRequest.encode()))[0];
|
|
189
|
-
|
|
190
|
-
// returns the same request provided except with the policy authorized creation datas included
|
|
191
|
-
return requestToInitialize.addCreationSignature(requestToInitializeDetails.creationTime, creationSig).encode();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async execute(data: TideMemory, waitForAll: boolean = false): Promise<Uint8Array[]>{
|
|
181
|
+
async execute(data: TideMemory): Promise<Uint8Array[]>{
|
|
195
182
|
this.checkEnclaveOpen();
|
|
196
183
|
await this.initDone;
|
|
197
184
|
const pre_resp = this.recieve("sign request completed");
|
|
@@ -200,7 +187,6 @@ export class RequestEnclave extends Heimdall<RequestEnclave>{
|
|
|
200
187
|
message:{
|
|
201
188
|
flow: "sign",
|
|
202
189
|
request: data,
|
|
203
|
-
waitForAll,
|
|
204
190
|
}
|
|
205
191
|
})
|
|
206
192
|
const resp = await pre_resp;
|
package/src/heimdall.ts
CHANGED
|
@@ -211,17 +211,6 @@ export enum windowType{
|
|
|
211
211
|
Redirect,
|
|
212
212
|
Hidden
|
|
213
213
|
};
|
|
214
|
-
export interface HiddenInit{
|
|
215
|
-
doken: string;
|
|
216
|
-
/**
|
|
217
|
-
* @returns A refresh doken for Heimdall
|
|
218
|
-
*/
|
|
219
|
-
dokenRefreshCallback: () => Promise<string> | undefined;
|
|
220
|
-
/**
|
|
221
|
-
* @returns A function that re authenticates the current user from the client. (Used to update their session key on Identity System). Returns a new doken too.
|
|
222
|
-
*/
|
|
223
|
-
requireReloginCallback: () => Promise<string>;
|
|
224
|
-
}
|
|
225
214
|
interface EnclaveFlow<T>{
|
|
226
215
|
name: string;
|
|
227
216
|
_windowType: windowType;
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { ApprovalEnclave } from "./enclaves/ApprovalEnclave"
|
|
2
2
|
import { RequestEnclave } from "./enclaves/RequestEnclave"
|
|
3
|
-
import { ApprovalEnclaveNew } from "./enclaves/ApprovalEnclaveNEW"
|
|
4
|
-
import PolicySignRequest from "./models/PolicySignRequest"
|
|
5
|
-
import { TideMemory, Policy, BaseTideRequest, PolicyParameters } from "asgard-tide"
|
|
6
|
-
|
|
7
3
|
export { ApprovalEnclave }
|
|
8
|
-
export { RequestEnclave }
|
|
9
|
-
export { ApprovalEnclaveNew }
|
|
10
|
-
export { PolicySignRequest }
|
|
11
|
-
export { TideMemory, Policy, BaseTideRequest, PolicyParameters }
|
|
4
|
+
export { RequestEnclave }
|
package/src/wrapper.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TideMemory } from "asgard-tide";
|
|
2
1
|
export const version = "1";
|
|
3
2
|
|
|
4
3
|
export function wrapper(arr: NestedEntry): TideMemory {
|
|
@@ -139,4 +138,121 @@ interface entry{
|
|
|
139
138
|
value: any;
|
|
140
139
|
encoding?: string;
|
|
141
140
|
}
|
|
142
|
-
type NestedEntry = (entry | Uint8Array | NestedEntry)[]; // added Uint8Array as an optional type so we can serialize it without deep copy
|
|
141
|
+
type NestedEntry = (entry | Uint8Array | NestedEntry)[]; // added Uint8Array as an optional type so we can serialize it without deep copy
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// Tide Memory Object helper functions from tide-js
|
|
145
|
+
export class TideMemory extends Uint8Array{
|
|
146
|
+
static CreateFromArray(datas: Uint8Array[]): TideMemory {
|
|
147
|
+
const length = datas.reduce((sum, next) => sum + next.length, 0);
|
|
148
|
+
const mem = this.Create(datas[0], length);
|
|
149
|
+
for(let i = 1; i < datas.length; i++){
|
|
150
|
+
mem.WriteValue(i, datas[i]);
|
|
151
|
+
}
|
|
152
|
+
return mem;
|
|
153
|
+
}
|
|
154
|
+
static Create(initialValue: Uint8Array, totalLength: number, version: number = 1): TideMemory {
|
|
155
|
+
if (totalLength < initialValue.length + 4) {
|
|
156
|
+
throw new Error("Not enough space to allocate requested data. Make sure to request more space in totalLength than length of InitialValue plus 4 bytes for length.");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Total buffer length is 4 (version) + totalLength
|
|
160
|
+
const bufferLength = 4 + totalLength;
|
|
161
|
+
const buffer = new TideMemory(bufferLength);
|
|
162
|
+
const dataView = new DataView(buffer.buffer);
|
|
163
|
+
|
|
164
|
+
// Write version at position 0 (4 bytes)
|
|
165
|
+
dataView.setInt32(0, version, true); // true for little-endian
|
|
166
|
+
|
|
167
|
+
let dataLocationIndex = 4;
|
|
168
|
+
|
|
169
|
+
// Write data length of initialValue at position 4 (4 bytes)
|
|
170
|
+
dataView.setInt32(dataLocationIndex, initialValue.length, true);
|
|
171
|
+
dataLocationIndex += 4;
|
|
172
|
+
|
|
173
|
+
// Write initialValue starting from position 8
|
|
174
|
+
buffer.set(initialValue, dataLocationIndex);
|
|
175
|
+
|
|
176
|
+
return buffer;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
WriteValue(index: number, value: Uint8Array): void {
|
|
180
|
+
if (index < 0) throw new Error("Index cannot be less than 0");
|
|
181
|
+
if (index === 0) throw new Error("Use CreateTideMemory to set value at index 0");
|
|
182
|
+
if (this.length < 4 + value.length) throw new Error("Could not write to memory. Memory too small for this value");
|
|
183
|
+
|
|
184
|
+
const dataView = new DataView(this.buffer);
|
|
185
|
+
let dataLocationIndex = 4; // Start after the version number
|
|
186
|
+
|
|
187
|
+
// Navigate through existing data segments
|
|
188
|
+
for (let i = 0; i < index; i++) {
|
|
189
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
190
|
+
throw new RangeError("Index out of range.");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Read data length at current position
|
|
194
|
+
const nextDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
195
|
+
dataLocationIndex += 4;
|
|
196
|
+
|
|
197
|
+
dataLocationIndex += nextDataLength;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Check if there's enough space to write the value
|
|
201
|
+
if (dataLocationIndex + 4 + value.length > this.length) {
|
|
202
|
+
throw new RangeError("Not enough space to write value");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Check if data has already been written to this index
|
|
206
|
+
const existingLength = dataView.getInt32(dataLocationIndex, true);
|
|
207
|
+
if (existingLength !== 0) {
|
|
208
|
+
throw new Error("Data has already been written to this index");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Write data length of value at current position
|
|
212
|
+
dataView.setInt32(dataLocationIndex, value.length, true);
|
|
213
|
+
dataLocationIndex += 4;
|
|
214
|
+
|
|
215
|
+
// Write value starting from current position
|
|
216
|
+
this.set(value, dataLocationIndex);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
GetValue<T extends Uint8Array>(index: number): T{
|
|
220
|
+
// 'a' should be an ArrayBuffer or Uint8Array
|
|
221
|
+
if (this.length < 4) {
|
|
222
|
+
throw new Error("Insufficient data to read.");
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Create a DataView for reading integers in little-endian format
|
|
226
|
+
const dataView = new DataView(this.buffer, this.byteOffset, this.byteLength);
|
|
227
|
+
|
|
228
|
+
// Optional: Read the version if needed
|
|
229
|
+
// const version = dataView.getInt32(0, true);
|
|
230
|
+
|
|
231
|
+
let dataLocationIndex = 4;
|
|
232
|
+
|
|
233
|
+
for (let i = 0; i < index; i++) {
|
|
234
|
+
// Check if there's enough data to read the length of the next segment
|
|
235
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
236
|
+
throw new RangeError("Index out of range.");
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const nextDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
240
|
+
dataLocationIndex += 4 + nextDataLength;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Check if there's enough data to read the length of the final segment
|
|
244
|
+
if (dataLocationIndex + 4 > this.length) {
|
|
245
|
+
throw new RangeError("Index out of range.");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const finalDataLength = dataView.getInt32(dataLocationIndex, true);
|
|
249
|
+
dataLocationIndex += 4;
|
|
250
|
+
|
|
251
|
+
// Check if the final data segment is within bounds
|
|
252
|
+
if (dataLocationIndex + finalDataLength > this.length) {
|
|
253
|
+
throw new RangeError("Index out of range.");
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return this.subarray(dataLocationIndex, dataLocationIndex + finalDataLength) as T;
|
|
257
|
+
}
|
|
258
|
+
}
|
package/tsconfig.cjs.json
CHANGED
package/tsconfig.esm.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Summary
|
|
2
|
-
|
|
3
|
-
<!--
|
|
4
|
-
High-level overview of what is included in this release.
|
|
5
|
-
Mention major features, fixes, and any notable changes.
|
|
6
|
-
-->
|
|
7
|
-
|
|
8
|
-
### Features:
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
### Bug fixes:
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Release Notes
|
|
17
|
-
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
# Testing
|
|
21
|
-
|
|
22
|
-
<!--
|
|
23
|
-
Explain what has been tested and how.
|
|
24
|
-
Link to test runs, screenshots, or logs where relevant.
|
|
25
|
-
-->
|
|
26
|
-
|
|
27
|
-
### Test Types
|
|
28
|
-
|
|
29
|
-
- [ ] Unit tests
|
|
30
|
-
- [ ] Integration tests
|
|
31
|
-
- [ ] End-to-end / UI tests
|
|
32
|
-
- [ ] Manual QA
|
|
33
|
-
- [ ] Performance / load tests
|
|
34
|
-
- [ ] Other (describe):
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
name: Enforce release label and template on release branches
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, edited, synchronize, reopened, labeled, unlabeled]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
enforce-label-and-template:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- name: Require "release" label and release template for release/* base
|
|
12
|
-
uses: actions/github-script@v7
|
|
13
|
-
with:
|
|
14
|
-
script: |
|
|
15
|
-
const pr = context.payload.pull_request;
|
|
16
|
-
const base = pr.base.ref; // target branch, e.g. "release/1.2.3"
|
|
17
|
-
const labels = pr.labels.map(l => l.name);
|
|
18
|
-
const body = (pr.body || "").trim();
|
|
19
|
-
|
|
20
|
-
// Only enforce on release branches
|
|
21
|
-
if (!base.startsWith("release/")) {
|
|
22
|
-
core.info(`Base branch "${base}" is not release/*, skipping checks.`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const errors = [];
|
|
27
|
-
|
|
28
|
-
// 1) Enforce "release" label
|
|
29
|
-
const hasReleaseLabel = labels.includes("release");
|
|
30
|
-
if (!hasReleaseLabel) {
|
|
31
|
-
errors.push('PRs into release/* must have the "release" label before they can be merged.');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// 2) Enforce that the PR used the release template (checks for "# Release Notes")
|
|
35
|
-
const releaseNotesHeader = "# Release Notes";
|
|
36
|
-
const hasReleaseNotesSection = body.includes(releaseNotesHeader);
|
|
37
|
-
if (!hasReleaseNotesSection) {
|
|
38
|
-
errors.push(
|
|
39
|
-
'PRs into release/* must use the release PR template and include a "# Release Notes" section.'
|
|
40
|
-
);
|
|
41
|
-
} else {
|
|
42
|
-
// 3) Enforce that the Release Notes section has some real content
|
|
43
|
-
const startIndex = body.indexOf(releaseNotesHeader);
|
|
44
|
-
let afterHeader = body.slice(startIndex + releaseNotesHeader.length);
|
|
45
|
-
|
|
46
|
-
// Split into lines after the header
|
|
47
|
-
const lines = afterHeader.split(/\r?\n/);
|
|
48
|
-
|
|
49
|
-
const releaseNotesLines = [];
|
|
50
|
-
let started = false;
|
|
51
|
-
|
|
52
|
-
for (const line of lines) {
|
|
53
|
-
const trimmed = line.trim();
|
|
54
|
-
|
|
55
|
-
// Skip the first blank line(s) right after the heading
|
|
56
|
-
if (!started && trimmed === "") {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
started = true;
|
|
61
|
-
|
|
62
|
-
// Stop when we hit a new Markdown heading or a horizontal rule (---)
|
|
63
|
-
if (/^#{1,6}\s+/.test(trimmed)) {
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
if (/^---\s*$/.test(trimmed)) {
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
releaseNotesLines.push(trimmed);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Filter out placeholder-only lines (empty or just "-")
|
|
74
|
-
const meaningfulLines = releaseNotesLines.filter(l => l !== "" && l !== "-");
|
|
75
|
-
|
|
76
|
-
if (meaningfulLines.length === 0) {
|
|
77
|
-
errors.push(
|
|
78
|
-
'The "# Release Notes" section appears empty. Please replace the placeholder "-" with actual release notes.'
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (errors.length > 0) {
|
|
84
|
-
core.setFailed(errors.join("\n"));
|
|
85
|
-
} else {
|
|
86
|
-
core.info("Release label and template checks passed.");
|
|
87
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { HiddenInit, windowType } from "../heimdall";
|
|
2
|
-
import { TideMemory } from "asgard-tide";
|
|
3
|
-
import { RequestEnclave } from "./RequestEnclave";
|
|
4
|
-
export declare class ApprovalEnclaveNew extends RequestEnclave {
|
|
5
|
-
name: string;
|
|
6
|
-
_windowType: windowType;
|
|
7
|
-
init(data: HiddenInit): ApprovalEnclaveNew;
|
|
8
|
-
approve(requestsToApprove: RequestToApprove[]): Promise<OperatorApprovalResponse[]>;
|
|
9
|
-
}
|
|
10
|
-
declare class RequestToApprove {
|
|
11
|
-
id: string;
|
|
12
|
-
request: TideMemory;
|
|
13
|
-
}
|
|
14
|
-
declare class OperatorApprovalResponse extends RequestToApprove {
|
|
15
|
-
status: Status;
|
|
16
|
-
static isOperatorApprovalResponse(object: any): object is OperatorApprovalResponse;
|
|
17
|
-
}
|
|
18
|
-
declare enum Status {
|
|
19
|
-
Approved = "approved",
|
|
20
|
-
Denied = "denied",
|
|
21
|
-
Pending = "pending"
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApprovalEnclaveNew = void 0;
|
|
4
|
-
const heimdall_1 = require("../heimdall");
|
|
5
|
-
const RequestEnclave_1 = require("./RequestEnclave");
|
|
6
|
-
class ApprovalEnclaveNew extends RequestEnclave_1.RequestEnclave {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = "approvalNew";
|
|
10
|
-
this._windowType = heimdall_1.windowType.Popup;
|
|
11
|
-
}
|
|
12
|
-
init(data) {
|
|
13
|
-
return super.init(data);
|
|
14
|
-
}
|
|
15
|
-
async approve(requestsToApprove) {
|
|
16
|
-
// return fully serialized approved requests
|
|
17
|
-
this.checkEnclaveOpen();
|
|
18
|
-
await this.initDone;
|
|
19
|
-
const pre_resp = this.recieve("approvals");
|
|
20
|
-
this.send({
|
|
21
|
-
type: "approvalRequests",
|
|
22
|
-
message: {
|
|
23
|
-
requests: requestsToApprove,
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const resp = await pre_resp;
|
|
27
|
-
if (!Array.isArray(resp))
|
|
28
|
-
throw 'Expecting request completed data to be an array, not' + resp;
|
|
29
|
-
if (!resp.every((d) => OperatorApprovalResponse.isOperatorApprovalResponse(d)))
|
|
30
|
-
throw 'Expecting all entries in response to be OperatorApprovalResponse';
|
|
31
|
-
this.close();
|
|
32
|
-
return resp;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.ApprovalEnclaveNew = ApprovalEnclaveNew;
|
|
36
|
-
class RequestToApprove {
|
|
37
|
-
}
|
|
38
|
-
class OperatorApprovalResponse extends RequestToApprove {
|
|
39
|
-
static isOperatorApprovalResponse(object) {
|
|
40
|
-
return (object != null &&
|
|
41
|
-
typeof object.id === 'string' &&
|
|
42
|
-
(object.request instanceof Uint8Array || object.request == null) &&
|
|
43
|
-
Object.values(Status).includes(object.status));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
var Status;
|
|
47
|
-
(function (Status) {
|
|
48
|
-
Status["Approved"] = "approved";
|
|
49
|
-
Status["Denied"] = "denied";
|
|
50
|
-
Status["Pending"] = "pending";
|
|
51
|
-
})(Status || (Status = {}));
|
|
52
|
-
//# sourceMappingURL=ApprovalEnclaveNEW.js.map
|