@hyperledger/anoncreds-shared 0.1.0-dev.2

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.
Files changed (81) hide show
  1. package/LICENSE +192 -0
  2. package/README.md +62 -0
  3. package/build/Anoncreds.d.ts +204 -0
  4. package/build/Anoncreds.js +5 -0
  5. package/build/Anoncreds.js.map +1 -0
  6. package/build/AnoncredsObject.d.ts +6 -0
  7. package/build/AnoncredsObject.js +15 -0
  8. package/build/AnoncredsObject.js.map +1 -0
  9. package/build/ObjectHandle.d.ts +7 -0
  10. package/build/ObjectHandle.js +21 -0
  11. package/build/ObjectHandle.js.map +1 -0
  12. package/build/api/Credential.d.ts +34 -0
  13. package/build/api/Credential.js +50 -0
  14. package/build/api/Credential.js.map +1 -0
  15. package/build/api/CredentialDefinition.d.ts +20 -0
  16. package/build/api/CredentialDefinition.js +30 -0
  17. package/build/api/CredentialDefinition.js.map +1 -0
  18. package/build/api/CredentialDefinitionPrivate.d.ts +4 -0
  19. package/build/api/CredentialDefinitionPrivate.js +12 -0
  20. package/build/api/CredentialDefinitionPrivate.js.map +1 -0
  21. package/build/api/CredentialOffer.d.ts +11 -0
  22. package/build/api/CredentialOffer.js +19 -0
  23. package/build/api/CredentialOffer.js.map +1 -0
  24. package/build/api/CredentialRequest.d.ts +19 -0
  25. package/build/api/CredentialRequest.js +26 -0
  26. package/build/api/CredentialRequest.js.map +1 -0
  27. package/build/api/CredentialRequestMetadata.d.ts +4 -0
  28. package/build/api/CredentialRequestMetadata.js +12 -0
  29. package/build/api/CredentialRequestMetadata.js.map +1 -0
  30. package/build/api/CredentialRevocationConfig.d.ts +20 -0
  31. package/build/api/CredentialRevocationConfig.js +21 -0
  32. package/build/api/CredentialRevocationConfig.js.map +1 -0
  33. package/build/api/CredentialRevocationState.d.ts +16 -0
  34. package/build/api/CredentialRevocationState.js +32 -0
  35. package/build/api/CredentialRevocationState.js.map +1 -0
  36. package/build/api/KeyCorrectnessProof.d.ts +4 -0
  37. package/build/api/KeyCorrectnessProof.js +12 -0
  38. package/build/api/KeyCorrectnessProof.js.map +1 -0
  39. package/build/api/MasterSecret.d.ts +5 -0
  40. package/build/api/MasterSecret.js +15 -0
  41. package/build/api/MasterSecret.js.map +1 -0
  42. package/build/api/Presentation.d.ts +48 -0
  43. package/build/api/Presentation.js +57 -0
  44. package/build/api/Presentation.js.map +1 -0
  45. package/build/api/PresentationRequest.d.ts +4 -0
  46. package/build/api/PresentationRequest.js +12 -0
  47. package/build/api/PresentationRequest.js.map +1 -0
  48. package/build/api/RevocationRegistry.d.ts +16 -0
  49. package/build/api/RevocationRegistry.js +12 -0
  50. package/build/api/RevocationRegistry.js.map +1 -0
  51. package/build/api/RevocationRegistryDefinition.d.ts +24 -0
  52. package/build/api/RevocationRegistryDefinition.js +32 -0
  53. package/build/api/RevocationRegistryDefinition.js.map +1 -0
  54. package/build/api/RevocationRegistryDefinitionPrivate.d.ts +4 -0
  55. package/build/api/RevocationRegistryDefinitionPrivate.js +12 -0
  56. package/build/api/RevocationRegistryDefinitionPrivate.js.map +1 -0
  57. package/build/api/RevocationRegistryDelta.d.ts +4 -0
  58. package/build/api/RevocationRegistryDelta.js +12 -0
  59. package/build/api/RevocationRegistryDelta.js.map +1 -0
  60. package/build/api/RevocationStatusList.d.ts +22 -0
  61. package/build/api/RevocationStatusList.js +25 -0
  62. package/build/api/RevocationStatusList.js.map +1 -0
  63. package/build/api/Schema.d.ts +11 -0
  64. package/build/api/Schema.js +15 -0
  65. package/build/api/Schema.js.map +1 -0
  66. package/build/api/index.d.ts +17 -0
  67. package/build/api/index.js +30 -0
  68. package/build/api/index.js.map +1 -0
  69. package/build/error.d.ts +10 -0
  70. package/build/error.js +12 -0
  71. package/build/error.js.map +1 -0
  72. package/build/index.d.ts +7 -0
  73. package/build/index.js +20 -0
  74. package/build/index.js.map +1 -0
  75. package/build/register.d.ts +5 -0
  76. package/build/register.js +6 -0
  77. package/build/register.js.map +1 -0
  78. package/build/types.d.ts +11 -0
  79. package/build/types.js +14 -0
  80. package/build/types.js.map +1 -0
  81. package/package.json +34 -0
