@@ -68,6 +68,7 @@ import type {
68
68
SetCustomLoggerOptions ,
69
69
SetMaxLogLevelOptions ,
70
70
StoreCloseOptions ,
71
+ StoreCopyToOptions ,
71
72
StoreCreateProfileOptions ,
72
73
StoreGenerateRawKeyOptions ,
73
74
StoreGetProfileNameOptions ,
@@ -80,6 +81,9 @@ import type {
80
81
AriesAskarErrorObject ,
81
82
AeadParamsOptions ,
82
83
MigrateIndySdkOptions ,
84
+ StoreGetDefaultProfileOptions ,
85
+ StoreSetDefaultProfileOptions ,
86
+ StoreListProfilesOptions ,
83
87
} from '@hyperledger/aries-askar-shared'
84
88
85
89
import {
@@ -117,6 +121,7 @@ import {
117
121
FFI_SESSION_HANDLE ,
118
122
FFI_STORE_HANDLE ,
119
123
FFI_INT8 ,
124
+ FFI_STRING_LIST_HANDLE ,
120
125
} from './ffi'
121
126
import { getNativeAriesAskar } from './library'
122
127
@@ -902,6 +907,14 @@ export class NodeJSAriesAskar implements AriesAskar {
902
907
return this . promisify ( ( cb , cbId ) => this . nativeAriesAskar . askar_store_close ( storeHandle , cb , cbId ) )
903
908
}
904
909
910
+ public storeCopyTo ( options : StoreCopyToOptions ) : Promise < void > {
911
+ const { storeHandle, targetUri, passKey, keyMethod, recreate } = serializeArguments ( options )
912
+
913
+ return this . promisify ( ( cb , cbId ) =>
914
+ this . nativeAriesAskar . askar_store_copy ( storeHandle , targetUri , keyMethod , passKey , recreate , cb , cbId )
915
+ )
916
+ }
917
+
905
918
public async storeCreateProfile ( options : StoreCreateProfileOptions ) : Promise < string > {
906
919
const { storeHandle, profile } = serializeArguments ( options )
907
920
const response = await this . promisifyWithResponse < string > (
@@ -922,6 +935,15 @@ export class NodeJSAriesAskar implements AriesAskar {
922
935
return ret . deref ( ) as string
923
936
}
924
937
938
+ public async storeGetDefaultProfile ( options : StoreGetDefaultProfileOptions ) : Promise < string > {
939
+ const { storeHandle } = serializeArguments ( options )
940
+ const response = await this . promisifyWithResponse < string > ( ( cb , cbId ) =>
941
+ this . nativeAriesAskar . askar_store_get_default_profile ( storeHandle , cb , cbId )
942
+ )
943
+
944
+ return handleInvalidNullResponse ( response )
945
+ }
946
+
925
947
public async storeGetProfileName ( options : StoreGetProfileNameOptions ) : Promise < string > {
926
948
const { storeHandle } = serializeArguments ( options )
927
949
const response = await this . promisifyWithResponse < string > ( ( cb , cbId ) =>
@@ -931,6 +953,30 @@ export class NodeJSAriesAskar implements AriesAskar {
931
953
return handleInvalidNullResponse ( response )
932
954
}
933
955
956
+ public async storeListProfiles ( options : StoreListProfilesOptions ) : Promise < string [ ] > {
957
+ const { storeHandle } = serializeArguments ( options )
958
+ const listHandle = await this . promisifyWithResponse < Buffer > (
959
+ ( cb , cbId ) => this . nativeAriesAskar . askar_store_list_profiles ( storeHandle , cb , cbId ) ,
960
+ FFI_STRING_LIST_HANDLE
961
+ )
962
+ if ( listHandle === null ) {
963
+ throw AriesAskarError . customError ( { message : 'Invalid handle' } )
964
+ }
965
+ const counti32 = allocateInt32Buffer ( )
966
+ this . nativeAriesAskar . askar_string_list_count ( listHandle , counti32 )
967
+ this . handleError ( )
968
+ const count = counti32 . deref ( ) as number
969
+ const ret = [ ]
970
+ const strval = allocateStringBuffer ( )
971
+ for ( let i = 0 ; i < count ; i ++ ) {
972
+ this . nativeAriesAskar . askar_string_list_get_item ( listHandle , i , strval )
973
+ this . handleError ( )
974
+ ret . push ( strval . deref ( ) )
975
+ }
976
+ this . nativeAriesAskar . askar_string_list_free ( listHandle )
977
+ return ret
978
+ }
979
+
934
980
public async storeOpen ( options : StoreOpenOptions ) : Promise < StoreHandle > {
935
981
const { profile, keyMethod, passKey, specUri } = serializeArguments ( options )
936
982
@@ -983,6 +1029,14 @@ export class NodeJSAriesAskar implements AriesAskar {
983
1029
return handleInvalidNullResponse ( response )
984
1030
}
985
1031
1032
+ public async storeSetDefaultProfile ( options : StoreSetDefaultProfileOptions ) : Promise < void > {
1033
+ const { storeHandle, profile } = serializeArguments ( options )
1034
+
1035
+ return this . promisify ( ( cb , cbId ) =>
1036
+ this . nativeAriesAskar . askar_store_set_default_profile ( storeHandle , profile , cb , cbId )
1037
+ )
1038
+ }
1039
+
986
1040
public async migrateIndySdk ( options : MigrateIndySdkOptions ) : Promise < void > {
987
1041
const { specUri, kdfLevel, walletKey, walletName } = serializeArguments ( options )
988
1042
await this . promisify ( ( cb , cbId ) =>
0 commit comments