@synet/credential
Version:
VC Credentials - Simple, Robust, Unit-based Verifiable Credentials service
132 lines (131 loc) • 4.84 kB
TypeScript
/**
* Synet-specific Verifiable Credential types
*
* This module extends the base universal types with Synet-specific implementations
* for networking, identity, authorization, and asset management.
*
* Key design principles:
* - Extends universal base types from @synet/credential
* - Synet-specific networking and identity concepts
* - Concrete implementations for Synet ecosystem
* - Demonstrates the extension pattern for other clients
*/
import type { W3CVerifiableCredential, BaseCredentialSubject, IdentitySubject, AuthorizationSubject, AssetSubject, GovernanceSubject, DeclarationSubject, Intelligence, Holder } from "./types-base";
export interface SynetHolder extends Holder {
id: string;
name?: string;
[key: string]: unknown;
}
/**
* Synet-specific credential alias
*
* This creates the dependency moat by aliasing SynetVerifiableCredential
* to W3CVerifiableCredential, ensuring maximum compatibility while
* maintaining Synet's identity.
*/
export type SynetVerifiableCredential<S extends BaseCredentialSubject = BaseCredentialSubject> = W3CVerifiableCredential<S>;
export interface RootIdentitySubject extends IdentitySubject {
networkId: string;
poolCidr: string;
url?: string;
}
export interface GatewayIdentitySubject extends IdentitySubject {
networkId: string;
regionId?: string;
cidr?: string;
ip?: string;
ipPoolId?: string;
publicKeyHex?: string;
}
export interface MarketIdentitySubject extends IdentitySubject {
marketId: string;
title: string;
description?: string;
ipfsUri?: string;
tags?: string[];
regionId?: string;
version?: string;
}
export interface IntelligenceAuthorizationSubject extends AuthorizationSubject {
intelligence: Intelligence;
witnesses?: SynetHolder[];
certifications?: string[];
}
export interface RootAuthorizationSubject extends AuthorizationSubject {
networkId: string;
}
export interface GatewayAuthorizationSubject extends AuthorizationSubject {
networkId: string;
regionId: string;
ip: string;
cidr: string;
ipPoolId: string;
validUntil?: string;
}
export interface FungibleAssetSubject extends AssetSubject {
quantity: number;
totalSupply: number;
}
export interface NonFungibleAssetSubject extends AssetSubject {
uniqueIdentifier?: string;
}
export interface DataAssetSubject extends AssetSubject {
licensedBy?: SynetHolder;
scope?: string[];
}
export interface IpAssetSubject extends AssetSubject {
networkId: string;
ip: string;
}
export interface IpPoolAssetSubject extends AssetSubject {
networkId: string;
cidr: string;
regionId?: string;
}
export interface PolicySubject extends GovernanceSubject {
}
export interface RootPolicySubject extends PolicySubject {
networkId: string;
policyId: string;
version: string;
}
export interface NetworkDeclarationSubject extends DeclarationSubject {
networkId: string;
policyId: string;
ipv4?: string;
ipv6?: string;
cidr?: string;
networkType?: string;
topology?: string;
rootUrl?: string;
}
export interface RoutingSubject extends BaseCredentialSubject {
ip: string;
publicKey: string;
endpoint: string;
networkId: string;
issuedBy: SynetHolder;
}
export declare const SynetCredentialType: {
readonly Identity: "IdentityCredential";
readonly Authorization: "AuthorizationCredential";
readonly Asset: "AssetCredential";
readonly Governance: "GovernanceCredential";
readonly Declaration: "DeclarationCredential";
readonly RootIdentity: "RootIdentityCredential";
readonly GatewayIdentity: "GatewayIdentityCredential";
readonly MarketIdentity: "MarketIdentityCredential";
readonly RootAuthorization: "RootAuthorizationCredential";
readonly GatewayAuthorization: "GatewayAuthorizationCredential";
readonly IntelligenceAuthorization: "IntelligenceAuthorizationCredential";
readonly DataAsset: "DataAssetCredential";
readonly IpPool: "IpPoolAssetCredential";
readonly Ip: "IpAssetCredential";
readonly FungibleAsset: "FungibleAssetCredential";
readonly NonFungibleAsset: "NonFungibleAssetCredential";
readonly RootPolicy: "RootPolicyCredential";
readonly NetworkDeclaration: "NetworkDeclarationCredential";
readonly Routing: "RoutingCredential";
};
export type SynetCredentialTypeValues = (typeof SynetCredentialType)[keyof typeof SynetCredentialType];
export type { W3CVerifiableCredential, BaseCredentialSubject, IdentitySubject, AuthorizationSubject, AssetSubject, GovernanceSubject, DeclarationSubject, BaseCredentialType, Intelligence, Holder, VerifiableResource, CredentialDelegation, ProofType, CredentialIssueOptions, CredentialVerifyOptions, CredentialStorage, CredentialResult, VerificationResult, } from "./types-base";