@trinsic/trinsic-web
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -64,2 +64,52 @@ import * as jspb from 'google-protobuf' | ||
export class ServerConfig extends jspb.Message { | ||
getEndpoint(): string; | ||
setEndpoint(value: string): ServerConfig; | ||
getPort(): number; | ||
setPort(value: number): ServerConfig; | ||
getUseTls(): boolean; | ||
setUseTls(value: boolean): ServerConfig; | ||
serializeBinary(): Uint8Array; | ||
toObject(includeInstance?: boolean): ServerConfig.AsObject; | ||
static toObject(includeInstance: boolean, msg: ServerConfig): ServerConfig.AsObject; | ||
static serializeBinaryToWriter(message: ServerConfig, writer: jspb.BinaryWriter): void; | ||
static deserializeBinary(bytes: Uint8Array): ServerConfig; | ||
static deserializeBinaryFromReader(message: ServerConfig, reader: jspb.BinaryReader): ServerConfig; | ||
} | ||
export namespace ServerConfig { | ||
export type AsObject = { | ||
endpoint: string, | ||
port: number, | ||
useTls: boolean, | ||
} | ||
} | ||
export class Nonce extends jspb.Message { | ||
getTimestamp(): number; | ||
setTimestamp(value: number): Nonce; | ||
getRequestHash(): Uint8Array | string; | ||
getRequestHash_asU8(): Uint8Array; | ||
getRequestHash_asB64(): string; | ||
setRequestHash(value: Uint8Array | string): Nonce; | ||
serializeBinary(): Uint8Array; | ||
toObject(includeInstance?: boolean): Nonce.AsObject; | ||
static toObject(includeInstance: boolean, msg: Nonce): Nonce.AsObject; | ||
static serializeBinaryToWriter(message: Nonce, writer: jspb.BinaryWriter): void; | ||
static deserializeBinary(bytes: Uint8Array): Nonce; | ||
static deserializeBinaryFromReader(message: Nonce, reader: jspb.BinaryReader): Nonce; | ||
} | ||
export namespace Nonce { | ||
export type AsObject = { | ||
timestamp: number, | ||
requestHash: Uint8Array | string, | ||
} | ||
} | ||
export enum ResponseStatus { | ||
@@ -66,0 +116,0 @@ SUCCESS = 0, |
@@ -31,4 +31,6 @@ // source: services/common/v1/common.proto | ||
goog.exportSymbol('proto.services.common.v1.JsonPayload.JsonCase', null, global); | ||
goog.exportSymbol('proto.services.common.v1.Nonce', null, global); | ||
goog.exportSymbol('proto.services.common.v1.RequestOptions', null, global); | ||
goog.exportSymbol('proto.services.common.v1.ResponseStatus', null, global); | ||
goog.exportSymbol('proto.services.common.v1.ServerConfig', null, global); | ||
/** | ||
@@ -76,2 +78,44 @@ * Generated by JsPbCodeGenerator. | ||
} | ||
/** | ||
* Generated by JsPbCodeGenerator. | ||
* @param {Array=} opt_data Optional initial data array, typically from a | ||
* server response, or constructed directly in Javascript. The array is used | ||
* in place and becomes part of the constructed object. It is not cloned. | ||
* If no data is provided, the constructed object will be empty, but still | ||
* valid. | ||
* @extends {jspb.Message} | ||
* @constructor | ||
*/ | ||
proto.services.common.v1.ServerConfig = function(opt_data) { | ||
jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||
}; | ||
goog.inherits(proto.services.common.v1.ServerConfig, jspb.Message); | ||
if (goog.DEBUG && !COMPILED) { | ||
/** | ||
* @public | ||
* @override | ||
*/ | ||
proto.services.common.v1.ServerConfig.displayName = 'proto.services.common.v1.ServerConfig'; | ||
} | ||
/** | ||
* Generated by JsPbCodeGenerator. | ||
* @param {Array=} opt_data Optional initial data array, typically from a | ||
* server response, or constructed directly in Javascript. The array is used | ||
* in place and becomes part of the constructed object. It is not cloned. | ||
* If no data is provided, the constructed object will be empty, but still | ||
* valid. | ||
* @extends {jspb.Message} | ||
* @constructor | ||
*/ | ||
proto.services.common.v1.Nonce = function(opt_data) { | ||
jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||
}; | ||
goog.inherits(proto.services.common.v1.Nonce, jspb.Message); | ||
if (goog.DEBUG && !COMPILED) { | ||
/** | ||
* @public | ||
* @override | ||
*/ | ||
proto.services.common.v1.Nonce.displayName = 'proto.services.common.v1.Nonce'; | ||
} | ||
@@ -505,3 +549,377 @@ | ||
if (jspb.Message.GENERATE_TO_OBJECT) { | ||
/** | ||
* Creates an object representation of this proto. | ||
* Field names that are reserved in JavaScript and will be renamed to pb_name. | ||
* Optional fields that are not set will be set to undefined. | ||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. | ||
* For the list of reserved names please see: | ||
* net/proto2/compiler/js/internal/generator.cc#kKeyword. | ||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the | ||
* JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @return {!Object} | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.toObject = function(opt_includeInstance) { | ||
return proto.services.common.v1.ServerConfig.toObject(opt_includeInstance, this); | ||
}; | ||
/** | ||
* Static version of the {@see toObject} method. | ||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include | ||
* the JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @param {!proto.services.common.v1.ServerConfig} msg The msg instance to transform. | ||
* @return {!Object} | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.services.common.v1.ServerConfig.toObject = function(includeInstance, msg) { | ||
var f, obj = { | ||
endpoint: jspb.Message.getFieldWithDefault(msg, 1, ""), | ||
port: jspb.Message.getFieldWithDefault(msg, 2, 0), | ||
useTls: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) | ||
}; | ||
if (includeInstance) { | ||
obj.$jspbMessageInstance = msg; | ||
} | ||
return obj; | ||
}; | ||
} | ||
/** | ||
* Deserializes binary data (in protobuf wire format). | ||
* @param {jspb.ByteSource} bytes The bytes to deserialize. | ||
* @return {!proto.services.common.v1.ServerConfig} | ||
*/ | ||
proto.services.common.v1.ServerConfig.deserializeBinary = function(bytes) { | ||
var reader = new jspb.BinaryReader(bytes); | ||
var msg = new proto.services.common.v1.ServerConfig; | ||
return proto.services.common.v1.ServerConfig.deserializeBinaryFromReader(msg, reader); | ||
}; | ||
/** | ||
* Deserializes binary data (in protobuf wire format) from the | ||
* given reader into the given message object. | ||
* @param {!proto.services.common.v1.ServerConfig} msg The message object to deserialize into. | ||
* @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||
* @return {!proto.services.common.v1.ServerConfig} | ||
*/ | ||
proto.services.common.v1.ServerConfig.deserializeBinaryFromReader = function(msg, reader) { | ||
while (reader.nextField()) { | ||
if (reader.isEndGroup()) { | ||
break; | ||
} | ||
var field = reader.getFieldNumber(); | ||
switch (field) { | ||
case 1: | ||
var value = /** @type {string} */ (reader.readString()); | ||
msg.setEndpoint(value); | ||
break; | ||
case 2: | ||
var value = /** @type {number} */ (reader.readInt32()); | ||
msg.setPort(value); | ||
break; | ||
case 3: | ||
var value = /** @type {boolean} */ (reader.readBool()); | ||
msg.setUseTls(value); | ||
break; | ||
default: | ||
reader.skipField(); | ||
break; | ||
} | ||
} | ||
return msg; | ||
}; | ||
/** | ||
* Serializes the message to binary data (in protobuf wire format). | ||
* @return {!Uint8Array} | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.serializeBinary = function() { | ||
var writer = new jspb.BinaryWriter(); | ||
proto.services.common.v1.ServerConfig.serializeBinaryToWriter(this, writer); | ||
return writer.getResultBuffer(); | ||
}; | ||
/** | ||
* Serializes the given message to binary data (in protobuf wire | ||
* format), writing to the given BinaryWriter. | ||
* @param {!proto.services.common.v1.ServerConfig} message | ||
* @param {!jspb.BinaryWriter} writer | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.services.common.v1.ServerConfig.serializeBinaryToWriter = function(message, writer) { | ||
var f = undefined; | ||
f = message.getEndpoint(); | ||
if (f.length > 0) { | ||
writer.writeString( | ||
1, | ||
f | ||
); | ||
} | ||
f = message.getPort(); | ||
if (f !== 0) { | ||
writer.writeInt32( | ||
2, | ||
f | ||
); | ||
} | ||
f = message.getUseTls(); | ||
if (f) { | ||
writer.writeBool( | ||
3, | ||
f | ||
); | ||
} | ||
}; | ||
/** | ||
* optional string endpoint = 1; | ||
* @return {string} | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.getEndpoint = function() { | ||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); | ||
}; | ||
/** | ||
* @param {string} value | ||
* @return {!proto.services.common.v1.ServerConfig} returns this | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.setEndpoint = function(value) { | ||
return jspb.Message.setProto3StringField(this, 1, value); | ||
}; | ||
/** | ||
* optional int32 port = 2; | ||
* @return {number} | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.getPort = function() { | ||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); | ||
}; | ||
/** | ||
* @param {number} value | ||
* @return {!proto.services.common.v1.ServerConfig} returns this | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.setPort = function(value) { | ||
return jspb.Message.setProto3IntField(this, 2, value); | ||
}; | ||
/** | ||
* optional bool use_tls = 3; | ||
* @return {boolean} | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.getUseTls = function() { | ||
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); | ||
}; | ||
/** | ||
* @param {boolean} value | ||
* @return {!proto.services.common.v1.ServerConfig} returns this | ||
*/ | ||
proto.services.common.v1.ServerConfig.prototype.setUseTls = function(value) { | ||
return jspb.Message.setProto3BooleanField(this, 3, value); | ||
}; | ||
if (jspb.Message.GENERATE_TO_OBJECT) { | ||
/** | ||
* Creates an object representation of this proto. | ||
* Field names that are reserved in JavaScript and will be renamed to pb_name. | ||
* Optional fields that are not set will be set to undefined. | ||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. | ||
* For the list of reserved names please see: | ||
* net/proto2/compiler/js/internal/generator.cc#kKeyword. | ||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the | ||
* JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @return {!Object} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.toObject = function(opt_includeInstance) { | ||
return proto.services.common.v1.Nonce.toObject(opt_includeInstance, this); | ||
}; | ||
/** | ||
* Static version of the {@see toObject} method. | ||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include | ||
* the JSPB instance for transitional soy proto support: | ||
* http://goto/soy-param-migration | ||
* @param {!proto.services.common.v1.Nonce} msg The msg instance to transform. | ||
* @return {!Object} | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.services.common.v1.Nonce.toObject = function(includeInstance, msg) { | ||
var f, obj = { | ||
timestamp: jspb.Message.getFieldWithDefault(msg, 1, 0), | ||
requestHash: msg.getRequestHash_asB64() | ||
}; | ||
if (includeInstance) { | ||
obj.$jspbMessageInstance = msg; | ||
} | ||
return obj; | ||
}; | ||
} | ||
/** | ||
* Deserializes binary data (in protobuf wire format). | ||
* @param {jspb.ByteSource} bytes The bytes to deserialize. | ||
* @return {!proto.services.common.v1.Nonce} | ||
*/ | ||
proto.services.common.v1.Nonce.deserializeBinary = function(bytes) { | ||
var reader = new jspb.BinaryReader(bytes); | ||
var msg = new proto.services.common.v1.Nonce; | ||
return proto.services.common.v1.Nonce.deserializeBinaryFromReader(msg, reader); | ||
}; | ||
/** | ||
* Deserializes binary data (in protobuf wire format) from the | ||
* given reader into the given message object. | ||
* @param {!proto.services.common.v1.Nonce} msg The message object to deserialize into. | ||
* @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||
* @return {!proto.services.common.v1.Nonce} | ||
*/ | ||
proto.services.common.v1.Nonce.deserializeBinaryFromReader = function(msg, reader) { | ||
while (reader.nextField()) { | ||
if (reader.isEndGroup()) { | ||
break; | ||
} | ||
var field = reader.getFieldNumber(); | ||
switch (field) { | ||
case 1: | ||
var value = /** @type {number} */ (reader.readInt64()); | ||
msg.setTimestamp(value); | ||
break; | ||
case 2: | ||
var value = /** @type {!Uint8Array} */ (reader.readBytes()); | ||
msg.setRequestHash(value); | ||
break; | ||
default: | ||
reader.skipField(); | ||
break; | ||
} | ||
} | ||
return msg; | ||
}; | ||
/** | ||
* Serializes the message to binary data (in protobuf wire format). | ||
* @return {!Uint8Array} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.serializeBinary = function() { | ||
var writer = new jspb.BinaryWriter(); | ||
proto.services.common.v1.Nonce.serializeBinaryToWriter(this, writer); | ||
return writer.getResultBuffer(); | ||
}; | ||
/** | ||
* Serializes the given message to binary data (in protobuf wire | ||
* format), writing to the given BinaryWriter. | ||
* @param {!proto.services.common.v1.Nonce} message | ||
* @param {!jspb.BinaryWriter} writer | ||
* @suppress {unusedLocalVariables} f is only used for nested messages | ||
*/ | ||
proto.services.common.v1.Nonce.serializeBinaryToWriter = function(message, writer) { | ||
var f = undefined; | ||
f = message.getTimestamp(); | ||
if (f !== 0) { | ||
writer.writeInt64( | ||
1, | ||
f | ||
); | ||
} | ||
f = message.getRequestHash_asU8(); | ||
if (f.length > 0) { | ||
writer.writeBytes( | ||
2, | ||
f | ||
); | ||
} | ||
}; | ||
/** | ||
* optional int64 timestamp = 1; | ||
* @return {number} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.getTimestamp = function() { | ||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); | ||
}; | ||
/** | ||
* @param {number} value | ||
* @return {!proto.services.common.v1.Nonce} returns this | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.setTimestamp = function(value) { | ||
return jspb.Message.setProto3IntField(this, 1, value); | ||
}; | ||
/** | ||
* optional bytes request_hash = 2; | ||
* @return {!(string|Uint8Array)} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.getRequestHash = function() { | ||
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); | ||
}; | ||
/** | ||
* optional bytes request_hash = 2; | ||
* This is a type-conversion wrapper around `getRequestHash()` | ||
* @return {string} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.getRequestHash_asB64 = function() { | ||
return /** @type {string} */ (jspb.Message.bytesAsB64( | ||
this.getRequestHash())); | ||
}; | ||
/** | ||
* optional bytes request_hash = 2; | ||
* Note that Uint8Array is not supported on all browsers. | ||
* @see http://caniuse.com/Uint8Array | ||
* This is a type-conversion wrapper around `getRequestHash()` | ||
* @return {!Uint8Array} | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.getRequestHash_asU8 = function() { | ||
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( | ||
this.getRequestHash())); | ||
}; | ||
/** | ||
* @param {!(string|Uint8Array)} value | ||
* @return {!proto.services.common.v1.Nonce} returns this | ||
*/ | ||
proto.services.common.v1.Nonce.prototype.setRequestHash = function(value) { | ||
return jspb.Message.setProto3BytesField(this, 2, value); | ||
}; | ||
/** | ||
* @enum {number} | ||
@@ -508,0 +926,0 @@ */ |
import * as jspb from 'google-protobuf' | ||
import * as services_common_v1_common_pb from '../../../services/common/v1/common_pb'; | ||
import * as pbmse_v1_pbmse_pb from '../../../pbmse/v1/pbmse_pb'; | ||
export class CreateWalletRequest extends jspb.Message { | ||
getController(): string; | ||
setController(value: string): CreateWalletRequest; | ||
getDescription(): string; | ||
@@ -27,3 +23,2 @@ setDescription(value: string): CreateWalletRequest; | ||
export type AsObject = { | ||
controller: string, | ||
description: string, | ||
@@ -38,10 +33,14 @@ securityCode: string, | ||
getWalletId(): string; | ||
setWalletId(value: string): CreateWalletResponse; | ||
getAuthData(): Uint8Array | string; | ||
getAuthData_asU8(): Uint8Array; | ||
getAuthData_asB64(): string; | ||
setAuthData(value: Uint8Array | string): CreateWalletResponse; | ||
getCapability(): string; | ||
setCapability(value: string): CreateWalletResponse; | ||
getAuthToken(): Uint8Array | string; | ||
getAuthToken_asU8(): Uint8Array; | ||
getAuthToken_asB64(): string; | ||
setAuthToken(value: Uint8Array | string): CreateWalletResponse; | ||
getInvoker(): string; | ||
setInvoker(value: string): CreateWalletResponse; | ||
getIsProtected(): boolean; | ||
setIsProtected(value: boolean): CreateWalletResponse; | ||
@@ -59,5 +58,5 @@ serializeBinary(): Uint8Array; | ||
status: services_common_v1_common_pb.ResponseStatus, | ||
walletId: string, | ||
capability: string, | ||
invoker: string, | ||
authData: Uint8Array | string, | ||
authToken: Uint8Array | string, | ||
isProtected: boolean, | ||
} | ||
@@ -153,20 +152,22 @@ } | ||
export class WalletProfile extends jspb.Message { | ||
getDidDocument(): services_common_v1_common_pb.JsonPayload | undefined; | ||
setDidDocument(value?: services_common_v1_common_pb.JsonPayload): WalletProfile; | ||
hasDidDocument(): boolean; | ||
clearDidDocument(): WalletProfile; | ||
getName(): string; | ||
setName(value: string): WalletProfile; | ||
getWalletId(): string; | ||
setWalletId(value: string): WalletProfile; | ||
getAuthData(): Uint8Array | string; | ||
getAuthData_asU8(): Uint8Array; | ||
getAuthData_asB64(): string; | ||
setAuthData(value: Uint8Array | string): WalletProfile; | ||
getInvoker(): string; | ||
setInvoker(value: string): WalletProfile; | ||
getAuthToken(): Uint8Array | string; | ||
getAuthToken_asU8(): Uint8Array; | ||
getAuthToken_asB64(): string; | ||
setAuthToken(value: Uint8Array | string): WalletProfile; | ||
getCapability(): string; | ||
setCapability(value: string): WalletProfile; | ||
getIsProtected(): boolean; | ||
setIsProtected(value: boolean): WalletProfile; | ||
getInvokerJwk(): Uint8Array | string; | ||
getInvokerJwk_asU8(): Uint8Array; | ||
getInvokerJwk_asB64(): string; | ||
setInvokerJwk(value: Uint8Array | string): WalletProfile; | ||
getConfig(): services_common_v1_common_pb.ServerConfig | undefined; | ||
setConfig(value?: services_common_v1_common_pb.ServerConfig): WalletProfile; | ||
hasConfig(): boolean; | ||
clearConfig(): WalletProfile; | ||
@@ -183,7 +184,7 @@ serializeBinary(): Uint8Array; | ||
export type AsObject = { | ||
didDocument?: services_common_v1_common_pb.JsonPayload.AsObject, | ||
walletId: string, | ||
invoker: string, | ||
capability: string, | ||
invokerJwk: Uint8Array | string, | ||
name: string, | ||
authData: Uint8Array | string, | ||
authToken: Uint8Array | string, | ||
isProtected: boolean, | ||
config?: services_common_v1_common_pb.ServerConfig.AsObject, | ||
} | ||
@@ -190,0 +191,0 @@ } |
@@ -7,3 +7,2 @@ /** | ||
import * as grpcWeb from 'grpc-web'; | ||
import * as pbmse_v1_pbmse_pb from '../../../pbmse/v1/pbmse_pb'; | ||
import * as services_universal$wallet_v1_universal$wallet_pb from '../../../services/universal-wallet/v1/universal-wallet_pb'; | ||
@@ -33,8 +32,2 @@ export declare class WalletClient { | ||
createWallet(request: services_universal$wallet_v1_universal$wallet_pb.CreateWalletRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.Error, response: services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse) => void): grpcWeb.ClientReadableStream<services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse>; | ||
methodInfoCreateWalletWithWorkflow: grpcWeb.AbstractClientBase.MethodInfo<services_universal$wallet_v1_universal$wallet_pb.CreateWalletRequest, services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse>; | ||
createWalletWithWorkflow(request: services_universal$wallet_v1_universal$wallet_pb.CreateWalletRequest, metadata: grpcWeb.Metadata | null): Promise<services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse>; | ||
createWalletWithWorkflow(request: services_universal$wallet_v1_universal$wallet_pb.CreateWalletRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.Error, response: services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse) => void): grpcWeb.ClientReadableStream<services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse>; | ||
methodInfoCreateWalletEncrypted: grpcWeb.AbstractClientBase.MethodInfo<pbmse_v1_pbmse_pb.EncryptedMessage, pbmse_v1_pbmse_pb.EncryptedMessage>; | ||
createWalletEncrypted(request: pbmse_v1_pbmse_pb.EncryptedMessage, metadata: grpcWeb.Metadata | null): Promise<pbmse_v1_pbmse_pb.EncryptedMessage>; | ||
createWalletEncrypted(request: pbmse_v1_pbmse_pb.EncryptedMessage, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.Error, response: pbmse_v1_pbmse_pb.EncryptedMessage) => void): grpcWeb.ClientReadableStream<pbmse_v1_pbmse_pb.EncryptedMessage>; | ||
methodInfoSearch: grpcWeb.AbstractClientBase.MethodInfo<services_universal$wallet_v1_universal$wallet_pb.SearchRequest, services_universal$wallet_v1_universal$wallet_pb.SearchResponse>; | ||
@@ -41,0 +34,0 @@ search(request: services_universal$wallet_v1_universal$wallet_pb.SearchRequest, metadata: grpcWeb.Metadata | null): Promise<services_universal$wallet_v1_universal$wallet_pb.SearchResponse>; |
@@ -10,3 +10,2 @@ /** | ||
import * as grpcWeb from 'grpc-web'; | ||
import * as pbmse_v1_pbmse_pb from '../../../pbmse/v1/pbmse_pb'; | ||
import * as services_universal$wallet_v1_universal$wallet_pb from '../../../services/universal-wallet/v1/universal-wallet_pb'; | ||
@@ -62,24 +61,2 @@ export class WalletClient { | ||
} | ||
methodInfoCreateWalletWithWorkflow = new grpcWeb.AbstractClientBase.MethodInfo(services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse, (request) => { | ||
return request.serializeBinary(); | ||
}, services_universal$wallet_v1_universal$wallet_pb.CreateWalletResponse.deserializeBinary); | ||
createWalletWithWorkflow(request, metadata, callback) { | ||
if (callback !== undefined) { | ||
return this.client_.rpcCall(this.hostname_ + | ||
'/services.universalwallet.v1.Wallet/CreateWalletWithWorkflow', request, metadata || {}, this.methodInfoCreateWalletWithWorkflow, callback); | ||
} | ||
return this.client_.unaryCall(this.hostname_ + | ||
'/services.universalwallet.v1.Wallet/CreateWalletWithWorkflow', request, metadata || {}, this.methodInfoCreateWalletWithWorkflow); | ||
} | ||
methodInfoCreateWalletEncrypted = new grpcWeb.AbstractClientBase.MethodInfo(pbmse_v1_pbmse_pb.EncryptedMessage, (request) => { | ||
return request.serializeBinary(); | ||
}, pbmse_v1_pbmse_pb.EncryptedMessage.deserializeBinary); | ||
createWalletEncrypted(request, metadata, callback) { | ||
if (callback !== undefined) { | ||
return this.client_.rpcCall(this.hostname_ + | ||
'/services.universalwallet.v1.Wallet/CreateWalletEncrypted', request, metadata || {}, this.methodInfoCreateWalletEncrypted, callback); | ||
} | ||
return this.client_.unaryCall(this.hostname_ + | ||
'/services.universalwallet.v1.Wallet/CreateWalletEncrypted', request, metadata || {}, this.methodInfoCreateWalletEncrypted); | ||
} | ||
methodInfoSearch = new grpcWeb.AbstractClientBase.MethodInfo(services_universal$wallet_v1_universal$wallet_pb.SearchResponse, (request) => { | ||
@@ -86,0 +63,0 @@ return request.serializeBinary(); |
import ServiceBase from "./ServiceBase"; | ||
import { ProviderClient } from "./proto"; | ||
import { ProviderClient, ServerConfig } from "./proto"; | ||
import { InvitationStatusRequest, InvitationStatusResponse, InviteRequest, InviteResponse } from "./proto"; | ||
@@ -7,5 +7,5 @@ export * from "grpc-web"; | ||
client: ProviderClient; | ||
constructor(serviceAddress?: string); | ||
constructor(config?: ServerConfig); | ||
inviteParticipant(request: InviteRequest): Promise<InviteResponse>; | ||
invitationStatus(request: InvitationStatusRequest): Promise<InvitationStatusResponse>; | ||
} |
@@ -6,19 +6,13 @@ import ServiceBase from "./ServiceBase"; | ||
client; | ||
constructor(serviceAddress = "localhost:5000") { | ||
super(); | ||
this.client = new ProviderClient(serviceAddress, {}, {}); | ||
constructor(config = null) { | ||
super(null, config); | ||
this.client = new ProviderClient(this.address); | ||
} | ||
inviteParticipant(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.invite(request, this.getMetadata(), (error, response) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
return resolve(response); | ||
}); | ||
}); | ||
async inviteParticipant(request) { | ||
let response = await this.client.invite(request, await this.getMetadata(request)); | ||
return response; | ||
} | ||
invitationStatus(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.invitationStatus(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.invitationStatus(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -25,0 +19,0 @@ reject(error); |
import { Metadata } from "grpc-web"; | ||
import { WalletProfile } from "./proto"; | ||
import { ServerConfig, WalletProfile } from "./proto"; | ||
import { Message } from "google-protobuf"; | ||
export default abstract class ServiceBase { | ||
capInvocation: string; | ||
getMetadata(): Metadata; | ||
setProfile(profile: WalletProfile): Promise<void>; | ||
activeProfile: WalletProfile; | ||
serverConfig: ServerConfig; | ||
address: string; | ||
constructor(profile?: WalletProfile, config?: ServerConfig); | ||
getMetadata(request: Message): Promise<Metadata>; | ||
updateActiveProfile(profile: WalletProfile): void; | ||
} |
@@ -1,32 +0,34 @@ | ||
import { CreateProofRequest, JsonWebKey, LdProofs, LdSuite } from "@trinsic/okapi"; | ||
import { Struct } from "google-protobuf/google/protobuf/struct_pb"; | ||
import { Buffer } from "buffer"; | ||
import { CreateOberonProofRequest, Oberon } from "@trinsic/okapi"; | ||
import { Nonce, ServerConfig } from "./proto"; | ||
import { fromUint8Array } from "js-base64"; | ||
export default class ServiceBase { | ||
capInvocation; | ||
getMetadata() { | ||
if (!this.capInvocation) | ||
throw new Error("Profile not set."); | ||
let metadata = { "Capability-Invocation": this.capInvocation }; | ||
return metadata; | ||
activeProfile; | ||
serverConfig; | ||
address; | ||
constructor(profile = null, config = new ServerConfig().setEndpoint("prod.trinsic.cloud").setPort(443).setUseTls(true)) { | ||
this.activeProfile = profile; | ||
this.serverConfig = config; | ||
this.address = `${config.getUseTls() ? "https" : "http"}://${this.serverConfig.getEndpoint()}:${this.serverConfig.getPort()}`; | ||
} | ||
async setProfile(profile) { | ||
let capabilityDocument = { | ||
"@context": "https://wid.org/security/v2", | ||
invocationTarget: profile.getWalletId(), | ||
proof: { | ||
proofPurpose: "capabilityInvocation", | ||
created: new Date().toISOString(), | ||
capability: profile.getCapability(), | ||
}, | ||
async getMetadata(request) { | ||
var requestHash = await crypto.subtle.digest("SHA-256", request.serializeBinary()); | ||
var timestamp = Date.now(); | ||
let nonce = new Nonce().setTimestamp(timestamp).setRequestHash(new Uint8Array(requestHash)); | ||
let proof = await Oberon.createProof(new CreateOberonProofRequest() | ||
.setNonce(nonce.serializeBinary()) | ||
.setData(this.activeProfile.getAuthData()) | ||
.setToken(this.activeProfile.getAuthToken())); | ||
var metadata = { | ||
Authorization: `Oberon ` + | ||
`ver=1,` + | ||
`proof=${fromUint8Array(proof.getProof_asU8(), true)},` + | ||
`data=${fromUint8Array(this.activeProfile.getAuthData_asU8(), true)},` + | ||
`nonce=${fromUint8Array(nonce.serializeBinary(), true)}`, | ||
}; | ||
let proofRequest = new CreateProofRequest() | ||
.setDocument(Struct.fromJavaScript(capabilityDocument)) | ||
.setKey(JsonWebKey.deserializeBinary(profile.getInvokerJwk_asU8())) | ||
.setSuite(LdSuite.JCSED25519SIGNATURE2020); | ||
let proofResponse = await LdProofs.generate(proofRequest); | ||
// Set the auth field to the signed document by converting it back | ||
// to JSON and encoding it in base64 | ||
this.capInvocation = Buffer.from(JSON.stringify(proofResponse.getSignedDocument().toJavaScript())).toString("base64"); | ||
return metadata; | ||
} | ||
updateActiveProfile(profile) { | ||
this.activeProfile = profile; | ||
} | ||
} | ||
//# sourceMappingURL=ServiceBase.js.map |
import ServiceBase from "./ServiceBase"; | ||
import { TrustRegistryClient } from "./proto"; | ||
import { ServerConfig, TrustRegistryClient } from "./proto"; | ||
import { AddFrameworkRequest, AddFrameworkResponse, CheckIssuerStatusRequest, CheckIssuerStatusResponse, CheckVerifierStatusRequest, CheckVerifierStatusResponse, RegisterIssuerRequest, RegisterIssuerResponse, RegisterVerifierRequest, RegisterVerifierResponse, RemoveFrameworkRequest, RemoveFrameworkResponse, SearchRegistryResponse, UnregisterIssuerRequest, UnregisterIssuerResponse, UnregisterVerifierRequest, UnregisterVerifierResponse } from "./proto"; | ||
export declare class TrustRegistryService extends ServiceBase { | ||
client: TrustRegistryClient; | ||
constructor(serviceAddress?: string); | ||
constructor(config?: ServerConfig); | ||
registerIssuer(request: RegisterIssuerRequest): Promise<RegisterIssuerResponse>; | ||
@@ -8,0 +8,0 @@ registerVerifier(request: RegisterVerifierRequest): Promise<RegisterVerifierResponse>; |
@@ -6,9 +6,9 @@ import ServiceBase from "./ServiceBase"; | ||
client; | ||
constructor(serviceAddress = "localhost:5000") { | ||
super(); | ||
this.client = new TrustRegistryClient(serviceAddress, null, null); | ||
constructor(config = null) { | ||
super(null, config); | ||
this.client = new TrustRegistryClient(this.address); | ||
} | ||
registerIssuer(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.registerIssuer(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.registerIssuer(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -22,4 +22,4 @@ reject(error); | ||
registerVerifier(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.registerVerifier(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.registerVerifier(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -33,4 +33,4 @@ reject(error); | ||
unregisterIssuer(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.unregisterIssuer(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.unregisterIssuer(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -44,4 +44,4 @@ reject(error); | ||
unregisterVerifier(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.unregisterVerifier(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.unregisterVerifier(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -55,4 +55,4 @@ reject(error); | ||
checkIssuer(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.checkIssuerStatus(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.checkIssuerStatus(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -66,4 +66,4 @@ reject(error); | ||
checkVerifier(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.checkVerifierStatus(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.checkVerifierStatus(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -77,4 +77,5 @@ reject(error); | ||
search(query) { | ||
return new Promise((resolve, reject) => { | ||
this.client.searchRegistry(new SearchRegistryRequest().setQuery(query), this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
const request = new SearchRegistryRequest().setQuery(query); | ||
this.client.searchRegistry(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -88,4 +89,4 @@ reject(error); | ||
addGovernanceFramework(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.addFramework(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.addFramework(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -99,4 +100,4 @@ reject(error); | ||
removeGovernanceFramework(request) { | ||
return new Promise((resolve, reject) => { | ||
this.client.removeFramework(request, this.getMetadata(), (error, response) => { | ||
return new Promise(async (resolve, reject) => { | ||
this.client.removeFramework(request, await this.getMetadata(request), (error, response) => { | ||
if (error) { | ||
@@ -103,0 +104,0 @@ reject(error); |
import ServiceBase from "./ServiceBase"; | ||
import { WalletClient } from "./proto"; | ||
import { CredentialClient } from "./proto"; | ||
import { ServerConfig, WalletClient, CredentialClient } from "./proto"; | ||
import { GetProviderConfigurationResponse, WalletProfile, ConnectResponse, SearchResponse } from "./proto"; | ||
@@ -14,3 +13,3 @@ import { SendResponse } from "./proto"; | ||
credentialClient: CredentialClient; | ||
constructor(serviceAddress?: string); | ||
constructor(config?: ServerConfig); | ||
registerOrConnect(email: string): Promise<ConnectResponse>; | ||
@@ -17,0 +16,0 @@ getProviderConfiguration(): Promise<GetProviderConfigurationResponse>; |
@@ -1,6 +0,4 @@ | ||
import { DIDKey, GenerateKeyRequest, KeyType, } from "@trinsic/okapi"; | ||
import { Struct } from "google-protobuf/google/protobuf/struct_pb"; | ||
import ServiceBase from "./ServiceBase"; | ||
import { GetProviderConfigurationRequest, WalletClient } from "./proto"; | ||
import { CredentialClient } from "./proto"; | ||
import { GetProviderConfigurationRequest, WalletClient, CredentialClient } from "./proto"; | ||
import { ConnectRequest, CreateWalletRequest, WalletProfile, InsertItemRequest, SearchRequest, } from "./proto"; | ||
@@ -13,6 +11,6 @@ import { CreateProofRequest, IssueRequest, SendRequest, VerifyProofRequest } from "./proto"; | ||
credentialClient; | ||
constructor(serviceAddress = "localhost:5000") { | ||
super(); | ||
this.client = new WalletClient(serviceAddress, null, null); | ||
this.credentialClient = new CredentialClient(serviceAddress, null, null); | ||
constructor(config = null) { | ||
super(null, config); | ||
this.client = new WalletClient(this.address); | ||
this.credentialClient = new CredentialClient(this.address); | ||
} | ||
@@ -45,10 +43,3 @@ registerOrConnect(email) { | ||
async createWallet(securityCode = null) { | ||
// Generate new DID used by the current device | ||
let keyRequest = new GenerateKeyRequest().setKeyType(KeyType.ED25519); | ||
let myKey = await DIDKey.generate(keyRequest); | ||
let myDidDocument = myKey.getDidDocument().toJavaScript(); | ||
// Create an encrypted message | ||
let createWalletRequest = new CreateWalletRequest() | ||
.setDescription("My Cloud Wallet") | ||
.setController(myDidDocument["id"].toString()); | ||
let createWalletRequest = new CreateWalletRequest().setDescription("My Cloud Wallet"); | ||
if (!securityCode) | ||
@@ -60,7 +51,5 @@ securityCode = ""; | ||
let walletProfile = new WalletProfile() | ||
.setWalletId(createWalletResponse.getWalletId()) | ||
.setCapability(createWalletResponse.getCapability()) | ||
.setDidDocument(new JsonPayload().setJsonStruct(myKey.getDidDocument())) | ||
.setInvoker(createWalletResponse.getInvoker()) | ||
.setInvokerJwk(myKey.getKeyList()[0].serializeBinary()); | ||
.setAuthData(createWalletResponse.getAuthData()) | ||
.setAuthToken(createWalletResponse.getAuthToken()) | ||
.setIsProtected(createWalletResponse.getIsProtected()); | ||
return walletProfile; | ||
@@ -71,5 +60,5 @@ } | ||
request.setJsonStruct(Struct.fromJavaScript(document)); | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let issueRequest = new IssueRequest().setDocument(request); | ||
this.credentialClient.issue(issueRequest, this.getMetadata(), (error, response) => { | ||
this.credentialClient.issue(issueRequest, await this.getMetadata(issueRequest), (error, response) => { | ||
if (error) { | ||
@@ -86,5 +75,5 @@ reject(error); | ||
search(query = "SELECT * from c") { | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let searchRequest = new SearchRequest().setQuery(query); | ||
this.client.search(searchRequest, this.getMetadata(), (error, response) => { | ||
this.client.search(searchRequest, await this.getMetadata(searchRequest), (error, response) => { | ||
if (error) { | ||
@@ -102,5 +91,5 @@ reject(error); | ||
var request = new JsonPayload().setJsonStruct(Struct.fromJavaScript(item)); | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let itemRequest = new InsertItemRequest().setItem(request); | ||
this.client.insertItem(itemRequest, this.getMetadata(), (error, response) => { | ||
this.client.insertItem(itemRequest, await this.getMetadata(itemRequest), (error, response) => { | ||
if (error) { | ||
@@ -117,7 +106,7 @@ reject(error); | ||
var request = new JsonPayload().setJsonStruct(Struct.fromJavaScript(document)); | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let sendRequest = new SendRequest(); | ||
sendRequest.setEmail(email); | ||
sendRequest.setDocument(request); | ||
this.credentialClient.send(sendRequest, this.getMetadata(), (error, response) => { | ||
this.credentialClient.send(sendRequest, await this.getMetadata(sendRequest), (error, response) => { | ||
if (error) { | ||
@@ -134,7 +123,7 @@ reject(error); | ||
var request = new JsonPayload().setJsonStruct(Struct.fromJavaScript(revealDocument)); | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let createProofRequest = new CreateProofRequest(); | ||
createProofRequest.setDocumentId(documentId); | ||
createProofRequest.setRevealDocument(request); | ||
this.credentialClient.createProof(createProofRequest, this.getMetadata(), (error, response) => { | ||
this.credentialClient.createProof(createProofRequest, await this.getMetadata(createProofRequest), (error, response) => { | ||
if (error) { | ||
@@ -151,6 +140,6 @@ reject(error); | ||
var request = new JsonPayload().setJsonStruct(Struct.fromJavaScript(proofDocument)); | ||
return new Promise((resolve, reject) => { | ||
return new Promise(async (resolve, reject) => { | ||
let verifyProofRequest = new VerifyProofRequest(); | ||
verifyProofRequest.setProofDocument(request); | ||
this.credentialClient.verifyProof(verifyProofRequest, this.getMetadata(), (error, response) => { | ||
this.credentialClient.verifyProof(verifyProofRequest, await this.getMetadata(verifyProofRequest), (error, response) => { | ||
if (error) { | ||
@@ -157,0 +146,0 @@ reject(error); |
{ | ||
"name": "@trinsic/trinsic-web", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "verifiable credentials", | ||
@@ -15,7 +15,6 @@ "main": "lib/index.js", | ||
"build:copy": "npx copyfiles -u 1 './src/proto/**/*_pb.*' ./lib/", | ||
"test:setenv": "pwsh ./setenv.ps1", | ||
"test:build": "npx webpack build", | ||
"test:jasmine": "npx jasmine-browser-runner runSpecs", | ||
"test:debug": "npx jasmine-browser-runner serve", | ||
"test": "npm run test:setenv && npm run test:build && npm run test:jasmine" | ||
"test": "npm run test:build && npm run test:jasmine" | ||
}, | ||
@@ -31,6 +30,7 @@ "author": "Trinsic", | ||
"dependencies": { | ||
"@trinsic/okapi": "^1.0.0-preview.27", | ||
"@trinsic/okapi": "^1.0.1", | ||
"buffer": "^6.0.3", | ||
"google-protobuf": "^3.17.2", | ||
"grpc-web": "^1.2.1" | ||
"grpc-web": "^1.2.1", | ||
"js-base64": "^3.7.2" | ||
}, | ||
@@ -40,3 +40,3 @@ "devDependencies": { | ||
"@types/node": "^15.12.0", | ||
"chromedriver": "^93.0.1", | ||
"chromedriver": "^95.0.0", | ||
"copyfiles": "^2.4.1", | ||
@@ -43,0 +43,0 @@ "geckodriver": "^2.0.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
728001
16548
5
+ Addedjs-base64@^3.7.2
+ Addedjs-base64@3.7.7(transitive)
Updated@trinsic/okapi@^1.0.1