@@ -0,0 +1,22 @@
1
+ import type { RevocationRegistryDefinition } from './RevocationRegistryDefinition';
2
+ import { AnoncredsObject } from '../AnoncredsObject';
3
+ export declare type CreateRevocationStatusListOptions = {
4
+ revocationRegistryDefinitionId: string;
5
+ revocationRegistryDefinition: RevocationRegistryDefinition;
6
+ timestamp?: number;
7
+ issuanceByDefault: boolean;
8
+ };
9
+ export declare type UpdateRevocationStatusListTimestampOptions = {
10
+ timestamp: number;
11
+ };
12
+ export declare type UpdateRevocationStatusListOptions = {
13
+ timestamp?: number;
14
+ issued?: Array<number>;
15
+ revoked?: Array<number>;
16
+ revocationRegstryDefinition: RevocationRegistryDefinition;
17
+ };
18
+ export declare class RevocationStatusList extends AnoncredsObject {
19
+ static create(options: CreateRevocationStatusListOptions): RevocationStatusList;
20
+ updateTimestamp(options: UpdateRevocationStatusListTimestampOptions): void;
21
+ update(options: UpdateRevocationStatusListOptions): void;
22
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RevocationStatusList = void 0;
4
+ const AnoncredsObject_1 = require("../AnoncredsObject");
5
+ const register_1 = require("../register");
6
+ class RevocationStatusList extends AnoncredsObject_1.AnoncredsObject {
7
+ static create(options) {
8
+ const revocationRegistryDefinitionObjectHandle = options.revocationRegistryDefinition.handle;
9
+ const revocationStatusList = register_1.anoncreds.createRevocationStatusList(Object.assign(Object.assign({}, options), { revocationRegistryDefinition: revocationRegistryDefinitionObjectHandle }));
10
+ return new RevocationStatusList(revocationStatusList.handle);
11
+ }
12
+ updateTimestamp(options) {
13
+ const updatedRevocationStatusList = register_1.anoncreds.updateRevocationStatusListTimestampOnly({
14
+ timestamp: options.timestamp,
15
+ currentList: this.handle,
16
+ });
17
+ this.handle = updatedRevocationStatusList;
18
+ }
19
+ update(options) {
20
+ const updatedRevocationStatusList = register_1.anoncreds.updateRevocationStatusList(Object.assign(Object.assign({}, options), { revocationRegistryDefinition: options.revocationRegstryDefinition.handle, currentList: this.handle }));
21
+ this.handle = updatedRevocationStatusList;
22
+ }
23
+ }
24
+ exports.RevocationStatusList = RevocationStatusList;
25
+ //# sourceMappingURL=RevocationStatusList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RevocationStatusList.js","sourceRoot":"","sources":["../../src/api/RevocationStatusList.ts"],"names":[],"mappings":";;;AAEA,wDAAoD;AACpD,0CAAuC;AAoBvC,MAAa,oBAAqB,SAAQ,iCAAe;IAChD,MAAM,CAAC,MAAM,CAAC,OAA0C;QAC7D,MAAM,wCAAwC,GAAG,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAA;QAC5F,MAAM,oBAAoB,GAAG,oBAAS,CAAC,0BAA0B,iCAC5D,OAAO,KACV,4BAA4B,EAAE,wCAAwC,IACtE,CAAA;QAEF,OAAO,IAAI,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAEM,eAAe,CAAC,OAAmD;QACxE,MAAM,2BAA2B,GAAG,oBAAS,CAAC,uCAAuC,CAAC;YACpF,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,IAAI,CAAC,MAAM;SACzB,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,2BAA2B,CAAA;IAC3C,CAAC;IAEM,MAAM,CAAC,OAA0C;QACtD,MAAM,2BAA2B,GAAG,oBAAS,CAAC,0BAA0B,iCACnE,OAAO,KACV,4BAA4B,EAAE,OAAO,CAAC,2BAA2B,CAAC,MAAM,EACxE,WAAW,EAAE,IAAI,CAAC,MAAM,IACxB,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,2BAA2B,CAAA;IAC3C,CAAC;CACF;AA7BD,oDA6BC"}
@@ -0,0 +1,11 @@
1
+ import { AnoncredsObject } from '../AnoncredsObject';
2
+ export declare type CreateSchemaOptions = {
3
+ name: string;
4
+ version: string;
5
+ issuerId: string;
6
+ attributeNames: string[];
7
+ };
8
+ export declare class Schema extends AnoncredsObject {
9
+ static create(options: CreateSchemaOptions): Schema;
10
+ static load(json: string): Schema;
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Schema = void 0;
4
+ const AnoncredsObject_1 = require("../AnoncredsObject");
5
+ const register_1 = require("../register");
6
+ class Schema extends AnoncredsObject_1.AnoncredsObject {
7
+ static create(options) {
8
+ return new Schema(register_1.anoncreds.createSchema(options).handle);
9
+ }
10
+ static load(json) {
11
+ return new Schema(register_1.anoncreds.schemaFromJson({ json }).handle);
12
+ }
13
+ }
14
+ exports.Schema = Schema;
15
+ //# sourceMappingURL=Schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/api/Schema.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,0CAAuC;AASvC,MAAa,MAAO,SAAQ,iCAAe;IAClC,MAAM,CAAC,MAAM,CAAC,OAA4B;QAC/C,OAAO,IAAI,MAAM,CAAC,oBAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;IAC3D,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,MAAM,CAAC,oBAAS,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;CACF;AARD,wBAQC"}
@@ -0,0 +1,17 @@
1
+ export * from './Credential';
2
+ export * from './CredentialDefinition';
3
+ export * from './CredentialDefinitionPrivate';
4
+ export * from './CredentialRevocationConfig';
5
+ export * from './CredentialRevocationState';
6
+ export * from './KeyCorrectnessProof';
7
+ export * from './CredentialOffer';
8
+ export * from './CredentialRequest';
9
+ export * from './CredentialRequestMetadata';
10
+ export * from './MasterSecret';
11
+ export * from './PresentationRequest';
12
+ export * from './Presentation';
13
+ export * from './Schema';
14
+ export * from './RevocationRegistry';
15
+ export * from './RevocationRegistryDefinition';
16
+ export * from './RevocationRegistryDefinitionPrivate';
17
+ export * from './RevocationRegistryDelta';
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Credential"), exports);
14
+ __exportStar(require("./CredentialDefinition"), exports);
15
+ __exportStar(require("./CredentialDefinitionPrivate"), exports);
16
+ __exportStar(require("./CredentialRevocationConfig"), exports);
17
+ __exportStar(require("./CredentialRevocationState"), exports);
18
+ __exportStar(require("./KeyCorrectnessProof"), exports);
19
+ __exportStar(require("./CredentialOffer"), exports);
20
+ __exportStar(require("./CredentialRequest"), exports);
21
+ __exportStar(require("./CredentialRequestMetadata"), exports);
22
+ __exportStar(require("./MasterSecret"), exports);
23
+ __exportStar(require("./PresentationRequest"), exports);
24
+ __exportStar(require("./Presentation"), exports);
25
+ __exportStar(require("./Schema"), exports);
26
+ __exportStar(require("./RevocationRegistry"), exports);
27
+ __exportStar(require("./RevocationRegistryDefinition"), exports);
28
+ __exportStar(require("./RevocationRegistryDefinitionPrivate"), exports);
29
+ __exportStar(require("./RevocationRegistryDelta"), exports);
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B;AAC5B,yDAAsC;AACtC,gEAA6C;AAC7C,+DAA4C;AAC5C,8DAA2C;AAC3C,wDAAqC;AACrC,oDAAiC;AACjC,sDAAmC;AACnC,8DAA2C;AAC3C,iDAA8B;AAC9B,wDAAqC;AACrC,iDAA8B;AAC9B,2CAAwB;AACxB,uDAAoC;AACpC,iEAA8C;AAC9C,wEAAqD;AACrD,4DAAyC"}
@@ -0,0 +1,10 @@
1
+ export declare type AnoncredsErrorObject = {
2
+ code: number;
3
+ extra?: string;
4
+ message: string;
5
+ };
6
+ export declare class AnoncredsError extends Error {
7
+ readonly code: number;
8
+ readonly extra?: string;
9
+ constructor({ code, message, extra }: AnoncredsErrorObject);
10
+ }
package/build/error.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnoncredsError = void 0;
4
+ class AnoncredsError extends Error {
5
+ constructor({ code, message, extra }) {
6
+ super(message);
7
+ this.code = code;
8
+ this.extra = extra;
9
+ }
10
+ }
11
+ exports.AnoncredsError = AnoncredsError;
12
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAmB,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAwB;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AATD,wCASC"}
@@ -0,0 +1,7 @@
1
+ export * from './api';
2
+ export * from './register';
3
+ export * from './Anoncreds';
4
+ export * from './error';
5
+ export * from './AnoncredsObject';
6
+ export * from './ObjectHandle';
7
+ export * from './types';
package/build/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./api"), exports);
14
+ __exportStar(require("./register"), exports);
15
+ __exportStar(require("./Anoncreds"), exports);
16
+ __exportStar(require("./error"), exports);
17
+ __exportStar(require("./AnoncredsObject"), exports);
18
+ __exportStar(require("./ObjectHandle"), exports);
19
+ __exportStar(require("./types"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAqB;AACrB,6CAA0B;AAC1B,8CAA2B;AAC3B,0CAAuB;AACvB,oDAAiC;AACjC,iDAA8B;AAC9B,0CAAuB"}
@@ -0,0 +1,5 @@
1
+ import type { Anoncreds } from './Anoncreds';
2
+ export declare let anoncreds: Anoncreds;
3
+ export declare const registerAnoncreds: ({ lib }: {
4
+ lib: Anoncreds;
5
+ }) => Anoncreds;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerAnoncreds = exports.anoncreds = void 0;
4
+ const registerAnoncreds = ({ lib }) => (exports.anoncreds = lib);
5
+ exports.registerAnoncreds = registerAnoncreds;
6
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":";;;AAIO,MAAM,iBAAiB,GAAG,CAAC,EAAE,GAAG,EAAsB,EAAE,EAAE,CAAC,CAAC,iBAAS,GAAG,GAAG,CAAC,CAAA;AAAtE,QAAA,iBAAiB,qBAAqD"}
@@ -0,0 +1,11 @@
1
+ declare type ByteBufferOptions = {
2
+ len: number;
3
+ data: Uint8Array;
4
+ };
5
+ export declare class ByteBuffer {
6
+ len: number;
7
+ data: Uint8Array;
8
+ constructor({ data, len }: ByteBufferOptions);
9
+ static fromUint8Array(data: Uint8Array): ByteBuffer;
10
+ }
11
+ export {};
package/build/types.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ByteBuffer = void 0;
4
+ class ByteBuffer {
5
+ constructor({ data, len }) {
6
+ this.data = data;
7
+ this.len = len;
8
+ }
9
+ static fromUint8Array(data) {
10
+ return new ByteBuffer({ data, len: data.length });
11
+ }
12
+ }
13
+ exports.ByteBuffer = ByteBuffer;
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAKA,MAAa,UAAU;IAIrB,YAAmB,EAAE,IAAI,EAAE,GAAG,EAAqB;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,IAAgB;QAC3C,OAAO,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACnD,CAAC;CACF;AAZD,gCAYC"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@hyperledger/anoncreds-shared",
3
+ "version": "0.1.0-dev.2",
4
+ "license": "Apache-2.0",
5
+ "description": "Anoncreds wrapper library with NodeJS and React Native",
6
+ "main": "build/index",
7
+ "source": "src/index",
8
+ "types": "build/index",
9
+ "homepage": "https://github.com/hyperledger/anoncreds/tree/main/wrappers/javascript/anoncreds-shared",
10
+ "repository": {
11
+ "url": "https://github.com/hyperledger/anoncreds",
12
+ "type": "git",
13
+ "directory": "wrappers/javascript/anoncreds-shared"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "build"
20
+ ],
21
+ "scripts": {
22
+ "build": "yarn run clean && yarn run compile",
23
+ "clean": "rimraf -rf ./build",
24
+ "compile": "tsc -p tsconfig.build.json"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/core": "7.17.9",
28
+ "@babel/runtime": "7.17.9",
29
+ "prettier": "2.6.2",
30
+ "rimraf": "3.0.2",
31
+ "typescript": "4.5.5"
32
+ },
33
+ "gitHead": "b1e2be51ffd03d6f96e665cd4f7b755e909f34a4"
34
+ }