@vess-id/ai-identity 0.1.0 → 0.2.0

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/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VerifiablePresentation, VPRequest, Agent, DIDDocument, VCTemplate, ConnectorResponse, ToolPermissionRequest, OrganizationConfig, Grant, CreateGrantRequest, GrantStatus, CheckGrantPermissionRequest, CheckGrantPermissionResult, UpdateGrantRequest, CredentialType, IssueSDJWTVCRequest, IssueSDJWTVCResult, VerifySDJWTVCResult, GrantConstraints, EvaluationContext, ConstraintEvaluationResult, ConstraintViolation, ConstraintWarning, TimeWindowConstraint, RiskLevel } from '@vess-id/ai-identity-types';
2
2
  export * from '@vess-id/ai-identity-types';
3
- import Ajv from 'ajv';
4
3
  import * as jose from 'jose';
5
4
  import { JWK } from 'jose';
5
+ import Ajv from 'ajv';
6
6
  import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
7
7
  import { DisclosureFrame } from '@sd-jwt/types';
8
8
 
@@ -730,6 +730,16 @@ declare class AgentDIDManager {
730
730
  private deleteAgentDIDMapping;
731
731
  }
732
732
 
733
+ interface KeyPairGenerationResult {
734
+ did: string;
735
+ publicKey: JWK;
736
+ privateKey: JWK;
737
+ }
738
+ declare class UserKeyPairManager {
739
+ generateKeyPair(): Promise<KeyPairGenerationResult>;
740
+ extractPublicKeyInfo(did: string): JWK;
741
+ }
742
+
733
743
  interface OrganizationDisclosureConfig {
734
744
  organizationDid: string;
735
745
  defaultFields: string[];
@@ -3001,4 +3011,4 @@ declare function getKeyIdFromDid(did: string): string;
3001
3011
 
3002
3012
  declare const version = "0.0.1";
3003
3013
 
3004
- export { type ABACPolicyEngine, ACTION_REGISTRY, AIdentityClient, type AIdentityConfig, APIVCManager, type AbacDecision, type AbacInput, type ActionMeta, type ActionRegistry, AgentDIDManager, AgentManager, AllowAllAbac, type CapabilityMeta, type CheckPermissionInput, type CheckPermissionResult, ConstraintEvaluator, type ConstraintEvaluatorOptions, type CredentialDisclosureConfig, type CredentialRef, type CredentialStatusInfo, type CredentialStore, type DecisionTrace, DisclosureConfigManager, DummyCreds, DummyVpVerifier, FilesystemKeyStorage, type JsonSchema, KeyManager, type KeyRotationConfig, type KeyRotationInfo, KeyRotationManager, type KeyStorageConfig, type KeyStorageProvider, type MemoryDocument, MemoryKeyStorage, MemoryManager, type MemoryQuery, type MemoryQueryResult, MetricsManager, type OperationMetric, type OrganizationDisclosureConfig, type PlanDelegationInput, type PlanDelegationResult, type Provider, type ReBACChecker, type Relation, type ResourceRef, type ResourceScope, type ResourceType, type RevocationList, type RevocationListEntry, RevocationManager, type SDJWTMetrics, SDJwtClient, SimpleRebac, type ToolDefinition, ToolManager, UserIdentityManager, VCManager, VPManager, type VerifiedVcClaims, type VpVerifier, checkPermissionWithVP, configure, createAjv, createDidJwk, defaultConstraintEvaluator, evaluateConstraints, extractPublicKey, extractPublicKeyFromDid, generateKeyPair, generateNonce, getClient, getKeyIdFromDid, getRequiredRelations, getRequiredScopes, indexActions, indexCapabilities, isValidDidJwk, loadActionRegistryFromFile, loadActionRegistryFromObject, planDelegationForVC, resolveActionsFromSelection, signJWT, validateRegistryObject, verifyJWT, version };
3014
+ export { type ABACPolicyEngine, ACTION_REGISTRY, AIdentityClient, type AIdentityConfig, APIVCManager, type AbacDecision, type AbacInput, type ActionMeta, type ActionRegistry, AgentDIDManager, AgentManager, AllowAllAbac, type CapabilityMeta, type CheckPermissionInput, type CheckPermissionResult, ConstraintEvaluator, type ConstraintEvaluatorOptions, type CredentialDisclosureConfig, type CredentialRef, type CredentialStatusInfo, type CredentialStore, type DecisionTrace, DisclosureConfigManager, DummyCreds, DummyVpVerifier, FilesystemKeyStorage, type JsonSchema, KeyManager, type KeyPairGenerationResult, type KeyRotationConfig, type KeyRotationInfo, KeyRotationManager, type KeyStorageConfig, type KeyStorageProvider, type MemoryDocument, MemoryKeyStorage, MemoryManager, type MemoryQuery, type MemoryQueryResult, MetricsManager, type OperationMetric, type OrganizationDisclosureConfig, type PlanDelegationInput, type PlanDelegationResult, type Provider, type ReBACChecker, type Relation, type ResourceRef, type ResourceScope, type ResourceType, type RevocationList, type RevocationListEntry, RevocationManager, type SDJWTMetrics, SDJwtClient, SimpleRebac, type ToolDefinition, ToolManager, UserIdentityManager, UserKeyPairManager, VCManager, VPManager, type VerifiedVcClaims, type VpVerifier, checkPermissionWithVP, configure, createAjv, createDidJwk, defaultConstraintEvaluator, evaluateConstraints, extractPublicKey, extractPublicKeyFromDid, generateKeyPair, generateNonce, getClient, getKeyIdFromDid, getRequiredRelations, getRequiredScopes, indexActions, indexCapabilities, isValidDidJwk, loadActionRegistryFromFile, loadActionRegistryFromObject, planDelegationForVC, resolveActionsFromSelection, signJWT, validateRegistryObject, verifyJWT, version };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VerifiablePresentation, VPRequest, Agent, DIDDocument, VCTemplate, ConnectorResponse, ToolPermissionRequest, OrganizationConfig, Grant, CreateGrantRequest, GrantStatus, CheckGrantPermissionRequest, CheckGrantPermissionResult, UpdateGrantRequest, CredentialType, IssueSDJWTVCRequest, IssueSDJWTVCResult, VerifySDJWTVCResult, GrantConstraints, EvaluationContext, ConstraintEvaluationResult, ConstraintViolation, ConstraintWarning, TimeWindowConstraint, RiskLevel } from '@vess-id/ai-identity-types';
2
2
  export * from '@vess-id/ai-identity-types';
