Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attestations V2 #23

Open
wants to merge 138 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
cd9ea98
Enable Attestations
monkins1010 Apr 6, 2023
4d36210
Correct init of Attestations
monkins1010 Apr 6, 2023
1af9783
Typo
monkins1010 Apr 6, 2023
154341c
add more constructors
monkins1010 Apr 6, 2023
4f556a0
add decision
monkins1010 Apr 6, 2023
348be7a
Add attesation reply
monkins1010 Apr 6, 2023
818d978
updates for data
monkins1010 Apr 12, 2023
1c99825
Updates for types of premissions
monkins1010 Apr 14, 2023
5130a1f
Refactor Permission Class
monkins1010 Apr 17, 2023
19d25e1
Challenge updated
monkins1010 Apr 17, 2023
9f5627e
Fix for blank array
monkins1010 Apr 18, 2023
eef8770
Allow empty permission()
monkins1010 Apr 18, 2023
1fd85f0
Refactor RequestedPermission
monkins1010 Apr 18, 2023
ec0ea10
vdxfkey update
monkins1010 Apr 18, 2023
0fb819a
Merge remote-tracking branch 'upstream/master'
monkins1010 Apr 21, 2023
c8039df
Merge remote-tracking branch 'verus/master'
monkins1010 May 7, 2023
4fc7b95
Merge remote-tracking branch 'verus/master'
monkins1010 Jun 16, 2023
4f22a13
update
monkins1010 Jun 16, 2023
4b4c6af
Add Principals and TxDestination
monkins1010 Jun 16, 2023
09ecb41
Start adding in the Identity Serializer
monkins1010 Jun 16, 2023
917c6d0
Remove dupliacate and add to index
monkins1010 Jun 16, 2023
c7e00c7
Autosave 1:44 21/06/2023
monkins1010 Jun 21, 2023
3b8bb5c
Push to principal addresses array
monkins1010 Jun 21, 2023
5274539
Adding contentmultimap processing
monkins1010 Jun 21, 2023
14f0505
Updates to contentmultimap
monkins1010 Jun 21, 2023
5fc9631
update addresses
monkins1010 Jun 21, 2023
1aa4cad
Updates to Identity SErializer
monkins1010 Jun 22, 2023
e447c41
From object to buffer test pass
monkins1010 Jun 23, 2023
9994c93
Identity Serializer passing
monkins1010 Jun 23, 2023
bc8cf4a
Merge remote-tracking branch 'verus/master'
monkins1010 Jun 23, 2023
7d2581b
Build and add attestation tests
monkins1010 Jun 23, 2023
cd4c236
Partial build of attestation class for review
monkins1010 Jun 28, 2023
f8e7ef4
Add Attestation functions
monkins1010 Jul 7, 2023
8a75bbc
Fix Attestation Serialization
monkins1010 Jul 10, 2023
91ed3f7
Read byteLength Attestations
monkins1010 Jul 10, 2023
5c82882
Start Adding MMR Functions to Attestations
monkins1010 Jul 10, 2023
c6a617d
Add MMR
monkins1010 Jul 12, 2023
f968257
Builds updated
monkins1010 Jul 14, 2023
6a9914f
Merge remote-tracking branch 'upstream/master'
monkins1010 Jul 18, 2023
504f224
Merge remote-tracking branch 'verus/master'
monkins1010 Aug 1, 2023
0765c6c
Merge branch 'master' of https://github.com/monkins1010/verus-typescr…
monkins1010 Aug 1, 2023
7f7cf75
Merge remote-tracking branch 'verus/master'
monkins1010 Oct 18, 2023
22a40be
Merge branch 'master' of https://github.com/monkins1010/verus-typescr…
monkins1010 Oct 18, 2023
4db33b4
Update Attestation Keys
monkins1010 Oct 20, 2023
c2042b5
Merge branch 'master' of https://github.com/monkins1010/verus-typescr…
monkins1010 Oct 20, 2023
ad63592
Updates to Compactsize
monkins1010 Oct 20, 2023
50264f0
Updates from merge
monkins1010 Nov 6, 2023
b80fd97
Merge branch 'master' of https://github.com/monkins1010/verus-typescr…
monkins1010 Nov 6, 2023
b790b50
Update Blake2b library
monkins1010 Nov 7, 2023
2750520
Add create hash back in
monkins1010 Nov 7, 2023
473b5d0
Use BN instead of BigInt
monkins1010 Nov 7, 2023
c304748
Merge branch 'master' of https://github.com/monkins1010/verus-typescr…
monkins1010 Nov 7, 2023
0fcb2ec
Change BN > to gt
monkins1010 Nov 7, 2023
c6ccf32
Return to @noble hashes
monkins1010 Nov 7, 2023
4a6ee16
add big integer
monkins1010 Nov 7, 2023
23df01d
Swap Requested access constructor arguments to be consistent
monkins1010 Nov 8, 2023
55d1813
Merge remote-tracking branch 'upstream/master'
monkins1010 Nov 9, 2023
992b95b
Fix conflicts
monkins1010 Nov 9, 2023
04654dd
update yarn lock
monkins1010 Nov 9, 2023
b55bddc
update blake2b
monkins1010 Nov 10, 2023
6938dc6
Merge remote-tracking branch 'upstream/master'
monkins1010 Dec 4, 2023
10723f7
Add AttestationProof type with per leaf proof
monkins1010 Dec 14, 2023
f360fc2
Add AttestationData
monkins1010 Jan 2, 2024
5b0f879
Consolotate Attestation Class to be a full document, or a pruned ZK M…
monkins1010 Jan 3, 2024
bf0dc03
Add Attestation VDXFID webhook
monkins1010 Jan 5, 2024
1743fb8
Remove get and BN, Add Attestation Receiver
monkins1010 Jan 10, 2024
34e0d22
Add sytemID to signatures
monkins1010 Jan 11, 2024
789884e
wIP1
monkins1010 Jan 17, 2024
6eacc67
updates to mmr class
Jan 17, 2024
ffea9ce
WIP2
Jan 19, 2024
0d3e3fd
Updates to use Verus MMR type classes
monkins1010 Jan 29, 2024
f0ebfd5
Fix Component hash
monkins1010 Jan 29, 2024
444440a
Add CPartialAttestationProof
monkins1010 Jan 30, 2024
aec4960
Serialization fixes
monkins1010 Jan 30, 2024
b360a33
Refactor VDXF Keys, Friendly Names and Functions
monkins1010 Jan 31, 2024
5c35c33
Refactor vdxfid types functions
monkins1010 Jan 31, 2024
657e9aa
Create classes for Attestation data types
monkins1010 Feb 1, 2024
4cbbb93
Add in Attestation Keys
monkins1010 Feb 2, 2024
59eca7b
Key names updates
monkins1010 Feb 13, 2024
1578afb
Attestation Keys update
monkins1010 Feb 16, 2024
fe71ac8
Dependencies updates
monkins1010 Feb 16, 2024
e1d8d19
Merge remote-tracking branch 'upstream/master' into attest
monkins1010 Feb 16, 2024
66a1ca0
Added Personal Info
monkins1010 Feb 19, 2024
d889495
Update bech32 version and filenames
monkins1010 Feb 20, 2024
5a4e3d3
Updates to Personal Data and Attestations
monkins1010 Feb 23, 2024
2256443
camalcase fix
monkins1010 Feb 27, 2024
0b24869
Remove unused imports
monkins1010 Feb 27, 2024
4f05c8f
Add view keys
monkins1010 Feb 29, 2024
f51d0f9
Update Catagories
monkins1010 Mar 8, 2024
306ea8d
export profile types
monkins1010 Mar 8, 2024
0687804
Updates to add more categories
monkins1010 Mar 12, 2024
9453bf9
Key Updates
monkins1010 Mar 14, 2024
f7e2614
Add Category Keynames
monkins1010 Mar 21, 2024
7e7fbdf
Add attestation receive request
monkins1010 Mar 22, 2024
e216bb3
Added extra requested access item
monkins1010 Mar 25, 2024
17c4f8c
Rebuild error fix
monkins1010 Mar 26, 2024
9e486e0
Spelling Fixes
monkins1010 Mar 27, 2024
89915a6
Merge remote-tracking branch 'upstream/master' into attest
monkins1010 Mar 27, 2024
07e5840
sync keys
monkins1010 Mar 27, 2024
5d669d8
Add DataDescriptor, MMRDescriptor
monkins1010 Apr 15, 2024
c67d764
Updates to Classes for Datadescriptor WIP2
monkins1010 Apr 18, 2024
bbf57aa
Updates to CVDXF_Data
monkins1010 Apr 23, 2024
f85d66e
Add toJson Functions for Datadescriptor
monkins1010 Apr 24, 2024
e7ca299
Add signaturedata fromJson function
monkins1010 Apr 24, 2024
84ab394
Update Attestation to use VDXFData and Datadescriptors
monkins1010 Apr 26, 2024
a567298
Add classes to exports
monkins1010 Apr 26, 2024
4f00f0f
Add Attestation keys for Name and Type
monkins1010 Apr 29, 2024
079132b
Updates for debug
monkins1010 Apr 29, 2024
97b0b34
Remove circular dependancy
monkins1010 Apr 29, 2024
4c1de51
Updates for offsets
monkins1010 Apr 30, 2024
65ada69
Fix deserialization of MMRDescriptor
monkins1010 Apr 30, 2024
d8f323d
Add Attestation object key
monkins1010 May 2, 2024
19352f6
Add VDXFDataToUniValue
monkins1010 May 3, 2024
2e43bbf
Fix signature serializing
monkins1010 May 3, 2024
f34f2c7
Add helper function, and fix toJson for datadescriptors
monkins1010 May 10, 2024
bf7cd12
change Request to just data type
monkins1010 May 17, 2024
236b468
Extra keys to catagorize attestations viewed
monkins1010 May 20, 2024
2018f3d
update
monkins1010 May 20, 2024
194f1be
update test
monkins1010 May 20, 2024
dff3b51
Merge remote-tracking branch 'upstream/master' into attest
monkins1010 May 21, 2024
a2432b3
Add SignData
monkins1010 Aug 20, 2024
35ceb68
update dist
monkins1010 Sep 27, 2024
d71f45b
Updates to code base from code reveiew comments.
monkins1010 Oct 1, 2024
b6b37bb
Updates to comments for review
monkins1010 Oct 2, 2024
6731259
Merge remote-tracking branch 'upstream/master' into attest
monkins1010 Oct 2, 2024
d6dc753
Build dist Update
monkins1010 Oct 2, 2024
32464f4
update json key names and make consistent json functions
monkins1010 Oct 2, 2024
4491a5a
Updates to VdxfUniValue
monkins1010 Oct 8, 2024
9818850
More updates to VdxfUniValue
monkins1010 Oct 8, 2024
da760f4
Update identity tests with new contentmap style
monkins1010 Oct 8, 2024
c1c3856
Updates for tests #1
monkins1010 Oct 9, 2024
b6c596d
Tests updates
monkins1010 Oct 10, 2024
6e13097
Remove Helper function and combine into fromBuffer
monkins1010 Oct 15, 2024
cfceb6c
Fix capitals commit 1
monkins1010 Nov 11, 2024
ec2919f
Fix Capitals complete.
monkins1010 Nov 11, 2024
032524e
Fix serializers and add tests
monkins1010 Nov 20, 2024
f2f1fbb
update test
monkins1010 Nov 20, 2024
979735d
Update dist
monkins1010 Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions dist/pbaas/ContentMultiMapRemove.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference types="node" />
/// <reference types="bn.js" />
import { BigNumber } from '../utils/types/BigNumber';
import { SerializableEntity } from '../utils/types/SerializableEntity';
export declare class ContentMultiMapRemove implements SerializableEntity {
version: BigNumber;
action: BigNumber;
entryKey: string;
valueHash: Buffer;
static VERSION_INVALID: import("bn.js");
static VERSION_FIRST: import("bn.js");
static VERSION_LAST: import("bn.js");
static VERSION_CURRENT: import("bn.js");
static ACTION_FIRST: import("bn.js");
static ACTION_REMOVE_ONE_KEYVALUE: import("bn.js");
static ACTION_REMOVE_ALL_KEYVALUE: import("bn.js");
static ACTION_REMOVE_ALL_KEY: import("bn.js");
static ACTION_CLEAR_MAP: import("bn.js");
static ACTION_LAST: import("bn.js");
constructor(data: {
version?: BigNumber;
action?: BigNumber;
entryKey?: string;
valueHash?: Buffer;
});
getByteLength(): number;
toBuffer(): Buffer;
fromBuffer(buffer: Buffer, offset?: number): number;
}
63 changes: 63 additions & 0 deletions dist/pbaas/ContentMultiMapRemove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentMultiMapRemove = void 0;
const address_1 = require("../utils/address");
const bufferutils_1 = require("../utils/bufferutils");
const bn_js_1 = require("bn.js");
const vdxf_1 = require("../constants/vdxf");
const { BufferReader, BufferWriter } = bufferutils_1.default;
class ContentMultiMapRemove {
constructor(data) {
this.version = data.version || new bn_js_1.BN(1, 10);
this.action = data.action || new bn_js_1.BN(0, 10);
this.entryKey = data.entryKey || "";
this.valueHash = data.valueHash || Buffer.alloc(0);
}
getByteLength() {
let byteLength = 0;
byteLength += 4; // version uint32
byteLength + 4; // action uint32
if (this.action != ContentMultiMapRemove.ACTION_CLEAR_MAP) {
byteLength += 20;
if (this.action != ContentMultiMapRemove.ACTION_REMOVE_ALL_KEY) {
byteLength += 32;
}
}
return byteLength;
}
toBuffer() {
const bufferWriter = new BufferWriter(Buffer.alloc(this.getByteLength()));
bufferWriter.writeUInt32(this.version.toNumber());
bufferWriter.writeUInt32(this.action.toNumber());
if (this.action != ContentMultiMapRemove.ACTION_CLEAR_MAP) {
bufferWriter.writeSlice((0, address_1.fromBase58Check)(this.entryKey).hash);
if (this.action != ContentMultiMapRemove.ACTION_REMOVE_ALL_KEY) {
bufferWriter.writeSlice(this.valueHash);
}
}
return bufferWriter.buffer;
}
fromBuffer(buffer, offset = 0) {
const reader = new BufferReader(buffer, offset);
this.version = new bn_js_1.BN(reader.readUInt32());
this.action = new bn_js_1.BN(reader.readUInt32());
if (this.action != ContentMultiMapRemove.ACTION_CLEAR_MAP) {
this.entryKey = (0, address_1.toBase58Check)(reader.readSlice(20), vdxf_1.I_ADDR_VERSION);
if (this.action != ContentMultiMapRemove.ACTION_REMOVE_ALL_KEY) {
this.valueHash = reader.readSlice(32);
}
}
return reader.offset;
}
}
exports.ContentMultiMapRemove = ContentMultiMapRemove;
ContentMultiMapRemove.VERSION_INVALID = new bn_js_1.BN(0);
ContentMultiMapRemove.VERSION_FIRST = new bn_js_1.BN(1);
ContentMultiMapRemove.VERSION_LAST = new bn_js_1.BN(1);
ContentMultiMapRemove.VERSION_CURRENT = new bn_js_1.BN(1);
ContentMultiMapRemove.ACTION_FIRST = new bn_js_1.BN(1);
ContentMultiMapRemove.ACTION_REMOVE_ONE_KEYVALUE = new bn_js_1.BN(1);
ContentMultiMapRemove.ACTION_REMOVE_ALL_KEYVALUE = new bn_js_1.BN(2);
ContentMultiMapRemove.ACTION_REMOVE_ALL_KEY = new bn_js_1.BN(3);
ContentMultiMapRemove.ACTION_CLEAR_MAP = new bn_js_1.BN(4);
ContentMultiMapRemove.ACTION_LAST = new bn_js_1.BN(4);
2 changes: 2 additions & 0 deletions dist/pbaas/CurrencyValueMap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export declare class CurrencyValueMap implements SerializableEntity {
getByteLength(): number;
toBuffer(): Buffer;
fromBuffer(buffer: Buffer, offset?: number): number;
IsValid(): boolean;
toJson(): any;
}
15 changes: 15 additions & 0 deletions dist/pbaas/CurrencyValueMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,20 @@ class CurrencyValueMap {
}
return reader.offset;
}
IsValid() {
for (let [key, value] of this.value_map) {
if (!key) {
return false;
}
}
return true;
}
toJson() {
const value_map = {};
for (let [key, value] of this.value_map) {
value_map[key] = value.toString();
}
return value_map;
}
}
exports.CurrencyValueMap = CurrencyValueMap;
32 changes: 32 additions & 0 deletions dist/pbaas/Rating.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// <reference types="bn.js" />
/// <reference types="node" />
import { BigNumber } from '../utils/types/BigNumber';
import { SerializableEntity } from '../utils/types/SerializableEntity';
export declare class Rating implements SerializableEntity {
static VERSION_INVALID: import("bn.js");
static VERSION_FIRST: import("bn.js");
static VERSION_LAST: import("bn.js");
static VERSION_CURRENT: import("bn.js");
static TRUST_UNKNOWN: import("bn.js");
static TRUST_BLOCKED: import("bn.js");
static TRUST_APPROVED: import("bn.js");
static TRUST_FIRST: import("bn.js");
static TRUST_LAST: import("bn.js");
version: BigNumber;
trustLevel: BigNumber;
ratings: Map<string, Buffer>;
constructor(data?: {
version?: BigNumber;
trustLevel?: BigNumber;
ratings?: Map<string, Buffer>;
});
getByteLength(): number;
toBuffer(): Buffer;
fromBuffer(buffer: Buffer, offset?: number): number;
IsValid(): boolean;
toJson(): {
version: string;
trustlevel: string;
ratings: Map<string, Buffer>;
};
}
75 changes: 75 additions & 0 deletions dist/pbaas/Rating.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rating = void 0;
const varint_1 = require("../utils/varint");
const varuint_1 = require("../utils/varuint");
const address_1 = require("../utils/address");
const bufferutils_1 = require("../utils/bufferutils");
const bn_js_1 = require("bn.js");
const vdxf_1 = require("../constants/vdxf");
const { BufferReader, BufferWriter } = bufferutils_1.default;
class Rating {
constructor(data = {}) {
this.version = data.version || new bn_js_1.BN(1, 10);
this.trustLevel = data.trustLevel || new bn_js_1.BN(0, 10);
this.ratings = new Map(data.ratings || []);
}
getByteLength() {
let byteLength = 0;
byteLength += 4; // version uint32
byteLength + 1; // trustLevel uint8
byteLength += varuint_1.default.encodingLength(this.ratings.size);
for (const [key, value] of this.ratings) {
byteLength += 20;
byteLength += varint_1.default.encodingLength(new bn_js_1.BN(value.length));
byteLength += value.length;
}
return byteLength;
}
toBuffer() {
const bufferWriter = new BufferWriter(Buffer.alloc(this.getByteLength()));
bufferWriter.writeUInt32(this.version.toNumber());
bufferWriter.writeUInt8(this.trustLevel.toNumber());
bufferWriter.writeCompactSize(this.ratings.size);
for (const [key, value] of this.ratings) {
const { hash } = (0, address_1.fromBase58Check)(key);
bufferWriter.writeSlice(hash);
bufferWriter.writeVarSlice(value);
}
return bufferWriter.buffer;
}
fromBuffer(buffer, offset = 0) {
const reader = new BufferReader(buffer, offset);
this.version = new bn_js_1.BN(reader.readUInt32());
this.trustLevel = new bn_js_1.BN(reader.readUInt8());
const count = reader.readCompactSize();
for (let i = 0; i < count; i++) {
const hash = reader.readSlice(20);
const value = reader.readVarSlice();
const base58Key = (0, address_1.toBase58Check)(hash, vdxf_1.I_ADDR_VERSION);
this.ratings.set(base58Key, value);
}
return reader.offset;
}
IsValid() {
return this.version.gte(Rating.VERSION_FIRST) && this.version.lte(Rating.VERSION_LAST) &&
this.trustLevel.gte(Rating.TRUST_FIRST) && this.trustLevel.lte(Rating.TRUST_LAST);
}
toJson() {
return {
version: this.version.toString(),
trustlevel: this.trustLevel.toString(),
ratings: this.ratings
};
}
}
exports.Rating = Rating;
Rating.VERSION_INVALID = new bn_js_1.BN(0, 10);
Rating.VERSION_FIRST = new bn_js_1.BN(1, 10);
Rating.VERSION_LAST = new bn_js_1.BN(1, 10);
Rating.VERSION_CURRENT = new bn_js_1.BN(1, 10);
Rating.TRUST_UNKNOWN = new bn_js_1.BN(0, 10); // unknown and can be included in exploration
Rating.TRUST_BLOCKED = new bn_js_1.BN(1, 10); // suspected or known to be untrustworthy and should not be interacted with
Rating.TRUST_APPROVED = new bn_js_1.BN(2, 10); // explicitly believed to be trustworthy enough to interact with
Rating.TRUST_FIRST = new bn_js_1.BN(0, 10);
Rating.TRUST_LAST = new bn_js_1.BN(2, 10);
2 changes: 2 additions & 0 deletions dist/pbaas/TransferDestination.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ export declare class TransferDestination implements SerializableEntity {
fromBuffer(buffer: Buffer, offset?: number): number;
static fromJson(data: TransferDestinationJson): TransferDestination;
toJson(): TransferDestinationJson;
IsValid(): boolean;
GetAuxDest(destNum: any): TransferDestination;
}
43 changes: 40 additions & 3 deletions dist/pbaas/TransferDestination.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports.LAST_VALID_TYPE_NO_FLAGS = exports.DEST_RAW;
exports.FLAG_DEST_AUX = new bn_js_1.BN(64, 10);
exports.FLAG_DEST_GATEWAY = new bn_js_1.BN(128, 10);
exports.FLAG_MASK = exports.FLAG_DEST_AUX.add(exports.FLAG_DEST_GATEWAY);
const UINT160_BYTE_SIZE = 20;
class TransferDestination {
constructor(data) {
this.type = exports.DEST_INVALID;
Expand Down Expand Up @@ -89,9 +90,9 @@ class TransferDestination {
length += (0, address_1.fromBase58Check)(this.gateway_code).hash.length; // gateway_code
}
else {
length += 20;
length += UINT160_BYTE_SIZE;
}
length += 8; // fees
length += 8; // fees int64
}
if (this.hasAuxDests()) {
length += varuint_1.default.encodingLength(this.aux_dests.length); // aux dests compact size
Expand All @@ -113,7 +114,7 @@ class TransferDestination {
writer.writeSlice((0, address_1.fromBase58Check)(this.gateway_code).hash);
}
else {
writer.writeSlice(Buffer.alloc(20));
writer.writeSlice(Buffer.alloc(UINT160_BYTE_SIZE));
}
writer.writeInt64(this.fees);
}
Expand Down Expand Up @@ -162,5 +163,41 @@ class TransferDestination {
aux_dests: this.aux_dests.map(x => x.toJson())
};
}
IsValid() {
// verify aux dests
let valid = (((this.type.and(exports.FLAG_DEST_AUX).gt(new bn_js_1.BN(0))) && this.aux_dests.length > 0) || (!(this.type.and(exports.FLAG_DEST_AUX).gt(new bn_js_1.BN(0))) && !(this.aux_dests.length > 0)));
if (valid && this.aux_dests) {
for (let i = 0; i < this.aux_dests.length; i++) {
if (!this.GetAuxDest(i).IsValid()) {
valid = false;
break;
}
}
}
return !!(valid &&
!this.typeNoFlags().eq(exports.DEST_INVALID) &&
this.typeNoFlags().lte(exports.LAST_VALID_TYPE_NO_FLAGS) &&
((!(this.type.and(exports.FLAG_DEST_GATEWAY)) && !this.gateway_id) || this.gateway_id));
}
GetAuxDest(destNum) {
const retVal = this.aux_dests[destNum];
if (destNum >= 0 && destNum < this.aux_dests.length) {
if (retVal.type.and(exports.FLAG_DEST_AUX).gt(new bn_js_1.BN(0)) || retVal.aux_dests.length > 0) {
retVal.type = exports.DEST_INVALID;
}
// no gateways or flags, only simple destinations work
switch (retVal.type) {
case exports.DEST_ID:
case exports.DEST_PK:
case exports.DEST_PKH:
case exports.DEST_ETH:
case exports.DEST_SH:
break;
default:
retVal.type = exports.DEST_INVALID;
}
}
return retVal;
}
}
exports.TransferDestination = TransferDestination;
12 changes: 12 additions & 0 deletions dist/vdxf/classes/Attestation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { BufferDataVdxfObject } from '../index';
export interface AttestationRequestInterface {
attestationId: string;
accepted_attestors: Array<string>;
attestation_keys: Array<string>;
attestor_filters?: Array<string>;
}
export declare class Attestation extends BufferDataVdxfObject {
setAttestationViewRequestData(attestationId: string, accepted_attestors: Array<string>, attestation_keys: Array<string>, attestor_filters: Array<string>): void;
getAttestationViewRequestData(): AttestationRequestInterface;
getAttestationProvisioningData(): any[];
}
Loading