@verana-labs/vs-agent-sdk 1.11.0-dev.14 → 1.11.0-dev.15
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/build/blockchain/IndexerWebSocketService.d.ts +8 -2
- package/build/blockchain/IndexerWebSocketService.js +77 -41
- package/build/blockchain/IndexerWebSocketService.js.map +1 -1
- package/build/blockchain/VeranaChainService.d.ts +2 -0
- package/build/blockchain/VeranaChainService.js +7 -4
- package/build/blockchain/VeranaChainService.js.map +1 -1
- package/build/blockchain/VeranaIndexerService.d.ts +4 -1
- package/build/blockchain/VeranaIndexerService.js +15 -0
- package/build/blockchain/VeranaIndexerService.js.map +1 -1
- package/build/blockchain/handlers/IndexerHandlerRegistry.d.ts +1 -1
- package/build/blockchain/handlers/defaultHandlers.js +17 -16
- package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
- package/build/blockchain/handlers/stateMutations.d.ts +3 -3
- package/build/blockchain/handlers/stateMutations.js +44 -5
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- package/build/blockchain/types.d.ts +50 -2
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/utils/setupSelfTr.d.ts +115 -0
- package/build/utils/setupSelfTr.js +452 -0
- package/build/utils/setupSelfTr.js.map +1 -0
- package/build/utils/trustCredentialStore.d.ts +18 -0
- package/build/utils/trustCredentialStore.js +196 -0
- package/build/utils/trustCredentialStore.js.map +1 -0
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateMutations.js","sourceRoot":"","sources":["../../../src/blockchain/handlers/stateMutations.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"stateMutations.js","sourceRoot":"","sources":["../../../src/blockchain/handlers/stateMutations.ts"],"names":[],"mappings":";;AASA,kDAcC;AAED,kDAaC;AAED,wDAuBC;AAED,4CA0BC;AAED,kDAsCC;AAnID,gEAAiE;AAGjE,2C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,27 @@
|
|
|
1
|
-
import { BaseLogger
|
|
1
|
+
import { BaseLogger } from '@credo-ts/core';
|
|
2
2
|
export declare const VERANA_BECH32_PREFIX = "verana";
|
|
3
3
|
export declare const RECORD_ID = "verana-blockchain-sync-state";
|
|
4
|
+
export type IndexerEventRecord = {
|
|
5
|
+
type: 'indexer-event';
|
|
6
|
+
event_type: string;
|
|
7
|
+
did: string;
|
|
8
|
+
block_height: number;
|
|
9
|
+
tx_hash: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
payload: {
|
|
12
|
+
module: string;
|
|
13
|
+
action: string;
|
|
14
|
+
message_type: string;
|
|
15
|
+
tx_index: number;
|
|
16
|
+
message_index: number;
|
|
17
|
+
sender: string;
|
|
18
|
+
related_dids: string[];
|
|
19
|
+
entity_type?: string;
|
|
20
|
+
entity_id?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
4
23
|
export interface IndexerEventsResponse {
|
|
5
|
-
events:
|
|
24
|
+
events: IndexerEventRecord[];
|
|
6
25
|
count: number;
|
|
7
26
|
after_block_height: number;
|
|
8
27
|
}
|
|
@@ -59,6 +78,35 @@ export interface VeranaSyncState {
|
|
|
59
78
|
credentialSchemas: Record<string, SyncedCredentialSchema>;
|
|
60
79
|
permissions: Record<string, SyncedPermission>;
|
|
61
80
|
}
|
|
81
|
+
export interface TrustRegistryDto {
|
|
82
|
+
id: number;
|
|
83
|
+
did: string;
|
|
84
|
+
controller: string;
|
|
85
|
+
archived: string | null;
|
|
86
|
+
active_gf_version?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface CredentialSchemaDto {
|
|
89
|
+
id: number;
|
|
90
|
+
tr_id: number;
|
|
91
|
+
json_schema: string;
|
|
92
|
+
issuer_perm_management_mode?: string;
|
|
93
|
+
verifier_perm_management_mode?: string;
|
|
94
|
+
archived: string | null;
|
|
95
|
+
created: string;
|
|
96
|
+
modified: string;
|
|
97
|
+
}
|
|
98
|
+
export interface PermissionDto {
|
|
99
|
+
id: number;
|
|
100
|
+
schema_id: number;
|
|
101
|
+
did: string | null;
|
|
102
|
+
type: number;
|
|
103
|
+
perm_state: 'ACTIVE' | 'REVOKED' | 'SLASHED' | 'REPAID' | 'EXPIRED' | 'FUTURE' | 'INACTIVE';
|
|
104
|
+
vp_state?: string;
|
|
105
|
+
revoked: string | null;
|
|
106
|
+
slashed: string | null;
|
|
107
|
+
effective_until?: string;
|
|
108
|
+
modified: string;
|
|
109
|
+
}
|
|
62
110
|
export interface PermQueryClient {
|
|
63
111
|
GetPermission(req: {
|
|
64
112
|
id: Long;
|
package/build/index.d.ts
CHANGED
|
@@ -17,4 +17,6 @@ export { webhookListener } from './utils/webhook';
|
|
|
17
17
|
export type { WebhookData } from './utils/webhook';
|
|
18
18
|
export { sendWebhookEvent, sendMessageReceivedEvent } from './utils/webhookEvent';
|
|
19
19
|
export * from './utils/util';
|
|
20
|
+
export * from './utils/setupSelfTr';
|
|
21
|
+
export * from './utils/trustCredentialStore';
|
|
20
22
|
export * from './blockchain';
|
package/build/index.js
CHANGED
|
@@ -57,5 +57,7 @@ var webhookEvent_1 = require("./utils/webhookEvent");
|
|
|
57
57
|
Object.defineProperty(exports, "sendWebhookEvent", { enumerable: true, get: function () { return webhookEvent_1.sendWebhookEvent; } });
|
|
58
58
|
Object.defineProperty(exports, "sendMessageReceivedEvent", { enumerable: true, get: function () { return webhookEvent_1.sendMessageReceivedEvent; } });
|
|
59
59
|
__exportStar(require("./utils/util"), exports);
|
|
60
|
+
__exportStar(require("./utils/setupSelfTr"), exports);
|
|
61
|
+
__exportStar(require("./utils/trustCredentialStore"), exports);
|
|
60
62
|
__exportStar(require("./blockchain"), exports);
|
|
61
63
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,0CAAuB;AAGvB,UAAU;AACV,+D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OAAA;AAAE,4HAAA,oBAAoB,OAAA;AACnD,oFAA6G;AAApG,sIAAA,yBAAyB,OAAA;AAAE,sIAAA,yBAAyB,OAAA;AAC7D,sFAAoF;AAA3E,wIAAA,0BAA0B,OAAA;AAEnC,cAAc;AACd,2EAK2C;AAJzC,4HAAA,oBAAoB,OAAA;AACpB,kHAAA,UAAU,OAAA;AACV,oHAAA,YAAY,OAAA;AACZ,wHAAA,gBAAgB,OAAA;AAGlB,QAAQ;AACR,uCAAwE;AAA/D,yGAAA,gBAAgB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,oGAAA,WAAW,OAAA;AACjD,qCAA4C;AAAnC,qGAAA,aAAa,OAAA;AACtB,2CAAiD;AAAxC,0GAAA,eAAe,OAAA;AAExB,qDAAiF;AAAxE,gHAAA,gBAAgB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AACnD,+CAA4B;AAC5B,sDAAmC;AACnC,+DAA4C;AAE5C,+CAA4B"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { W3cCredential, W3cPresentation, W3cCredentialSchema, W3cCredentialSubject, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, W3cCredentialOptions, DidRecord, W3cPresentationOptions, Logger } from '@credo-ts/core';
|
|
2
|
+
import { AnySchemaObject } from 'ajv/dist/2020';
|
|
3
|
+
import { VsAgent } from '../agent/VsAgent';
|
|
4
|
+
interface SelfTrDefaults {
|
|
5
|
+
agentLabel: string;
|
|
6
|
+
agentInvitationImageUrl?: string;
|
|
7
|
+
fallbackBase64?: string;
|
|
8
|
+
serviceType: string;
|
|
9
|
+
serviceDescription: string;
|
|
10
|
+
serviceMinimumAgeRequired: number;
|
|
11
|
+
serviceTermsAndConditions: string;
|
|
12
|
+
servicePrivacyPolicy: string;
|
|
13
|
+
orgRegistryId: string;
|
|
14
|
+
orgRegistryUrl: string;
|
|
15
|
+
orgAddress: string;
|
|
16
|
+
orgType: string;
|
|
17
|
+
orgCountryCode: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const presentations: {
|
|
20
|
+
name: string;
|
|
21
|
+
schemaUrl: string;
|
|
22
|
+
}[];
|
|
23
|
+
export declare const credentials: {
|
|
24
|
+
name: string;
|
|
25
|
+
credUrl: string;
|
|
26
|
+
schemaUrl: string;
|
|
27
|
+
}[];
|
|
28
|
+
export declare const createJsonSchema: W3cCredentialSchema;
|
|
29
|
+
export declare const createJsonSubjectRef: (id: string) => W3cCredentialSubject;
|
|
30
|
+
export declare const mapToSelfTr: (url: string, publicApiBaseUrl: string) => string;
|
|
31
|
+
export declare const setupSelfTr: ({ agent, publicApiBaseUrl, defaults, }: {
|
|
32
|
+
agent: VsAgent;
|
|
33
|
+
publicApiBaseUrl: string;
|
|
34
|
+
defaults: SelfTrDefaults;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
export declare function createCredential(options: Partial<W3cCredentialOptions>): W3cCredential;
|
|
37
|
+
/**
|
|
38
|
+
* Signs a W3C Verifiable Credential or Presentation using the provided agent and verification method.
|
|
39
|
+
*
|
|
40
|
+
* The function determines whether the input object is a `W3cCredential` or a `W3cPresentation`,
|
|
41
|
+
* and applies the appropriate signing operation using Linked Data Proofs (`Ed25519Signature2020`).
|
|
42
|
+
*
|
|
43
|
+
* @param agent - The agent instance.
|
|
44
|
+
* @param obj - The credential or presentation object to be signed.
|
|
45
|
+
* @param verificationMethod - The DID verification method used to generate the proof.
|
|
46
|
+
* @returns A signed W3C Verifiable Credential or Presentation in JSON-LD format.
|
|
47
|
+
*/
|
|
48
|
+
export declare function signerW3c(agent: VsAgent, obj: W3cCredential, verificationMethod: string): Promise<W3cJsonLdVerifiableCredential>;
|
|
49
|
+
export declare function signerW3c(agent: VsAgent, obj: W3cPresentation, verificationMethod: string): Promise<W3cJsonLdVerifiablePresentation>;
|
|
50
|
+
/**
|
|
51
|
+
* Generates and signs a verifiable presentation containing a verifiable credential.
|
|
52
|
+
* Stores the signed presentation and its integrity metadata in the DID record.
|
|
53
|
+
*
|
|
54
|
+
* - Retrieves and validates claims for the agent's DID.
|
|
55
|
+
* - Computes an integrity digest for the claims.
|
|
56
|
+
* - If a presentation with the same integrity already exists in the DID metadata, it is returned.
|
|
57
|
+
* - Otherwise, a new presentation is created, signed, and stored in the DID metadata.
|
|
58
|
+
*
|
|
59
|
+
* @param agent - The VsAgent instance used for signing and DID management.
|
|
60
|
+
* @param logger - Logger instance for logging operations.
|
|
61
|
+
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
62
|
+
* @param schemaKey - Unique identifier for the presentation type and metadata key.
|
|
63
|
+
* @param type - Array of credential types to include.
|
|
64
|
+
* @param credentialSchema - Schema definition for the credential.
|
|
65
|
+
* @returns The signed verifiable presentation, with integrity metadata.
|
|
66
|
+
*/
|
|
67
|
+
export declare function generateVerifiablePresentation(agent: VsAgent, id: string, ecsSchemas: Record<string, string>, schemaKey: string, type: string[], credentialSchema: W3cCredentialSchema, defaults: SelfTrDefaults): Promise<any>;
|
|
68
|
+
export declare function createPresentation(options: Partial<W3cPresentationOptions>): W3cPresentation;
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves and validates claims for a credential subject.
|
|
71
|
+
* If claims are not found, builds default claims based on the schemaKey.
|
|
72
|
+
* Validates claims against the ECS schema for the given schemaKey.
|
|
73
|
+
*
|
|
74
|
+
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
75
|
+
* @param subject - Credential subject, including ID.
|
|
76
|
+
* @param schemaKey - Unique identifier for the credential type.
|
|
77
|
+
* @returns The validated claims object.
|
|
78
|
+
* @throws If claims are invalid or schema is missing.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getClaims(logger: Logger, ecsSchemas: Record<string, string>, { id, claims }: W3cCredentialSubject, schemaKey: string, defaults: SelfTrDefaults): Promise<Record<string, unknown>>;
|
|
81
|
+
/**
|
|
82
|
+
* Validate a validateSchema object against the corresponding AJV schema.
|
|
83
|
+
* Throws an Error if the schema is missing or validation fails.
|
|
84
|
+
*/
|
|
85
|
+
export declare function validateSchema(ecsSchema: AnySchemaObject, credentialSubject: Record<string, any>): void;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a Subresource Integrity (SRI) digest to the provided data using the schema content
|
|
88
|
+
* fetched from the provided URL or from a local schema map as fallback.
|
|
89
|
+
*
|
|
90
|
+
* @template T - The type of the data object.
|
|
91
|
+
* @param id - The URL of the schema to fetch.
|
|
92
|
+
* @param data - The object to which the digest will be added.
|
|
93
|
+
* @param ecsSchemas - Optional map of local schemas to use as fallback if the fetch fails.
|
|
94
|
+
* @returns A new object combining the original data and a `digestSRI` property.
|
|
95
|
+
* @throws Error if both the fetch and local fallback fail.
|
|
96
|
+
*/
|
|
97
|
+
export declare function addDigestSRI<T extends object>(id?: string, data?: T, ecsSchemas?: Record<string, string>): Promise<T & {
|
|
98
|
+
digestSRI: string;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Generates a SRI digest string for the given content using the specified algorithm.
|
|
102
|
+
* @param content - The content to hash.
|
|
103
|
+
* @param algorithm - The hash algorithm to use (default: sha256).
|
|
104
|
+
* @returns The SRI digest string.
|
|
105
|
+
*/
|
|
106
|
+
export declare function generateDigestSRI(content: string, algorithm?: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Converts an image URL to a Base64-encoded data URI string.
|
|
109
|
+
*
|
|
110
|
+
* @param url - The image URL to convert.
|
|
111
|
+
* @returns A Base64 data URI string, or a fallback placeholder if the image cannot be fetched or is invalid.
|
|
112
|
+
*/
|
|
113
|
+
export declare function urlToBase64(logger: Logger, url: string | undefined, fallback: string): Promise<string>;
|
|
114
|
+
export declare function getVerificationMethodId(logger: Logger, didRecord: DidRecord): string;
|
|
115
|
+
export {};
|