3
- import Ajv from 'ajv';
4
3
  import * as jose from 'jose';
5
4
  import { JWK } from 'jose';
5
+ import Ajv from 'ajv';
6
6
  import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
7
7
  import { DisclosureFrame } from '@sd-jwt/types';
8
8
 
@@ -730,6 +730,16 @@ declare class AgentDIDManager {
730
730
  private deleteAgentDIDMapping;
731
731
  }
732
732
 
733
+ interface KeyPairGenerationResult {
734
+ did: string;
735
+ publicKey: JWK;
736
+ privateKey: JWK;
737
+ }
738
+ declare class UserKeyPairManager {
739
+ generateKeyPair(): Promise<KeyPairGenerationResult>;
740
+ extractPublicKeyInfo(did: string): JWK;
741
+ }
742
+
733
743
  interface OrganizationDisclosureConfig {
734
744
  organizationDid: string;
735
745
  defaultFields: string[];
@@ -3001,4 +3011,4 @@ declare function getKeyIdFromDid(did: string): string;
3001
3011
 
3002
3012
  declare const version = "0.0.1";
3003
3013
 
3004
- export { type ABACPolicyEngine, ACTION_REGISTRY, AIdentityClient, type AIdentityConfig, APIVCManager, type AbacDecision, type AbacInput, type ActionMeta, type ActionRegistry, AgentDIDManager, AgentManager, AllowAllAbac, type CapabilityMeta, type CheckPermissionInput, type CheckPermissionResult, ConstraintEvaluator, type ConstraintEvaluatorOptions, type CredentialDisclosureConfig, type CredentialRef, type CredentialStatusInfo, type CredentialStore, type DecisionTrace, DisclosureConfigManager, DummyCreds, DummyVpVerifier, FilesystemKeyStorage, type JsonSchema, KeyManager, type KeyRotationConfig, type KeyRotationInfo, KeyRotationManager, type KeyStorageConfig, type KeyStorageProvider, type MemoryDocument, MemoryKeyStorage, MemoryManager, type MemoryQuery, type MemoryQueryResult, MetricsManager, type OperationMetric, type OrganizationDisclosureConfig, type PlanDelegationInput, type PlanDelegationResult, type Provider, type ReBACChecker, type Relation, type ResourceRef, type ResourceScope, type ResourceType, type RevocationList, type RevocationListEntry, RevocationManager, type SDJWTMetrics, SDJwtClient, SimpleRebac, type ToolDefinition, ToolManager, UserIdentityManager, VCManager, VPManager, type VerifiedVcClaims, type VpVerifier, checkPermissionWithVP, configure, createAjv, createDidJwk, defaultConstraintEvaluator, evaluateConstraints, extractPublicKey, extractPublicKeyFromDid, generateKeyPair, generateNonce, getClient, getKeyIdFromDid, getRequiredRelations, getRequiredScopes, indexActions, indexCapabilities, isValidDidJwk, loadActionRegistryFromFile, loadActionRegistryFromObject, planDelegationForVC, resolveActionsFromSelection, signJWT, validateRegistryObject, verifyJWT, version };
3014
+ export { type ABACPolicyEngine, ACTION_REGISTRY, AIdentityClient, type AIdentityConfig, APIVCManager, type AbacDecision, type AbacInput, type ActionMeta, type ActionRegistry, AgentDIDManager, AgentManager, AllowAllAbac, type CapabilityMeta, type CheckPermissionInput, type CheckPermissionResult, ConstraintEvaluator, type ConstraintEvaluatorOptions, type CredentialDisclosureConfig, type CredentialRef, type CredentialStatusInfo, type CredentialStore, type DecisionTrace, DisclosureConfigManager, DummyCreds, DummyVpVerifier, FilesystemKeyStorage, type JsonSchema, KeyManager, type KeyPairGenerationResult, type KeyRotationConfig, type KeyRotationInfo, KeyRotationManager, type KeyStorageConfig, type KeyStorageProvider, type MemoryDocument, MemoryKeyStorage, MemoryManager, type MemoryQuery, type MemoryQueryResult, MetricsManager, type OperationMetric, type OrganizationDisclosureConfig, type PlanDelegationInput, type PlanDelegationResult, type Provider, type ReBACChecker, type Relation, type ResourceRef, type ResourceScope, type ResourceType, type RevocationList, type RevocationListEntry, RevocationManager, type SDJWTMetrics, SDJwtClient, SimpleRebac, type ToolDefinition, ToolManager, UserIdentityManager, UserKeyPairManager, VCManager, VPManager, type VerifiedVcClaims, type VpVerifier, checkPermissionWithVP, configure, createAjv, createDidJwk, defaultConstraintEvaluator, evaluateConstraints, extractPublicKey, extractPublicKeyFromDid, generateKeyPair, generateNonce, getClient, getKeyIdFromDid, getRequiredRelations, getRequiredScopes, indexActions, indexCapabilities, isValidDidJwk, loadActionRegistryFromFile, loadActionRegistryFromObject, planDelegationForVC, resolveActionsFromSelection, signJWT, validateRegistryObject, verifyJWT, version };
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  SimpleRebac: () => SimpleRebac,
53
53
  ToolManager: () => ToolManager,
54
54
  UserIdentityManager: () => UserIdentityManager,
55
+ UserKeyPairManager: () => UserKeyPairManager,
55
56
  VCManager: () => VCManager,
56
57
  VPManager: () => VPManager,
57
58
  checkPermissionWithVP: () => checkPermissionWithVP,
@@ -2811,6 +2812,32 @@ function getClient(config, password) {
2811
2812
  return defaultClient;
2812
2813
  }
2813
2814
 
2815
+ // src/identity/user-key-pair-manager.ts
2816
+ var UserKeyPairManager = class {
2817
+ /**
2818
+ * Generate a new key pair and create a did:jwk DID
2819
+ */
2820
+ async generateKeyPair() {
2821
+ const keyPair = await SDJwtClient.generateKeyPair();
2822
+ const did = createDidJwk(keyPair.publicKey);
2823
+ return {
2824
+ did,
2825
+ publicKey: keyPair.publicKey,
2826
+ privateKey: keyPair.privateKey
2827
+ };
2828
+ }
2829
+ /**
2830
+ * Extract public key info from a did:jwk DID
2831
+ * @throws Error if the DID is not in did:jwk format
2832
+ */
2833
+ extractPublicKeyInfo(did) {
2834
+ if (!did.startsWith("did:jwk:")) {
2835
+ throw new Error("Only did:jwk format is supported");
2836
+ }
2837
+ return extractPublicKeyFromDid(did);
2838
+ }
2839
+ };
2840
+
2814
2841
  // src/vc/api-vc-manager.ts
2815
2842
  var import_ai_identity_types2 = require("@vess-id/ai-identity-types");
2816
2843
 
@@ -4753,6 +4780,7 @@ var version = "0.0.1";
4753
4780
  SimpleRebac,
4754
4781
  ToolManager,
4755
4782
  UserIdentityManager,
4783
+ UserKeyPairManager,
4756
4784
  VCManager,
4757
4785
  VPManager,
4758
4786
  checkPermissionWithVP,